To measure my electricity usage I decided to build a small system that would count LED blinks on my power meter which indicate the used Wh. It was pretty straight forward system requiring an Internet connected microcontroller to log the data and some sort of sensor that would detect LED blinks on the power meter which is not my property and thus not accessible or modifiable.
The main reason to do this project is to get a better overview of the electricity usage as the house is heated by a heat pump so basically everything works on electricity or other free (thermal solar collector) and renewable sources (stove).
I had a CC3200 development kit laying around, it’s featuring a chip with Wi-Fi and an ARM Cortex-M4 processor running at 80MHz, it was more than enough to fill all the needs of this project.
Scope statement
Before starting I decided what the system should do and have:
- Upload data hourly to Google Spreadsheets
- Count LED blinks with an edge detecting interrupt
- Allow to backlog data in case of loss of Wi-Fi connection
- Internal clock to count time (seconds)
- Synchronize internal clock with real time every day
Bonus goals:
- Make a HTTP server to view electricity usage in live
- Put the processor in low-power mode when idle
Hardware
- Processor: for this project a CC3200 development kit was used because it has built-in Wi-Fi connectivity and all the required parts for power management, interrupt detection and timers.
- Sensor: a cheap light sensor would’ve been enough, but I wanted a robust edge detection. I had a photoresistor module in my electronics box from a past project and it was perfect for the task as it works with 3-6V (3.3V required for the CC3200) and it has an op-amp in comparator mode and a potentiometer allowing to set the toggling threshold. It has also a LED to see the sensor state and a LED indicating if the module is powered, all on a neat PCB.
Electronics
Aside from the CC3200 and the light sensor module all the project needed was a 5V source to power the CC3200 and a cable between the CC3200 and light sensor module. I used a USB phone charger I had laying around (do not buy those from eBay/DX… they’re dangerous) and made the other cable with an old and bad-quality USB cable, but it works well for low-power applications such as this one.
I wanted to have the light sensor fixed on the power meter, but without having to modify it or somehow glue to the module on since it’s not my property. The solution was to 3D-print a small sensor enclosure that would hold the sensor right where it needs to be over the LED and fix the enclosure with cable ties on top of the power meter. Since the enclosure was so small and an easy task I used Google Sketchup to make it and the STL exporter add-on to get the 3D printable file.
For more detail: Electricity usage monitor Using Arduino