Вы находитесь на странице: 1из 4

http://www.elektronika.ba/projekti/?

akc=daj_projekt&idprojekt=9

SMS Box!

What is it for?

This device acts as interface between your microcontroller project and a GSM phone. It handles all modem data
communication between the GSM phone and your micro-project. The best thing is that it decodes PDU into TEXT on the
fly!

I still don't get it

It means that you can easily SMS-enable your any project without need for learning AT commands and parsing
complicated data when talking to AT modem inside the phone.

History

If you ever wanted to connect a GSM phone to your microcontroller project you would need to know it's AT command set,
use serial communication, parse all kinds of data to extract what you really need, handle communication errors and all
sorts of other stuff. Most of AT commands are standard for every phone but not every phone supports SMS texting in
ASCII mode («TEXT-MODE»), instead they use PDU-MODE.
If every phone was like eg. Nokia 6210 life would be pretty nice. Just build a cable to enable its F-BUS (www.atrox.at)
and that's it, you can start using SMS messages in text-mode. Other cheaper phones such as Siemens C/M35, S25 and
many Ericsson phones do not support text-mode for SMS messaging. Instead, they can only be used in pdu-mode
(http://www.dreamfabric.com/sms). The good thing about them is that they are very cheap and do not require any
external cables for initialization. They have their RS232 (TX, RX and GND) port and that's it – you are ready to talk to the
modem inside it.

So what do I need SMS Box! for and why did I build it? The answer is pretty simple, I guess... In the past few years I was
playing around with building SMS Controller projects for home/car – automation. First there was a «GSM Kontroler v1»
with 6 relay-outputs using Siemens S25. It worked great but only for my local GSM – network. It used PDU mode and
didn't decode it, it read it as it was. Okay, the second version (4 digital inputs, 4 relay outputs) used Mitsubishi Trium
Mars (this little baby is surprisingly great and does support text-mode for SMS, I just love its firmware). Anyway I found
out that it was nowhere available to buy anymore, so that's the end of version 2, tough luck.
The third version used DLR-3P Nokia phones and it's still a great little device. It's working at many locations doing some
great stuff such as controlling water level in a pool at one location, resetting many wireless access points, controlling
ham-radio repeaters and it's used as car-alarm (sms and call notify to car owner). I suggest building this device if you
ever need it.
The nasty thing about all of these projects above is that I had to re-write the firmware for my microcontroller as 99%
phones return different answer for the same command issued to it. All of this just for sake of additional few commands
added to the device and use of another phone that supports text-mode SMS. I do not need to mention that Nokia 6210 is
also pretty hard to find and/or is still quite expensive as well as the GSM modems that could replace all this talk about
PDU and TEXT modes.

SMS Box! in SMD version

Power-up and GSM initialization

Sending SMS message from easyPIC3 dev board

SMS Box! in PDIP version


Technical

The SMS Box! handles SMS messages in pdu-mode so you don't need to worry about *many* things. You can talk to it
over its «4-wire bus» and can be used for:

1. Receiving sms messages (PDU -> TEXT conversion!)


2. Sending sms messages (TEXT mode)
3. Dialling a telephone number
4. Hang-up a call
5. Query call status
6. Receive CLIP string
7. Report a RING to microcontroller project (interrupt your uC program)
8. Answer a call
9. Set phone's date and time – not implemented yet
10. Get phone's date and time – not implemented yet
11. Check prepaid credit balance

It's based on PIC16F877A microcontroller running on 16MHz at 5V. It has an onboard level converter for serial
communication with the gsm phone because PIC's UART RX input pin has a Schmitt trigger triggering at 4,5 - 5V while
the phone is sending only approx. 3V from it's TX pin. It also has a zener diode at TX pin so it doesn't kill the phone's
network connection when talking to it. Firmware is 100% written in MPASM assembler.

Two jumpers in the schematics are for: baud-rate selection (9600bps or 19200bps) - Siemens phones mostly use 19200
while Ericssons use 9600bps, the other jumper is for enabling the RING with CLIP reporting to your microcontroller
project (if you need to be notified when the gsm phone is ringing so that you can see who's calling).

The device has been developed and tested on Siemens M35 phone. Other Siemens phones require testing and
should/must work. The same thing is for the Ericsson phones. The phones that can be used are ones that have «AT
modem» inside, UART port and work on 19200 or 9600bps (almost all phones).

The concept

click to enlarge

Picture doesn't need any explanation. SMS Box! is grey box in the middle.

Primitive commands (communicating with the box)

Commands you can send to the SMS Box!: ([0] is representing a null-byte, all commands are case-sensitive ASCII
characters)

Name Command-string example Possible return value Short description


a) Read sms R 38761123456[0]Hello Read SMS message if any.
world![0]
b) Re-read sms r [0] Re-read SMS if previously read any.
c) Send sms S038761123456[0]Hey[0] [0] Send an SMS message.
d) Reply sms s0Hey[0] [0] Send an SMS message to the
sender's number of previously read
SMS message.
e) Dial a number D38761123456[0] [0] Place a voice call.
f) Hang-up H [0] Terminate current call.
g) Call status C 1 Query the phone to see its current
call status.
h) Last CLIP get c 38761123456[0] Get the last or current caller's ID
number.
i) Answer call A 0 Answer a voice call.
j) Set timestamp t - Not implemented yet.
k) Get timestamp T - Not implemented yet.
l) Check prepaid p*101#[0] Your balance is 12,43 EUR. Issues CUSD service command.
credit

For detailed explanation of commands and their return values and the rest of this paragraph, please see
PDF file.

Communication protocol, the 4-wire bus

Not so much thought has been given to this 4-wire synchronous bus.

Looking from the SMS Box!'s side, we have:

1. Data line – bidirectional (input - output)


2. Clock line – unidirectional (input - your microcontroller project is clocking-out/in the data from/to the SMS Box!)
3. IRQ line – unidirectional (input – this is interrupt for SMS Box!)
4. HEY line – unidirectional (output – this is where IRQ is generated to your microcontroller project)

All communication lines are pulled-up to Vcc with PIC16F877A's internal pull-up resistors, so, active line = low (GND).

Data transfer concept («......» in the image above represent wires)

SMS Box!'s 4-wire communication assembler routines (send and receive) are in PDF file as well.

Jumper selection

On SMS Box! you will find two jumpers:

1. Ring reporting selection (jumper in position=Off, jumper removed=On)


2. Baud rate selection (jumper in position=9600bps, jumper removed=19200bps)

Вам также может понравиться