An IoT based project for a smart farm
# Smart Shamba
Smart Shamba is an automated IoT-based agricultural monitoring system designed to track crucial soil and climate data. The platform captures environmental metrics from hardware deployments and streams them real-time to a centralized web dashboard to assist in farming insights and precise irrigation management.
---
## System Architecture Overview
The system operates across three interconnected layers to handle data collection, transmission, and visualization:
1. **Firmware (ESP32):** Reads data directly from field sensors (Temperature, Humidity, Soil Moisture, and Soil pH) and publishes JSON payloads over a secure connection to a cloud MQTT broker.
2. **Backend Bridge (Node.js):** Connects to the MQTT broker, acts as a subscriber to incoming sensor feeds, processes payloads, and commits them to a persistent cloud database instance.
3. **Frontend Dashboard (HTML/CSS/JS):** Establishes an active WebSocket listener directly with the cloud database, rendering instantaneous dashboard card updates and historic time-series trend lines.
---
## Technical Stack
* **Hardware Runtime:** MicroPython (ESP32)
* **Backend Runtime:** Node.js
* **Messaging Protocol:** MQTT via HiveMQ Cloud (TLS encrypted over port 8883)
* **Cloud Database:** Firebase Realtime Database (Belgium/europe-west1 regional instance)
* **Frontend UI:** Vanilla HTML5, CSS3, JavaScript (ES6+ Modules), and Chart.js
---
## Data Contract
Every sensor payload generated by the hardware and processed by the system conforms to the following standardized data schema:
```json
{
"deviceId": "string (e.g., 'esp32-01')",
"timestamp": "ISO 8601 string (generated by backend bridge)",
"temperature": "number (°C)",
"humidity": "number (%)",
"soilMoisture": "number (%)",
"soilPH": "number (0-14, or null if uncalibrated)"
}