Firebeetle 2 Gas Sensor
About the project
I recently won a FireBeetle 2 ESP32E on the ElectroMaker Show and thought it would be a great opportunity to build a portable gas sensor.
Project info
Difficulty: Easy
Platforms: Arduino, DFRobot, Seeed Studio, Espressif, Node-RED
Estimated time: 1 week
License: MIT license (MIT)
Items used in this project
Hardware components
Story
Robin Mitchell did a Product of the Week video on the FireBeetle 2 ESP32-E board from DFRobot about a month ago. And I won the giveaway on Ian's show. I had mentioned that I would use it to build a portable gas sensor since I had just gotten a Multichannel Gas Sensor board from Seeed Studio. So, here is that project.
The FireBeetle 2 ESP32-E board has some great features that make it ideal for building a portable IoT sensor - ESP32 processor with WiFi/Bluetooth, battery interface, GDI display port, and female GPIO headers.
Components
Here are the parts that I am using for my project (front and back):
Top: Fermion 1.8" 128x160 TFT Displaywith GDI cable
Middle: FireBeetle2 ESP32E
Bottom: Seeed MultiGas Sensor V2
LiPo battery
Arduino IDE
I normally use the Arduino IDE to program ESP32 boards and the DFRobot Beetle boards are included in the Board Manager esp32 boards. I am using Arduino IDE 2.2.1. I included the following Additional Boards Manager URL under Preferences: "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json".
Then selected the FireBeetle 2 ESP32-E:
And used the default settings for my programs:
Hardware Connections
GDI Display - 18 pin FPC cable
MultiGas Sensor - GPIO Header 3.3V, GND, SCL(22), SDA(21) to Grove 4 pin connector
Battery - 2 pin JST-PH connector VBat, GND; Voltage Monitor on A2(34) - divide by 2
Optional momentary push button on D7(13) to GND
Pinout
3D Printed Case
For flexibility I decided to mount all the parts except for the sensor in a 3D printed case. The sensor connects via a Grove connector. That way it is easy to swap sensors.
Top - TFT Display with slot for SD card
Bottom - FireBeetle2, LiPo battery, Grove connector(I2C), hole for Reset button access, Push Button, cutout for USB-C connector access
Display Test
The first thing I wanted to verify was the operation of the TFT display.
Install display library DFRobot_GDL from github into Arduino IDE.
Upload the TFT sample code from FireBeetle_2_Board_ESP32_S3_Advanced_Tutorial. The code also runs on the FireBeetle2 ESP32E.
Picture below shows code running on TFT with case open before battery and cover were installed.
MS8607 Test
Since I had not used the MultiGas sensor I wanted to try an I2C sensor that I have used before as a functional test. I decide to use the MS8607 PHT (Pressure/Humidity/Temperature) sensor.
I installed the Adafruit MS8607 and Sensor libraries. I wanted to publish the sensor values using MQTT so that I could display them on a Node-Red UI. I run a local MQTT server and Node-Red using a RPi4.
Here are the libraries that I am using:
#include <Wire.h>
#include <WiFi.h>
#include <PubSubClient.h>
#include <Adafruit_MS8607.h>
#include <Adafruit_Sensor.h>
#include "DFRobot_GDL.h"
The picture below shows the readings on the TFT. Case is complete but still running on USB power.
Results on Serial Monitor:
The Node-Red Flow
Very simple flow receives PHT data on the topic published by the FireBeetle2 using an MQTT input node and displays it on the dashboard using a chart node.
The Node-Red Dashboard
MultiGas Sensor V2
Now to get with the actual project - the gas sensor.
The Seeed MultiGas Sensor V2 board uses four individual gas sensors for each gas type:
- GM102B NO2 sensor
- GM302B C2H5OH sensor
- GM502B VOC sensor
- GM702B CO sensor
The wiki is here: Grove-Multichannel-Gas-Sensor-V2.
The library on github is here: Seeed_Multichannel_Gas_Sensor.
Here is a picture of the gas sensor operating on battery power:
Results on Serial Monitor:
The Node-Red Flow
The Node-Red Dashboard
Not PPM
The gas sensor interface and display is working as I had planned, but there is still some work to be done. I am somewhat confused by the results that I am getting from the Seeed MultiGas Sensor library. The results that I get are not gas readings in PPM but just conversion of raw sensor voltages, so I will need to figure out how to "calibrate" or adjust them.
Here are the library sensor values along with the sensor voltages:
I guess I was confused by a Hackster project that I saw that used the same gas sensor and library: Air Quality Monitoring Station.
That project called the same library functions to read the sensors but somehow returned "sensible?" values in PPM (except the NO2).
Something that I will need to figure out. For now at least I can get a qualitative measure of gas readings, i.e. detect changes.
Test with Isopropyl Alcohol
A quick test using isopropyl alcohol surprised me. I don't have any active air movement but the time it took for the sensor to clear after exposure to a small amount of spilled alcohol was much longer than I expected (hours). And the CO sensor is somewhat noisier than before the test. I'll need to do a lot more experimenting with the sensor responses to different stimuli...
Leave your feedback...