Example Code for Arduino-Read Sensor Raw Value
This project demonstrates how to read the raw analog output value from the Fermion: MEMS H2 Sensor using an Arduino board. Users will learn how to wire the sensor to the Arduino and use basic analog read functions to retrieve real-time sensor data.
Hardware Preparation
| Name | Model/SKU | Quantity | Purchase Link |
|---|---|---|---|
| DFRduino UNO R3 | DFRduino UNO R3 | 1 | DFRduino UNO R3 |
| MEMS Gas Sensor | Fermion: MEMS H2 Sensor | 1 | SEN0572 |
| Jumper wires | - | 若干 | - |
Software Preparation
- Arduino IDE (Follow the official installation guide for Windows/macOS/Linux.)
Wiring Diagram

Other Preparation Work
- The module needs to be warmed up for more than 5 minutes when powered on for the first time. It is recommended to warm up for more than 24 hours if it has not been used for a long time.
Sample Code
int sensorPin = A0;
int sensorValue = 0;
void setup()
{
Serial.begin(9600); //Set serial baud rate to 9600 bps
}
void loop()
{
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(100);
}
Result
Open the serial port monitor and get the original value of the sensor.
Was this article helpful?
