top of page
Writer's pictureSanskruti Ashtikar

Building a Smart Irrigation System Using TinkerCAD

Introduction


Watering your plants can be a time-consuming task, especially if you have a large garden or if you're not always around to tend to your plants. A Smart Irrigation System automates this process by watering your plants based on soil moisture levels, ensuring they get the right amount of water. In this tutorial, we’ll guide you through creating a Smart Irrigation System using TinkerCAD, Arduino, and a soil moisture sensor. This project is a great introduction to IoT (Internet of Things) and smart home automation.





Materials Needed


To build this project in TinkerCAD, you will need the following components:

  • Arduino Uno

  • Breadboard

  • Soil Moisture Sensor

  • Relay Module

  • Water Pump (simulated with an LED in TinkerCAD)

  • Resistor (220Ω for LED)

  • Jumper Wires


Step 1: Setting Up the Components


  1. Arduino and Breadboard: Start by opening TinkerCAD and creating a new circuit project. Drag and drop an Arduino Uno and a breadboard onto the workspace.

  2. Soil Moisture Sensor: The soil moisture sensor measures the moisture level in the soil. It has three pins:

    • VCC: Connect to the 5V pin on the Arduino.

    • GND: Connect to GND on the Arduino.

    • SIG: Connect to analog pin A0 on the Arduino.

  3. Relay Module: The relay module controls the water pump (simulated by an LED in this tutorial). It has three pins:

    • VCC: Connect to the 5V pin on the Arduino.

    • GND: Connect to GND on the Arduino.

    • IN: Connect to digital pin 7 on the Arduino.

  4. Water Pump (LED): Since TinkerCAD does not support simulating a water pump, we will use an LED to represent the water pump. Connect the LED as follows:

    • Anode (longer leg) to the NO (Normally Open) pin on the relay.

    • Cathode (shorter leg) to GND via a 220Ω resistor.


Step 2: Wiring Diagram


Ensure your wiring looks like this:

  • Soil Moisture Sensor:

    • VCC → 5V on Arduino

    • GND → GND on Arduino

    • SIG → A0 on Arduino

  • Relay Module:

    • VCC → 5V on Arduino

    • GND → GND on Arduino

    • IN → Digital Pin 7 on Arduino

  • LED (Simulated Water Pump):

    • Anode (long leg) → NO pin on the relay

    • Cathode (short leg) → GND on breadboard (via 220Ω resistor)





Step 3: Writing the Code


With the circuit set up, let’s write the Arduino code to control the smart irrigation system

int sensorPin = A0;  // Analog pin connected to soil moisture sensor
int relayPin = 7;    // Digital pin connected to relay
int sensorValue = 0; // Variable to store the value from the sensor
int threshold = 600; // Threshold value for soil moisture
void setup() {
  pinMode(sensorPin, INPUT);
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, LOW); // Initially turn off the relay
  Serial.begin(9600);          // Initialize serial communication for debugging
}
void loop() {
  sensorValue = analogRead(sensorPin); // Read the soil moisture sensor value
  
  Serial.print("Soil Moisture Level: ");
  Serial.println(sensorValue);  // Print the sensor value to the Serial Monitor
  
  if (sensorValue > threshold) {
    digitalWrite(relayPin, HIGH); // Turn on the relay to water the plants
    Serial.println("Watering the plants...");
  } else {
    digitalWrite(relayPin, LOW);  // Turn off the relay
    Serial.println("Soil is moist enough, no need to water.");
  }
  
  delay(10000); // Delay for 10 seconds before the next reading
}

Step 4: Simulating the Circuit


  1. After entering the code, click the "Start Simulation" button in TinkerCAD.

  2. The soil moisture sensor will continuously read the moisture level. If the soil is too dry (indicated by a high sensor value), the relay will activate, simulating the water pump (represented by the LED turning on).

  3. If the soil is moist enough (sensor value below the threshold), the relay remains off, and the water pump does not run.





Step 5: Understanding the Code


  • Soil Moisture Sensor: The sensor measures the moisture level in the soil and outputs an analog value. A higher value indicates drier soil, while a lower value indicates wetter soil.

  • Relay Module: The relay acts as a switch to control the water pump. When the soil moisture level is below the set threshold, the relay is activated, turning on the pump.

  • Threshold: The threshold value determines when the pump should be activated. You can adjust this value based on your soil type and watering needs.


Step 6: Enhancing the System


This basic system can be further enhanced with additional features:

  • LCD Display: Add an LCD screen to display the current soil moisture level and system status.

  • Real-Time Clock (RTC): Incorporate an RTC module to water the plants at specific times of the day.

  • Wi-Fi Module: Use a Wi-Fi module like the ESP8266 to monitor and control the system remotely through a smartphone or computer.


Conclusion


You have successfully created a Smart Irrigation System using TinkerCAD and Arduino. This project showcases the practical application of sensors and automation in agriculture and gardening. With this system, your plants will receive the right amount of water automatically, ensuring their healthy growth.


By following this guide, you’ve gained valuable experience in working with sensors, relay modules, and Arduino programming. This system can be expanded and modified for various smart home applications, making it a versatile project for learning and experimentation.


Want us to guide you through your project or make the project for you ?






Create Various Projects

Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 



2 views0 comments

Related Posts

See All

Comments


bottom of page