This is a comprehensive real-time sensor data monitoring system featuring:
- React Frontend
- Django Backend
- AVR ATmega328P Microcontroller
- Deep Learning LSTM Model for Temperature Predictions
- Manual and Automatic Device Control
- LED Indicator System
- Introduction
- Features
- System Architecture
- Technologies Used
- Frontend (React)
- Backend (Django)
- Deep Learning Predictions
- Hardware Setup (AVR ATmega328P)
- WebSocket Real-Time Communication
- Database
- Device Control System
- Installation
- Usage
daq.webm
This project integrates sensor data collection, real-time monitoring, advanced temperature predictions, and comprehensive device control using an ATmega328P microcontroller, Django backend, React frontend, and an LSTM neural network. By leveraging an ATmega328P microcontroller, Django backend, React frontend, and an LSTM neural network, This Project provides a comprehensive solution for sensor data analysis, forecasting, and device management.
-
Real-Time Sensor Data Monitoring
- Live updates from multiple sensors
- Web dashboard with interactive visualizations
-
Device Control System
- Manual device control interface
- Automatic device control based on sensor conditions
- Support for 5 independent devices
- Individual LED status indicators for each device
- Configurable control rules and thresholds
-
Deep Learning Temperature Predictions
- LSTM model for accurate temperature forecasting
- Real-time prediction updates
- Historical data-driven predictions
-
WebSocket Integration
- Seamless, real-time data transmission
- Minimal data loss
- Instant sensor reading updates
-
Comprehensive Backend
- Django REST API
- CRUD operations on sensor data
- Efficient data processing
-
Modern Frontend
- React-based web interface
- Interactive charts and graphs
- Responsive design
-
Hardware Layer
- AVR ATmega328P microcontroller
- Multiple sensors (temperature, pressure, etc.)
- 5 controllable devices
- LED indicators for device status
- UART communication
-
Backend Layer
- Django REST Framework
- WebSocket server (Django Channels)
- LSTM prediction model
- Device control logic
- SQLite/PostgreSQL database
-
Frontend Layer
- React application
- Real-time data visualization
- Device control interface
- WebSocket client
-
Manual Control
- Individual on/off switches for each device
- Real-time status updates
- Override automatic control modes
-
Automatic Control
- Rule-based device management
- Sensor threshold triggers
- Configurable control parameters
- Intelligent decision-making based on sensor data
- Device On and Device Off indication
-
Manual Mode
- Direct user control
- Immediate device state changes
-
Automatic Mode
- Predefined rules
- Sensor-driven device management
- Configurable thresholds
- Frontend: React, Axios, WebSocket API, Chart.js/Plotly.js
- Backend: Django, Django REST Framework, Django Channels
- Device Control: AVR GPIO, Interrupt-driven control
- Deep Learning: LSTM (Long Short-Term Memory) Neural Network
- Hardware: AVR ATmega328P, Various Sensors
- Communication: UART, WebSockets
- Database: SQLite/PostgreSQL
- Axios
- WebSocket API
- Chart.js/Plotly.js
cd client/sensor-monitoring
npm install
npm start
- Django REST Framework
- Django Channels
- Serial Communication Module
- LSTM Prediction Module
- Device Control Module
cd server/sensor_monitoring
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
The project integrates a Long Short-Term Memory (LSTM) neural network for temperature predictions:
- Uses historical sensor data for training
- Provides real-time temperature forecasts
- Supports multiple prediction horizons
- Adaptive learning from continuous sensor inputs
cd DeepLearning_Predictions
python run.py
- ATmega328P Microcontroller
- Sensors (Temperature, Pressure, etc.)
- USB-to-Serial Converter
- 5 Controllable Devices
- LED Indicators
void USART_Init(unsigned int ubrr) {
UBRR0H = (unsigned char)(ubrr>>8);
UBRR0L = (unsigned char)ubrr;
UCSR0B = (1<<RXEN0)|(1<<TXEN0);
}
void USART_Transmit(unsigned char data) {
while (!(UCSR0A & (1<<UDRE0)));
UDR0 = data;
}
// Device control and LED management
void initDeviceControl() {
// Set device control pins as output
DDRD |= 0b11111000; // Pins for 5 devices
DDRB |= 0b00000111; // LED indicator pins
// Initial device and LED states
PORTD &= 0b00000111; // Devices off
PORTB &= 0b11111000; // LEDs off
}
void setDeviceState(uint8_t device, bool state) {
if (state) {
PORTD |= (1 << (device + 3)); // Turn device on
PORTB |= (1 << device); // Turn corresponding LED on
} else {
PORTD &= ~(1 << (device + 3)); // Turn device off
PORTB &= ~(1 << device); // Turn corresponding LED off
}
}
const socket = new WebSocket('ws://localhost:8000/ws/sensors/');
socket.onmessage = function (event) {
const sensorData = JSON.parse(event.data);
updateDashboard(sensorData);
};
// Device Control WebSocket
const deviceSocket = new WebSocket('ws://localhost:8000/ws/devices/');
deviceSocket.onmessage = function (event) {
const deviceData = JSON.parse(event.data);
updateDevicePanel(deviceData);
};
Supported Databases:
- SQLite (Development)
- PostgreSQL (Production)
- MPU6050 Gyroscope
- SW420 Vibration Sensor
- LDR Light Sensor
- BMP280 Pressure Sensor
- Temperature Prediction Logs
- Device Control Logs
- Device ID
- Device Name
- Current State
- Control Mode (Manual/Automatic)
- Trigger Conditions
- Last Updated Timestamp
- Python 3.8+
- Node.js 14+
- npm
- AVR Toolchain
- Clone the repository
- Setup Python virtual environment
- Install backend dependencies
- Setup frontend dependencies
- Configure hardware connections
- Setup database
- Configure WebSocket settings
- Setup hardware
- Configure device control rules
- Start Django backend
- Launch React frontend
- Open web dashboard
- Monitor sensors and control devices
- Set sensor thresholds
- Define automatic control rules
- Configure device priority
- Set LED indicator behaviors
- Check UART communication
- Verify WebSocket connections
- Validate sensor calibration
- Ensure proper device wiring
- Review Django and React logs
- Fork the repository
- Create feature branches
- Submit pull requests
- Follow coding standards
- Update documentation