One of the objective I had when I started the Raspberry pi based logging system is to record the power used in the house. My first thought was naturally use a transformer around the main power cable of the house. I tried with this kind of device :
As it give an AC signal proportional to the intensity, it should be use with diode and filtering capacitor to be acquired by an ADC.
As you can imagine, resolution is fixed by the ADC and for low current, you get low precision.
My power provider’s meter is one made in the 60’s, the famous electromagnetical induction watt-hour meter. The metal disc makes a complete revolution every 10Watt/hour or 36KJ. If we divide these 10Watt/hour by the time the disc takes to make a revolution, we get the instantaneous power consumption in Watts.
We now have to detect the passage of short black mark on the side of the disc, and count the time between two. I choose to use a photo-resistor and a red laser diode for high brightness.
I’m using PIC 8bit micro-controllers, and instead of using the ADC, I choose to use the convenient comparator.
A divider made of a potentiometer give the fix voltage to compare with the signal from the photo-resistor. The rotating disc is like a large gear, implies the edge is made of tooth. The resulting signal from the brightness is then not pure square, but more a square with sine on top. Our comparator will see some “bounce” between the two states.
But the dark mark has certain length, brightness drops lasts a certain time. We could imagine then a kind of de-bouncing code (or hysteresis ?) . Consisting of allowing a change of state only if it lasts a certain time.
The absolute precision of the system relies of the watt-meter and the PIC clock precision. Less you consume, more the counted time number increase then more ‘resolution’ we have.
It takes a bit of effort to tune the threshold of the comparator as well as the ‘de-bouncing’ counters. Also, aligning the diode and photo-resistor with the disc behind the small glass window is a bit delicate. To help, three leds indicate the status.
The code of the PIC micro-controller is compiled with Hi-Tech C compiler and is there : link
The logging station is my pilogger project. The RF link is made with a new address of the nRF24L01 network.
It runs now for about a month and have around 1 watt of resolution. I could identify that my fridge consume 90 watts during ~10 min every 90 min. Or that the water circulating pump of my heating system consume roughly constantly 80 watts.
On the log of this particular 24 hours window, we can see the 3Kw of the traditional oven (I made a cake :oP ), the 1.5Kw of the micro-wave oven, the regular runs of the fridge, some media such as TV plus computer plus audio amp, etc…