The Bwired electricity monitor
Posted: Wed Nov 29, 2006 11:39 pm
For years I was thinking about the possibility to measure the electricity consumption automatically. I was lucky to have a electricity meter with a very interesting features, this meter had a very bright red LED in the middle which flashes 480 times when 1 kW (1000 Watt) is consumed. This got me thinking about building an interface to pick up the flashes with a sensor and feeding this into my 1-wire network.

Thanks to JON00 I found out that it was possible to use a Infra-red barrier mini-kits from Velleman. (Type MK120) This kit consisted of a transmitter and receiver PCB complete with components and for under 15 euros. With some minor modification, this is the perfect interface for this project.
The receiver side of this kit consists of a photo diode which is designed to pick up infra-red from the transmitter. Looking at the circuit diagram, the transmitter LED's were actually being fed from a a stable oscillator. The modulated IR Light was then being received by the photo diode on the receiver PCB and fed into various op amp stages to integrate and compare the voltages obtained. This voltage (when the photo diode received IR light) was compared to a reference voltage and would switch the final opto to an OFF state. This would then switch to an ON state when no IR illumination was received. For its intended application, the buzzer & LED would activate when somebody crossed the beam.
The output needed to be reversed, this can be done by modifying the receiver PCB and swapping the + and - inputs of the last comparator. This involved 4 cuts on the PCB and a few bits of wire to transpose the connections. It would be nice to leave the LED as an indicator, just use a BC547 transistor and a 1K resistor as the switch interface. Don't install the buzzer its of no use anymore!
The 1-wire interface is the easy part. One of the common uses for 1-Wire is for temperature and weather related devices. Several weather instruments require counters to input the data this includes rain gauges & lightning detectors. A company called AAG http://www.aagelectronica.com/aag in Mexico manufacture 1-Wire counter boards (TAI8585) at minimal cost. These consist of a battery backed DS2423 1-Wire counter, so no counts are lost. The TAI8585 can be triggered by a reed relay or other shorting method.
These two boards, the receiver part of the Velleman MK120 kit and the AAG 1-Wire TAI8585 Pulse counter are the main interface. Of course you need a standard 1-Wire receiver to connect it all trough RS232 to your computer. I use the Log08 1-Wire interface from MIDON http://www.midondesign.com for all my 1-Wire devices.
Technical construction
One of the most important parts of this project was how to mount the photo diode in front of the pulsed LED without obstructing the meter too much and raised eyebrows from the meter reader. A 8mm wide length of sheet metal was bent in to a Z formation with a 5.5mm hole drilled at the end and another 4mm for mounting. To keep interference out use a screened cable to connect the photo diode to the MK120.
Photo Diode mounted in front of LED meter
The Velleman receiver kit is constructed apart from the photo diode and the buzzer. R11 was replaced from a 470K to 15K to reduce the sensitivity of the circuit. As mentioned before, you need to swap pins 9 and 10 on the LM324 IC. As the pads on the PCB could get dislodged, cutting of the board was done after construction with a sharp knife. A meter set to low resistance was then used to confirm that the tracks had been completely cut. Wire links as shown were then added to complete the modification.
Red lines indicate where the PCB tracks need to be cut

Wire links required to complete the modification
Connection of the photo diode and 9V battery to the circuit confirmed correct operation with the on-board LED flashing at the same time as the meter LED.
Just mount the AAG 1-wire counter on top of the Velleman PCB using the mounting holes designed for the battery holder. Use two 25mm M3 pan head screws to mount the 1-Wire AAG board. A 1K resistor is soldered to R12 and pushed through the large hole nearby so that it appeared at the top of board. The collector and emitter of the BC547 are then soldered directly to the 1-wire board (across the reed relay) and the other end of the 1K resistor soldered to the base of the transistor. Finally a ground/common wire is connected from the Velleman PCB to the 1-Wire PCB.

