loading
Picture of SMS controlled Wireless Irrigation System
design.png
GSM_irri_logo.png

UPDATE 02/13/11 : Voting has started for the Sparkfun Microcontroller Contest. Please VOTE for me!

UPDATE 02/26/11 : I won a second prize!! Huzzah! Thanks for all the votes guys!


UPDATE 03/17/11: I would love to win a Laser cutter in the Epilog challenge as it would help the small DIY community in Calcutta,                                     which just started a few months back to cut all their materials using a CNC instead of using their saws etc. 

Irrigating crops with the exactly right amount of water is a tedious task, especially when you have to walk a long distance to the irrigation pump in the middle of the night to check whether any problem (fish getting stuck in the intake and as a result the irrigation motor burning or jamming!)  has occured. As I saw my uncles tired of doing the same, I felt there had to be some remote controlled solution to their problems.

I started to think about a system, which would:

1.  Detect jamming of the motor and immediately shut it down.
2.  Be cost effective.(Less than $150)
3.  Remotely turn on and off the irrigation motor.
4.  Send back a message to the operator, if an error occured.

And thus came the brainstorm to build the "SMS controlled Wireless Irrigation System" . I also wanted to submit this to the Sparkfun Microcontroller Contest , so it was all the more reason for me to go straight to building the prototype.

The prototype could do the following:

1.  Be remotely controlled via SMSs through a cellular GSM network.
2.  Send back ERROR messages to the operator, if the Miniature Circuit Breaker (MCB)  was tripped due to electrical faults or motor jamming.
3.  Control loads of up to 15 amps.

The fruits of my work is detailed in this ible.

P.S I suggest that you read through the entire Instructable before starting.
 

 
Remove these adsRemove these ads by Signing Up

Step 1: Getting the Materials

Picture of Getting the Materials
IMG_2735.JPG
For this project we need various cheap parts and you should be able to get these easily at any local Radio Shack. We only need a few extra parts which you might have to go to another shop. The bill should total at max. $100. You must think I'm joking but I'm not. At India, we get stuff even cheaper - Rs.1000 ($40 approx.) max.

Parts List:

Hardware Parts:

1. 1x cheap/old/used GSM mobile phone with SMS feature(with charger)
2. 1x Activated GSM SIM/micro-SIM card of your preffered provider
3. 1x Miniature Circuit Breakers
4. 1x 120v/240v(choose for your country) 30 Amp Relays
5. 1x Atmega 168/328p or an Arduino (OR any other micro with which you are friendly)
6. 1x 9v Power Supply for the Arduino/Atmega etc.
7. 1x Universal charger if you don't have a phone charger
8. 1x High-Gain external antenna(optional)
9. Wires (240v/120v FIRE-PROOF wires) and some scraps for the circuit-board
10. 2x 240v terminal blocks
11. 4x spade connectors(for the relays)
12. 3x terminal blocks 
13. A enclosure(to encase the electronics) like http://www.pactecenclosures.com/product-detail.php?classid=35&seriesid=38&productid=231

Electronics Parts:

1. 10x 1N4001 diodes
2. 4x 2n2222 transistors
3. 2x TIP31 transistors
4. 3x TIP102 transistors
5. 10x 1K resistors
6. 2x Miniature Push Switches
6. 1x Perfboard (not if you make a PCB)
7. 1x Pack of Misc. LEDs(small size)
8. 5x relays with 5v coil

Tools Needed:


