SMS Transceiver for PIC (SMST4PIC)

FAQ
SMS Transceiver (SMST)

Home Page Entry SMS Transceiver SMS Transceiver for PIC (SMST4PIC)

created: 13. Oct. 2004, last modified: 19. Dec. 2006
Copyright © 2004-2006 Wolfgang Rankl, Munich
Impressum und rechtliche Hinweise


zum SeitenanfangContent

Project SMS Transceiver for PIC Single-Chip-Microcontroller (SMST4PIC)

Project overview

Reasons for the Usage of PIC

Tools for PIC

Reasons for this Project

Overview about the available versions

SMST4PIC release 5

PIC 12F629 technical overview

Circuit diagram

The Box

Overview about the Software

Sourcecode

SMST4PIC release 6

Overview about the Software

Circuit diagram

PCB

Source

Further Informations

Mobile phone conncetion

Mobile Phones and RS 232

Text Compression of the PDUs

Remarks for own extensions

Books

Tools

Similar projects


zum SeitenanfangProject SMS Transceiver for PIC Single-Chip-Microcontrollers (SMST4PIC)

zum Seitenanfang

Reason for this Project

The following picture shows an alarm system from my youth. This worked quite well but it is quite impossible to get an alarm message over a bigger distance than 30 m. Thats the reason to build a better solution.

I started this project because the origin SMS Transceiver (SMST) works only with an energy consuming PC and I want to have a solution which could be also battery powered. In this project a PIC microcontroller is connected to a mobile phone via RS232. With this hardware it is possible to send and receive SMS from a PIC single chip microcontroller.

zum Seitenanfang

Project Overview

SMS Transceiver for PIC (SMST4PIC) is a tool for sending SMS via a RS232 serial connection between a PIC and a mobile phone. It establish on the basis of a serial line connection a AT command based communication for sending SMS and SMS-based e-Mails. This portation of SMS Transceiver is a demonstration for sending SMS via mobile phone triggered manualy or by a motion detector. In addition to the sending of SMS a detected motion generates also an 440 Hz audio frequency output for e.g. a walkie talkie.

This implementation of SMS4PIC could be used quite well as an alarm system.

SMST4PIC is tested with many different mobile phone in many different GSM networks. SMST4PIC use a standalized AT interface for communication with the mobile phone. The result is that it will work with nearly all avalable GSM phones.

For coding of SMS and different types of AT commands to mobile phones see SMS Transceiver.

zum Seitenanfang

Reasons for the Usage of PIC

The reason for the usage of PIC Single-Chip-Microcontrollers are because they are cheap, widely spread and there are many variants available. An other advantage is that they need not much energy and they have a very good sleep mode.

There is an excellent German web side about PIC programming (www.sprut.de) with a broad description of nearly all aspects of PICs and many code examples.

zum Seitenanfang

Tools for PIC

The development tools (simulator, assembler, linker compiler) for PIC are really good, available for free and can be downloaded from Microchip (www.microchip.com).

For programming the PIC I had build the RS232 JDM programmer (www.jdm.homepage.dk) which supports most of the PICs and works also quite well (including Windows XP). There is also a freeware GUI available for this programmer called IC-Prog (www.ic-prog.com). All of this tools are for free and absolutely sufficiant for this type of development.

This is a picture of my IC-Prog with serial cable to the PC.

For checking the RS232 communication between microcontroller and mobile phone I use a 2nd PC with running Hyperterm (the Micro$oft standard terminal programm) and connect the receive line to the communication between microcontroller and mobile phone. This works quite well.

IF SMST4PIC have to do more data processing it would be a good idea to go from assember to a C compiler like the CC5x (www.bknd.com/cc5x/index.shtml).

Since it is not possible to use the original JDM programmer for PICs with 28 pins it is neccessary to build an adaptor. This is quite easy because you just have to connect the Vpp, power, data, clock and GND connection to the corresponding pins of a 28 pin socket. This is the circuit diagramm for the adoptor.

The following picture shows how it looks in reality with my JDM programmer. A nimportant point is that you can build in the same way an in-circuit programmer. You only have to connect the appropriate lines from the programmer with the corresponding pins in the circuit. But don't forget to cut the connection to the rest of the circuit when programming.

zum Seitenanfang

Version Overview

SMST4PIC Version 5

SMST4PIC Version 5 is battery powered and work with an cheap PIC 12F629. The software is quite simple to understand and is a good basis for other projects. The trigger for the SMS is a motion detector and a test button. The RS232 is realized in software and Version 5 uses less hardware ressource of the PIC so it is quite easy to port it to other PIC microcontrollers. Version 5 is written in PIC assembler

SMST4PIC Version 6

Beside SMST4PIC Version 5 the new Version 6 of SMST4PIC will exist. This is the next generation of SMST4PIC with many improvement in hardware and software.

