A real-time sensor monitoring system built with Django for tracking waste management data through ESP32-powered sensors. This project provides a web dashboard to visualize environmental sensor data including distance measurements, gas concentrations, temperature, and humidity.
- Real-time Data Monitoring: Live sensor data updates every 5 seconds
- Multiple Sensor Support:
- Distance sensors (for waste level monitoring)
- MQ-4 gas sensors (methane detection)
- MQ-135 air quality sensors
- Temperature and humidity sensors
- Firebase Integration: Seamless data storage and retrieval
- Responsive Dashboard: Bootstrap-powered web interface
- ESP32 Compatible: Designed to work with ESP32 microcontrollers
- Backend: Django 5.1.4
- Database: Firebase Realtime Database
- Frontend: HTML5, Bootstrap 5.3.0, jQuery 3.6.0
- Hardware: ESP32 microcontroller
- Sensors: Distance sensors, MQ-4, MQ-135, DHT22/AM2302
- Python 3.8+
- Firebase account and project
- ESP32 microcontroller (for data collection)
- Required sensors (MQ-4, MQ-135, distance sensor, temperature/humidity sensor)
-
Clone the repository
git clone https://github.com/JulioCaesarRBG/TrashTransforms.git cd TrashTransforms -
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install django firebase-admin python-decouple
-
Configure Firebase
- Create a Firebase project at Firebase Console
- Generate a service account key (JSON file)
- Enable Realtime Database
- Create a
.envfile in the project root:
FIREBASE_CREDENTIALS=path/to/your/firebase-credentials.json FIREBASE_DATABASE_URL=https://your-project-id-default-rtdb.firebaseio.com/ SECRET_KEY=your-django-secret-key DEBUG=True
-
Run migrations
python manage.py migrate
-
Start the development server
python manage.py runserver
GET /- Main dashboard viewGET /get_data/- Fetch sensor data from Firebase (JSON)
The system expects sensor data in the following JSON format:
{
"timestamp": "2025-01-01 12:00:00",
"distance": 25.5,
"mq4": 150,
"mq135": 200,
"temperature": 24.5,
"humidity": 65.0
}sensors/
βββ sensor_data_1/
β βββ timestamp: "2025-01-01 12:00:00"
β βββ distance: 25.5
β βββ mq4: 150
β βββ mq135: 200
β βββ temperature: 24.5
β βββ humidity: 65.0
βββ sensor_data_2/
βββ ...
- Smart Waste Management: Monitor trash bin fill levels
- Environmental Monitoring: Track air quality and weather conditions
- Industrial IoT: General sensor data collection and visualization
- Research Projects: Environmental data analysis
- Real-time Updates: Automatic data refresh every 5 seconds
- Responsive Design: Works on desktop, tablet, and mobile devices
- Data Table: Clean tabular view of all sensor readings
- Error Handling: Graceful handling of connection issues
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
-
Firebase Connection Error
- Verify your Firebase credentials and database URL
- Check Firebase security rules
-
No Data Appearing
- Ensure ESP32 is sending data to the correct Firebase path
- Check network connectivity
-
Django Server Issues
- Verify all dependencies are installed
- Check the
.envfile configuration
If you encounter any issues or have questions, please open an issue on GitHub.
- Built with Django framework
- Firebase for real-time data storage
- Bootstrap for responsive UI design
- ESP32 community for hardware inspiration
Made with β€οΈ for smart waste management and environmental monitoring