2016-11-18

In this post we are going to construct a farmer friendly GSM pump motor controller circuit which could turn on and off the irrigation system remotely from anywhere in the world via SMS and return you with an acknowledgement message. The idea was requested by Mr. PG Ragavandir.

By: Girish Radhakrishnan

The Request

Dear Sir,

Greeting for the day, sir I'm looking for a circuit which Pump Motor get 'ON' & 'OFF'by using Remote or by mobile message for around 10 Km surrounding, it will be used for Farmers for there land (which they can be bit tension free). if possible can you help me for supporting them please.

Thanks & Best Regards
PG Ragavandir

The Design

Agriculture is one of biggest industry in India which serves food for more than a billion people every year. Producing vast amount of food is never an easy task; irrigation is one of the factor.

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.

India is known for IT skills and space programs and reached mars less than cost of movie “Gravity”, this signify the great potential among Engineers and Scientists. But, the skills are not uniformly distributed across different fields; agriculture is one of the field where technological development is slow.

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

Let’s dive into technical part of the project.

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.

The Circuit:



The transformer step down the 230VAC to 12VAC 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 modem
RX----------------------TX

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

Try to get a male jack power connector for the GSM and arduino, if not just solder the wires directly from power supply to arduino and GSM, which might increase the mess in the project.

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:

//----------------Program developed by R.Girish------------//
int LED = 8;
int motor = 9;
int temp=0;
int i=0;
char str[15];
void setup()
{
Serial.begin(9600);
pinMode(motor,OUTPUT);
pinMode(LED,OUTPUT);
digitalWrite(motor,LOW);
digitalWrite(LED,LOW);
delay(20000);
delay(20000);
delay(20000);
Serial.println("AT+CNMI=2,2,0,0,0");
delay(1000);
Serial.println("AT+CMGF=1");
delay(500);
Serial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
Serial.println("System is ready to receive commands.");// The SMS text you want to send
delay(100);
Serial.println((char)26); // ASCII code of CTRL+Z
delay(1000);
}
void loop()
{
if(temp==1)
{
check();
temp=0;
i=0;
delay(1000);
}
}
void serialEvent()
{
while(Serial.available())
{
if(Serial.find("/"))
{
delay(1000);
while (Serial.available())
{
char inChar=Serial.read();
str[i++]=inChar;
if(inChar=='/')
{
temp=1;
return;
}
}
}
}
}
void check()
{
if(!(strncmp(str,"motor on",8)))
{
digitalWrite(motor,HIGH);
digitalWrite(LED,HIGH);
delay(1000);
Serial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
Serial.println("Motor Activated");// The SMS text you want to send
delay(100);
Serial.println((char)26); // ASCII code of CTRL+Z
delay(1000);
}
else if(!(strncmp(str,"motor off",9)))
{
digitalWrite(motor,LOW);
digitalWrite(LED,LOW);
delay(1000);
Serial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
Serial.println("Motor deactivated");// The SMS text you want to send
delay(100);
Serial.println((char)26); // ASCII code of CTRL+Z
delay(1000);
}
else if(!(strncmp(str,"test",4)))
{
Serial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
Serial.println("The System is Working Fine.");// The SMS text you want to send
delay(100);
Serial.println((char)26); // ASCII code of CTRL+Z
delay(1000);
}
}
//----------------Program developed by R.Girish------------//

NOTE 1: While compiling the program it shows a warning, which you can ignore it. The program is verified and tested.

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

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

NOTE 4: Please purchase a GSM modem without power button in the module; in case of power failure it won’t latch in into mobile network unless you manually press the button, so avoid such type of GSM modems. The GSM modem one without power button will latch into mobile network directly after power retains.

Author’s Prototype of GSM Pump Motor Controller Circuit:



How to use the above setup:

•    Use /motor on/ to activate the relay.

•    Use /motor off/ to deactivate the relay.

•    Use /test/ for testing the response from the circuit.

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.

The above commands are fool proof and never trigger the motor falsely, the setup will not respond any SMS other than the above specified commends.

Show more