Edge Impulse logo
Blog Post

Who Turned Out the Lights? EdenOff Anticipates Power Outages with Machine Learning

Machine Learning, TinyMLCan a tiny Arduino device placed inside the power outlet anticipate outages with edge ML?

Nick Bild

May 21, 2022

    With so much of our lives now being spent in one way or another interacting with electronic devices, power outages can be a huge pain. It is not just a matter of inconvenience either — more critical applications, like food storage, medical devices, and HVAC systems can also be taken out of service when the power blinks out. Even in the United States, where there is a relatively advanced energy grid, there were 1.33 billion outage hours for consumers in 2020. If those outages could be predicted in advance, it could potentially save the lives of those most at risk. Knowing that the power was likely to turn off, people that rely on medical devices powered by electricity, or the elderly in the midst of a heatwave, could take proactive steps before they get into a dangerous situation.

    We are now one step closer to being able to predict power outages thanks to some recent work by machine learning enthusiast Roni Bandini. He used some common, off-the-shelf components to build a low-cost device called EdenOff that can anticipate when a power outage is likely to occur in the near future. This tiny gadget that can be tucked away on the inside of a power outlet is able to make these predictions with the help of a machine learning algorithm that was developed with Edge Impulse Studio.

    The assembled hardware

    To get started, Bandini first needed to identify some measurable factors that might be predictive of a future power outage. In reality, there are sure to be many more contributing factors, but as a proof of concept, he chose to look at ambient temperature and the voltage level being supplied at the electrical outlet. An Arduino Nano 33 BLE Sense was selected for the build because it has sufficient processing power available to run an ML algorithm, and it also has an onboard temperature sensor. A ZMPT101B voltage sensor was added to the project to determine the voltage level being supplied to the outlet  A seven-segment display and a digital buzzer were included to provide alerts about predicted power supply issues.

    Bandini used synthetic data to train his model, but real data could be acquired from multiple sources, including power distributors and auditors. He curated this data into a columnar format including timestamp, temperature, voltage, and average of the previous five voltage readings. The intent of the last column is to detect recent variations in service. This data was separated into sets that corresponded with power outages, and those that did not, and both were uploaded to Edge Impulse.

    Curating the training data

    An impulse was created with a machine learning classifier, and it was trained on the data that was previously uploaded. Training classification accuracy was found to reach 94.2% by the end of the process. The feature explorer tool showed good separation between the classes, indicating that the selected variables have good predictive power. A good model having been developed, Bandini next needed to deploy the model to the Arduino board.

    An analysis pipeline optimized for resource-constrained devices was exported from Edge Impulse as an Arduino library, after which it could be flashed to the board. A custom 3D-printed faceplate was created to mount the device into a wall outlet, then the build was complete. The device continually samples temperature and voltage levels, and runs inferences against the model. If an upcoming power outage is predicted, a warning message will show on the display, and the buzzer will sound an alert.

    Training the model

    This is a fantastic project that is very low-cost and simple enough for just about anyone to build. As a hardware hacker, one of the most interesting aspects of it is that it can still be considered a work in progress. Can you think of any other variables that might be predictive of a power outage? Swing on over to Bandini's public project and test out that theory by training your own model. 

    Want to see Edge Impulse in action? Schedule a demo today. 


    Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

    Subscribe to our newsletter