Want to monitor temperature, humidity, pressure, and air quality from anywhere?
Air Quality Monitoring Station
that can be viewed on the web or mobile!
In this project, I’ve built an IoT-enabled Air Quality Station using the Bosch BME688 sensor connected to the Arduino IoT Cloud, running on my custom-made “Bug in Circuit” ESP32 board.
The twist?The board includes intentional hardware bugs that students must debug — making it a learning-first hardware kit that teaches real-world problem-solving.
🎓 What is “Bug in Circuit”?Bug in Circuit is an IoT STEM kit I developed to teach:
Real-world debugging of microcontroller circuits
- Real-world debugging of microcontroller circuits
Working with relays, sensors, and cloud platforms
- Working with relays, sensors, and cloud platforms
Critical thinking through hands-on engineering
- Critical thinking through hands-on engineering
It’s powered by ESP32 and fully compatible with Arduino IoT Cloud, Alexa, and Google Assistant.
click here -> Know More About Bug in Circuit
🔍 Features✅ Real-time temperature, humidity, pressure, and altitude ✅ VOC-based IAQ (Indoor Air Quality) approximation ✅ Scaled AQI (%) visualization using a cloud dashboard ✅ Wi-Fi connectivity using ESP32 ✅ Arduino IoT Cloud integration for remote monitoring ✅ Perfect for home, school, lab, or greenhouse environments
🧠 What is IAQ and How It Works?The BME680 includes a gas sensor that detects VOCs (volatile organic compounds).I implemented an approximation method to convert the raw gas resistance into a scaled IAQ value (0–500) and then mapped it to a percentage to display on a gauge widget.
Bosch's official IAQ ranges inspired this scaling:
The Arduino IoT Cloud dashboard gives a clean and responsive UI that works on desktop and mobile. I used:
Gauges for temperature, humidity, pressure, and altitude
- Gauges for temperature, humidity, pressure, and altitude
A circular percentage meter for air quality (%)
- A circular percentage meter for air quality (%)
🌐 What You Can Monitor
Real Time Data Monitoring in Arduino IoT Cloud
🔧 Hardware Used
Code Overview
Uses Zanshin_BME680
or BME688
with Bosch logic
Calculates IAQ based on gas resistance
Sends data to Arduino IoT Cloud via ESP32
Uses custom IAQ % for better dashboard integration
// Final integrated code: BME680 + Arduino IoT Cloud + IAQ estimation
#include "Zanshin_BME680.h"
#include "thingProperties.h"
BME680_Class BME680;
float altitudeFromPressure(const int32_t press, const float seaLevel = 1013.25) {
return 44330.0 * (1.0 - pow(((float)press / 100.0) / seaLevel, 0.1903));
}
int calculateIAQ(uint32_t gasResistance) {
float gas_kOhm = gasResistance / 1000.0;
if (gas_kOhm > 550) return 25;
else if (gas_kOhm > 450) return 75;
else if (gas_kOhm > 350) return 125;
else if (gas_kOhm > 250) return 175;
else if (gas_kOhm > 150) return 225;
else if (gas_kOhm > 50) return 300;
else return 400;
}
int getIAQCategory(int iaq) {
if (iaq <= 50) return 5;
else if (iaq <= 100) return 25;
else if (iaq <= 150) return 50;
else if (iaq <= 200) return 75;
else if (iaq <= 250) return 85;
else if (iaq <= 350) return 100;
else return 100;
}
void setup() {
Serial.begin(115200);
delay(1500);
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
Wire.begin();
Serial.println("Initializing BME680...");
while (!BME680.begin(I2C_STANDARD_MODE)) {
Serial.println("- Unable to find BME680. Retrying...");
delay(5000);
}
BME680.setOversampling(TemperatureSensor, Oversample16);
BME680.setOversampling(HumiditySensor, Oversample16);
BME680.setOversampling(PressureSensor, Oversample16);
BME680.setIIRFilter(IIR4);
BME680.setGas(320, 150);
Serial.println("BME680 initialized.");
}
void loop() {
ArduinoCloud.update();
static int32_t tempRaw, humidityRaw, pressureRaw, gasRaw;
BME680.getSensorData(tempRaw, humidityRaw, pressureRaw, gasRaw);
// Convert values for cloud
temperature = tempRaw / 100.0;
humidity = humidityRaw / 1000.0;
pressure = pressureRaw / 100.0;
altitude = altitudeFromPressure(pressureRaw);
int iaq = calculateIAQ(gasRaw);
iaqCategory = getIAQCategory(iaq);
// Serial debug
Serial.print("Temp: "); Serial.print(temperature);
Serial.print(" °C, Humidity: "); Serial.print(humidity);
Serial.print(" %, Pressure: "); Serial.print(pressure);
Serial.print(" hPa, Altitude: "); Serial.print(altitude);
Serial.print(" m, Gas: "); Serial.print(gasRaw / 1000.0);
Serial.print(" kOhm, IAQ: "); Serial.print(iaq);
Serial.print(" iaqCategory"); Serial.print(iaqCategory);
delay(10000);
}
// Empty handlers (optional)
void onIaqCategoryChange() {}
void onAltitudeChange() {}
void onHumidityChange() {}
void onPressureChange() {}
void onTemperatureChange() {}
💡 Why I Built ThisAir quality is something we often take for granted. With a cheap sensor and a Wi-Fi-connected board, I wanted to show how anyone can measure and track environmental data with minimal effort and maximum learning potential.
🔮 Future Enhancements
Add BSEC library for precision IAQ, CO₂ equivalent
OLED display integration
Voice alerts with Alexa
More “bug” challenges for learners
🧠 Why This MattersAir quality affects health.Debugging builds critical skills.IoT connects everything.
This project brings it all together into one affordable, hands-on educational kit.🤝 Let's Connect
Have questions, suggestions, or want to collaborate?Let’s talk on LinkedIn or Instagram.
📦 Educational ValueThis project is designed for:
📚 STEM & engineering students
🔧 Hands-on hardware learners
🧠 Makers who love solving real-world bugs
☁️ IoT & home automation enthusiast
With Bug in Circuit, students don’t just wire up — they debug, think, fix, and learn.
🏁 Final ThoughtsThis project is ideal for:
STEM educators
Home automation enthusiasts
Air quality researchers
IoT beginners
Bug In Circuit: Live in KickStarter
Comments