This project presents a Smart Irrigation System that automatically monitors soil moisture levels and controls a water pump to maintain optimal soil conditions. The system features:
- π― Real-time soil moisture monitoring (0-100% scale)
- π§ Automatic pump control based on moisture thresholds
- πΊ LCD display for status visualization
- π Dual implementation - Arduino (C++) and Assembly language
- β‘ Low-power design suitable for field deployment
The system categorizes soil moisture into three levels:
| Status | Moisture Range | Pump Action | Display |
|---|---|---|---|
| π΄ DRY | 0% - 50% | β Pump ON | "STATUS: DRY PUMP: ON" |
| π‘ NORMAL | 51% - 75% | β Pump OFF | "STATUS: NORMAL PUMP: OFF" |
| π’ WET | 76% - 100% | β Pump OFF | "STATUS: WET PUMP: OFF" |
- Automatic calibration support for different soil types
- Hysteresis prevention to avoid rapid on/off cycling
- Serial monitor output for debugging and data logging
- Arduino Board (Uno/Nano/Mega)
- Soil Moisture Sensor (Analog output)
- Relay Module (5V, supports active-low/active-high)
- Water Pump (12V DC recommended)
- 16x2 LCD Display (I2C interface, address 0x27)
Arduino Component
------- ---------
Pin A0 β Soil Moisture Sensor (Analog Out)
Pin 4 β Relay Module (Signal)
SDA β LCD I2C (SDA)
SCL β LCD I2C (SCL)
5V β Sensors & LCD Power
GND β Common Ground
- Arduino: 5V via USB or 7-12V barrel jack
- Pump: Separate 12V power supply (connected through relay)
Located in /Arduino-version/
Key Features:
- Uses Arduino IDE libraries
- Easy to modify and calibrate
- Serial debugging support
- I2C LCD library integration
Dependencies:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>Calibration:
const int dryAnalog = 600; // Adjust based on your sensor
const int wetAnalog = 100; // Adjust based on your sensorLocated in /Aseembly-version/
Key Features:
- Low-level hardware control
- Optimized for performance
- Direct register manipulation
- Educational value for understanding microcontroller architecture
-
Install Required Libraries:
- Open Arduino IDE
- Go to
SketchβInclude LibraryβManage Libraries - Install:
LiquidCrystal I2Cby Frank de Brabander
-
Open the Project:
cd Arduino-version/CO_New_copy_20251217214409/Open
CO_New_copy_20251217214409.inoin Arduino IDE -
Configure:
- Adjust
dryAnalogandwetAnalogvalues based on your sensor - Set
relayActiveLowto match your relay module type
- Adjust
-
Upload:
- Select your Arduino board type
- Choose the correct COM port
- Click "Upload"
-
Monitor:
- Open Serial Monitor (9600 baud)
- Observe moisture readings and pump status
-
Navigate to the Assembly version directory:
cd Aseembly-version/ -
Follow the specific assembly toolchain instructions for your setup
βββββββββββββββββββ
β Read Sensor β
β (Analog A0) β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Map to 0-100% β
β Moisture Scale β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Check Ranges β
βββββββββββββββββββ€
β β€50% β DRY β
β 51-75% β NORMAL β
β β₯76% β WET β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Control Pump β
β Update LCD β
βββββββββββββββββββ
Modify these values in the code:
if (moisture <= 50) {
// DRY condition - change threshold here
}
else if (moisture <= 75 && moisture >= 51) {
// NORMAL condition - change thresholds here
}If your LCD uses a different I2C address:
LiquidCrystal_I2C lcd(0x27, 16, 2); // Change 0x27 to your addressFind your address using an I2C scanner sketch.
Moisture: 45%
STATUS: DRY (0-50) - PUMP ACTIVATED
Pump State: ON - Watering...
Moisture: 63%
STATUS: NORMAL (51-75) - PUMP OFF
Pump State: OFF - No watering
Moisture: 82%
STATUS: WET (76-100) - PUMP OFF
Pump State: OFF - No watering
This project demonstrates:
- β Analog sensor interfacing
- β Relay control for high-power devices
- β I2C communication protocol
- β Threshold-based decision making
- β Real-time system design
- β Low-level programming (Assembly version)
Contributions are welcome! Here's how you can help:
- π΄ Fork the repository
- πΏ Create a feature branch (
git checkout -b feature/AmazingFeature) - πΎ Commit your changes (
git commit -m 'Add AmazingFeature') - π€ Push to the branch (
git push origin feature/AmazingFeature) - π Open a Pull Request
This project is open source and available
Mahmoud7111
- GitHub: @Mahmoud7111
- Repository: smart-irrigation-assembly-and-arduino
- Arduino Community for excellent libraries
- Contributors to open-source sensor libraries
- Everyone who has provided feedback and suggestions
If you encounter any issues or have questions:
- Check the existing Issues
- Create a new issue with detailed information
- Provide your hardware setup and serial monitor output
β Star this repository if you found it helpful!