Machine Learning on the RPI 2040: Edge Impulse & Environment Monitoring

Many of Adiuvo’ s projects are based in the space industry where we design circuit cards, FPGAs and Software for satellites such an ESA PLATO or ESA / NASA Lunar Gateway.

Space flight hardware involves a lot of movement and travel as the circuits are initially moved to the integrator to be integrated in the payload and then once included in the payload the payload is integrated with the satellite and eventually the satellite is integrated with the launcher. During all of this travel the design is subjected to temperature changes, humidity, shock, and vibration, if the environmental conditions experienced by the design are too extreme then damage could result. Of course, this is not the case for just space electronics but any high-end electronic system faces the same challenges.

Many of these systems are monitored by shock labels, humidity strips or expensive temperature and vibration loggers.

I have been a fan of the RPI2040 and the RPI Pico for a while, we have used to its flexible PIO capabilities to emulate satellite interfaces, sensors, and clocks.

I was therefore interested to see the Edge Impulse release the support the RPI2040. It is low cost, powerful and very flexible, I started thinking about how could the RPI2040 be used to create a low-cost environmental sensor which could be deployed along side the space designs in shipping which would log environmental conditions. The RPI2040 is easily capable of interfacing with a I2C or SPI NVRAM memory and sensors, TinyML could then be used to detect and trigger the recording of events and their duration rather than just recording all the time.

To try this idea out I thought I would create a simple project which uses the RPI Pico and a Humidity and Temperature sensor. This sir petty simple to do as the initial Edge Impulse firmware for the Pico supports a temperature humidity sensor on pin GP18 (power is pin 36 and ground pin 18). All we need to do then is create a simple breadboard with the Pico on and the sensor connected by wires.

Creating the project was straight forward using edge impulse

To connect the device, we need to download the RPI Pico firmware and flash this onto the device.

Once the device has the correct firmware on it, we can launch the edge impulse daemon and connect it to the project and RPI Pico.

We should see the RPI Pico under our devices in our project

With the project created the next step is to gather some data for this quick test I am captured data at room temperature and leveraged the fridge in my office for the lower temperature measurements.

Once the data was captured, we can begin defining the impulse – for this simple test I used only the temperature information. I select the classification as I wanted to classify if the temperature is correct or not.

For the parameters the minimum, average and maximum temperatures are the most important parameters. This makes sense when you are classifying slow changing parameters such as temperature.

The training of the model gave good initial results.

Live testing of the model from the Pico connected to the EI cloud project shows similar performance.

The result may be a little impacted by the wiring quality on the lash up I created for this.

Finally, I created the deployment image for the RPI Pico to allow me to test the model without being connected to the Cloud.

Walking around the office building and popping the sensor back in the fridge it was obvious the model was working as I expected.

This project I think shows the benefits of the RPI and Tiny ML, now on my list of board designs for this year is a RPI based, so that we can see what environmental impacts our boards experience in transit.

670 views0 comments

Recent Posts

See All