Solder connection of the 1K resistor and ground connection

Circuit diagram of transistor interface

Detailed view of interface and 1-wire board mounted on Velleman PCB

Another view of finished interface
All that's needed is to mount the finished interface within a plastic box. Just add two sockets, one for the photo transistor and the other for the 1-Wire & 12V supply. Solder the LED and mount it on the outside of the box.

Completed interface mounted in plastic box
Possible technical problems
If you encounter some problems reading the flashes it could be the circuit is to sensitive. The sensitivity of the circuit by adjusted by replacing R11 on the Velleman PCB. For instance to make it less sensitive you can replace R11 with 15K instead of 470K. Also use a screened cable for the photo-transistor and keep the distance as short as possible.
Software
With the Bwired Home Control System, which is my general control system I read all the data from the 1-Wire network. Keep in mind that the 1-Wire TAI8585 only can count to 65535 before it resets to zero. As there are 480 flashes in 1 KWh the pulse counter will reset after counting 136KWh. I read the 1-Wire once every minute and store about 60 readings in one hour. This way I can keep track of the current energy consumption and also usage for the hole day. All the data is saved into a SQL server called MYSQL. With my home Control System I can start all kinds of events based on the energy consumption. For example, if there is no one at home and the energy consumption is higher then 0.500 KWh I get a message on my cell phone.
Benefits
We were consuming about 10.000 kW a year, way to much! For years I was thinking about a plan to measure the electricity automatically. With this little project I was able to reduce the electricity from 10.000 KW to 6635 KW. Because of the accurate and minute by minute reading of electricity consumption I became much more aware of it all. I found out that I was consuming 0.600 kWh at night! With simple things like unplugging adapters of my cellular (GSM) and standby of video an television I was able to reduce the power to around 0.380kWh. I also discovered that there are a lot of power adapters which consume a lot of energy, I use now power switching adapters which have a high performance and so consume much less energy. The energy monitor is automatically plugged in my Home Control System which adds nice little features like for example getting a mail on your cell phone GSM) if the power consumption is higher then 0.500kWh and there is no one at home. I really think automating your home or business and controlling your energy can help to reduce the worlds growing energy problem.

Thanks to JON00 I found out that it was possible to use a Infra-red barrier mini-kits from Velleman. (Type MK120) This kit consisted of a transmitter and receiver PCB complete with components and for under 15 euros. With some minor modification, this is the perfect interface for this project.
The receiver side of this kit consists of a photo diode which is designed to pick up infra-red from the transmitter. Looking at the circuit diagram, the transmitter LED's were actually being fed from a a stable oscillator. The modulated IR Light was then being received by the photo diode on the receiver PCB and fed into various op amp stages to integrate and compare the voltages obtained. This voltage (when the photo diode received IR light) was compared to a reference voltage and would switch the final opto to an OFF state. This would then switch to an ON state when no IR illumination was received. For its intended application, the buzzer & LED would activate when somebody crossed the beam.
The output needed to be reversed, this can be done by modifying the receiver PCB and swapping the + and - inputs of the last comparator. This involved 4 cuts on the PCB and a few bits of wire to transpose the connections. It would be nice to leave the LED as an indicator, just use a BC547 transistor and a 1K resistor as the switch interface. Don't install the buzzer its of no use anymore!
The 1-wire interface is the easy part. One of the common uses for 1-Wire is for temperature and weather related devices. Several weather instruments require counters to input the data this includes rain gauges & lightning detectors. A company called AAG http://www.aagelectronica.com/aag in Mexico manufacture 1-Wire counter boards (TAI8585) at minimal cost. These consist of a battery backed DS2423 1-Wire counter, so no counts are lost. The TAI8585 can be triggered by a reed relay or other shorting method.
These two boards, the receiver part of the Velleman MK120 kit and the AAG 1-Wire TAI8585 Pulse counter are the main interface. Of course you need a standard 1-Wire receiver to connect it all trough RS232 to your computer. I use the Log08 1-Wire interface from MIDON http://www.midondesign.com for all my 1-Wire devices.
Technical construction
One of the most important parts of this project was how to mount the photo diode in front of the pulsed LED without obstructing the meter too much and raised eyebrows from the meter reader. A 8mm wide length of sheet metal was bent in to a Z formation with a 5.5mm hole drilled at the end and another 4mm for mounting. To keep interference out use a screened cable to connect the photo diode to the MK120.

Photo Diode mounted in front of LED meter
The Velleman receiver kit is constructed apart from the photo diode and the buzzer. R11 was replaced from a 470K to 15K to reduce the sensitivity of the circuit. As mentioned before, you need to swap pins 9 and 10 on the LM324 IC. As the pads on the PCB could get dislodged, cutting of the board was done after construction with a sharp knife. A meter set to low resistance was then used to confirm that the tracks had been completely cut. Wire links as shown were then added to complete the modification.

Red lines indicate where the PCB tracks need to be cut

Wire links required to complete the modification
Connection of the photo diode and 9V battery to the circuit confirmed correct operation with the on-board LED flashing at the same time as the meter LED.
Just mount the AAG 1-wire counter on top of the Velleman PCB using the mounting holes designed for the battery holder. Use two 25mm M3 pan head screws to mount the 1-Wire AAG board. A 1K resistor is soldered to R12 and pushed through the large hole nearby so that it appeared at the top of board. The collector and emitter of the BC547 are then soldered directly to the 1-wire board (across the reed relay) and the other end of the 1K resistor soldered to the base of the transistor. Finally a ground/common wire is connected from the Velleman PCB to the 1-Wire PCB.

Solder connection of the 1K resistor and ground connection

Circuit diagram of transistor interface

Detailed view of interface and 1-wire board mounted on Velleman PCB

Another view of finished interface
All that's needed is to mount the finished interface within a plastic box. Just add two sockets, one for the photo transistor and the other for the 1-Wire & 12V supply. Solder the LED and mount it on the outside of the box.

Completed interface mounted in plastic box
Possible technical problems
If you encounter some problems reading the flashes it could be the circuit is to sensitive. The sensitivity of the circuit by adjusted by replacing R11 on the Velleman PCB. For instance to make it less sensitive you can replace R11 with 15K instead of 470K. Also use a screened cable for the photo-transistor and keep the distance as short as possible.
Software
With the Bwired Home Control System, which is my general control system I read all the data from the 1-Wire network. Keep in mind that the 1-Wire TAI8585 only can count to 65535 before it resets to zero. As there are 480 flashes in 1 KWh the pulse counter will reset after counting 136KWh. I read the 1-Wire once every minute and store about 60 readings in one hour. This way I can keep track of the current energy consumption and also usage for the hole day. All the data is saved into a SQL server called MYSQL. With my home Control System I can start all kinds of events based on the energy consumption. For example, if there is no one at home and the energy consumption is higher then 0.500 KWh I get a message on my cell phone.
Benefits
We were consuming about 10.000 kW a year, way to much! For years I was thinking about a plan to measure the electricity automatically. With this little project I was able to reduce the electricity from 10.000 KW to 6635 KW. Because of the accurate and minute by minute reading of electricity consumption I became much more aware of it all. I found out that I was consuming 0.600 kWh at night! With simple things like unplugging adapters of my cellular (GSM) and standby of video an television I was able to reduce the power to around 0.380kWh. I also discovered that there are a lot of power adapters which consume a lot of energy, I use now power switching adapters which have a high performance and so consume much less energy. The energy monitor is automatically plugged in my Home Control System which adds nice little features like for example getting a mail on your cell phone GSM) if the power consumption is higher then 0.500kWh and there is no one at home. I really think automating your home or business and controlling your energy can help to reduce the worlds growing energy problem.