Keeping Your Energy Levels Up with Edge ML

With energy prices up sharply this year, many people are searching for ways to reduce their expenditures in this area. There are many ways to cut these costs, like upgrading to more efficient technologies, or exploring alternative energy sources like solar and wind power. However, each of these options comes with additional expenses and trade-offs of its own. Fortunately, in most cases there is a much easier path to savings — eliminating waste. Consider the case of heating oil. It may not be as widely used as it once was, but nevertheless, millions of people around the globe rely on this fuel source for space heating and other purposes.

Heating oil is stored on-site in tanks at the locations where it is consumed. To keep the tanks topped off, the fuel must be distributed to customers by tanker truck as needed.  Distributors must walk a fine line with their delivery schedules. If they deliver too frequently, the expense of the deliveries raises fuel costs for everyone. If they do not deliver often enough, customers may run out of fuel. Running out of heating oil in the winter months can create a life-threatening situation in many parts of the world.

Sony Spresense camera

Traditionally, heating oil distributors use a formula to determine when a customer most likely needs to be resupplied. However, this formula cannot account for unexpected situations, like vacations or visiting house guests that can significantly influence fuel consumption. This problem could be solved by directly measuring the contents of the tank, but most tanks have analog meters that are not easy to read in an automated fashion, and retrofitting existing tanks with new sensors is both expensive and risky.  Engineer Mithun Das recently gave these problems some consideration and came up with a very interesting solution. He built a device, with an assist from Edge Impulse, that can capture measurements from the existing analog tank meters and transfer them to the cloud via cellular networks. The solution is completely wireless and requires no modifications to the existing infrastructure, so it can be implemented virtually anywhere.

Das’ method uses a camera to capture an image of the analog meter, then uses a regression algorithm developed with Edge Impulse to determine how much heating oil is left in the tank. That data is then transferred to a web dashboard over LTE networks. The device itself was assembled using the powerful six-core Sony Spresense development board, with a Spresense camera board and LTE extension board added in. The entire system is powered by a small, rechargeable battery to enable the device to operate for long durations even when no source of electricity is available nearby.

A 3D-printed replica of a heating oil gauge

In order to teach the regression model how to map camera images to precise measurements of the heating oil tank’s contents, labeled sample data was needed. An actual tank takes a long time to be depleted, so rather than slowly capturing samples over the course of a month, Das 3D printed a gauge that mimics a real one so that he could manipulate it at will. Images depicting various levels of remaining oil were captured with the Sony Spresense in this way and were automatically uploaded to Edge Impulse Studio using custom firmware.

Now for the easy part — an impulse was designed to preprocess the image data and perform a regression that can return values between 0 and 100, indicating the level of heating oil in the tank. Using the previously uploaded example data, this model was trained and evaluated.  Das found the regression model to be very closely approximating the values represented by the analog meter in the images.

Exploring example data in Edge Impulse

With everything checking out, Das was ready to deploy the Edge Impulse model to the Sony Spresense development board. This was accomplished by using the deployment tool to create an Arduino library for download. The library was imported into Arduino IDE, then Das was able to run the Edge Impulse model within his own Arduino project. This project was compiled and uploaded to the development board.

Das set up the resources in AWS to host the predictions made by the model, and created a dashboard to make it simple to view the results. It is not difficult to envision a system very much like this being used by heating oil distributors to determine exactly when each of their customers needs to have their fuel replenished. By eliminating unnecessary trips, costs can be trimmed which helps to keep prices down. Dangerous situations in which customers run out of fuel in the winter can also be avoided by using this device.

The dashboard

The project documentation contains a lot more detail that will help you to get your own heating oil tank monitor up and running quickly. Itd would also be possible to adapt these methods to fit similar problems by making little tweaks to the Edge Impulse project that Das has made public.

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