A comprehensive baby monitoring system using ESP8266 microcontrollers and temperature sensors. This project provides real-time temperature monitoring, data visualization, and remote management capabilities.
-
Real-time Temperature Monitoring
- Support for DHT22 and DS18B20 temperature sensors
- Multiple sensor locations (nursery, living room, bedroom)
- Temperature range monitoring and alerts
- Historical data tracking
-
Web Dashboard
- Real-time temperature visualization using Chart.js
- WebSocket-based live updates
- Responsive design with Bootstrap 5
- Dark/light theme support
- Interactive charts and graphs
-
Power Management
- Deep sleep mode for energy efficiency
- Configurable update intervals
- Battery level monitoring
- Power-saving LED indicators
-
Security Features
- Device authentication
- Secure WebSocket connections
- Rate limiting
- Input validation
- Helmet.js security headers
-
Data Management
- MySQL database storage
- Automatic data retention
- Data visualization
- Export capabilities
- ESP8266 microcontroller (NodeMCU or similar)
- DHT22 or DS18B20 temperature sensor
- LED indicators (3x)
- Green: Normal operation
- Yellow: Warning/Processing
- Red: Error/Alert
- Power supply (USB or battery)
- Jumper wires
- Breadboard (optional)
- Battery pack for portable operation
- Enclosure for protection
- External antenna for better WiFi range
ESP8266 DHT22
3.3V --> VCC
GND --> GND
D4 --> DATA
ESP8266 DS18B20
3.3V --> VCC
GND --> GND
D4 --> DATA
ESP8266 LED
3.3V --> Green LED (through 220Ω resistor)
D5 --> Yellow LED (through 220Ω resistor)
D6 --> Red LED (through 220Ω resistor)
- Node.js (v14 or higher)
- MySQL Server (v5.7 or higher)
- Arduino IDE
- Required Arduino libraries:
- ESP8266WiFi
- DHT sensor library
- OneWire
- DallasTemperature
- ESP8266HTTPClient
- ArduinoJson
- Clone the repository:
git clone https://github.com/yourusername/baby-monitor.git
cd baby-monitor
- Install Node.js dependencies:
npm install
- Set up the database:
mysql -u root -p < MySQL\ Deploy
- Configure environment variables:
Create a
.env
file in the project root:
PORT=3000
DB_HOST=localhost
DB_USER=your_username
DB_PASSWORD=your_password
DB_NAME=BabyMonitor
NODE_ENV=development
- Start the server:
npm start
-
Open the appropriate sketch in Arduino IDE:
ESP8266 - DHT22 Sketch
for DHT22 sensorsESP8266 - DS18B20 Sketch
for DS18B20 sensors
-
Install required libraries through Arduino IDE Library Manager
-
Configure WiFi and server settings in the sketch:
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
const char* serverUrl = "http://your-server:3000";
- Upload the sketch to your ESP8266
-
Green LED
- Solid: Normal operation
- Blinking: Data transmission
- Off: Deep sleep
-
Yellow LED
- Solid: Processing
- Blinking: Warning
- Off: Normal state
-
Red LED
- Solid: Error
- Blinking: Critical error
- Off: Normal state
The system uses deep sleep mode to conserve power:
- Wake up every 5 minutes (configurable)
- Read temperature data
- Transmit data to server
- Return to deep sleep
- Device authentication using unique keys
- Secure WebSocket connections
- Rate limiting on API endpoints
- Input validation and sanitization
- Security headers with Helmet.js
- CORS protection
- Error logging and monitoring
-
WiFi Connection Issues
- Check WiFi credentials
- Verify signal strength
- Check router settings
-
Sensor Reading Errors
- Verify wiring
- Check sensor power supply
- Verify sensor type configuration
-
Database Connection Issues
- Check database credentials
- Verify MySQL service is running
- Check network connectivity
-
WebSocket Connection Issues
- Check server status
- Verify firewall settings
- Check browser console for errors
Enable debug mode by setting DEBUG_MODE
to true
in the sketch:
#define DEBUG_MODE true
- Sensor readings: 30 days
- System events: 90 days
- Automatic cleanup via MySQL events
- Automatic status updates
- Inactive device detection after 24 hours
- Status synchronization with sensors
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- ESP8266 community for hardware support
- Chart.js for data visualization
- Bootstrap for UI components
- All contributors and maintainers