Introduction: GSM Based Relay Switching Using Arduino UNO

hello friends, Pratik here..

we are going to discuss here how to switch relays over gsm module using and arduino and Gsm 900A.

required Material:

1. Arduino uno

2. Gsm 900A module.

3. 2 Relay module.

4. 12v 1amp or 2amp adapter for Gsm module.

5. Bunch of Point to point connectors.

Step 1: Make the Connections As Given Below.

We are going to use the 5v relays. you can change them to 12v just switch the relay energising coil to 12v insted of 5v while using them.

1. Connect Tx and Rx of gsm module to Rx and Tx of arduino. i.e Tx of Gsm to Rx of arduino and vice a versa.

2. make common ground. i.e connect ground of Gsm module to Arduino.

3. relay 1 to pin 7 and relay 2 to pin 6. vcc of relay to 5v arduino. // connect vcc of relay module to 12v if using 12v relay.

4. You can connect leds to 8 and 9th pin as status indicators of relays if you want they are also listed in code.

be careful while doing the connections. if anything doesn't work please recheck the connections. after connecting everything your assembly may look like it. Remember to upload the code before connecting tx rx to gsm otherwise it will not upload properly.

Step 2: Code:

you can use the following code to operate the relay module over Gsm.

there is a lot of data commented using /* and */. you can choose that date as per your requirements. replace the xxxxxxxxxx with the recievers mob no you want to recieve feedback on.

Step 3: Sending the Messages.

Codes used to control relays are :

1. #a1b1 it will send a logic high to arduino so the relays will be turned on.

2.#a0b0 it will send logic zero to the arduino so the relays will be turned off.

a is for relay 1 and b is for relay 2. these are just variables. you can change them in code as per your requirements.

Step 4: Done.

Now you are Good to go. Assemble the components and enjoy switching the relays.

thank you for taking your time to read the article. please provide a feedback if possible.

Automation Contest 2016

Participated in the
Automation Contest 2016