Using GSM Mobile Phone to Switch Appliances

Published

Introduction: Using GSM Mobile Phone to Switch Appliances

INTRODUCTION :

There is no proper article or instructable available which details you every step used to build up a GSM enabled switch to control your home appliances . Thus this instructable demonstrates a way to control your home appliances using your mobile phone. Since the mobile phone uses GSM service so it is called a GSM enabled switch.

THINGS REQUIRED :

1. Arduino UNO

2. SIM 900 GSM Cellular Shield For Arduino

http://tronixlabs.com/retired/sim900-gsm-cellular-...

3. 4 channel Relay Module

4. Jumper Wires

5. Cell phone

6. Sim Card

Step 1: Interfacing the 4 Channel Relay Module

Relay Module:

A relay is an electrically operated switch.
Relay breakout module is a smart choice for controlling higher current loads from your microcontroller development board, PC parallel port or Arduino. The relays are driven by popular darlington array ULN2803A . This darlington transistor provide sufficient output to be driven by the arduino digital output.

Connect the V pin to 5V and the GND pin to the corresponding GND of the Arduino. The darlington IC pins are marked 1-n (n here is the number of relay the darlington IC is driving) connect them to the digital output pins of arduino The relay have three terminals N/O(NORMALLY OPEN) , N/C(NORMALLY CLOSED), COM.

One of the AC terminals which is conventionally connected to a manual switch is connected to the COM terminal and the other is connected to the N/O terminal.The pins marked IN1,IN2....IN8 are used for driving the corresponding relay ,connect these to the digital output pins of the arduino.

Step 2: Interfacing the SIM900 GSM Cellular Module for Arduino

PRECAUTIONS:

1. Power: The Linksprite shield we use needs 5V up to 2A into the onboard DC socket.

2. Antenna. If your module does not have an antenna – get one.

3. SIM: Turn off the PIN lock on the SIM card. The easiest way to do this is to put the SIM in a handset and use the menu function.

SERIAL :

We will use the Arduino software serial library and the Linksprite shield has hard-wired the serial from the SIM900 to a set of jumpers, and uses a default speed of 19200. jumpers are to be set to the “SWserial” side.

And thus whenever an instance of SoftwareSerial is created, we use 7,8 as shown below:

SoftwareSerial SIM900(7, 8); // RX, TX

TESTING CONNECTION:

1. Insert the SIM and lock the SIM card to the carrier on the bottom of the shield as shown in the figure.

2. Then plug the shield into your Uno, attach 5V power to the DC socked on the GSM shield, and USB from the Uno to the PC.

3. Press the “PWRKEY” button on the side of the shield for a second.

4. The bright “STATUS” LED will be on, and then the “NETLIGHT” LED will blink once every 800 milliseconds- until the GSM module has found the network, at which point it will blink once every three seconds.

Step 3: Software

EXPLAINATION :

The first command to use is AT+CMGF=1 which sets the SMS mode to text (as used in the previous example)

The second is AT+CNMI=2,2,0,0 – which tells the GSM module to send the contents of any new SMS out to the serial line.

The program works in two stages.

First it will wait for an SMS to be received, and then have the contents sent to the Arduino via serial .

The next stage is to filter out the commands in the text message
The commands (that is, the contents of your text message to the Arduino) will be in the form #ON1 or #OFF1 where ‘ON’ will be switching on the bulb 1, 2, 3 and 4 will relate to digital pins 7, 8, 12 and 13. For example, to turn on D7, you would compose your SMS as #ON1.

After processing the SMS we use the AT command AT+CMGD=1,4 to delete all the SMSs from the SIM card, otherwise it will fill up and reject further commands.

When D7,D8.. are HIGH it switches on the corresponding relay to complete the circuit and hence the bulb is on.

Share

Recommendations

  • Woodworking Contest

    Woodworking Contest
  • Casting Contest

    Casting Contest
  • Oil Contest

    Oil Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

31 Comments

Hey, help me understand, how can i interface a motion sensor, to send signal to the microcontroller and to the GSM. And from the GSM the message/call will be send to my phone, and the command from the phone to turn motor on?

hello can you assists, i am doing the same project you are you doing and i tried your code but my relays stay on and dont switch on when i sent SMS.

1 reply

the sketch/software or the on board code so that i can upload

please i need the sketch

Not working..

after uploading code relays are automatically on and sms commands not working.

I'm planning to do a home automation project

how can i interface 5V 4 Channel relay and a sim 900 module (without power supply) to arduino uno which has only one 5V pin and one 3.3 V ?

_I'm new to arduino

Thanks friends.

I have also desin as per your.

Junior Design Engineer

www.nrdcentre.com

Awesome job bro!! keep up the good work, I will make sure I will do
your project. I have some question if I may ask. How to control all the
four relays separately through a phone call or/and SMS? How can I set
relay one to go one for one seconds only, and relay four to stay on for 3
seconds. Can I have it code protected so in case someone calls the
numbers none of the relays would trigger? Thank you once again. Yazen

hi,thanks for the wonderful project..i have ordered for the relay that you have provided in the link..it actually consists of 9 pinouts......

in1,in2.........in8 and a com pin..

how should i connect it to arduino..

Awsome project...will u help me with documentation....plz

Awsome project...will u help me with documentation....plz

sir code please

Hi, I'm interested in doing the same kind of thing, but with a pump and a reservoir. As is illustrated in the image. The only thing is the pump is about 500m from the reservoir. I wish to have a GSM unit at the pump and a GSM unit at the reservoir. Is it possible for the Arduino boards to communicate with each other so no input from a mobile phone is requiered?

FAZYN6QHWX48WYY.LARGE.jpg

Sir can u please upload the code

Great job. Pls tell me about where pin9 could connect to power up. Do D7 connect to rx and D8 connect to tx of arduino?

Nice Project! How would I have to change the code to only allow commands from certain phone numbers? Can you tell me where to connect PIN 9 from the Arduino on the GSM board to power it on? Thanks a lot!

Well done Himshekhar.das. This project sounds really interesting. I want to try it. Kindly assist with more detail on the Relay module.