logo elektroda
logo elektroda
X
logo elektroda

microLuna, this time egde AI in the electricity meter.

pixel7  8 4221 Cool? (+18)
📢 Listen (AI):


Good day.

In reference to my previous construction Link I present another version of Luna.
This time it was launched in 100% on ESP32 , with the task of fulfilling the assumptions of edge AI.

The previous construction performed calculations on an additional device (rpi), now everything uses only the resources of the microprocessor.
The software is based on the TensorFlow Lite library, which forced me to rebuild the network model (reducing the number of neurons).
The layout has also changed slightly due to the SD card support, some of the ESP32cam pins overlap with those of the card. ADS was connected to the other legs.
The system has a web interface in the form of a dashboard, with the possibility of reporting on events that have occurred.
Refreshing the charts every 5 seconds, so basically a real-time preview.

Model for a toddler

Unfortunately, the ESP32 microprocessor has limited resources in relation to the "big brothers", which forces them to be properly managed.
My network had to be drastically reduced and despite concerns about accuracy, I was able to reduce its size to 1208 neurons,
while maintaining a decent detectability.

Code: Dos
Log in, to see the code


Instead of the previously analyzed 500 sec range, Luna now only sees 32.
This causes differences in the time of indicating detected devices, sometimes it is simply too short a period to classify an unusual waveform.
At the moment it is testing various layer topologies.
According to the hint from the previous topic, I am trying to use a recursive LSTM network, so far without results - it does not achieve the same accuracy as the current one, and I have difficulties implementing it in tf Lite.

Training - only for the big ones

The network trains on pc. I don't know if it can be done on ESP, I'm afraid it would take quite a long time ...
I did the learning in python using the previously built application and collected samples, but as it turns out they are too long [500] and the relevant data does not fit in the 32 sec range.
I am not able to review and re-describe them, so I added to the software the functions of collecting new and saving them locally.
After starting, a file is created with 32 samples of 32 values (full range is collected every second).



Swatches can be saved to existing ones or add a new category. Everything is stored on the SD card attached to the system.
To make it easier, I added ftp support on the microprocessor which makes it easier to download data.
Such a package can enrich the base for Luna and train her again.
I also added a ready network uploader, which facilitates the upgrade, it is enough to select a properly generated .bin file (it can be done from the python level) and the system will start the new version after restart.



History with the flow

I save the data every 120 seconds in the csv file - this window seems optimal at the moment, maybe a bit too long in relation to the 32 seconds of the buffer. I will see after a few days, I want to minimize the logs.
Luna's website currently has a simple reporting system - a chart showing the above collected data.
I am going to add filtering by period, device etc. If there was any sql or pandas on esp ...

Screenshots showing the story below:



What's next?

I will certainly develop both soft system and training.
In line with the previous suggestions, I will add the MQTT protocol, so far I have focused on the egde AI technology development platform, which basically succeeded.
I am already working on the next version, but it will be wearable ...

p.

About Author
pixel7 wrote 656 posts with rating 160 , helped 53 times. Live in city warszawa. Been with us since 2007 year.

Comments

speedy9 29 Jul 2022 09:43

ESP32-S3 has support for neural networks. Have you thought about using this SoC version? [Read more]

linuxtorpeda 29 Jul 2022 12:46

Everything's fine, just: 1) what for? 2) did you know how other solutions regarding the classification of devices in the network are working? (e.g. using FFT) 3) do you have an idea for commercialization... [Read more]

khoam 29 Jul 2022 13:34

" Edge AI is the deployment of AI applications in devices throughout the physical world. It's called "edge AI" because the AI computation is done near the user at the edge of the network, close to... [Read more]

pixel7 01 Aug 2022 08:00

Yes, but for now I'm building from what I have. 1. For DIY presentations 2. Yes, but for the moment I have to let go of my transformation. 3. And there is such a chance? At the beginning,... [Read more]

linuxtorpeda 01 Aug 2022 09:40

Which of the two solutions gives the best results, FFT or neural networks? I ask out of curiosity. No, that's a rhetorical question :) That is why I personally gave up dealing with electronics... [Read more]

khoam 01 Aug 2022 13:01

True, but NVIDIA also borrowed this term. Perhaps, the description of this software on ESP32 is practically none. You have to guess many things. At that time, I did not have an account on Elektroda... [Read more]

aadeer 02 Aug 2022 00:17

How did you rate the accuracy of the network? You could describe it more precisely, because e.g. from what you have posted here you can see that the last layer has 8 neurons, or 8 outputs. It would be... [Read more]

sweter_007 02 Aug 2022 02:26

Hello. Old wolves bark at young wolves. There are five milling machines in the factory. Find a broken drill, please. Here you will need a shaft position sensor, a current sensor, a sound sensor. We... [Read more]

%}