# README
Plant Monitoring System
A server-based plant monitoring system using ESP32 to track soil moisture, temperature, and humidity.
This project is a Server-Based Plant Monitoring System using an ESP32 microcontroller. It integrates multiple sensors to monitor soil moisture, temperature, and humidity levels in real time. The data is displayed on a web-based dashboard hosted by the ESP32, allowing users to access it from any browser.
Real-time plant monitoring with an interactive web dashboard hosted by ESP32.
Features
- Real-time Sensor Monitoring:
- Soil Moisture
- Temperature
- Humidity
- Web Dashboard:
- Interactive, responsive, and user-friendly.
- Automatic and manual refresh options.
- API Endpoint:
/get-sensor-data
provides JSON-formatted sensor readings for integration with other applications.
- Error Handling:
- Detects and handles invalid sensor readings gracefully.
Requirements
Hardware:
- ESP32 microcontroller
- DHT22 Sensor
- Soil Moisture Sensor
- Breadboard and connecting wires
Software:
- Arduino IDE or PlatformIO
- ESP32 board support in Arduino IDE
- Libraries:
Installation
Step 1: Clone the Repository
git clone https://github.com/Vinayakahr10/Vinayakahr10-Plant_Monitoring_System_V1.0
cd Vinayakahr10-Plant_Monitoring_System_V1.0
Step 2: Configure WiFi Credentials
- Open the
Plant_Monitoring_system_V1.0.ino
file in the Arduino IDE. - Replace the placeholder WiFi credentials in the following lines:
const char* ssid = "YOUR_SSID"; // Replace with your WiFi SSID const char* password = "YOUR_PASSWORD"; // Replace with your WiFi password
Step 3: Set Up the Hardware
-
Connect the DHT22 Sensor:
- Connect the Data Pin of the DHT22 to GPIO 15 on the ESP32.
- Connect the VCC Pin to 5V and GND Pin to GND.
-
Connect the Soil Moisture Sensor:
- Connect the Analog Output Pin (AO) of the soil moisture sensor to GPIO A0 (or another ADC-capable pin on the ESP32).
- Connect the VCC Pin to 5V and GND Pin to GND.
-
Power the Circuit:
- Use the USB cable to connect the ESP32 to your computer for both power and programming.
-
Double-check the wiring to ensure all connections are secure and correct.
Step 4: Access the Dashboard
-
After uploading the code to the ESP32, open the Serial Monitor in the Arduino IDE.
- Ensure the baud rate is set to 115200.
-
Once the ESP32 connects to your WiFi network, it will display the IP address assigned by the router on the Serial Monitor. For example:
http://192.168.1.100
-
Open a web browser on any device connected to the same WiFi network.
-
Enter the ESP32's IP address in the browser's address bar (e.g.,
http://192.168.1.100
). -
You will see the Sensor Dashboard, which displays:
- Humidity
- Temperature
- Soil Moisture
- Click the Refresh button on the dashboard to manually update the sensor readings, or wait for the data to auto-refresh every 5 seconds.
Usage
Dashboard Features:
-
Real-Time Monitoring:
- Displays the latest readings for:
- Humidity (in percentage)
- Temperature (in °C)
- Soil Moisture (in percentage)
- Automatically refreshes every 5 seconds or can be refreshed manually using the "Refresh Data" button.
- Displays the latest readings for:
-
Error Alerts:
- If sensor data cannot be read, the dashboard will display an error message:
"Error fetching data!"
- If sensor data cannot be read, the dashboard will display an error message:
-
REST API:
- Access raw sensor data in JSON format by navigating to
/get-sensor-data
. - Example API response:
{ "humidity": 55.5, "temperature": 22.3, "soilMoisture": 72 }
- This can be used for further integration with other IoT applications or systems.
- Access raw sensor data in JSON format by navigating to
Customization
You can modify the project as follows:
-
Change Dashboard Appearance:
- Edit the
getPage()
function in the code to customize the HTML/CSS for the web dashboard.
- Edit the
-
Sensor Calibration:
- If the soil moisture sensor readings are inaccurate, adjust the calculation in the
loop()
function:moisture = 100 - ((sensor_analog / 4095.0) * 100);
- Replace
4095.0
with the maximum analog value specific to your sensor.
- If the soil moisture sensor readings are inaccurate, adjust the calculation in the
-
Add More Sensors:
- You can connect additional sensors (e.g., light sensors, pH sensors) and extend the dashboard by updating the
getPage()
function and/get-sensor-data
endpoint.
- You can connect additional sensors (e.g., light sensors, pH sensors) and extend the dashboard by updating the
Future Enhancements
Planned improvements for this project:
- Data Logging:
- Store sensor readings on an SD card or cloud platform for historical analysis.
- Graphical Dashboard:
- Add live charts for visualizing sensor data trends.
- Mobile App Integration:
- Develop a companion app for mobile devices.
- Power Optimization:
- Implement deep sleep mode on the ESP32 to reduce power consumption.
- Notification Alerts:
- Send alerts via email or SMS when soil moisture drops below a threshold.
Known Issues
1. WiFi Connection Failure
- If the ESP32 cannot connect to WiFi after 10 seconds, it will restart automatically.
- Ensure your WiFi credentials are correct and the network is active.
2. Invalid Sensor Readings
- If the DHT22 or soil moisture sensor returns NaN, check the sensor connections and power supply.
3. Browser Compatibility
- The dashboard is tested on modern browsers like Chrome, Firefox, and Edge.
- Older browsers may not render the design correctly.
- Report Issues: Found a bug? Open an issue in the repository.
- Add Features: Fork the repository, implement a feature, and submit a pull request.
Made with <3 by @Vinayakahr10