This project involves designing and implementing a smart gas sensor. Starting with its fabrication at the AIME laboratory, the project extended to integrating the sensor with an Arduino UNO and LoRa module for wireless communication.
The objective was to create a system capable of detecting gas, processing the data, and transmitting it to a remote dashboard via LoRaWAN. This project helped us gain hands-on experience in electronics, programming, and networking.
The gas sensor was fabricated during a training period at AIME. It uses [material, e.g., nanoparticles of WO3], which allows for high sensitivity to specific gases like [e.g., ethanol, ammonia].
The sensor includes:
-
Sensitive layer: Nanoparticles deposited on interdigitated aluminum combs.
-
Heating element: A polysilicon resistor to adjust operating temperature.
-
Calibration zone: An area without nanoparticles for baseline measurements.
Pin Number | Description |
---|---|
2, 4 | Sensitive layer (with nanoparticles) |
3, 6 | Heating element |
5, 10 | Temperature sensor |
7, 9 | Calibration layer |
1, 8 | Not used |
To create a functional system, we wired the following components:
- Arduino UNO: Central microcontroller for the system.
- LoRa Module (RN2483): For wireless communication.
- Gas Sensor: To detect gas concentrations.
The connections were as follows:
- Gas sensor: Connected to the analog pin A0 on the Arduino.
- LoRa module: TX and RX connected to pins 10 and 11 on the Arduino.
- Power: Arduino powered via USB, LoRa module powered through the 3.3V pin.
The Arduino code consists of two parts:
- Initialization: Retrieve and configure the LoRa module with its EUI for registration in the LoRaWAN network (via ChirpStack).
- Data Transmission: Read gas sensor values, process the data, and send it via LoRa.
Code Highlights
The setup() function initializes the LoRa module and the gas sensor. The loop() function reads the sensor data, encodes it, and transmits it using the sendBytes() function.
Configuration Parameters:
- AppEUI: Configured for LoRaWAN registration.
- AppKey: Security key for LoRaWAN.
- Sensor Pin: Pin A0 for the gas sensor.
- LoRa TX/RX: Pins 10 and 11 for communication.
Below is a view of the routed PCB on KiCad.
![Capture d’écran 2025-01-24 à 17 13 35](https://private-user-images.githubusercontent.com/151730353/406508654-72e78dc1-0980-4b78-ba98-3dc29822a225.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MTU4NDksIm5iZiI6MTczOTUxNTU0OSwicGF0aCI6Ii8xNTE3MzAzNTMvNDA2NTA4NjU0LTcyZTc4ZGMxLTA5ODAtNGI3OC1iYTk4LTNkYzI5ODIyYTIyNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQwNjQ1NDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jYWYwN2FmOGFiMTA0NGJiMTE2NTVhZDgyMDk1MTE3NzZkODIzZDhlMjQ3NGUxYzU3ODc0OWZhYmJkNmFhMDRjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.FfmH1jnKyucz8qlrX9zOaj5xmFrma5NatNjIZ2uKxkE)
The Node-RED flow for this project is designed to receive, process, and display data from a LoRa sensor. The flow involves:
- Data Reception: An MQTT node listens for incoming sensor data, typically from a LoRaWAN network like ChirpStack.
- Data Extraction: A function node decodes the received Base64-encoded data and extracts the gas level value.
- Data Processing: Another function node analyzes the gas level and triggers an alert if the value exceeds a set threshold (e.g., 200).
- Visualization: A chart node displays the real-time gas levels in the Node-RED dashboard.
Flow Highlights:
- MQTT Node: Configured to receive sensor data from a LoRa network.
- Function Nodes: Process and filter the incoming data (e.g., extract, decode, and analyze gas levels).
- Chart Node: Displays the data in real-time on a graphical interface.
Key Parameters:
- MQTT broker configuration: Connects to the LoRa network.
- Threshold value: Set to 200 for triggering the alert.
- Dashboard: Accessible via http://127.0.0.1:1880/ui.
The MIT App Inventor app is designed to connect to the Arduino, allowing users to control the system and view sensor data in real-time.
Features:
- Connect to Arduino: The app connects to the Arduino via Bluetooth when the user presses a connect button.
- Control LED: Users can turn the LED on or off using buttons in the app.
- Gas Level Monitoring: The app continuously receives the current gas level from the sensor and displays it.
- Real-time Updates: Gas level data is updated in real-time on the app interface.
Key Components:
- Connect Button: Establishes communication with the Arduino.
- LED Control Buttons: Turns the LED on and off.
- Label: Displays the current gas level.
- Notifier: Alerts the user if the gas level exceeds a predefined threshold.
This app provides simple, real-time interaction with the Arduino system, enabling both control and monitoring of environmental conditions.