Multimeter
Soldering Iron
Screw Driver
Drill (with drill bits)
Sander ;) see (http://www.instructables.com/id/Recycled-HDD-Rotary-Sander-for-5/)

Step 2: Assembling the Mains Circuit

Picture of Assembling the Mains Circuit
IMG_2711.JPG
IMG_2712.JPG
IMG_2715.JPG
WARNING: This project uses High Voltage AC mains voltage and could cause death or electrical shock, so I am not responsible for any damage you do to yourself or to others around you. Proceed at your own discretion and if you are NOT comfortable doing this part yourself, get it done by a qualified electrician.

This project uses a high voltage relay(30 Amps and 240v)to control the irrigation pump.The mains circuit is housed in a separate enclosure and consists of the Miniature Circuit Breaker, A wall socket and a resettable cartridge fuse (the ones where a button pops out).

You will have to wire up the mains line as shown in the below diagram, basically like this:

Power Plug-------- Electronics controller ------- MCB-------- Wall Socket

After connecting everything up, make sure to route the wires and put the entire setup in a separate junction box with a few ventilation holes drilled in the sides,with the MCB and wall socket showing on top.

Step 3: Making the MCB State-Detection Sensor

Picture of Making the MCB State-Detection Sensor
IMG_2785.JPG
IMG_2786.JPG
The MCB state-detection sensor is basically a custom switch, which detects whether the MCB is in its tripped position or not. Accordingly the Arduino takes the steps to send the error SMS to the pump operator.

It consists of two screws, which are placed in such a way that the switch is closed when the MCB trips. One screw is mounted on the MCB's face plate and the other is mounted on the MCB's plastic switch. The diagram below clearly explains how I did it.

Attach one wire to Analog 2 on the Arduino , the other one to 5v on the Arduino, placing a 1K pullup resistor at the junction and attach the other leg of the resistor to the common GND on the Arduino. Step 5 shows this properly, in the form of a circuit diagram.(2nd  picture)


Step 4: Assembling the Electronics Controller -- Part 1

Picture of Assembling the Electronics Controller -- Part 1
IMG_2624.JPG
IMG_2628.JPG

Part 1 -- The Enclosure:

The most important step in assembling the electronics controller is to get to a suitable enclosure in which all the necessary parts will fit.

I managed to find a very suitable cordless telephone in which all the electronics fitted well. I had it lying about, gathering dust, when I found that the Arduino fitted quite well and a few corners would have to be dremelled off for the other electronics to fit snugly. 

I disassembled the old phone and took out the existing circuit. Keeping this aside for future projects/parts harvesting, I did the first loose fit of the Arduino, finding that the old power ports on the phone were perfectly spaced for the Arduino's interface ports. After mounting the Arduino, I snapped off a few safety tabs on the base, so that the extra electronics fitted. The pictures below well document the step.

If you order an enclosure online, make sure that it is large enough and it uses laser-friendly plastics, so that, you can laser cut the interface ports for the Arduino. Otherwise, it is a pain to open up the enclosure every time you want to update the code.

Step 5: Assembling the Electronics Controller -- Part 2

Picture of Assembling the Electronics Controller -- Part 2
relay_controller_bb.JPG
IMG_2673.JPG
IMG_2695.JPG
Part 2 --240v Relay Controller Circuit

The relay controller circuit deals with the control of the 240v relay and the amplification of the volts from the speaker of the GSM phone. A TIP122 is used to control the relay and and another TIP31 is used for the phones's speakers.A power indicator is also added to show Arduino power on, attached to the 3v pin on the Arduino.This circuit is done on a scrap piece of perf-board, with the transistors surface-mounted.

The TIP 122 is a part of the usual Arduino relay controller circuit, as found in the Arduino learning resources page(http://www.arduino.cc/playground/uploads/Learning/relays.pdf ). 

The snubbing diode is an 1N4004 and the resistor, a 1K one. The relay power source is same as the Arduino power source, 9.6v.The relay has a 12v coil voltage, but 9.6v does the trick.

The TIP 31 controls a LED which lights up when a sound is played through the phone's speaker. This LED flashes into a LDR which is connected to Arduino's Analog pin 0, thus allowing the Arduino to detect when an SMS is received. A pullup resistor is put on the other   leg, one end connected to 5v and the other pin of the resistor connected to common GND.(check the 2nd picture) The same thing is done for the MCB State-detection sensor

I managed to find a nice plastic cover for the LDR-LED combo, harvested from another circuit, something I believe was used in RF comm circuit.The power source for the TIP31 is the Arduino 5v pin.

Circuit Index:

R2, R3 and R4 are 1K resistors
Q1 is a TIP 31 transistor
Q2 is a TIP 122 transistor
K1 is the 240v 30A relay
J1 is the Mains Live wire
J2 is the Phone's vibrator motor connector
J3 is the GND and 5v connector
D1 is a 1N4004 'snubbing diode'
S1 is the MCB State-Detection sensor

Step 6: Assembling the Electronics Controller -- Part 3

Picture of Assembling the Electronics Controller -- Part 3
kpad_controller_bb.JPG
IMG_2659.JPG
IMG_2663.JPG
Part 3 -- Assembling the Keypad Controller

The keypad controller will control the three relays which in turn "press" the buttons on the keypad to send the "ERROR" sms or any other SMS you need to send.

I built it on a scrap piece of perfboard using PCB-friendly (whose pins are meant to be soldered on to circuits) 5v relays.

The circuit diagram below shows the connecting of the parts in order.

Circuit Index:

Q1, Q2 and Q3 are 2N2222 transistors.
D1,D2 and D3 are 1N 4001 snubbing diodes.
R1, R2 and R3 are 1K current limiting resistors.
K1, K2 and K3 are the 5 volt relays.

The base of the transistors are connected to the Arduino's digital pins via 1K resistors to limit the current draw from the pins.

The snubbing diodes prevent any power spikes from the relay coils frying the circuit.

The collectors of the transistors are connected to a common ground shared by the Arduino.

The emmiters are connected to the anode of the diodes as shown in the second circuit diagram below.



 


Step 7: Assembling the Electronics Controller -- Part 4

Part 4 -- Connecting the bits and pieces

Now that we are finished assembling the parts of the circuit, it is time to connect them all up.refer to the provided diagram and do the following things:

1. Attach the  Keypad controller's pin 1,2 and 3 to Arduino digital pins 4,5 and 6 respectively.
2. Attach the relay controller's "relay control" wire to the Arduino digital pin 3.
3. Connect the LDR's wires to GND, 5v and analog 0, as explained in step 5.
4. Connect the wires from the TIP 31 to the phone's vibrator motor terminals. 
5. Attach the Keypad controller's 5v and GND to the respective Arduino pins.
6. Connect the power LED to the 3v and GND.(if additional power LED is attached)
7. Connect the relay controller's 9v and GND to the Arduino's respective pins.
8. Connect the MCB sensor's wires to GND, 5v and analog 2, as explained in step 3.
9. Attach the previously soldered keypad wires to the keypad controller.
10. Connect a 9v power supply to the Arduino and set the power jumpers to "EXT"

Confirm once more with the circuit diagram that everything is attached to the proper pins before continuing.

You may zip-tie everything up once you test that everything is OK.I did not do it, so it looks rather messy, but I plan to do this when I get time.

Step 8: Wiring the Cellphone

This step is different for every mobile phone, but the basics are same.We will attach the two wires from the 240v relay controller to the phones's vibrator motor connections and also connect up the relays from the keypad controller in this step. 

You need to find out whether the mobile has the feature to send draft messages to a saved number, if not you're out of luck and you need to get another mobile. Almost all Nokia mobile phones have this feature, and they are also easy to modify.

The first thing to try with the phone is to find out what are the minimum number of different buttons you have to press to send the drafts message, start to finish. The number of buttons you need are the number of relays you need on the keypad controller circuit.
I needed only two buttons, but still I kept an extra relay on the board, just in case. We will wire the relays switching pins to the keypads buttons so that they can be operated by the Arduino.

Before starting to modify the phone, make sure that you have altered the main menu listing on the phone so that you have to use the least number of buttons on the keypad.Also make shure that the phone is set to "Vibrate Once", on receiving an SMS.

Solder on the connections from the relay pins to the keypad as shown and clearly mark it out (colour coding , etc.) so that connecting to the Arduino is easy.I used some ribbon cable as it looks neat and orderly.

We will remove the vibrator motor and solder the two wires from it to the LED-LDR circuit and reassemble the phone to complete this step. 

The video below shows the booting up process of the Phone after modification


Step 9: Installing the Firmware onto the Arduino

Picture of Installing the Firmware onto the Arduino
The only thing to do in this step is to copy the sketch to your computer and to upload that to the Arduino.

The code is not at all well written, but it does work and I am ALWAYS welcome to sugesstion, bug reports and anything else you wish to tell me about.

You will need to change the SMS_error function to suit your phones menu system. Feel free to PM me for any help.Remember to add another HIGH/LOW combo if you need to press an extra button to wake the phone from standby.

The code is attached below(GSM_irrigation2_0a.pde) and am not going into the details of uploading a sketch to the Arduino as there are many tutorials on the net teaching you to do the same.

I suggest you learn a bit more about Arduino coding, if you don't know how to upload a sketch, before starting this project.

Step 10: Changing your Phone's Settings

Picture of Changing your Phone's Settings
vodafone.jpg
You need to change the settings on the phone and change some with your SIM card provider so that no junk SMSs are received. I used a new SIM card, I did not disclose the number to anyone and I suggest you do the same to avoid unwanted calls/SMSs

The first step would be to register yourself on the operator's DND(Do Not Disturb) list for calls and SMSs. That would prevent any telemarketing calls from making your system go bonkers!

Then set the following settings on your phone:

1. Set the "Vibrate Once" alert type for SMS received.
2. Change the main menu order so that the SMS menu is on top of the list.(optional)
3. Delete all SIM card (NOT phone) contacts and keep only one number saved under any name.(Phone number of the person who will receive the "error" SMS)

Step 11: Finish it all up

Picture of Finish it all up
IMG_2672.JPG
IMG_2679.JPG
IMG_2715.JPG
IMG_2731.JPG
IMG_2806.JPG
The last step is to connect the electronics controller to the mains controller.

We will cut and attach the Mains wire from the plug to to the relay using 2 Spade connectors and the  other connector will go to the Mains circuit box while the Neutral and Ground wires are routed via the electronics enclosure to the Mains circuit box

Solder everything,screw everything into place, give a final check, close the top of the enclosure and we are done!!!!

Step 12: Testing!!

Picture of Testing!!
IMG_2796.JPG
IMG_2800.JPG
Well we're done constructing it and now comes the exciting part.

Switching ON and OFF:

Attach the 9v connector to the Arduino,attach the power plug to the mains socket and switch 'er ON!!

 If nothing happens???? >> Go to the last step

But if everything powers on OK and you see the little green Power LED >> Huzzah!!

Connect a load (I used an aquarium air pump just for the sake of variety) to the Mains's circuit's socket, set the MCB to 'ON' position and then insert the SIM card into the phone and power it up. Connect its charger to a wall socket too.

Send a SMS to the phone number and if the LED flashes on receiving the SMS, and the relay is switched on by the Arduino, we are DONEEEEEEEE!

You need to connect the irrigation pump to the wall socket on the MCB box to control it. Any other appliance can be SMS controlled via this socket.

Test Video:



Sending the Error SMS:

Trip the MCB by hand to see the little relays clicking,controlled with the Arduino.The phone should display an SMS being sent to the pre-saved number.The "kat" sound at the beginning of the video is the MCB getting tripped and we can clearly see "Message Sent"

Oh YEAH!!!! *!celebrates!*

Test Video: 

Step 13: Troubleshooting

Picture of Troubleshooting
If nothing happens when you power the system up, see that:

1. The Arduino power jumper is set to "EXT" or external power.
2. The power adapter you use is not faulty.
3. The Arduino is not faulty.

If the Arduino powers on and the code isn't executed, check that:

1. You have uploaded the code properly, if not, reinstall the code.
2. Your Arduino is not faulty.
3. The USB cable is not faulty.
4. All connections are connected properly. ( check step 7)

If still your problem is not solved, PM me for help.

Step 14: Future Improvements

Picture of Future Improvements

This project has enormous potential and may be used in various other ways, due to its cheap and cost efficient design.

I admit it is not a very very well designed system, and rather a proof-of concept design, and the system could be spammed and be turned on/off.

I am working on some Java authentication software to recieve only SMSs from a particular number. Any help will be appreciated and recognised!

Few improvements would be:

1. Use it as a home automation controller, by adding a few more 240 volt relays.
2. Remotely perform jobs.
3. Use it in conjunction with a solar panel, so that the entire system is eco-friendly.
4. Use a float switch in a tank, so that the system automatically shuts the pump down, once the reservoir is full.

Ideas by other Members:

To detect the MCB trip, use an opto isolator to measure the voltage across the motor - steveastrouk

A proper circuit diagram as well as a photo diagram, for those that can read them - steveastrouk

Managing feed and water levels for livestock, detecting flooding, managing wind turbines, reporting intrusion, remotely opening and closing gates to allow stock to move between pastures or return to barn, or remote monitoring of aquaculture/aquaponics systems. - bobsegravescollis

More IDEAS ???? COMING SOON?


If you have any more ideas, write them in the 'Comments' and I will add them with your name recognized.

Picture Courtesy of www.prlog.org

1-40 of 52Next »
Hi Kabir,

Some constructive comments for your project:

1.) A proper circuit diagram as well as a photo diagram, for those that can read them.

2.) When wiring a plug top, make SURE that the Earth wire is LONGER than the others, so the last wire to snap, if you jerk it is always the Earth.

