In my last article, I explained about
controlling Light/Fan using
Arduino Mega 2560. Now I will explain about the Automatic Watering System on plants using Arduino Mega 2560.
Introduction
- In this article, I will explain about the Automatic Watering System to plants using Arduino Mega 2560.
- It can be very useful for maintaining the plants.
- It will monitor the plants at the correct time and give the status of the plants.
Parts Of List:
- Arduino Mega 2560
- Soil moisture sensor
- Bluetooth
- Motor
- Led
- GSM-Module
- Bread Board
- Hook up wires
GSM-Module
- GSM means Global System For Mobile and it can be used to send and receive a message in critical areas.
- It can also act as a GSM modem.
- It can have a PIN configuration and MIC is also attached.
Figure 1: GSM-Module
Soil Moisture sensor
Bluetooth Module
Step 1:Connection from GSM To Arduino Mega 2560
- Connect the RX pin of the GSM board to the RX1 of the Arduino Mega 2560.
- Connect the TX pin of the GSM board to the TX1 of the Arduino Mega 2560.
- Connect the 5V power supply to the Arduino Mega 2560.
- At last, connect the GND to the GSM board.
Step 2:Connection From Soil Moisture To Arduino Mega 2560
- Vcc pin to the 5v
- Gnd to Gnd
- Data pin to the Analog A0
Step 3: Connection From Bluetooth TO Arduino Mega 2560
- RX to TX
- TX to RX
- Vcc to Arduino 5v
- Gnd to Gnd
Step 4:LED To Arduino Mega 2560
- Connect the positive pin in digital pin 5 in Arduino Mega 2560
- Connect the negative pin in the GND to Arduino Mega 2560.
Programming:
- #include<SoftwareSerial.h>
- SoftwareSerial firstSerial(15,16);
- int led = 5;
- int pin=A0;
- int moisture=0;
- String readString;
- void setup()
- {
- Serial.begin(9600);
- firstSerial.begin(9600);
- Serial.begin(9600);
- pinMode(led, OUTPUT);
- delay(100);
- }
-
- void loop()
- {
- while (Serial.available())
- {
- delay(4);
- char c = Serial.read();
- readString += c;
- }
- if (readString.length() > 0)
- {
- Serial.println(readString);
- if (readString == "ON")
- {
- digitalWrite(led, HIGH);
- }
- if (readString == "OFF")
- {
- digitalWrite(led, LOW);
- }
- readString = "";
- }
- int soilmoisture=analogRead(pin);
- if(soilmoisture>=100){
- digitalWrite(led,HIGH);
- firstSerial.println("AT+CMGF=1");
- delay(1000);
- firstSerial.println("AT+CMGS=\"+xxxxxxxxxx\"\r");
- delay(1000);
- firstSerial.println("Hai there I need some water");
- delay(100);
- firstSerial.println((char)23);
- delay(1000);
- }
- else{
- digitalWrite(led,LOW);
- }
- Serial.println(soilmoisture);
- Serial.print("%");
- delay(20);
- }
Explanation:
- I have explained about Automatic Watering System on plants using Arduino Mega 2560.
- It can be used to measure the level of plants in the soil.
- When the plants are in a dry condition it can be used to send the following message to the user, "Hey there! I NEED SOME WATER".
- So it can be used to send water to the plant automatically by Android App.
Read more articles on the Internet of Things: