A standalone, WiFi-based monitoring and automation system for hydroponic farming using Arduino/ESP32.
This project provides real-time monitoring and automated control of nutrient levels (pH, EC), water temperature, and water level across 4 hydroponic tanks, integrated with a Telegram Bot interface for remote access and control.
β
Monitor pH, EC, and temperature per tank
β
Automatic dosing using 4 peristaltic pumps (1 per tank)
β
Shared solenoid valve for automatic draining
β
Shared refill pump for automatic water level refill
β
Threshold-based automation per tank (stored in SPIFFS JSON config)
β
Telegram Bot integration for:
- Scheduled data reporting every 15 minutes
- Manual data request
- Changing threshold parameters remotely
β
Notification alerts if pH or EC is out of range
β Standalone operation (ESP32, no external PC/server)
βββ src/ # Main source code
β βββ main.ino
β βββ config.h
β βββ sensors/ # Sensor modules
β βββ actuators/ # Actuator controllers
β βββ telegram/ # Telegram Bot handler
β βββ utils/ # Utility modules
β βββ README.md # Source-level documentation
βββ test/ # Test sketches
β βββ test_ph_sensor.ino
β βββ test_ec_sensor.ino
β βββ test_telegram.ino
βββ data/ # SPIFFS data (upload via SPIFFS uploader)
β βββ thresholds.json
βββ docs/ # Documentation & diagrams
β βββ README.md
β βββ Graphic Schematic Drawing.svg
β βββ flowchart.png
βββ README.md # Project overview
- ESP32 Dev Board
- 4x pH Sensors (analog)
- 4x EC Sensors (analog)
- 4x DS18B20 Waterproof Temperature Sensors
- 1x Ultrasonic Sensor (water level)
- 4x Peristaltic Pumps (12V)
- 1x Solenoid Valve (12V)
- 1x Refill Pump (12V)
- Relay modules or MOSFET drivers for actuators
- 12V Power Supply for actuators
- 5V Regulator for ESP32
- Waterproof enclosures for outdoor environment
Refer to docs/README.md
for detailed wiring pinout and schematic flow.
Key connections:
Sensor/Actuator | Pin Mapping |
---|---|
pH 1β4 | A0βA3 |
EC 1β4 | A4βA7 |
Temp sensors | D1 (1-Wire) |
Ultrasonic | D5/D6 |
Pumps 1β4 | D7βD10 |
Solenoid valve | D11 |
Refill pump | D12 |
-
Uses Universal Arduino Telegram Bot library
-
Responds to commands:
/status
β current sensor data/setph [tank] [min] [max]
β update pH threshold/setec [tank] [min] [max]
β update EC threshold
-
Sends automatic updates every 15 minutes
-
Sends alerts if pH/EC outside thresholds
Thresholds per tank are stored in /data/thresholds.json
(uploaded via SPIFFS uploader):
{
"tanks": [
{ "id": 1, "ph_min": 5.8, "ph_max": 6.5, "ec_min": 1.2, "ec_max": 1.8 },
...
]
}
Update thresholds either by:
- Editing and re-uploading
thresholds.json
- Using Telegram
/setph
and/setec
commands
-
Clone the repository
-
Open in Arduino IDE or PlatformIO
-
Install dependencies:
- ArduinoJson
- Universal Telegram Bot
- WiFi
- SPIFFS
-
Configure WiFi credentials and Telegram token in
config.h
-
Upload
/data/thresholds.json
via SPIFFS uploader -
Flash firmware
-
Verify Telegram Bot responds and sensors function
Use provided test sketches in /test
to validate individual sensors and modules before full deployment.
- Flowchart and technical docs available in
docs/
MIT License
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.