An automated plant watering system with remote control via a mobile app.
- ESP32 microcontroller - WiFi-enabled board for wireless communication
- DC water pump - Controlled via GPIO pin 23
- 3x DC solenoid valves - Water distribution to individual plants (GPIO 19, 21, 22)
- 3x capacitive soil moisture sensors - Analog readings on GPIO 15, 5, 18
- 3x IRLZ44N MOSFETs - Low-side switching for pump and valves
- 2x 9V batteries - Power supply (connected in series for 18V or parallel for extended runtime)
- LEDs - Visual indicators
- MOSFETs drive the pump and valves, with ESP32 GPIO pins controlling the gates
- Soil moisture sensors use analog-to-digital conversion (ADC) to measure soil conductivity
- Sensors are calibrated with
airValue = 3500(dry) andwaterValue = 1500(wet), mapped to 0-100% moisture scale
Written in C++ using the Arduino framework.
Key Features:
- WiFi connectivity - Creates or connects to a network using credentials defined in code
- HTTP web server - Listens on port 80 for control commands
- Moisture monitoring - Polls sensors every 20 seconds, converts raw ADC values to percentage
- Valve control logic - Activates specific valves and automatically manages pump state
- RESTful API endpoints:
/status- Returns JSON with current moisture levels and valve/pump states/valve1on,/valve1off- Control valve 1 (and similarly for valves 2 and 3)
Operation:
- Pump runs only when at least one valve is open
- When all valves close, the pump automatically shuts off
- Serial output at 115200 baud displays IP address and diagnostic information
Built with .NET MAUI (cross-platform framework) in C#.
Functionality:
- Connects to the ESP32 via HTTP using the IP address displayed in serial monitor
- Displays real-time soil moisture percentages for each plant
- Provides buttons to manually trigger watering for individual plants
- Polls
/statusendpoint periodically to update UI
- Flash the firmware: Upload
Mobile_Irigation_No1.inoto the ESP32 using Arduino IDE - Note the IP address: Open Serial Monitor (115200 baud) to see the ESP32's IP
- Configure the app: Update the IP address in the C# code (MAUI app) to match
- Build and deploy: Compile the MAUI app and install on Android/iOS/Windows
- Calibrate sensors: Adjust
airValueandwaterValuein the.inofile based on your sensors' readings in dry soil and water
- Sensor readings are raw ADC values (0-4095 on ESP32) mapped to percentage
- WiFi reconnection logic attempts to restore connectivity if the connection drops
- The system supports up to 3 plants but can be expanded by adding more pins and endpoints