SMST4PIC runs on a PIC 16F876 with 20 MHz a 28 pins with 3 ports. Beside the motion detector there are much more possibilities to connect peripheral components as on version 5. The serial RS232 connection is driven by the PIC USART with a much higher data tranmission rate than the old software solution in version5. A connected temperatur sensor (DS 1620) can be used to get via request SMS the actual temperatur. A 2 * 16 charcter LCD display (HD44780 compatible) offers a improved user interface. SMST4PIC Version 6 can be activated and deactivated by SMS and have the ability to receive and send SMS with dynamical generated text. SMST4PIC Version 6 have the ability to send power down SMS without any power from outside the box. The software is written in PIC assembler.


zum SeitenanfangSMST4PIC Version 5

SMST4PIC Version 5 is battery powered and work with an cheap PIC 12F629. The software is quite simple to understand and is a good basis for other projects.

This is a picture of SMST4PIC Version 5 with a over serial line connected mobile phone.

zum Seitenanfang

PIC 12F629 technical overview

The PIC 12F629 is a 8-Pin fash-based 8-Bit CMOS microcontroller with an +/- 1% internal 4 MHz oscillator. The operating voltage range is from 2,0 V to 5,5 V with an operating current of 100 µA at 1 MHz and 2,0 V. The typical operating current with internal 4 MHz oscillator at 5 V is a few µA. It is possible that the PIC 12F629 drive up till 25 mA to ground or Vcc on every I/O pin. The usable temperage area is from -40 °C to +125 °C. The chip have 1024 words programm flash, 128 bytes data EEPROM and 64 bytes RAM.

For an implementation of all the PC features of SMS Transceiver the PIC 12F629 have not enough RAM. An other disadvantage it that the programing language of the PIC 12F629 is regulary assembler and not C. If you need more input and output pins I suggest to use the PIC 16F876 because it have quite much I/O capabilities and also two PWM which might be quite interesting if you want to control motors.

If there is a need for are more feature rich implementation of SMS Transceiver I suggest to use a 8051 single chip microcontroller derivat like P89LPC900 series from Philips or the AVR microcontrollers series from ATMEL. There are some powerful C compilers and development tools for this chips. The disadvantage is that most of these tools are not for free, therefore I have make the decision to use PIC microcontrollers

zum Seitenanfang

Circuit Diagramm

The hardware for SMST4PIC is quite simple. The main part is a PIC 12F629 single chip microcontroller and a MAX 232 chip for the RS232 signals. The are 2 LEDs. One LED is used for a simple power on and a scond LED is software controlled by the PIC. A push button is also connected to the PIC and can be used for manuelly trigger. The sensor is a standard PIR motion detector.

The circuit needs 11,5 mA at 4,8 V.

This is the circuit diagramm of SMST4PIC (click on the diagramm for a large picture).

This is a picture of the PCB with the PIC microcontroller on the left side and the MAX232 on the rigth side.

zum Seitenanfang

The Box

The SMST4PIC circuit is build into a small box with all neccessary buttons, LEDs and connections.

This are different pictures of the SMST4PIC box.

zum Seitenanfang

Overview about the Software

The software uses as few as possible hardware specific functionality because this improves the portability.

For creating the predefined PDU for the SMS the function "create PDUs functionality" of the PC version of SMS Transceiver should be used. The encoded messages are stored in the data flash memory of the PIC microcontroller. The PIC will then send the appropriate message if an event occurs. This makes the software in the microcontroller much more easier as if you had to encode a complete PDU for the AT command.

The documentation of the software is completely done inside the assember source code file.

zum Seitenanfang

Sourcecode

SMST4PIC in Version 5 was released on 28. December 2004.

SMST4PIC consist of six PIC assembler source files:

SMST4PIC.asm (the main parts of the programm with all includes and the memory allocation)
EEPROM.asm (all data parts for EEPROM)
Macros.asm (all neccessary macros)
Serial.asm (the functions for the serial (RS232) communication)
Test.asm (test functions for hardware and software integration)
Utilities.asm (collection of useful functions)

SMST4PIC V5 can be downloaded here: SMST4PIC V5.


zum SeitenanfangSMST4PIC Version 6

Beside SMST4PIC Version 5 the Version 6 of SMST4PIC will exist. This is the next generation of SMST4PIC with many improvement in hardware and software.

SMST4PIC runs on a PIC 16F876 with 20 MHz a 28 pins with 3 ports. This means there are much more possibilities to connect peripheral components as on version 5. The serial RS232 connection is now driven by the PIC USART with a much higher data tranmission rate than the old software solution. A connected temperatur sensor (DS 1620) can be used to get via request SMS the actual temperatur. Nevertheless a 2 * 16 charcter LCD display (HD44780 compatible) offers a improved user interfaceSMST4PIC Version can be activated and deactivated by SMS and have the ability to receive and send SMS with dynamical generated text. SMST4PIC Version 6 have the ability to send power down SMS without any power from outside the box. The software is good documented and written in PIC assembler.

This is a picture of SMST4PIC Version 6 with a connected mobile phone.

zum Seitenanfang

Circuit Diagramm

The hardware for SMST4PIC is simple but have many components.

zum Seitenanfang

PCB

This is a picture of the PCB. The size of the PCB is 140 mm * 70 mm. All the power supply components are on the left side, the PIC microcontroller is in the middle of the PCB and the connection to most of the peripherals is on the rigth side.

