In this project, the home appliances
are controlled with the help of a cell phone. The system uses sms facility to
give the commands and receive the status from the receiver. The mobile user
sends a secret code with control data.
In the receiver section, GSM modem receives the commands and sends the
signal to the microcontroller. The microcontroller verifies the secret code and
performs the command functions. The controller also triggers the relay circuit
through the relay drivers. The relay drivers in turn control the load. The
status is send back to the mobile user. This project finds its application in
Automation of various fields. It is used as a Remote control for various
applications such as Home automation, Industrial automation, security system, agricultural
field and many other applications.
Microcontroller
Microcontroller used is Atmega-16 by
AVR. It is 40-pin IC with 16K flash memory. It has 4 ports that can be used as
I/O. By interfacing it with MAX-232 it can be used for serial communication. It
also has ISP facility. It works on 0-16MHz external oscillator.
Relay Drive Unit
Relays are used to drive appliances
.Relay drive unit consists of Transistors which are used for current boosting
.The input to transistor is fed from Microcontroller output port. The diode
across relay acts as freewheeling diode which is used for protection.
GSM Modem
WISMO
Quik Q24x6 is a self-contained E-GSM/GPRS 900/1800 or 850/1900 bi-band module
including the following features
• 58.4 x 32.2 x 3.9 mm
• 2 Watts EGSM 900/GSM 850 radio
section running under 3.6 Volts
• 1 Watt GSM1800/1900 radio section
running under 3.6 Volts
• Digital section running under 2.8
Volts
• 3V SIM interface
• Real Time Clock with calendar
• Battery charger
• Echo Cancellation + noise reduction
• Full GSM or GSM/GPRS software stack
• Hardware GPRS class 10 capable
• Complete shielding
• Complete interfacing
Power supply
Serial link
Audio
SIM card
Keyboard
LCD (not available with AT commands)
WISMO Quik Q24x6 Series has two
external connections
• RF connection pads (to the antenna)
• General Purpose Connector (GPC) to
Digital, Keyboard, Audio and Supply
WISMO Quik Q24x6 Series is designed to
fit in very small terminals and only. Some custom functions have to be added to
make a complete bi-band solution
• Keypad and LCD module
• Earpiece and Microphone
• Base connector
• Battery
• Antenna switch
• SIM connector
Power Supply
The power supply consists of
transformer for stepping down the voltage, rectifier, filter and regulator to
obtain DC voltage. The transformer used is 18V/1A. The filter o/p is connected
to regulator circuit of 5V & 12V.
Circuit Specifications
AVR Atmega-16 board, Power supply,
relay drive, appliances
1. 230/18V,
1A Transformer
2. Rectifier,
Filter & Regulator 5V & 12V
3. Atmega-16
board with ISP and Serial port
4. Relay
drive circuit with appliances connected
Software used
·
Codevision
AVR
·
Brays
terminal
·
Pony
prog
·
Eagle
5.1
ALGORITHM
1. Initialize
the modem by sending AT and ATE0 commands. Wait for the modem to respond with
OK.
2. Select
the preferred mode of sms and the preferred memory by sending AT+CMGF and
AT+CPMS. Wait for the modem to respond with OK,
3. Wait
for a new message to be received. The modem sends a message +CNMI on arrival of
new message.
4. Parse
the received message to extract the actual contents of message.
5. Compare
the received message with pre-defined statements in the microcontroller memory
to identify the action to be taken,
6. The
appropriate pin of the controller is set or reset depending on the message
received.
7. Send
a message to the user of the action taken.
8. If
the message demands the status of relays connected then read all the pins
connected to relays and send message regarding the status of each relay
connected.
9. After
appropriate action has been taken delete the message from the selected memory
location.
10. Wait
for the arrival any new messages and continue the process.
AT-Command set
The following section describes the
AT-Command set. The commands can be tried out by connecting a GSM modem to one
of the PC’s COM ports. Type in the test- command, adding CR + LF (Carriage
return + Line feed = \r\n) before executing.
AT-Command set overview
Command Description
AT
ATE0
AT+CNMI
AT+CPMS
AT+CMGF
AT+CMGR
AT+CMGS
AT+CMGD Check if serial interface and GSM modem is working
Turn echo off, less traffic on serial
line.
Display of new incoming SMS
Selection of SMS memory
SMS string format, how they are
compressed
Read new message from a given memory
location
Send message to a given recipient.
Delete message.
• Character string in quotation marks
is the actual text sent to modem.
• Optional commands and response
parameters are enclosed in brackets.
1. Status (AT)
The “AT” command is a status request
used for testing if a compatible modem isconnected and that the serial
interface is working properly.
AT command and possible responses
Command Response Comment
“AT”
“OK”
“ERROR” Connected and working
Serial line OK, modem error
2. Echo off (ATE0)
The “ATE0” command is used to config
the communication. By default, GSM modems
are set to echo any received command back with an acknowledgement. An
example of this is shown below.
AT\r\n //Command sent to modem
AT\r\nOK\r\n //Response from modem with echo enabled
After sending “AT”, the modem replies
with “AT\r\rOK\r\n”. With echo off, “ATE0”, the
modem would have answered “\r\nOK\r\n”
when executing “AT”.
The echo off command will reduce
traffic on the serial line. The “ATE1” command will
enable echo again.
ATE0 command and possible responses
Command Response Comment
“ATE0”
“OK”
“ERROR” Echo off
Could not turn echo off
3. New Message Indication (AT+CNMI)
“AT+CNMI” configures how the modem
signals arrival of new messages to the connected terminal device and how they
are stored in the modem. This feature is useful when it comes to reading new
messages. Instead of polling the modem periodically for arrival of new
messages, “AT+CNMI” can tell when a new message has arrived. The AVR will catch
such indication, and set a flag. This ensures that the modem only takes up CPU
resources when necessary.
AT+CNMI command and possible responses
Command Response Comment
“AT+CNMI"= [mode], [mt], [bm], [ds],
[bfr] ”OK”
”ERROR” Mode
set
Error, could not set such mode
1.
[mode] integer type: how messages are buffered.
2.
[mt] integer type: indication of new SMS, set to 1.
3.
[bm] integer type: Not in use.
4.
[ds] integer type: Not in use.
5.
[bfr] integer type: Not in use.
What values “[mode]”, “[mf]”, “[bm]”, “[ds]”
and “[bfr]” could take will be different from modem to modem. This should be
tested off line with modem connected to the PC.
An example is given below:
AT+CNMI=?\r\n //Possible value request
+CNMI: (0,1),(0,1),(0,2),(0,2),(1) //Possible parameter values
OK //Command executed OK
4. Preferred Message Storage (AT+CPMS)
The “AT+CPMS” command sets the target
memory location for storing sent, read, deleted and received SMS messages. Most
modems have multiple storage types:
• “SM”: SIM card memory.
• “ME”: Mobile Equipment storage.
Dedicated storage within the modem for text messages only.
• “MT”: Collection of all storage
connected to the modem: SM, ME or others. The phone will choose one appropriate
if this option is enabled.
AT+CPMS command and possible responses
Command Response Comment
“AT+CPMS"= [M1], [M2], [M3] “+CPMS:
[used1], [total1], [used2],
[total2], [used3], [total3]
“+CMS ERROR” Memory
configured
OK
Error
1.
[M1] string type: Memory from which messages are read and deleted.
2.
[M2] string type: Memory to which messages are written and sent.
3. [M3] string type: Memory in which
received messages are stored, if forwarding to pc is not set.
4. [used] integer type: is number of
messages currently in x.
5. [total] integer type: is total
number of message locations in x.
5. Message format (AT+CMGF)
The “AT+CMGF” command is used to set
input and output format of SMS messages.
Two modes are available:
• PDU mode: reading and sending SMS is
done in a special encoded format.
• Text mode: reading and sending SMS
is done in plain text.
This compressed format saves message payload
and is default on most modems. PDU mode is implemented in the source code for
this application note, it is possible to use text mode to reduce code footprint
if the connected modem supports this. In text mode header fields as sender
address, message length, validation period etc. can be read out in plain text
together with the sent message.
AT+CMGF command and possible responses
Command Response Comment
“AT+CMGF= [mode]" ”OK”
“ERROR” Mode selected
Error
[mode] integer type: 0 is PDU mode, 1
is text mode.
Read Message (AT+CMGR)
The “AT+CMGR” command is used to read
a message from a given memory location. Execution of “AT+CMGR” returns a
message at [index] from selected memory [M1]. The status of the message and the
entire compressed message (PDU) is returned. To get any useful information out
of the compressed message it should be decompressed.
AT+CMGR command and possible responses
Command Response Comment
“AT+CMGR=[index]”
“+CMGR: [stat], [alpha]
[length] \r\n [pdu] “
“+CMS ERROR” Message read OK
Error, No such index
1. [index] integer type: Read message
from location [index].
2. [stat]: integer type: Status of
message in memory: READ, UNREAD, SENT and UNSENT.
3.
[alpha] integer type: Manufacturer specific field. Not used.
4.
[length] integer type: Length of compressed message.
5.
[pdu] string type: Compressed message.
7. Send Message (AT+CMGS)
This command enables the user to send
SMS messages. How to include user defined text and recipient telephone number.
After the user defined fields are set, the message can be compressed and sent
using the “AT+CMGS” command. .
AT+CMGS command and possible responses
Command Response Comment
“AT+CMGS=[length]CR
[pdu]ctrl-Z”
“OK”
“+CMS ERROR” Message sent
Command error
[length] integer type: Length of message.
CR = Carriage return
[pdu] string type: Compressed message
Ctrl-Z: Command terminator. ASCII
character 26 (dec)
Delete Message (AT+CMGD)
This command is used to delete a
received stored message from [M1] .
.AT+CMGD command and possible
responses
Command Response Comment
“AT+CMGD= [index]”
“OK”
“ERROR” Message deleted
Command error
1. [index] integer type: Index of
message to delete.
APPLICATIONS
1. Home
Automation
2. Industrial
Automation
3. Irrigation
Automation
4. GPS
Navigation
5. Automobile
Industry
6. As
a Remote Control
7. Controlling
Dam Gates
8. Motor
Control applications
9. Security
System
0 comments:
Post a Comment