GSM Based Motor Pump Controller using Arduino

DIY – GSM Based Motor Pump Controller

The GSM pump motor controller circuit which could turn on and off the irrigation system remotely from anywhere in the world via cellphone SMS and return you with an acknowledgement message.

Most of the agriculturist’s crop field is situated far from their residence, just turning on the water pump costs huge for their transportation per year.

This SMS based GSM pump motor controller takes a baby step towards agricultural development, this may not be a revolutionary project but, it may bring delight among agriculturists.

The project is designed with minimal hardware components so that a beginner can accomplish it with ease.
The circuit consists of power supply, which powers the whole setup.

The Arduino is the brain of the project which take decisions and GSM modem which sends and receives text SMS and communicate with the user and relay which controls the motor.

How it Works:

Note: Please use at least 10K resistor at the base of the BC548 transistor, 330 Ohms is too low.

The transformer step down the 230VAC to 12V AC and bridge rectifier convert AC onto DC current and the current passes through an electrolytic capacitor to smooth the power supply.

A fixed 12V voltage regulator gives power to arduino, GSM modem and relay. The GSM modem is connected to arduino at pin #0 and pin #1, which are RX and TX respectively.

The RX of GSM is connected to TX of arduino and TX of GSM is connected to RX of arduino. If you are confused, just look at the below diagram, misconnection will not send or receive SMS.

ARDUINO    TX————–RX
GSM               RX————-TX

Ground to ground connection is also established between arduino and GSM modem.

The transistor drives the relay and the diode protects the circuit from high voltage spikes while switching the relay ON/OFF.

The LED indicator shows the status of the relay. If the LED glows the relay activated and if the LED is off, the relay is deactivated.

Insert a valid SIM on the GSM modem and try to take advantage of the offers availed by the network provider for SMS such as rate cutters, which will reduce the expenses for SMS.

Program Code:

#include <LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);
#include <SoftwareSerial.h>
SoftwareSerial SIM900(9,8);
String textMessage;
String message, motorState;

const int motor = 10;

 void setup() 
 {
  pinMode(motor, OUTPUT);

  Serial.begin(19200);
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("system is on");
  delay(1500);

  SIM900.begin(19200); 
  delay(3000);
  Serial.print("SIM900 is ready to send receive sms");   
  SIM900.print("AT+CMGF=1\r");   
  delay(100);
  SIM900.print("AT+CNMI=2,2,0,0,0\r"); 
  delay(100);
    
  SIM900.println("AT+CMGF=1");
  delay(1000);
  SIM900.println("AT+CMGS= \"+91*********7\"\r"); // Replace * with mobile number
  delay(1000);
  SIM900.println("System is On");
  delay(100);
  SIM900.println((char)26);
  lcd.clear();
}

void loop() 
{

   if(SIM900.available()>0)
   {
   textMessage = SIM900.readString();
   Serial.print(textMessage);    
   delay(10);   
   }
   if(textMessage.indexOf("motor on")>=0)
   {
    lcd.clear();
    digitalWrite(motor, HIGH);
    motorState = "on";
    Serial.println("motor set to ON");  
    textMessage = "ON";
    lcd.setCursor(0, 1 );
    lcd.print("motor on");
    delay(1000);      
  }
  if(textMessage.indexOf("motor off")>=0)
  {
 
    digitalWrite(motor, LOW);
    motorState = "off";
    Serial.println("motor set to OFF");
    textMessage = "OFF";
  } 
    if(textMessage.indexOf("state motor")>=0)
    {
    String message = "motor1 is " + motorState;
    Serial.println("motor1 state resquest");
    textMessage = "";
  } 
}    

NOTE 1: Please remove TX and RX connection from arduino while uploading the code.

NOTE 2: Replace “xxxxxxxxxxxxx” with recipient’s phone number in 4 places in the program.

How to use the above setup:

• Send /motor on/ SMS from your cellphone to activate the relay.

• Send /motor off/ SMS to deactivate the relay.

• Send /test/ SMS for testing the response from the circuit. Make sure you start the command with”/” and end with “/” otherwise it won’t accept as valid request.

• /motor on/ will turn ON the relay and return with an acknowledgement SMS “Motor Activated.”

• /motor off/ will turn off the relay and return with an acknowledgement SMS “Motor Deactivated.”

• If you send /test/ it will return with an acknowledgement SMS “The System is Working Fine.”

• The above message signifies that your setup is working fine.

• If no acknowledgement is returned to you can assume that no action is preceded on the motor and you may troubleshoot the problems.

• After powering the setup ON wait for 1 minute the system will send an acknowledgement SMS “System is ready to accept commands.” once you receive this SMS your project is ready to serve.

Subramanian
Subramanian

Subramanian MK, currently serving as a workshop instructor at Sakthi Polytechnic College, Erode Tamil Nadu. With a career spanning 25 + years, Subramanian MK has dedicated himself to advancing knowledge in Electronics and Communication Engineering (ECE). His passion for exploring new technologies has led to the development of numerous projects, showcasing expertise in IoT and PCB design.

Articles: 514

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.