Design GSM automation board with AVR microcontroller.
Key words: Microcontrollers, GSM, AT Command, Wireless, PDU format.
Wireless and mobile communications is one of the fastest growing areas of modern life. It has an enormous impact on almost every aspect of our daily lives. A world of ubiquitous wireless devices is emerging, from wireless sensors and tags to mobile terminals. There are a number of wireless systems and networks in operation such as GSM, GPRS, EDGE, IS-95, UMTS, IMT2000, DECT, IEEE 802.11 and Bluetooth. In the world, some of the big companies such as Siemens, Omron have just integrated the automation systems based on wireless GSM into their products, but construction of the one's own GSM automation board based on cheap and accessible electronic components for educational purposes and control of the appliances in the long range is almost the new area. This paper will describes how to use an AVR microcontroller and Siemens Mobile phone SL45i to design GSM automation board. The designed board can be use not only for the education in our university but can be applied to security system, home automation and some practical application in the industrial automation.
2. HARDWARE DESIGN
The CPU of the GSM automation board is the high-performance, 8-bit AVR microcontroller ATmega8515L. It's a microcontroller with RISC architecture, 8k Bytes of in-system self-programmable Flash, 512K Bytes internal SRAM, 512K Bytes EEPROM [Atmel Corp., 2006]. That chip include a programmable serial USART and ISP interface for In-System Programming. For easy manipulation with board, we use the 40-pin PDIP packages. The GSM automation board contains 8 analog inputs, 4 digital inputs and 4 digital opto-isolator outputs for control of AC appliances.
As mentioned earlier, the microcontroller Atmega8515L supports ISP. One 10-pin ISP connector is built in the board (compatible with programmer Kanda STK 200+/300 standard) and has six signals to implement: MISO, MOSI, RST, SCK, VCC and GND (Figure 1). The CPU can be programmed directly in board. The port P0 and P2 are pulled high externally through the pull--up resistors. Pins XLAL1 and XTAL2 are connected to the 4MHz crystal. The 8-bit A/D converter ADC0809 is connected to port P0 and controlled by pins AD_Start and OE. Pins AD_A0, AD_A1 and AD_A2 are used for select of the A/D channels [Tong, V.O., (2005)].
[FIGURE 1 OMITTED]
All of the board's schematics and layouts were drawn in the Orcad Capture CIS and Orcad Layout Plus from Cadence Design Systems. The board has designed as double-side PCB. One temperature sensor LM35D from National Semiconductor is connected to pin IN0 of ADC0809 for test function of A/D converter. The standard 16x2 alphanumeric LCD type HD44780 is connected in the 4-bit mode through port P0. The hardware real-time clock DS1307 and 256Kbit, 2-Wire Bus Serial EEPROM AT24C256 are also integrated on the board for registration of event's history. Both of these IC, which are connected to microcontroller through the pin P1.4 SCL (serial clock) and P1.3 SDA (serial data), work on I2C protocol [Ajay,V.D., (2005)].
In the port P2, four pins P2_7 to P2_4 are brought out to 4-pin header and reserved for 04 digital inputs, that can be used for a wiring of PIR sensors and magnetic contactors in the specific application of a home automation system. The other pins of port P2 (P2_0 ... P2_3) are reserved for 04 digital outputs. These pins are interfaced to phototransistor output optocouplers 4N35 and can drive the electrical appliances through Omron MY3 12VDC relays (Figure 2).
[FIGURE 2 OMITTED]
For a GSM communication, the board is equipped with the Siemens mobile phones, for our case we use the low cost SL 45i model. IC MAX232 is used to provide a 3 wire RS232 interface for connecting to the PC and mobile phone. The mobile modem communicates with PC and Atmega8515L by TX and RX signals (pin 5 and pin 6 in the 12-pins connector of Siemens SL45i), that are grounded through two resistors R10 and R11 with value 10k. (Figure 3).
The brief hardware features of GSM automation board are as follows:
* CPU: Atmega8515L 40-pin DIP package, crystal 4 MHz Memory: 8k Bytes Flash, 512K Bytes Internal SRAM, 512K Bytes EEPROM
* I/O: 8 analog inputs, 4 digital inputs, 4 digital outputs EEPROM: 24LC256, 256KB serial eeprom
* RTC: Real-time clock, DS1307 with 3V Lithium backup battery.
* ADC: ADC0809, 8 channels 8 -bit A/D Converter. LCD: 16x2 alphanumeric LCD type HD44780 GSM modem: Siemens Mobile SL 45i
* Relays board: Opto-isolator, OMRON MY3 Relays RS232 Level Converter: MAX232, Baudrate 19200.
* Operating Voltages: 5VDC for board's control, 12VDC for Relay's board, 230VAC for appliances.
[FIGURE 3 OMITTED]
3. AT COMMAND AND PDU FORMAT
3.1 AT Command
Remote control operation of the GSM automation board runs via a serial interface by the specific AT commands. All of the commands begin with the string "AT" and end with "<CR>" (Hexadecimal: 0x0D). The input of a command is acknowledged by the display of "OK" or "ERROR" [Pettersson, L., (2005)]. The next command can not entry until we have received the acknowledgment. Some of the frequently used AT commands for control GSM automation board are as follows:
3.2 PDU Format
The PDU (Protocol Description Unit) mode is the one of two methods to send and receive SMS messages. In our case, every string of SMS have to compress before sending and every received SMS have to decompress in 7--bit SMS messages using a special PDU format. The details of PDU format can be found in the application note [Atmel AVR App. Note No. 323, (2006)].
4. FUNCTIONS OF EMBEDDED SOFTWARE
The source program was written in C language and compiled with AVR CodeVision C compiler. It is an IDE for AVR chips having built-in software for STK200 compatible programmer. The embedded software have to ensure the following functions:
--Periodical scanning of the digital inputs and reading of the values from analog inputs (temperature from LM35D).
--Testing, if the analog values run over the limit or digital inputs change from high to low (PIR sensor and magnetic contactors are active), it will dial and send SMS to other user--defined mobile phone.
--Decode received SMS from user--defined mobile phone number and according to that, it will switch ON/OFF electrical appliances (230V AC ventilator).
--Display the current temperature from sensor LM35D and status of four digital outputs in LCD.
5. PRACTICAL APPLICATIONS
The designed GSM automation board can be used in home automation with remote control and monitoring via GSM communication. With GSM automation board, it is possible to monitor 12 inputs and activate 4 outputs. Besides monitoring a temperature, GSM board can activate an AC ventilator, switch ON/OFF lights, open an electric gate through SMS.
The GSM automation board can be applied in security and surveillance applications. Our designed system is enough to monitor moving persons via PIR detectors and door's magnetic contactors and send SMS messages in case of intrusion.
The hardware schematic and method of software development were provided to be an exemplary design for students to learn basic knowledge of design and programming of 8-bit AVR microcontrollers. The board is a generic tool for microcontroller laboratory tasks and improves the microcontroller communication capability. For the real world, the designed GSM board can work as data acquisition module in automation or cost-effectively module integrated to home automation, alarm system, SMS dialer and remote automatic control via SMS.
This works is supported by the research project No. QC.07.16 granted by Vietnam National University, Hanoi.
Ajay,V.D. (2005). Microcontrollers -Theory and Applications, Tata McGraw--Hill Publishing Company Limited, ISBN 0--07--058595--4, New Delhi.
Atmel AVR Application Note No. 323, (2006). Interfacing GSM Modem [Online], Available from: http://www.atmel.com/dyn/resources/prod_documents/ doc8016.pdf Accessed:2007-01-10.
Atmel Corporation. (2006). Atmega8515-L Datasheet, [Online], Available from: http://atmel.com/dyn/resources/prod_documents/doc2512.pdf Accessed:2007-02-20.
Pettersson, L. (2005). SMS and the PDU format, [Online], Available from: http://www.dreamfabric.com/sms/ Accessed:2007-02-20.
Tong, V.O. (2005). Design system with 8051 family, Phuong Dong Publishing Company, ISBN 06--2006 CXB--99, Ho Chi Minh city--Vietnam.
Tab. 1. Example of AT Commands for control of GSM Board Test AT Commands Meaning ATD Dial the telephone number ATE Active/Deactivate command echo AT + CMGS Send in an SMS in PDU format AT + CMGR Read in an SMS in PDU format AT + CMSS Send an SMS from the SMS memory AT + CMGC Send an SMS command
|Printer friendly Cite/link Email Feedback|
|Title Annotation:||global system for mobile communications, automatic voltage regulator|
|Author:||Pokorny, Pavel; Pham Manh, Thang|
|Publication:||Annals of DAAAM & Proceedings|
|Article Type:||Technical report|
|Date:||Jan 1, 2007|
|Previous Article:||Programming and computer graphics education on FAI UTB.|
|Next Article:||Rigidity analysis of vibrorolled surfaces.|