Stufin
Home Quick Cart Profile

Automatic Plant Watering System Kit

Buy Now

Pin Configuration

  • Automatic Plant Watering System Kit Documentation
  • Pinout Explanation
  • The Automatic Plant Watering System Kit is equipped with a microcontroller-based board that interfaces with various sensors and peripherals to automate the watering process. The kit's pinout consists of digital and analog pins, which are explained below:
  • Digital Pins:
  • 1. VCC (Power Pin):
  • Function: Power supply pin for the microcontroller and other components.
  • Description: Connect to a 5V power source (e.g., USB, battery, or wall adapter).
  • 2. GND (Ground Pin):
  • Function: Ground reference pin for the microcontroller and other components.
  • Description: Connect to the negative terminal of the power source or a common ground point.
  • 3. D0 (Digital Input/Output):
  • Function: General-purpose digital input/output pin for sensor connections or external devices.
  • Description: Can be used for connections like soil moisture sensor, temperature sensor, or other digital sensors.
  • 4. D1 (Digital Input/Output):
  • Function: General-purpose digital input/output pin for sensor connections or external devices.
  • Description: Can be used for connections like soil moisture sensor, temperature sensor, or other digital sensors.
  • 5. D2 (Water Pump Control):
  • Function: Digital output pin to control the water pump.
  • Description: Connect to the water pump's control wire to enable or disable the pump.
  • 6. D3 (LED Indicator):
  • Function: Digital output pin for the onboard LED indicator.
  • Description: The LED blinks or stays on to indicate system status, errors, or water pump operation.
  • Analog Pins:
  • 1. A0 (Analog Input):
  • Function: Analog input pin for sensor connections (e.g., soil moisture sensor).
  • Description: Connect to the analog output of a sensor to measure its output voltage.
  • 2. A1 (Analog Input):
  • Function: Analog input pin for sensor connections (e.g., temperature sensor).
  • Description: Connect to the analog output of a sensor to measure its output voltage.
  • Connections and Wiring
  • To connect the pins, follow this structure:
  • Power Connection:
  • + VCC (Power Pin) to 5V power source (e.g., USB, battery, or wall adapter).
  • + GND (Ground Pin) to the negative terminal of the power source or a common ground point.
  • Sensor Connections:
  • + Connect the soil moisture sensor to D0 (Digital Input/Output) or A0 (Analog Input) depending on the sensor type.
  • + Connect the temperature sensor to D1 (Digital Input/Output) or A1 (Analog Input) depending on the sensor type.
  • Water Pump Connection:
  • + Connect the water pump control wire to D2 (Water Pump Control).
  • LED Indicator Connection:
  • + The onboard LED is connected to D3 (LED Indicator) and will blink or stay on to indicate system status.
  • Important Notes:
  • Ensure proper polarity when connecting power sources and sensors.
  • Use suitable connector cables or wires to connect the components.
  • Refer to the datasheet of the specific sensors and components for detailed connection requirements.
  • Follow proper safety precautions when working with electrical components.
  • By following this pinout explanation and connection guide, you can assemble and integrate the Automatic Plant Watering System Kit with your project, ensuring seamless operation and efficient watering management for your plants.

Code Examples

Automatic Plant Watering System Kit Documentation
Overview
The Automatic Plant Watering System Kit is a comprehensive IoT solution designed to automate the watering process for plants. This kit consists of a soil moisture sensor, a water pump, a solenoid valve, and a microcontroller board. The kit is ideal for home automation, agriculture, and gardening applications.
Hardware Components
Soil Moisture Sensor (YL-69): measures the soil moisture levels
 Water Pump (DC 6V): pumps water to the plants
 Solenoid Valve (2-Way): controls the water flow to the plants
 Microcontroller Board (Arduino/ESP32): controls the entire system and communicates with the sensors and actuators
Software Requirements
Microcontroller Board programming using Arduino IDE or ESP32 framework
 Optional: Wi-Fi or cellular connectivity for remote monitoring and control
Code Examples
### Example 1: Basic Automatic Watering Using Arduino
This example demonstrates how to use the Automatic Plant Watering System Kit with an Arduino board to automate the watering process based on soil moisture levels.
```c++
#include <Arduino.h>
// Define pin connections
const int soilMoisturePin = A0;  // Soil moisture sensor pin
const int pumpPin = 9;        // Water pump pin
const int valvePin = 10;      // Solenoid valve pin
void setup() {
  Serial.begin(9600);
  pinMode(soilMoisturePin, INPUT);
  pinMode(pumpPin, OUTPUT);
  pinMode(valvePin, OUTPUT);
}
void loop() {
  int soilMoistureValue = analogRead(soilMoisturePin);
  if (soilMoistureValue < 400) { // adjust the threshold value based on your soil type
    digitalWrite(pumpPin, HIGH);
    digitalWrite(valvePin, HIGH);
    delay(10000); // water the plants for 10 seconds
    digitalWrite(pumpPin, LOW);
    digitalWrite(valvePin, LOW);
    delay(3600000); // wait for 1 hour before checking again
  } else {
    digitalWrite(pumpPin, LOW);
    digitalWrite(valvePin, LOW);
  }
  delay(1000); // check soil moisture every 1 second
}
```
### Example 2: Remote Monitoring and Control using ESP32 and Wi-Fi
This example demonstrates how to use the Automatic Plant Watering System Kit with an ESP32 board to monitor and control the watering process remotely using Wi-Fi.
```c++
#include <WiFi.h>
#include <HTTPClient.h>
// Define Wi-Fi credentials and API endpoint
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
const char apiEndpoint = "http://your-api-endpoint.com/plant_watering";
// Define pin connections
const int soilMoisturePin = 32;  // Soil moisture sensor pin
const int pumpPin = 25;        // Water pump pin
const int valvePin = 26;       // Solenoid valve pin
WiFiClient client;
HTTPClient http;
void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  Serial.println("Connected to WiFi");
  http.begin(apiEndpoint);
}
void loop() {
  int soilMoistureValue = analogRead(soilMoisturePin);
  if (soilMoistureValue < 400) { // adjust the threshold value based on your soil type
    digitalWrite(pumpPin, HIGH);
    digitalWrite(valvePin, HIGH);
    delay(10000); // water the plants for 10 seconds
    digitalWrite(pumpPin, LOW);
    digitalWrite(valvePin, LOW);
    delay(3600000); // wait for 1 hour before checking again
  } else {
    digitalWrite(pumpPin, LOW);
    digitalWrite(valvePin, LOW);
  }
  
  // Send soil moisture data to API endpoint
  http.addHeader("Content-Type", "application/x-www-form-urlencoded");
  http.POST("soil_moisture=" + String(soilMoistureValue));
  int statusCode = http.responseStatusCode();
  if (statusCode == 200) {
    Serial.println("Data sent successfully");
  } else {
    Serial.println("Error sending data: " + String(statusCode));
  }
  delay(1000); // check soil moisture and send data every 1 second
}
```
Note: In this example, you need to create an API endpoint to receive the soil moisture data and send control signals to the ESP32 board. The API endpoint can be implemented using a server-side programming language like Python, Node.js, or PHP.
### Example 3: Scheduled Watering using ESP32 and RTC
This example demonstrates how to use the Automatic Plant Watering System Kit with an ESP32 board to automate the watering process based on a schedule using a Real-Time Clock (RTC).
```c++
#include <WiFi.h>
#include <RTClib.h>
// Define RTC module
RTC_DS3231 rtc;
// Define pin connections
const int soilMoisturePin = 32;  // Soil moisture sensor pin
const int pumpPin = 25;        // Water pump pin
const int valvePin = 26;       // Solenoid valve pin
void setup() {
  Serial.begin(115200);
  rtc.begin();
  if (!rtc.isrunning()) {
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
}
void loop() {
  DateTime now = rtc.now();
  if (now.hour() == 8 && now.minute() == 0 && now.second() == 0) { // adjust the schedule based on your needs
    int soilMoistureValue = analogRead(soilMoisturePin);
    if (soilMoistureValue < 400) { // adjust the threshold value based on your soil type
      digitalWrite(pumpPin, HIGH);
      digitalWrite(valvePin, HIGH);
      delay(10000); // water the plants for 10 seconds
      digitalWrite(pumpPin, LOW);
      digitalWrite(valvePin, LOW);
    }
  }
  delay(1000); // check the schedule every 1 second
}
```
Note: In this example, you need to connect the ESP32 board to the internet to set the RTC module with the current date and time. You can use the `WiFi` library to connect to a Wi-Fi network and set the RTC module.