A real-time sensor monitoring dashboard with premium alert system, built for ESP8266 (NodeMCU). Features a responsive dark-themed web interface with mobile support, configurable alerts, and smooth animations.
-
Real-time Sensor Monitoring
- DHT11 Temperature & Humidity sensor
- MQ Gas sensor (analog)
- Live updates every 1 second
-
Premium Alert System
- Repetitive beeping (800ms interval) when thresholds exceeded
- Smooth screen flash animations
- Visual indicators (red flashing borders on sensor tiles)
- Configurable thresholds for all sensors
- iOS Safari audio support with user gesture handling
-
Responsive Design
- Dark theme matching modern UI standards
- Fully responsive for desktop, tablet, and mobile devices
- Optimized for iPhone and iPad
- Touch-friendly interface
-
Smart Display
- Anti-flickering using last known good values
- Smooth progress bars for sensor readings
- localStorage persistence for settings
- ESP8266 (NodeMCU v1.0 or compatible)
- DHT11 Temperature & Humidity sensor
- MQ Gas Sensor (analog output)
- Wiring:
- DHT11 Data β D4 (GPIO2)
- MQ Sensor β A0 (Analog input)
- Power: 3.3V/5V and GND
ESP8266 Pin Connections:
βββ DHT11
β βββ VCC β 3.3V
β βββ GND β GND
β βββ DATA β D4 (GPIO2)
βββ MQ Sensor
βββ VCC β 5V
βββ GND β GND
βββ A0 β A0 (Analog)
-
Install Arduino CLI (if not already installed):
brew install arduino-cli # macOS -
Install ESP8266 board support:
arduino-cli core update-index arduino-cli core install esp8266:esp8266
-
Install required libraries:
arduino-cli lib install "DHT sensor library" -
Upload the code:
./upload.sh
-
Install ESP8266 Board Support:
- Open Arduino IDE
- Go to
FileβPreferences - Add to "Additional Board Manager URLs":
https://arduino.esp8266.com/stable/package_esp8266com_index.json - Go to
ToolsβBoardβBoards Manager - Search "ESP8266" and install "esp8266 by ESP8266 Community"
-
Install Library:
- Go to
SketchβInclude LibraryβManage Libraries - Search "DHT sensor library" and install
- Go to
-
Upload:
- Open
sketch_nov4a/sketch_nov4a.ino - Select board:
ToolsβBoardβNodeMCU 1.0 (ESP-12E Module) - Select port:
ToolsβPortβ (your ESP8266 port) - Click Upload
- Open
-
Install PlatformIO (VS Code extension or CLI)
-
Build and Upload:
pio run -t upload
-
Connect to WiFi:
- SSID:
ESP_Sensor_Station - Password:
stark954
- SSID:
-
Open Dashboard:
- Navigate to:
http://192.168.4.1 - Works on any device (phone, tablet, computer)
- Navigate to:
The dashboard displays three sensor readings:
- Temperature (Β°C) - from DHT11
- Humidity (%) - from DHT11
- Gas Level (0-1023) - from MQ analog sensor
- Click "ALERTS" button to open alert settings
- Toggle the switch to enable alerts
- Configure thresholds:
- Temperature Max: Maximum acceptable temperature
- Humidity Min/Max: Acceptable humidity range
- Gas Level Max: Maximum gas sensor reading
- Settings are automatically saved to browser localStorage
When a threshold is exceeded:
- β Immediate beep + screen flash
- β Red flashing border on affected sensor tile
- β Repetitive beeping every 800ms
- β Screen flash with each beep
- β Automatically stops when values return to normal
iOS Safari requires user interaction to enable audio:
- Open the dashboard in Safari
- Tap anywhere on the page (or any button)
- Enable alerts using the toggle switch
- You should hear a test beep when enabling alerts
- Audio alerts will now work when thresholds are exceeded
- Responsive layout adapts to screen size
- Touch-friendly buttons (minimum 44px)
- Full-screen dashboard on mobile
- Works offline (local network only)
Edit in sketch_nov4a.ino:
const char* ssid = "ESP_Sensor_Station";
const char* password = "stark954";Edit in sketch_nov4a.ino:
#define DHTPIN D4 // DHT11 data pin
// MQ sensor always uses A0const unsigned long readInterval = 1000; // Sensor read interval (ms)
// Polling interval in JavaScript: 1000ms- Check ESP8266 power (LED should be on)
- Verify code uploaded successfully
- Check Serial Monitor for error messages
- Try resetting the ESP8266
- Check DHT11 wiring (especially data pin connection)
- Verify sensor is powered (3.3V)
- DHT11 needs 1-2 second intervals between reads
- Check Serial Monitor for sensor errors
- Tap the screen first to enable audio
- Check Safari permissions (Settings β Safari β Microphone)
- Ensure alerts are enabled (toggle switch)
- Try refreshing the page after tapping
- Verify WiFi connection to
ESP_Sensor_Station - Check URL:
http://192.168.4.1(not HTTPS) - Clear browser cache
- Try different browser
- Already fixed with "last known good values" system
- If still occurring, check sensor connections
- May indicate intermittent sensor readings
Sensors Project/
βββ sketch_nov4a/
β βββ sketch_nov4a.ino # Main Arduino sketch
βββ src/
β βββ main.cpp # PlatformIO version
βββ sensor_dashboard.html # Standalone demo version
βββ platformio.ini # PlatformIO configuration
βββ upload.sh # Automated upload script
βββ UPLOAD_INSTRUCTIONS.md # Detailed upload guide
βββ README.md # This file
Use sensor_dashboard.html for testing UI changes:
open sensor_dashboard.html # macOS
# or drag into browser# Using Arduino CLI
cd sketch_nov4a
arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2 sketch_nov4a.ino
# Using PlatformIO
pio run# Automated script
./upload.sh
# Manual (Arduino CLI)
arduino-cli upload -p /dev/cu.YOUR_PORT --fqbn esp8266:esp8266:nodemcuv2 sketch_nov4a.ino- ESP8266: NodeMCU v1.0 (ESP-12E)
- WiFi: 802.11 b/g/n
- AP Mode: Up to 4 clients
- Web Server: HTTP on port 80
- Update Rate: 1 second
- Sensor Read Interval: 1 second (DHT11 minimum)
- Dashboard: Responsive HTML5/CSS3/JavaScript
The default WiFi password is stark954. Change this in production:
const char* password = "your-secure-password";This project is open source. Feel free to modify and use for your projects.
Contributions welcome! Please feel free to submit issues or pull requests.
For issues or questions:
- Open an issue on GitHub
- Check Serial Monitor output for debugging
- Verify hardware connections match the wiring diagram
- Multiple sensor support
- Data logging to SD card
- MQTT integration
- OTA (Over-The-Air) updates
- Historical data charts
- Email/SMS notifications
Built with β€οΈ for IoT enthusiasts