The report consists of a background into the area of 8051 microcontroller and mobile communication, how they are interfaced to each other and AT (Attention) commands set used in communication.ericsson at command microcontroller
The simplist method to interface a mobile with microcontroller is use mobile phone which support AT Commands. By using this we can directly connect that phone via datacable to microcontroller kit at a baud rate of 9600 and you can send AT commands to that mobile to read and send sms or other data of interest. The first thing in this regard is to find a mobile phone with AT Commands. Recommendation is use sony erricson's 290i . You can use any other mobile suitable for this purpose. The same program with slight modifications for AVR microcontroller. Which avr microcontroller you want to use and what is the sensor you want to interface.
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! 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.
Control takes place by means of SMS (Short text Messages Service). When the mobile receives a predefined text message, like "alarm ON" or "Start pump", the circuit automatically recognizes it as a command, and switches the output accordingly.
At the componets level this project of mobile interfacing with microcontroller can be divided into these parts:-
1. Two mobile phones, one for general use and will be handled remotely, the second is specific mobile which will be interfaced with microcontroller 8051.
2. Microcontroller with necessary components inculding power supply, crystal, RS-232 components etc.
3. Interfacinf board, This is interfacinf board which will inculde the optocouplers, relays and other components required for interfacing of different input and output devices to microcontroller.
4. The hardware devices which are to be controlled through this projects will be connected to microcontroller usig above mentioned interfaing board.
The procdure for the mobile controlling of different hardware is very easy.
process begins on writing a SMS on mobile # 1, which will be transmitted to mobile # 2 through mobile networks. The second mobile will get that SMS and will transmit it to microcontroller via serial communication RS-232.
The micocontroller 8051 will check, if it is according to predefine commnad then, according action will be performed.
The whole process is explained in the diagram below.
The device can be used as well to notify the status of the input port, sending automatically a message every time the input changes.To know input status at any time, the device can send back a SMS describing the status of the input, as a response to a request message.
GSM cellular phones can accept AT commands (more precisely an extension of the AT command set).
Serial Communication between mobile and Microcontroller:-
Many mobile have configuration to work on serial communication, i tried the following setting of serial communication 9600,N,8,1 on null modem. The mobile and microcontroller are configured on above setting and they worked fine.
Now it is time to do some communication with mobile using AT command:
The very basic command that can be used for serial communication check between microcontroller and mobile phone is "AT" command, so lets try it first. When microcontroller sends AT, then
AT (When microcontroller sends AT, then and the cell phone answered: )
OK (cell phone response)
The second command:-
First, tell the phone which memory to use for successive commands:
AT+CPMS="ME","ME" +CPMS: 7,15,7,15,7,15 (this string will be transferred from microcontroller)
OK (Acknowledge signal or message from mobile)
This instructs the mobile to use internal memory "ME" in place of the "SM" memory from the SIM (Subscriber Identity Module) as default memory. Next, a message can be read from that memory specifying its number:
AT+CMGR=4 (To mobile from microcontroller)
the mobile replies as under:
+CMGR: 1,,27 0791934329005000040C9193433728501400001060314104350809D02A735A043DAB54
This is the fourth message, 1= received and read, 27 bytes long text, in PDU (Protocol Description Unit) format.
The PDU format is quite complex, as it contains many subfields packed together using different encodings. Among other things, it holds also service centre numbers, origin numbers, nation codes, a time stamp, and a descriptor of the character set used.
The next command frees precious mobile memory deleting the seventh message:
You can test mobile with AT, it responds with OK
Then you can enable the text mode with AT+CMGF=1, to enable text mode and wait for OK.
Then at AT+CMGS="+923011111111" (send this to mobile from microcontroller)
You can change above number with your desired phone number, you will get a > prompt and here put your message followed by ctrl+z.
"the sensor is active and pump is ON"+ctrl+z
If you get OK, your message will be tramsmitted.
You can use AT+CSQ to test signal strength.
The above codes will work with Ericsson T10s, T28 and R320 only. for other mobiles find their codes.
example code for above communication is as under: