2017-04-15

Power Logger

The power meter I have in my basement has a LED that blinks once every Wh. With a consuption of 3600W it will blink once every second. By logging the clock time at every blink it is possible to get a good overview of the consuption, both momentarily and over time.

The logger I have built is based on the Raspberry Pi Zero W. The LED sensor is based on a photo resistor and an opamp. It is connected to GPIO on the Raspberry Pi. An optional 16x2 LCD display is used to display the IP address of the logger and the current power consuption. A button is used to turn on the LCD backlight. Blink timestamps are logged to file and the data can be viewed in a Web GUI.

Mechanical Design

There is not much to say about the mechanical design. The LCD is attached to the RPi with a single M4 bolt and nuts. The logger and the sensor is attached with blu-tac to the power meter. The photo resistor have long legs that are bendable and can be used to finetune its position in front of the LED.

Electrical Design

The LED sensor is designed using two GL5528 photo resistors, one LM324N operational amplifier and one 4.7kOhm potentiometer. Two photo resistors make the circuit more tolerant to varying ambient lighting conditions. The photo resistors form two voltage dividers with the left and the right side of the potentiometer. The center of each divider is connected to the two inputs, plus and minus, of the opamp. More light on a photo resistor will increase the voltage to the opamp. When the plus voltage is larger than the minus voltage the output of the opamp will go high. The circuit has two modes of operation. Use the photo resistor connected to the plus side to get a high signal when the LED blinks and use the photo resistor connected to the the minus side to get a low signal when the LED blinks. If you choose the positive option then you should use the plus side photo resistor to detect the LED and adjust the potentiometer to get a low signal when the LED is dark. A 1kOhm resistor in parallel with the minus photo resistor prevents it from activating the opamp in darkness when it goes towards infinite resistance. The circuit is powered with 5V from the RPi. The output of the opamp is connected to RPi GPIO 10.


The 16x2 LCD is powered by 5V from the RPi and connected to GPIO in the following way.

RS - GPIO 25
EN - GPIO 24
D4 - GPIO 23
D5 - GPIO 17
D6 - GPIO 21
D7 - GPIO 22
BACKLIGHT (K) - GPIO 4

More information about LCD and RPi can be found at [1].

A switch is connected to GPIO 16 and GND to be used to turn on LCD backlight.

Software Design

See the GitHub project [2].

References

[1] https://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/wiring
[2] https://github.com/TheOtherMarcus/PowerLogger

No comments:

PM1 - Pro Memoria - For Memory

The written word is a powerful tool for knowledge transfer to colleagues and future self. Still, documentation is often neglected in favor o...