3.) TO detect the MCB trip, use an opto isolator to measure the voltage across the motor. If you want to know how, ask me. Its still a pretty cheap solution, but definitely more reliable in the field.

4.) You can reliably detect the phone ring, without opening it by using the earphone and a simple detector circuit.

5.) Sony-Ericsson phones for sure (don't know about Nokia) put out logic-level serial comms on their "USB" connections depending on what's connected to them - so you could talk directly to the phone, if you want for future credits.....

mhkabir (author)  steveastrouk4 years ago
I'll contact you after my exams(going on presently).

As for the proper circuit diagram, I din't manage time to upload one. I will upload it after my exams are over.

hi kabir.. can U send me your program and circuit digram on my mail..

actually I am facing some problem, when eorking for gsm and interrupt ...its urgent kindly help me........

my e mail id is ppritam10@gmail.com

Very impressive. The whole area of remote agriculture management is ripe for applications of GSM technology. Your thought of adding detection of water level to turn off the pump is really vital in that too much water can be as bad as too little, depending on the crop. Other applications would be managing feed and water levels for livestock, detecting flooding, managing wind turbines, reporting intrusion, remotely opening and closing gates to allow stock to move between pastures or return to barn, or remote monitoring of aquaculture/aquaponics systems.

Would it be possible to have all messages received by the remote device also sent to the operator's cell phone? In that way the operator would be alerted in case someone attempts to hack into the system. It might also be possible to use custom identification like unique rings for messages from the operator and ignore all others.
mhkabir (author)  bobsegravescollis4 years ago
Yes it would be possible to FORWARD the recieved messages to the operators telephone.

Nice ideas. Added them to the last step.

PM me if you need any more help/instrutions.
neha1912 days ago

Nice project idea, nearly what is the cost of this project.

AshokK124 months ago
naveennaveen8 months ago

hi,brother i like your project very much and i need your help ,can you send me a neat circuit diagram and program and if you have full video of this project please send it to my mail id:naveen1430@gmail.com. if you are updated this project with your ideas please send it to me.bye

saurabhN18 months ago

hi kabir con you mail me the program without the mcb circuit part

bheemsingh1 year ago

Hiiiii kabir.. can U plzz send me your program and circuit digram on my mail..
Your project is very interesting,,i want to make this for my family people....plz do help

nishant.panwar18@gmail.com

hi brother .Can you please send me a neat circuit diagram and program.

my email id is aqib.mehmood96@yahoo.com

hi brother .Can you please send me a neat circuit diagram and program.

my email id is aqib.mehmood96@yahoo.com

hi brother .Can you please send me a neat circuit diagram and program.

my email id is aqib.mehmood96@yahoo.com

aditya9851 year ago
Tell me about connections of tip 122
aditya9851 year ago
Is the ldr led circuit write because a single terminal of ldr
is connected to 5v and Gnd both

hi kabir ,i m also doing this project as my final year project .so plz give me full ckt diagram to my emai id:- ashwinvasudevan.c@gmail.com . please give me as soon as possible. Will be waiting for ur reply. thank you

please tell me the phone from which you have extracted the circuit
how can u program if it is a password protected thing
huseenia3 years ago
hello, i was impressed by your work, thanks, by the way i am currently doing my final year project , with same topic, but i am using arduino and wavecom GSM modem controlling stepper motor output with sensor input(high or low),
so i was thinking if u could e-mail me the code, so will try to learn and my project too. pls reply soon
thanks
very nice project. your method is a solution to the expensive gsm modems. it would be nice though to have a company to produce mobile phones which comunicates with uc. keep up the good work
mhkabir (author)  chelloo_parazit4 years ago
Actually some Sony Erricson phones can be operated by TTL level serial commands,

The older ones, most notably the 168i, could be operated via its headphone jack using simple AT commands.

Lets hope it is possible in modern phones.

Kabir
I executed AT commands on SE K510 and K750 phones. You can read, send, delete sms. Phone will notify you when it gets sms message. You only have to make on arduino programmable decoder of PDU message format . Then you get what number sent message and what command was there.
PoisonMondo4 years ago
i have ythe exact same phone and i am finding it impossible to open
mhkabir (author)  PoisonMondo4 years ago
Mine is held by clips on the inside.

It helps to have a prying tool. I hade to use some force before i could open the clips.

A good place to start prying is the battery charging port on the side.

Hope you are making one of these!
Kabir
Thanks, and im making one but using for a different purpose, as kind of a home automation controller
I have the same phone 2, but it has screws and no clips, but my jewlers screwdriver set cant open it :(
jashan5103 years ago
these are just 1A relays are the good enough to control the irrigation pumps?
hi kabir ,i m also doing this project as my final year project .so plz give me full ckt diagram my emai id:-pratik_patel_77@yahoo.co.in
francisroan3 years ago
amazing man im also 13 so were did u get the idea frm did u saw how to make it frm some websites???or u designed ur own ciruit???? and how did u bcome a pro member here???? u paid???
mhkabir (author)  francisroan3 years ago
For any question not related to the instructable PLS PM me. dont post it on the comment board.I designed the circuit myself as i said b4
francisroan3 years ago
hey i see that ur frm india me too, how old ae u ???? just amazed to see!!!and who helped u with the circuits????
mhkabir (author)  francisroan3 years ago
i am 13 and no one helped me with the circuits.
hi this one is a briiliant idea. n being a final engineering student m trying for the same as my project so could you please help me out?
menardmitch4 years ago
u gave use ur number in the one video!
Really beautiful work Kabir. A model Instructable.

Well done.

Steve
mhkabir (author)  steveastrouk4 years ago
Thanks! Please Vote !
BeefyHaze4 years ago
It is still a bad idea, because your provider will still send a monthly update text regardless of you being on the DND list.... I suggest you use a Linux netbook hooked up instead of a phone, it would have far more security and functionality. ex.: time control, on, off, you can even use ssh to connect to it.....
mhkabir (author)  BeefyHaze4 years ago
The aim of the system is to be cost-efffective. I will design the V2 the system with these modifications.
draraman4 years ago
Well done.
It will be very useful to rural India if you can find a sponsor to make it and market it at an affordable price.
congratulations.
mhkabir (author)  draraman4 years ago
My design is based on rural India. I am based in West Bengal.The pictureis from our own farmlands.
1-40 of 52Next »