Skip to content

Mahmoud7111/smart-irrigation-assembly-and-arduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌱 Smart Irrigation System - Assembly & Arduino

Assembly C++ Arduino

An intelligent automated irrigation system with dual implementation: Arduino and Assembly language


πŸ“– Overview

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

βš™οΈ Features

Moisture Level Detection

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"

Intelligent Control Logic

  • Automatic calibration support for different soil types
  • Hysteresis prevention to avoid rapid on/off cycling
  • Serial monitor output for debugging and data logging

πŸ› οΈ Hardware Requirements

Core Components

  • 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)

Connections

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

Power Supply

  • Arduino: 5V via USB or 7-12V barrel jack
  • Pump: Separate 12V power supply (connected through relay)

πŸ’» Software Versions

1️⃣ Arduino Version (C++)

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 sensor

2️⃣ Assembly Version

Located in /Aseembly-version/

Key Features:

  • Low-level hardware control
  • Optimized for performance
  • Direct register manipulation
  • Educational value for understanding microcontroller architecture

πŸš€ Getting Started

Arduino Version

  1. Install Required Libraries:

    • Open Arduino IDE
    • Go to Sketch β†’ Include Library β†’ Manage Libraries
    • Install: LiquidCrystal I2C by Frank de Brabander
  2. Open the Project:

    cd Arduino-version/CO_New_copy_20251217214409/

    Open CO_New_copy_20251217214409.ino in Arduino IDE

  3. Configure:

    • Adjust dryAnalog and wetAnalog values based on your sensor
    • Set relayActiveLow to match your relay module type
  4. Upload:

    • Select your Arduino board type
    • Choose the correct COM port
    • Click "Upload"
  5. Monitor:

    • Open Serial Monitor (9600 baud)
    • Observe moisture readings and pump status

Assembly Version

  1. Navigate to the Assembly version directory:

    cd Aseembly-version/
  2. Follow the specific assembly toolchain instructions for your setup


πŸ“Š System Logic Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Read Sensor    β”‚
β”‚  (Analog A0)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Map to 0-100%  β”‚
β”‚  Moisture Scale β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Check Ranges   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ ≀50%   β†’ DRY    β”‚
β”‚ 51-75% β†’ NORMAL β”‚
β”‚ β‰₯76%   β†’ WET    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Control Pump   β”‚
β”‚  Update LCD     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Customization

Adjusting Moisture Thresholds

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
}

Changing LCD Address

If your LCD uses a different I2C address:

LiquidCrystal_I2C lcd(0x27, 16, 2);  // Change 0x27 to your address

Find your address using an I2C scanner sketch.


πŸ“ Serial Monitor Output Example

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

πŸŽ“ Learning Outcomes

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)

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch (git checkout -b feature/AmazingFeature)
  3. πŸ’Ύ Commit your changes (git commit -m 'Add AmazingFeature')
  4. πŸ“€ Push to the branch (git push origin feature/AmazingFeature)
  5. πŸ”€ Open a Pull Request

πŸ“œ License

This project is open source and available


πŸ‘¨β€πŸ’» Author

Mahmoud7111


πŸ™ Acknowledgments

  • Arduino Community for excellent libraries
  • Contributors to open-source sensor libraries
  • Everyone who has provided feedback and suggestions

πŸ“ž Support

If you encounter any issues or have questions:

  1. Check the existing Issues
  2. Create a new issue with detailed information
  3. Provide your hardware setup and serial monitor output

⭐ Star this repository if you found it helpful!

About

An intelligent automated irrigation system with dual implementation: Arduino and Assembly language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors