Peter Quinn Details a Whole-Home Energy Monitoring Project — and ML-Powered Next Steps
Currently producing detailed graphs using a Raspberry Pi running InfluxDB and Grafana, Quinn has ideas on taking the project further.
Maker Peter Quinn has written up his experience in setting up whole-home energy monitoring, gathered from smart meter readings and visualized using Grafana — with plans afoot to put some machine intelligence to work spotting isolating the energy demand of individual appliances.
"When the power company put in smart meters, I wanted to see the data too," Quinn explains. "I wanted to know which appliances are running? How much does it cost to run any specific appliance —particularly the air conditioner and the pool filter pump? Would it save me money if I replaced one or more with more efficient ones? When I do run the A/C, what's the power source (solar, wind, hydro, natural gas, etc)? I started looking at how I could get the data."
Initially, Quinn set about pulling information from the PG&E-installed decade-old smart gas and electric meters using a software-defined radio (SDR). Sadly, the electricity data proved encrypted — and while the gas data was readable, it only reported once per day making it useless for the kind of real-time graphing and analysis Quinn had in mind for the project. The solution: an off-the-shelf adapter that reads from the smart meter and makes the data available via a local application programming interface (API) accessible via Wi-Fi.
"There's a bunch of ways [visualization] could be done," Quinn writes of the meat of the project. "I've been using Raspberry Pis for my home weather station and it was logical to just expand on it. I use InfluxDB to store the time series data with Grafana for charts and graphs. These are both well supported solutions that have free, open source versions that run well on [a Raspberry] Pi. I have them both running on a Raspberry Pi 4."
The Raspberry Pi runs a Python script that pulls usage data from the smart meter gateway, with a second script querying a remote API for information on the region's current energy mix — i.e. what percentage of the energy being delivered to the house is being generated by each source, including gas-fired generators and solar panels. These data are processed and stored in the InfluxDB database, with Grafana producing detailed graphs and charts.
"I can pretty much tell from looking at the graphs which appliances are running. It’s not difficult for a human to see the patterns," Quinn explains of the project's next steps. "What I'm currently working on is how to do this automatically. I found a number of resources — namely the Non-intrusive Load Monitoring Toolkit. I’m also learning about Hidden Markov Models. I might implement/train a model on my data without using the NILMTK implementation. I’m still figuring it out. I want to implement one of these algorithms and convert it to handle streaming data."
Quinn's full write-up is available on Hackaday.io; source code for the project has been merged into an earlier weather station project's GitHub repository, under the permissive Apache 2.0 license.