Anda di halaman 1dari 4

Always power up the gsm module with separate power supply 12v 1 A .

And insert
the SIM.
GSM module
RX and TX of gsm module to TX pin0 and RX pin1 of Arduino respectively.
Cross connection. rx to tx and tx to rx.Gnd of gsm module to arduino gnd.
Relay
relay1 to pin 7 and relay 2 to pin 6.
vcc of relay to 5v arduino.
gnd to gnd arduino
We are using Normally open connection in relay. so that we can trigger on and off
the light . Hot line from supply is connected to COM
Supply line to the Ac light/fan is connected to NO. Gnd or - or other terminal in
light/fan is connected directly.
Led's
Led 1 to pin 8 (fan status indicator)
Led 2 to pin 9 (light status indicator)

Step 3: Wiring
#a1b1
a1 turns on the fan.(relay 1)
b1 turns on the light.(relay 2)
#a0b0
a0 turns off the fan.
b0 turns off the light.
Green led indicates fan is ON
Orange led indicates light is ON
Both leds goes low when #a0b0 is sent.
Step 4: Basic AT Command
1. To change sms sending mode : AT+CMGF=1

mySerial.println("AT+CMGF=1");

2. To read SMS in text mode : AT+CNMI=2,2,0,0,0

mySerial.println("AT+CNMI=2,2,0,0,0");

3. To make a call : ATD+60XXXXXXXXX; //replace X with number you


want to call, change +60 to your country code

mySerial.println("ATD+60XXXXXXXXX;");

4. To disconnect / hangup call : ATH

mySerial.println("ATH");

5. To redial : ATDL

mySerial.println("ATDL");

6. To receive a phone call : ATA

mySerial.println("ATA");

gsm 3

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.

Anda mungkin juga menyukai