Create a Power Monitor using Pinoccio

It has been a long time I know, but I was really busy with some important projects.
I’d like to begin the new year with a new post about Pinoccio,  Pinoccio is a micro controller with a built in WiFi and mesh radio with easy access REST API, really useful for build small project for the “internet of things”. For more info read the old article Connect iOS to the internet of things (pinoccio)
The scope of this post is about how to build a simple house power meter and interfacing it with an iOS application.
First of all, to the “capitains” out there must be told that the purpose of the project is not to build a super precise power monitor or explain electrical engineering.

We live in a “green era” and power savings are really important not only for our pockets, so let’s build this thing.

Here is the inventory list:
- SCT-013-030 non invasive current sensor 30A/1V (SeedStudio)
- Pinoccio
- 2 resitors: 47kΩ and 15kΩ
- 1 capacitor: 100µF

In Italy we have a single-phase electrical power with 220V AC in the domestit distribution, is based on 3 wires, phase, neutro, ground.
The sensor works in a similar way to a transformer, the alternating current flowing in the phase produces a magnetic field in the core, which then induces a current in the secondary winding circuit.
The fantastic thing about this sensor is that it doesn’t require to open any sort of high power cicuit, we just need to close the clip around the phase wire.
The sensor outputs a voltage from 0 to ±1V for current from 0 to 30A, assuming a linearity of the response we have 33,3 mV for each ampere.
Here we need to think a little about how to condition the sensor output to make it compatible with Pinoccio inputs.
Pinoccio has an analog input that reads maximum 1.6V, is not clear in the documentation if using the AREF pin we can choose a bigger value.
To avoid surprises I’ve choosen the range 0-1.6V, since the sensor returns an oscillating response and the input can’t be negative, we need to bring the sensor voltage in a positive range, to do that we use that little circuit diagram.


Circuit Diagram

The max power output available for most domestic system is 3kW, approximately  13,63A , about the half of the full range, translated in the sensor output we have a ±500mV value, so we need to add more than 500mV to the sensor output to keep it a in a positive range.
The little circuit with the resistors is a so called voltage divider and provides a tension of 0.8V in the midpoint, in this way we can keep the voltage safe between 0.3V and 1.3.

Now that we have an input that fits inside a range compatibile with the Pinoccio’s analog/digital coventer(ADC), we can proceed with some calculations.
The ADC is 10bit that means that considering the possible max input the smallest value that can be represented (resolution or LSB) is 1.6V/1024 = 1,5625mV.

Reality in electornic really differs from what we calculate on paper and with mV representation is really easy to read wrong values due to errors.
Our voltage diveder due to resistance tollerance provides a tension of 0.875V instead of 0.8V, taking that into account now we know that our baseline value from the ADC is the value 560.
This number is really important because we need to remove it from each response that we receive from the ADC pin to obtain the real value from the sensor.

The iOS application, using Pinoccio API, requests the ADC value each seconds and after some simple math it converts it in the measured power.
Here is an animated GIF that displays the power bar: with some lights, computer turned on the measure power is 0.1kW, right after I turn on the woven measured power grows really fast up to 2.2kW.

Power Monitor App

Animated GIF of the power monitor app

Unfortunately build a real power monitor is not that easy, real power depends on the kind of load switched on, for resistive load (incandescence light bulb, woven etc) our measure is pretty close to reality.
Asking each second the value measured from the ADC is not that smart, I’m trying to figure out how to use the stream API from pinoccio.

Circuit picture

It was fun to build this simple setup, can’t wait to add an extension to run it on my iWatch and keep my power consumption under control.

Sorry, the comment form is closed at this time.

Related Posts