jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
5.67k stars 612 forks source link

[Feature] Support for Power- and Gasmeters #37

Closed simonscheib closed 3 years ago

simonscheib commented 3 years ago

I'm running this with my watermeter couple of weeks now and impressed so far. Great work. Initally I ordered a couple of ESP32's and hoped to get this to work also for my power and gasmeter. Since 1 OV2640 is DOA I started with my powermeter.

Common Problems (not code related): LED flash is way to bright and leads to massive reflection from the black numberwheels and the silver background of my meter - workaround: Add a slight angle wor the ESP32 and add some tape to mask everything but the numberwheels (alignment marks have been drawn by pen to the masking tape)

Recognition Problems: The font for the numbers is different than from the watemeter. So I assume the CNN needs to be trained more for this. Recognition works for most of the wheels, but not all: image image

Since I'm absolute new in neural networks etc. I cannot determine where to start. If there's something I can help with training the network, give me a hint. For further usage with a power/gasmeter, the analog ROI needs to be removed and also the last digital ROI needs to be shifted behind the comma. (for gasmeters this should be the last three digits if I recall correctly)

This would be nice to have all three meters digitized and even a deeper insight into consumptions.

Cheers, Simon

jomjol commented 3 years ago

Hi Simon, to you topics:

CNN-Training: You can collect typicall examples of your digits and send them to me (only 2-3 examples for each digit (0 ... 9) and I will incorporate them in the next training session (Format: jpg). One of the problem is the illumination. For example the 9 with the light bar in the middle is looking quite strange for the CNN. Maybe you find a change to remove this illumination reflection from the digit.

Removal of Analog: This is simple: just remove the analog definition in the config.ini. This is not tested perfectly, so maybe you find some bugs, just let me know - I will try to bug fix them as soon as possible.

Shifting of digits: This is already implemented - Parameter: DecimalShift = 1 Details: https://github.com/jomjol/AI-on-the-edge-device/wiki/Configuration-Parameter-Details

Best regards, jomjol

serafimdasaudade commented 3 years ago

Hi. I'm also doing some testing on a water-meter, but the led bright leads to massive reflection. I'm trying to edit the code to control the led pin using PWM, but with no success. :( It would be nice to have the control of the led bright in the config.ini.

tks,

jomjol commented 3 years ago

This will most propably not solve your problem. The OV2640 is used in a automated white light and illumination controll. So if you dimm the LED by let's say 50%, then the camera shutter time will adapt by 200%. You need to remove the reflection by a of axis illumination (e.g. separate illumination) of slight tilting of the camera. Maybe also a 90° rotation could help, because then the LED is maybe more out of axis. I will check for a PWM controll. If this is easy to implement, I will do anyway, but as mentioned above ... it will not help :-(

serafimdasaudade commented 3 years ago

Ok, I see. I will disable the pcb led and try with other illumination. Tks for the reply.

simonscheib commented 3 years ago

@jomjol I took some pictures of each digit for an Actaris gas-meter and a Ferraris power-meter. See attached file: zähler.zip

Some digits are only the last wheel to keep waiting times small for the first attempt. If you need more pictures of certain wheels which are not the last one, give me shout :)

Cheers, Simon

jomjol commented 3 years ago

Hi Simon, training with the new number is already done. You can find the tflite-files here: https://github.com/jomjol/neural-network-digital-counter-readout

You need to replace the dig0640s3.tflite with a version out of there - I suggest the ...small-v3.tflite

It is running on my system, after some tests I will update the config.ini itself.

simonscheib commented 3 years ago

Hi Jomjol, wow, that was quick. Works like charm at the first try: image

Waiting on a replacement OV2640 since one was DOA wo set up my gasmeter.

simonscheib commented 3 years ago

Just switched on ESP32 from my watermeter to my gasmeter to give the new trained numbers a try. Also working pretty good. The only thing one have to really care about: Lighting and preventing refelctions on the wheels. Once thats fixed, recognition works as expected: image

@jomjol If this is not too complicated: Maybe display the configured hostname of wlan.ini in the webfrontend or even better: A config parameter which sets the mode to be either a watermeter with digits an analog readings or a gas/powermeter with just digit readings. Besides that, this issue can be closed, or do you want to wait for the final implementation of dig0640s3.tflite with the next release?

jomjol commented 3 years ago

@simonscheib I have updated the rolling and now you find some host information on the info page (hostname, IP, ssid). I will not change the config to write which kind of meter it is. If you do not need analogs just remove them from the config.ini. Great, that your gas meter is working. I will close this issue for the moment. Best regards, jomjol