---
title: "Real-Time Laboratory Monitoring using Edge impulse"
url: "https://maker.wiznet.io/rahulkhannad1/contest/real-time-laboratory-monitoring-using-edge-impulse-1/"
markdown_url: "https://maker.wiznet.io/rahulkhannad1/contest/real-time-laboratory-monitoring-using-edge-impulse-1/md"
type: "Contests"
author: "rahulkhannad1"
author_url: "https://maker.wiznet.io/rahulkhannad1/"
original_author: "Rahul Khanna"
license: "MIT license (MIT)"
published: "2022-11-01"
language: "en"
tags: ["Machine Learning & AI", "AIoT", "Sensors", "Forecast", "Weather"]
hardware: ["WIZnet WizFi360-EVB-Pico", "Adafruit NeoPixel Ring: WS2812 5050 RGB LED", "Seeed Studio Grove - CO2 & Temperature & Humidity Sensor (SCD30)", "Seeed Studio Grove - Universal 4 Pin Buckled 5cm Cable (5 PCs Pack)"]
likes: 9
views: 2509
comments: 4
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Real-Time Laboratory Monitoring using Edge impulse

> Design and build a system to monitor the status of a laboratory using the WizFi360-EVB-Pico Board.

Original author: Rahul Khanna

## Components

- **WIZnet WizFi360-EVB-Pico** x 1
- **Adafruit NeoPixel Ring: WS2812 5050 RGB LED** x 1 ([docs](https://www.adafruit.com/product/1586))
- **Seeed Studio Grove - CO2 & Temperature & Humidity Sensor (SCD30)** x 1 ([docs](http://wiki.seeedstudio.com/Grove-CO2_Temperature_Humidity_Sensor-SCD30/))
- **Seeed Studio Grove - Universal 4 Pin Buckled 5cm Cable (5 PCs Pack)** x 1 ([docs](https://www.seeedstudio.com/Grove-Universal-4-Pin-Buckled-5cm-Cable-5-PCs-Pack.html?queryID=fc1f8bff04a6690bcd0609cdc4d71303&objectID=1701&indexName=bazaar_retailer_products))
- Software: **Arduino IDE** ([docs](https://www.arduino.cc/en/software))
- Software: **Edge Impulse** ([docs](https://docs.edgeimpulse.com/docs))
- Software: **WIZnet WizFi360-EVB-Pico-C** ([docs](https://github.com/Wiznet/WizFi360-EVB-Pico-C))

## Documents and links

- [Project Repo](https://github.com/Rahul24-06/Real-time-Laboratory-Monitoring) (code)
- [Hackster.io](https://www.hackster.io/rahulkhanna/real-time-laboratory-monitoring-using-edge-impulse-755813)

## Article

### **Why Did We Build This?**

The maintenance of the ambiance in places such as laboratories, especially chemical labs is essential. The temperature, humidity, and ambient light have to be monitored continuously and the level of Air quality and heat levels are used as an interrupt to prevent laboratory accidents.

![](https://hackster.imgix.net/uploads/attachments/1515889/40093_XyLiNfMT7B.jpg?auto=compress%2Cformat&w=740&h=555&fit=max)

**Hardware Build**

WizFi360-EVB-Pico is based on Raspberry Pi RP2040 and adds Wi-Fi connectivity using WizFi360. It is pin compatible with the Raspberry Pi Pico board and can be used for IoT Solution development.

![](https://hackster.imgix.net/uploads/attachments/1515884/dsc00307_VHyF5zCz1n.JPG?auto=compress%2Cformat&w=740&h=555&fit=max)

**Setting up IDE**

Open File -> Preferences, and enter the following into the Additional Boards Manager URLs

```plaintext
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
```

Now you can search for “wizfi” in the Boards Manager and install the latest package for Raspberry Pi Pico/RP2040. Add the [WizFi360EVB library](https://github.com/Rahul24-06/WizFi360EVB-Arduino)

![](https://hackster.imgix.net/uploads/attachments/1515881/screenshot_%2860%29_gni22gXxBF.png?auto=compress%2Cformat&w=740&h=555&fit=max)

Select the WIZnet WizFi360-EVB-Pico board and run the following blink code.

```plaintext
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(1000);                       // wait for a second
digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
delay(1000);                       // wait for a second
}
```

![](https://maker.wiznet.io/upload/ckeditor5/1010957293%5F1667313765%2Egif)

Now we have uploaded the code and the board is ready for this project.

### **Interfacing Sensor with WizFi360-EVB-PicoInterfacing Grove Temp&Humi Sensor (SHT40)**

![](https://hackster.imgix.net/uploads/attachments/1515931/image_8Q2taj5bbc.png?auto=compress%2Cformat&w=740&h=555&fit=max)

The SHT40 temperature is measured using a thermocouple method. A thermocouple consists of two types of metallic wires of different materials. One end of the two wires is welded together to form the working end, which is placed at the temperature to be measured. The other end is called the free end and is connected to the main control to form a closed loop.

- Download Grove Temp&Humi Sensor Code Library. Visit the [arduino-i2c-sht4x r](https://github.com/Sensirion/arduino-i2c-sht4x)epositories and download the entire repo to your local drive.

- Add the library to the Arduino IDE

Here we connect the SHT40 temperature and humidity sensor to the IO26 & IO27 pin of the WizFi360.

**Interfacing NeoPixel:**

The NeoPixel ring which I used is a 16-bit NeoPixel, i.e. the ring consists of 16 LEDs.

![](https://hackster.imgix.net/uploads/attachments/1515935/image_InsP8nEGGq.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**Connections **:

WizFi360 ------------------------------------------WS2816

VBUS -> Vcc

GND -> Ground(0V)

IO13 -> DI (Data IN)

The NeoPixel library is attached to the repository. The color of the NeoPixel is switched depending on the temperature and humidity stored in the variables.

Make the Connection as shown below.

![](https://maker.wiznet.io/upload/ckeditor5/1010957293%5F1667313810%2Ejpg)

### **Edge Impulse TFLite Model Generation & Deployment**

The main idea of this project is to use Raspberry Pi pico to detect some anomalies on the temperature data and the entire classification is done on the RP2040 MCU.

Depending on the hardware capacity and memory size, different types of MCU/Applications can be used in the TinyML, as shown in the below chart.

![](https://hackster.imgix.net/uploads/attachments/1516227/comp.png?auto=compress%2Cformat&w=740&h=555&fit=max)

To run a machine learning model on the Raspberry Pi pico, we need the ambient temperature data. Since the Raspberry Pi Pico has an internal temperature sensor, we use them to collect the temperature data. The ARM Cortex M0+ is suitable for Anomaly Detection and Sensor Classification which allows us to implement this project.

We will use edge impulse to build & train the TensorFlow Lite model. We will be collecting the gas sensor data for the following cases

- Temperature

- Humidity

- Pressure

We will be creating an edge impulse project named **Lab Monitoring - Anomaly Detection. **Running the following command will require your edge impulse email & password.

```plaintext
edge-impulse-daemon
```

![](https://hackster.imgix.net/uploads/attachments/1515951/ss1_yFZEBBput4.png?auto=compress%2Cformat&w=740&h=555&fit=max)

We have a 65% & 35% split for training and testing data. Next, we create Impulse and add the processing block with Flattern that Flatten an axis into a single value, useful for slow-moving averages like temperature data, in combination with other blocks. Next, we add a Keras Classification learning block, then click on Save Impulse. Next, we click the Generate features to train the model. After a few minutes, we can see the output in the Feature Explorer.

![](https://hackster.imgix.net/uploads/attachments/1515952/ss2_tkAlYn7ucf.png?auto=compress%2Cformat&w=740&h=555&fit=max)

You can visualize the features using the feature explorer.

![](https://hackster.imgix.net/uploads/attachments/1515953/ss3_8Lho4utMGg.png?auto=compress%2Cformat&w=740&h=555&fit=max)

Now we can deploy the model by exporting it into an Arduino library. Go to the Deployment tab in the left navigation. Select **Arduino,** Click **Build** to download the Arduino Library.

- Go to Sketch > Libraries > Add.ZIP Library, Select the library downloaded from Edge Impulse

- Open the** WizFiAnomalyDetector.ino** file and Upload the

### **Enclosure**

I used an Acrylic enclosure for this project. First, I placed all the circuitry inside the enclosure and screw it firmly. I made a small opening for the Neopixel Ring and the Temperature sensor. Finally, all the screws are firmly mounted and the power cable is inserted via a slot.

![](https://hackster.imgix.net/uploads/attachments/1516008/real-time_laboratory_monitoring_2_JGD38TpNs4.png?auto=compress%2Cformat&w=740&h=555&fit=max)

**Step 7: Let's See It Working**

This data that is logged can be displayed on either a website or with a mobile application.

### **Video:**

[Embedded media](https://www.youtube.com/embed/99ddR2ZpUAg?rel=0)

Give a thumbs up if it really helped you and do follow my channel for interesting projects. :)

Share this video if you like.

Happy to have you subscribed: <https://www.youtube.com/channel/UCks-9JSnVb22dlqtMgPjrlg/videos>

**Thanks for reading!**

---

Source: https://maker.wiznet.io/rahulkhannad1/contest/real-time-laboratory-monitoring-using-edge-impulse-1/
