Table of Contents
- Introduction
- Getting Started
- Edge Impulse
- Improving Edge Impulse Model
- Testing The Machine Learning Model With OpenMV
- Adding The Water Sprayer System
- Testing The Water Sprayer System
- IoT Ambient Monitoring System | Part1
- IoT Ambient Monitoring System | Part2
- Summary
**********************************************************************************************************************
In this last section I show you my final thoughts on the project, as well as references, how I solved problems and motivations. In this project there are still ideas to experiment, for example I no longer had time to repeat the experiment with wasps, test my artificial intelligence models in an apiary, etc. But if you have enough time, then you can start your own research and use my project as a reference.
Introduction
Here I show you a description of my project, goals, schematic diagram, necessary hardware and software. If you have read all the chapters, you should know that my project was divided into two parts: 1) Bees Monitor With Predators Repellent, and 2) IoT Ambient Monitoring System. Below I show you the flowcharts.
Getting Started
In this chapter I show you the main features and the setup of the Arduino Nicla Vision and MKR WAN 1310 boards. All this steps are necessary to update the firmware, install the libraries and a simple test to verify the good condition of the boards.
Edge Impulse
- Here I take the first steps to use the Edge Impulse platform, which helped me to make my artificial intelligence model. To start, I followed the steps in this arduino tutorial: https://docs.arduino.cc/tutorials/nicla-vision/image-classification
- This tutorial shows you the basic steps in image classification with Edge Impulse, however it uses very simple objects (fruits) with few features and for this reason they got a precision of 100% and loss of 0.06 which are perfect values.
- Bees, spiders and wasps have many features such as color, size, shapes, weight, texture, etc. In my case I had to make three models because the first two didn't work for me.
- The first model gave me an accuracy of 70.5% and a loss value of 0.89. Here I used 1200 images of bees, spiders and unknown.
- In the second model I added more images to increase the accuracy up to 98.8% and loss value to 0.05. However, I discovered that the model used up to 2.7 MB of Flash memory and the Nicla Vision only has 2 MB.
Improving Edge Impulse Model
- I faced next problem to made the model for Nicla Vision.
- I followed all steps for Image Classification with Edge Impulse and OpenMV in this link: https://docs.arduino.cc/tutorials/nicla-vision/image-classification
- However, I coulndn’t finish the last step: “7. Test the Model”. Everything was fine until I created and deploy a library with OpenMV in Edge Impulse.
- Since the Nicla Vision doesn’t have any on-board SRAM we need to build the machine learning model into the firmware and load it from the flash. So, I went to the openmv girhub and fork the repository.
- Then, I renamed the machine learning model and the label file, and In my fork, I replaced the built-in machine learning model under src/lib/libtf/models with the model downloaded from Edge Impulse. Finally, OpenMV failed to build a new firmware for Nicla Vision.
- I had repeated this process 3 times, I had changed the image size to 96 and 48, used Grayscale, etc. etc and nothing worked.
I found the solution in technical support of OpenMV, where I opened a report: https://forums.openmv.io/t/openmv-cant-build-a-new-firmware-for-nicla-vision/8200
The solution was to remove images from the model I was creating in Edge Impulse. However the accuracy dropped from 98.8 to 74.1%, but better than the first model (70.5%).
Testing The Machine Learning Model With OpenMV
Once I got OpenMV to create the binary file with the model, the next step was to upload it to the Nicla Vision. Here I did a simple test simulating bees and spiders with two images printed on paper.
Adding The Water Sprayer System
I stopped in the progress of my project due to the bug I experienced in the previous chapter. In this section I tried to improvise a practical and easy to use water sprayer. I found a prototype on the internet but I didn't like it because it used a servo mounted on the spray bottle. Finally I found a nicer solution using a gripper claw, which was perfect since it had holes through which to pass a strap, which helped me to hold the water sprayer bottle.
Testing The Water Sprayer System
- Here I did a final test with the prototype. Again experiment with the same images used in chapter 5. From the observations it can be concluded that the tests are affected by the size of the images, the lighting, the resolution of the digital camera, the focus of the image or object.
- The water sprayer system worked well, and here I faced the problem of not finding the information to program the GPIO ports of the Nicla Vision using MicroPython. Again I found the solution in the OpenMV discussion forum. Here is the link to the Open MV documentation which is useful for programmers: https://docs.openmv.io/openmvcam/tutorial/gpio_control.html
IoT Ambient Monitoring System | Part1
- In this section I show you the environmental monitoring of an apiary, inspired by the project that I developed last year for an ecological reserve. I have used the Arduino MKR WAN 1310 board as a receiver module. One of the advantages of this board is energy saving since its previous version wastes unnecessary energy.
- Finally, I preferred to improve the previous version of the IoT System instead of showing numbers of bees and spiders seen by the Nicla Vision because I think this is more useful to protect an apiary.
IoT Ambient Monitoring System | Part2
Here I do a simple test of the environmental monitoring prototype using temperature, humidity and air quality sensors. At the moment I have not been able to use this entire system in the ecological reserve of my community because the local authorities are providing maintenance.
Project/Repository
References:
- https://docs.edgeimpulse.com/docs/development-platforms/officially-supported-mcu-targets/arduino-nicla-vision
- https://docs.arduino.cc/tutorials/nicla-vision/image-classification
- https://openmv.io/pages/download
- https://store-usa.arduino.cc/products/arduino-mkr-wan-1310?selectedStore=us
- https://www.edgeimpulse.com/
- https://thingspeak.com/login?skipSSOCheck=true
- (Missing Blog Post)