A Measured Approach: Analog Meter Reading with the Arduino Nicla Vision

We may be living in a digital world, but analog is here to stay. Analog devices are still used for many applications. Consider, for example, the industrial gauges that measure numerous process variables like pressure, temperature, and flow. Sure, these meters could be replaced with digital versions, but in many cases that would be very costly to do. Moreover, the mechanical nature of analog gauges is desirable under some circumstances — no power supply or battery replacement is required for their operation. But in any case, analog meters do miss out on many of the benefits that come along with their digital counterparts, like remote monitoring. When analog meters are in use, humans have to physically check them to ensure that everything is operating normally.

It seems like a no-win situation for those using analog gauges. Monitoring them is an expensive proposition, but so is replacing them with digital versions. Fortunately, things may be looking a bit rosier in the near future due to recent advancements in tinyML-capable hardware and software tools. The engineers at Zalmotek have demonstrated how simple it can be to create a hybrid analog-digital meter with inexpensive, off-the-shelf hardware and machine learning models built with Edge Impulse.

Zalmotek’s idea was to create a device that can monitor existing analog gauges. The device uses computer vision and a neural network classifier to digitize measurements from the analog meter. Once that is done, it is trivial to wirelessly transmit those measurements to remote servers as part of a larger, automated monitoring infrastructure. And importantly, no analog meters were harmed in the making of this project — this functionality can be added on top of existing equipment and processes without making a single change to them.

Arduino Nicla Vision in a custom case

The Arduino Nicla Vision was chosen for the job because it is tiny, low-cost, and comes standard with a dual-core Arm Cortex-M7 MCU and an integrated 2 megapixel color camera. The entire bill of materials for the project could be satisfied with this single 22.86 x 22.86 millimeter board. To make it easy to mount the board in a variety of locations, and to protect it from environmental conditions, Zalmotek 3D-printed a case to house the device.

Classifying meter readings into three categories

To prove the concept, the device was tested on a boiler pressure gauge from a heating system. As previously mentioned, the plan was to use a neural network to determine the current measurement shown on the meter. It was decided to initially classify meter readings into one of three categories: low, medium, or high. Before that would be possible, the neural network would need to be shown some example images to train it.

Rather than attempt to capture images of every possible position the gauge’s needle can be in, Zalmotek took a shortcut and captured a single image. They then manipulated that image with image processing software to remove the needle, then it was programmatically inserted back into the image at differing orientations to simulate images of the needle being in positions all around the dial. This data was then uploaded to Edge Impulse so that they could get down to business with analyzing the images.

Sample training data

In Edge Impulse Studio, an impulse was created to proprocess the images. This step extracts the most relevant features and reduces the computational complexity of downstream steps in the analysis to optimize the pipeline for edge computing applications. These features are then sent to a MobileNetV2 96x96 0.05 model that is retrained to recognize analog meter measurements. By using transfer learning, the model benefits from having already been pretrained on a large image dataset, which helps to increase its accuracy in the new task.

After completing the impulse design, the model was trained using the previously uploaded images of the boiler pressure gauge. Classification accuracy was found to exceed 92% on the first pass, which is more than sufficient to prove the concept. By providing more data, and perhaps tweaking a few hyperparameters, it would be expected that this accuracy could climb even higher.

Model accuracy of 92.3% 

Everything checked out great up to this point, so Zalmotek got to work deploying the machine learning classification pipeline to the Nicla Vision board. This is quite simple, actually, so they were finished almost as soon as they began. Edge Impulse fully supports the Nicla Vision, so with a few clicks a firmware image containing everything needed to run the classifications can be downloaded and flashed to the board. For those that need to further customize the code to add in their own logic (like sending the results to the cloud, for example), the pipeline can be deployed as an Arduino or C++ library.

With little more than $100 and a free afternoon, a person has everything they need to get started converting old analog meters into modern, digital versions, with all of the benefits they bring. This is great news for efforts to improve efficiency, conserve resources, and reduce costs. Zalmotek has made their Edge Impulse project public, which is a great starting point for adapting this device to your own specific needs. There is also some detailed information in the documentation if you could use a few more tips.


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

Subscribe

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

Subscribe to our newsletter