The following picture pf the PCB shows a description the main components.

zum Seitenanfang

Overview about the Software

The documentation of the software is completely done inside the assember source code file.

zum Seitenanfang

Sources

SMST4PIC in Version 6 Snapshot D (Build 110) was released on 5. April 2009 and can be downloaded here: SMST4PIC V6.
Important: This is a development snapshot and not the final version!

This is the list file of SMST4PIC Snapshot D Build 110.


zum SeitenanfangFurther Informations

zum Seitenanfang

Mobile phone conncetion

For the mobile phone it is possible to use different types with serial port to connect to the PIC. I looked a little be araound the web and it seems to me that the Siemens modules (like MC35i / MC35i) are one of the best. On the other hand it is not very cheap. I personally use an old mobile from the bargain counter.

For checking the RS232 communication between microcontroller and mobile phone I use a 2nd PC with running Hyperterm (the Micro$oft standard terminal programm) and connect GND, RXD and TXD to the serial port of the 2nd PC. For the basic communication the terminal programm "COM Terminal" is also quite useful.

SMST4PIC sends on a serial RS 232 connection with 9600,N,8,1 (9600 bit/s, no parity, 8 data bits, 1 stop bit).

zum Seitenanfang

Mobile Phones and RS 232

Mobile phones uses for their internal components only 3 Volt or 1,8 Volt. Since RS 232 uses +/- 12 Volt a mobile phone can't connected just by the usual 3 wires (GND, TxD, RxD) to a PC. A voltage converson have to done within the connection cable. In fact this is the technical reason why these cables are so expensive. The usual way is, that inside one of the plugs is a RS 232 converter, similar to MAX 232. This converter gets it's supply power from the RS 232 port of the PC. Usual the DTR (data terminal ready) signal is used for this. The idle state of DTR is -12 V (- 6 V measured on a real PC) and DTR goes to + 12 V (- 6 V measured on a real PC) if a data transfer is started. In an Java application on the PC the DTR goes to +12 Volt after the "open" method and goes back to the idle voltage -12 Volt after the "close" method.

This has to be considered if a PIC is connected to a mobile phone. The voltage conversion circuit inside the cable between PIC and mobile phone needs some current and this current have to be supplied by the DTR. This works quite fine with the original cable from Nokia but it have to be checked with all other connection cables and other mobile phones.

zum Seitenanfang

Text Compression of the PDUs

The text messages of the SMS are compressed in the PDUs. The following table shows the compression where the string of 7 bit characters are stored in a string of bytes.

zum Seitenanfang

Remarks for own extensions

Date and Time

There is no real time clock on the SMST4PIC board but there might be a need for some applications to have the actual time and date. There are two way to realise this.

The first and easiest way is to fetch the time and date via AT command (AT+CCLK) from the mobile phone. A problem could be that there are many mobile phone who don't support this AT command.

An other way is that SMST4PIC sends a (empty) SMS to itself over the GSM network. This cost money but it works independent from the connected mobile phone. As a part of the message the SMSC copies the actual time and date into the SMS which is received by SMST4PIC. Time and date can be captured by the SMST4PIC software and afterwards used for the application.

Recognition if a SMS is received

There are many ways to recognize from SMST4PIC that the mobile phone had received a SMS. There is a specific AT command (at+cnmi) which informs in the mobile phone over the serial line that a SMS is received. This is the easiest way but the parameter of the AT command are quite complex.

An other way is to put a ligth sensor on the display of the mobile phone. SMST4PIC can than measure if the ligth of the mobile phone is on and can fetch via AT command all received messages. This is simple but needs the extra light sensor on the mobile phone. It works because most of the mobile phone switch on the light of this display for some seconds if a SMS is received. An advantage is that this methode recognize also an incomming call. This can be used to send a status SMS to a specific mobile phone without an extra status request SMS.

An alternative to the ligth sensor i a microphone connected with SMST4PIC. If a ring tone occurs because of a received SMS or a incomming call SMST4PIC can recognize this and look via AT command for new SMSs.

zum Seitenanfang

Books

There is also a interesting book about the use of SMS and microcontroller, but as I know only in German: "Fernsteuern über SMS, Elektor Verlag Aachen 2002, B. v. Berg, J. Engelmann, P. Grappe". The authors sell also a similar component to SMST4PIC (www.engelmann-schrader.de).

zum Seitenanfang

Tools

This is a quite good Web-based PDU converter. It can be used for generating and testing PDUs without installing software on the PC.
home.student.utwente.nl/s.p.ekkebus/portfolio/resource/sms_pdu.html

zum Seitenanfang

Similar projects

There are similar projects published in the internet, but as I know there is no other project with the functionality and the detailed description of SMST4PIC.

SMSremote control
www.serasidis.gr/circuits/smscontrol/smscontroller.htm

Tiny Planet
www.riccibitti.com/tinyplanet/tiny_intro.htm

SMS Controller Pt.1
www.siliconchip.com.au/cms/A_102670/article.html