As we move into non populated areas the infrastructure follows people. Also most of our power sources are build in remote areas. This infrastructure is both open to and cause fires. And climate change is not helping the situation. It gets hotter and drought prepares an environment ready to catch fire. As I was watching wild fires in California and Marmaris and felt I was far away from all these, It began to rain ash to Istanbul. The real cause is unknown but it was said, its because of fires in Athens forest which is 300 miles away. Nowhere is safe from climate change and we should get ready for it.
In California PG&E alone will bury 10000 miles of power lines. But not all infrastructure can be buried like mobile towers they should be observed. While there are commercial solutions available they depend on more expensive technologies like thermal cameras. As a fan of Tesla AI Systems, camera is all you need. if a single human with eyes can detect fires why we need these expensive systems. We need expendable systems, not so expensive that you save first in the event of fire. As they get cheaper they can be used not only for expensive infrastructure but also used to detect fires which farmers use to open illegal farmland like in Amazon rain forest.
So our two requirements are it must be extremely cheap and can communicate in long ranges. We do not need real time monitoring as fires tend to move in a logarithmic timescale. Power efficiency is nice to have as they will be deployed to remote areas that might not have electric and we might need to use solar cell and batteries. More watts you need, more you need to pay. Also after a point power usage means needing special thermal solutions and moving element like fans tend to fail first.
Esp32-Cam fit meets our requirement. Its cheap, comes with a built in camera Its supported in TinyML via Edge impulse and have an real active community. So what is the problem ? Communication. While Esp32-Cam comes with a WIFI but unfortunately its not optimized for long range power efficient communication. Its useful for sending images to somewhere else to be processed not sending results to somewhere.
After a search I find that LoRa is all I need. It has long range power efficient communication. Also as a added bonus there are some startups using LoRa to communicate with satellites. Its even more than I'm asking for. So I get LoRa module from Dorji DRF1278dm module. While it has many properties i use them with default settings and they work just fine. I use dateset created by Ali Khan, Bilal Hassan which you can reach from https://data.mendeley.com/datasets/gjmr63rz2r/1 and create a project in Edge Impulse which you can reach from https://studio.edgeimpulse.com/public/46275/latest.
After lots of trial and error I get a model that works with %88.42 accuracy and can fit into Esp32-Cam. If you want to edit the project yourself you can clone the project as seen below.
It took about 540 milliseconds to run model. It's highly effective for a small embedded board. The system program flow is giving in diagram below
The current state of the project is given below.
Power draw has given special attention so that even if its powered by solar energy it should work a day with battery. Since the system expected to run in forests the WIFI property of Esp32 have no usage its turned off. Esp32 has a few power modes explained in more detail in https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/ I tried to switch to Modem mode but somehow it needs memory which I need for AI, so I only turned off WIFI as its the biggest power hog. For more energy saving I turned frequency of Ep32 down to 10 MHz when CPU power is not needed. You can find more info on Esp32 frequency settings on https://deepbluembedded.com/esp32-change-cpu-speed-clock-frequency/. When not used Lora module is put into deep sleep mode in order to conserve more energy. The power draw of the system is 34.74 mA minimum and 224.18 mA maximum. The systems power usage can be adjusting the x in wait time. Different power usage is given in the chart below. The power draw is measured for one hour with a simple USB power meter.
Further power usage can be lowered with better integration of components.
Problems faced during the projectThe problems that I face can be divided into three parts Compiling Software, Esp32 programming and fitting model into memory.
Compiling software
At first i thought it will be easy to implement the system but its not the system required very specific Esp32 toolkit version 1.0.4. to compile the code in https://github.com/edgeimpulse/example-esp32-cam/tree/main/Examples/Basic-Image-Classification . Maybe I did something wrong or my system require an clean install but if you have trouble compiling it try with this version. But Esp32 toolkit 1.04 gives an error "The filename or extension is too long..." In order to fix it you must use project.local.txt for ESP32 as described here at the bottom of page https://docs.edgeimpulse.com/docs/running-your-impulse-arduino#code-compiling-fails-under-windows-os
Hardware programming
Esp32-Cam has a lot of versions from different vendors with different procedures for programming and troubleshooting. I only achieve to program it with Arduino Ide 1.8.13 with following settings
I cannot guarantee the settings to work Please refer to https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/ for more information. I succeed in programming board when I use the GND pin next to 5V instead of using the one next to UOT. Take special care not to put 5V to other ports. I burned two Esp32-Cam board.
AI Model
I really have trouble fitting it into memory it requires too much effort trial and error. I think I found a sweet spot but as in all AI projects you should try and try and try.
Future work
The current model can be develop furthermore in order to give precise results.
Comments