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
  • Soil moisture sensor is used to measure the volumetric water in the soil.
  • It measures the free soil moisture requiring removing, drying, and weight of a sample.
  • It consists of two pins only.
    Figure2: Soil moisture sensor
Bluetooth Module
  • It can be used to design the transparent wireless serial connection setup.
  • HC-05 module is easy to use Bluetooth SSP.
    Figure 3: Bluetooth Module
Connection:
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:
  1. #include<SoftwareSerial.h>
  2. SoftwareSerial firstSerial(15,16);
  3. int led = 5;
  4. int pin=A0;
  5. int moisture=0;
  6. String readString;
  7. void setup()
  8. {
  9. Serial.begin(9600);
  10. firstSerial.begin(9600);
  11. Serial.begin(9600);
  12. pinMode(led, OUTPUT);
  13. delay(100); // Baud Rate
  14. }
  15. void loop()
  16. {
  17. while (Serial.available()) //Send data only when you receive data
  18. {
  19. delay(4); //delay time
  20. char c = Serial.read();
  21. readString += c;
  22. }
  23. if (readString.length() > 0)
  24. {
  25. Serial.println(readString);
  26. if (readString == "ON")
  27. {
  28. digitalWrite(led, HIGH); // LED ON
  29. }
  30. if (readString == "OFF")
  31. {
  32. digitalWrite(led, LOW); //LED OFF
  33. }
  34. readString = "";
  35. }
  36. int soilmoisture=analogRead(pin);
  37. if(soilmoisture>=100){
  38. digitalWrite(led,HIGH);
  39. firstSerial.println("AT+CMGF=1");
  40. delay(1000);
  41. firstSerial.println("AT+CMGS=\"+xxxxxxxxxx\"\r"); //Enter Your Mobile Number instead XXXX while Testing
  42. delay(1000);
  43. firstSerial.println("Hai there I need some water");
  44. delay(100);
  45. firstSerial.println((char)23);
  46. delay(1000);
  47. }
  48. else{
  49. digitalWrite(led,LOW);
  50. }
  51. Serial.println(soilmoisture);
  52. Serial.print("%");
  53. delay(20);
  54. }
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.
Output:
Figure 4:Output
Read more articles on the Internet of Things: