Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Mega 2560 Based Smart Farming System with GSM Remote Monitoring and Control

View and Edit Project In Cirkit DesignerImage of Arduino Mega 2560 Based Smart Farming System with GSM Remote Monitoring and Control

Circuit Documentation

Summary

This circuit is designed to monitor and control an agricultural environment. It includes sensors for measuring temperature, humidity, soil moisture, UV index, and IR radiation. The system can remotely control servomotors and a stepper motor for various tasks such as feeding water and nutrients. A water pump is controlled to supply the mixture to the field, and a water flow sensor manages the flow and amount of water. The Arduino Mega 2560 microcontroller is the central processing unit, interfacing with a GSM module for cloud communication. The status and sensor data are displayed on a serial monitor.

Component List

Arduino Mega 2560

DHT11 Sensor V2

DFRobot Capacitive Soil Moisture Sensor (V1.0)

Adafruit SI1145 Digital UV Index + IR + Visible Light Sensor

Servomotor MG995

Water Flow Sensor

Mini Diaphragm Water Pump

Stepper Motor (Unipolar)

SIM900A

Power Supply

Relay Module 5v-30v

Wiring Details

Arduino Mega 2560

DHT11 Sensor V2

DFRobot Capacitive Soil Moisture Sensor (V1.0)

Adafruit SI1145 Digital UV Index + IR + Visible Light Sensor

Servomotor MG995

Water Flow Sensor

Mini Diaphragm Water Pump

Stepper Motor (Unipolar)

SIM900A

Power Supply

Relay Module 5v-30v

Documented Code

/*
 * Arduino Mega Project
 * This project reads data from a sensor array consisting of temperature,
 * humidity, soil moisture, UV index, and IR radiation sensors. It sends
 * this data to a cloud server via a GSM module and can remotely control
 * motors for feeding water, nutrients, and mixing liquids. It also controls
 * a water pump to feed the mixture to the farm field and a water flow
 * controller to manage the flow and amount of water. The data and status
 * are displayed on a serial monitor.
 */

#include <DHT.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_SI1145.h>
#include <Servo.h>
#include <Stepper.h>

#define DHTPIN 2
#define DHTTYPE DHT11
#define SOIL_MOISTURE_PIN A0
#define UV_SDA_PIN 20
#define UV_SCL_PIN 21
#define GSM_TX_PIN 18
#define GSM_RX_PIN 19
#define SERVO1_PIN 10
#define SERVO2_PIN 9
#define SERVO3_PIN 8
#define STEPPER_A_PIN 3
#define STEPPER_B_PIN 5
#define STEPPER_C_PIN 4
#define STEPPER_D_PIN 6
#define WATER_FLOW_PIN 7
#define RELAY_PIN 11

DHT dht(DHTPIN, DHTTYPE);
Adafruit_SI1145 uv = Adafruit_SI1145();
Servo servo1, servo2, servo3;
Stepper stepper(200, STEPPER_A_PIN, STEPPER_B_PIN, STEPPER_C_PIN, STEPPER_D_PIN);

void setup() {
  Serial.begin(9600);
  dht.begin();
  uv.begin();
  servo1.attach(SERVO1_PIN);
  servo2.attach(SERVO2_PIN);
  servo3.attach(SERVO3_PIN);
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(WATER_FLOW_PIN, INPUT);
  Serial1.begin(9600); // GSM module
}

void loop() {
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  int soilMoisture = analogRead(SOIL_MOISTURE_PIN);
  float uvIndex = uv.readUV();
  int waterFlow = digitalRead(WATER_FLOW_PIN);

  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.print(" %\t");
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.print(" *C\t");
  Serial.print("Soil Moisture: ");
  Serial.print