This is an old revision of the document!


Environmental Comfort Monitoring System with ESP32

Autor: Burciu Iustin Florian Email: iustin.burciu@stud.fiir.upb.ro Grupa: AAC

Introduction

This project focuses on building an embedded system to monitor environmental comfort using the ESP32 development board, along with an LM35 temperature sensor and an MQ-4 gas sensor. It continuously evaluates environmental conditions and computes a comfort score based on temperature and gas readings.

The implementation was initially created as a local web server hosted directly on the ESP32, allowing real-time monitoring from any browser within the same Wi-Fi network. Later, a second version was developed using Firebase Realtime Database, enabling remote data access and logging in real time from anywhere in the world.

The project includes:

  • Real-time data acquisition from temperature and gas sensors
  • Live display of sensor values and computed comfort score
  • Visual charts and indicator LEDs (both virtual and physical)
  • Automatic alerts and a persistent log for critical events
  • Optional Firebase integration for remote access

Hardware

Used Components:

  • ESP32 DevKit V1 – WiFi + Bluetooth enabled development board
  • LM35 – analog temperature sensor
  • MQ-4 – analog gas sensor
  • 2x LEDs (red and blue) – for visual alerts
  • Jumper wires, breadboard

ESP32 Connections:

Component ESP32 Pin Description
LM35 VCC 3.3V Power supply
LM35 GND GND Ground
LM35 OUT GPIO34 Temperature signal
MQ-4 VCC VIN Power supply (regulated)
MQ-4 GND GND Ground
MQ-4 A0 GPIO32 Gas level (analog)
LED Blue GPIO25 Lights up at comfort score 100
LED Red GPIO26 Lights up if gas > 30

System Diagram

Functionality

The system reads data from the LM35 and MQ-4 every 2 seconds and:

  • Computes a comfort score between 0 and 100.
  • Displays the values and graphs on a local HTML dashboard.
  • Logs alerts (dangerous gas levels or max score) in a scrollable event list.
  • Activates LEDs and virtual indicators based on thresholds.

Optional: Firebase Support

In a separate sketch, the system can also:

  • Push live data to Firebase Realtime Database
  • Use credentials and Web API key
  • Display values remotely via a mobile app or web

Code Snippets

1. Read Temperature and Gas:

```c float citesteTemperatura() {

int adc = analogRead(pinLM35);
float voltaj = adc * (5.0 / 4095.0);
return voltaj * 100.0;

}

int citesteGaz() {

return analogRead(pinMQ4);

}

iothings/proiecte/2025sric/esp32environmentalcomfortmonitoringsystemweb.1748482538.txt.gz · Last modified: 2025/05/29 04:35 by iustin.burciu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0