I developed a simple IoT-based carbon monoxide (CO) monitoring prototype using an MQ-7 gas sensor, NodeMCU ESP8266, and KiwisIoT. The sensor responds to carbon monoxide in the surrounding air, while the ESP8266 sends its analog readings to an online dashboard.
How It WorksThe MQ-7 uses a tin dioxide (SnO₂) sensing element whose resistance changes in response to carbon monoxide. The sensor module converts this response into an analog output.
The NodeMCU reads the analog signal and sends the raw reading to KiwisIoT through Wi-Fi.
Note: The raw ADC value is not a CO concentration in ppm. Accurate ppm measurement requires proper heater cycling, calibration, and a suitable measurement circuit.
Circuit ConnectionsMQ-7 module -------- NodeMCU ESP8266
VCC ------------- External regulated 5V
GND ----------GND
AO --------A0 (through suitable voltage scaling)
DO----Not required
Use a regulated 5V supply capable of powering the sensor heater. Check your particular MQ-7 module's output voltage and the NodeMCU board's A0 input limit before connecting AO.
KiwisIoT Dashboard- Create a device dashboard in KiwisIoT.
- Add a data channel for the MQ-7 analog reading.
- Configure the Wi-Fi credentials and Topic ID in the ESP8266 project.
- Send the sensor reading to the configured channel.
- Display the incoming value using a dashboard widget.
This example demonstrates raw analog monitoring and KiwisIoT publishing. It is an educational demonstration, not a calibrated CO measurement system.
#include <ESP8266WiFi.h>
#include <KiwisIoT.h>
const char* ssid = "YOUR_WIFI_NAME";
const char* pass = "YOUR_WIFI_PASSWORD";
const char* topic = "YOUR_KIWISIOT_TOPIC_ID";
#define MQ7_PIN A0
KiwisIoT kiwisiot(ssid, pass, topic);
unsigned long lastSend = 0;
void setup() {
Serial.begin(115200);
Serial.println("MQ-7 CO Monitoring");
kiwisiot.begin();
}
void loop() {
kiwisiot.run();
if (millis() - lastSend >= 2000) {
lastSend = millis();
int sensorValue = analogRead(MQ7_PIN);
Serial.print("MQ-7 Raw Value: ");
Serial.println(sensorValue);
// Send raw ADC reading to KiwisIoT Channel 0
kiwisiot.send("0", String(sensorValue));
}
delay(10);
}The constructor and publishing calls should be checked against your installed KiwisIoT library version. This simple sketch does not implement the MQ-7's required heater cycle.
Troubleshooting- Reading always zero: Check the analog output connection and sensor power supply.
- Reading always maximum: Check the A0 input voltage and module wiring.
- Unstable readings: Allow the sensor to warm up and check the power supply and ground.
- No dashboard updates: Verify Wi-Fi, Topic ID, channel configuration, and library connection.
- Sensor readings do not change: Check the sensor module and allow sufficient preheating.
- Educational carbon monoxide detection demonstrations
- Experimental indoor air-quality monitoring.
- IoT-based gas sensor data visualizations
- Laboratory gas-sensing experiments.
- Automotive exhaust monitoring prototypes.
- Remote monitoring demonstrations using wireless dashboards.
This project helped me understand how gas sensors can be integrated with IoT technology. By connecting the MQ-7 to NodeMCU ESP8266 and KiwisIoT, I can view sensor readings remotely through an online dashboard. It is a useful starting point for learning gas sensing and connected monitoring systems.
Recommended IoT Platform — KiwisIoTI recommend KiwisIoT for this project because it provides a dashboard for visualizing sensor data received from ESP8266-based projects.
Explore more examples and project ideas:






_JnuTDtq8iW.jpeg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)





Comments