Emon-server – 555 Timer as power usage sensor
A cheap 555 timer chip acting as Schmitt trigger combined with a phototransistor or LDR is taped to the ‘flashing light’ or ‘pulsing magnet’ on the electricity meter. The output of the 555 timer chip is connected to one of the GPIO pins on the Raspberry Pi. A Python script (executing in the background) recording 555 events is calculating actual energy usage [e.g. Watt] every time the 555 is signaling and stores epochs in an SQLite3 database. From this, another Python script (executed from e.g. cron) generates all kinds of energy usage information (e.g. kWh or kWday or whatever). Using Node.js (running on the same Pi) all data is ‘RESTified’ enabling spreading out to the W3. To maintain privacy JSON web tokens are required every time the service is queried. Oh, and there is also a Pimatic plugin available (here)
Reading the ‘flashing led’ requires a photo transistor taped to the energy meter. The 555 chip, acting as Schmitt trigger shapes the ‘flashing led/magnetic pulses’ to fast switching pulses without glitches (checkout the scoop images in the hardware folder).
The other nice feature of the 555 chip is it’s low impedance push-pull output stage making it possible to use thin and long cable connections to the Raspberry. Use a reed-contact for reading the ‘pulsing magnet’ on some gas meters.
In my setup the 555 chip is connected to RPI’s GPIO-4 (other GPIO-pins are possible, see the pin definition in the emonLogger.py script). At every falling edge an epoch is written to the SQLite3 database.
In my experiments the internal comparator and output stage of the 555 functions correctly when powered at 3.3 Volt (Raspberry PI). If you want to be sure buy the low-voltage version.
For more detail: Emon-server – 555 Timer as power usage sensor