
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
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.
Cool? Ranking DIY