It’s been awhile that I have last posted my projects here since I have helped my friends build their Senior Year Design Project. Now, it is finally done and I will be so happy to share it here. The project is all about a cellphone that will inform the user through Short Message Service (SMS) when an intruder triggered the alarm. Using the AT Commands the serial communication with the phone and the microcontroller was made possible.
The project comes into a case but temporarily removed for the presentation to the panel of judges since the case wont fit on the prototype.
There are two ways of sending and receiving SMS messages: by text mode and by PDU (protocol description unit) mode. The text mode (unavailable on this phone) is just an encoding of the bit stream represented by the PDU mode. The phone used was Sony Ericsson T68i and the only mode supported is PDU mode. It was a headache at first since I can only see hexadecimal figures but as time goes by I got used to it.
AT Commands used:
AT – check if the phone is connected
ATE(0 or 1) – 0=echo off 1=echo on
AT+CMGF=0 – pdu mode
AT+CMGS – *enter write pdu code *ctrl Z
AT+CMGR=(index or position of the message on the inbox) – read the message indicated on the index
AT+CPBS=”me” – select phonebook storage
AT+CPMS=”me”,”me”,”me” – select read/delete storage, write/send storage, received storage; (me means phone while sm means sim)
AT+CMGD=(index),0 – delete message on index number specified
AT+GMM – cellphone model
AT+GMI – cellphone manufacturer
*when the phone is switched off all the settings are set back to its default settings so they should always be set up on the program to avoid problems on the microcontroller and phone communication.
How does the system function:
Ports are set at first, Universal Asynchronous Receiver/Transmitter (UART) is initialized and a first check is done if the phone is turned ON or if it is connected. The Yellow LED then will light if a phone is detected. The microcontroller then will send a command to the phone to send to the user that the System is available and to wait for few seconds because everything is still being set up. After that the Red LED will light signifying that the phone is being set to settings that will help the microcontroller recognize the messages sent to the phone. When all is set the Red LED will stop blinking and the Orange LED will then light up implying that the Alarm is OFF by default. The phone then will send to the user that everything is ready and the alarm can now be turned on. The phone can be turned on by sending text message following the right format indicated on the second text message sent by the microcontroller. When the Alarm is turned on then the Blue LED will light and the Orange LED will turn off. When a disturbance occured, the microcontroller then will turn the siren on and it will send to the user that an intruder has been detected. The siren can only be turned off by sending the proper message format or if the system is turned off by switch. An additional feature was added here which is the sending of invalid password notification.
The microcontroller used here was PIC16F877A. The shock sensor is connected to the RB0/INT pin. The SIREN is connected to the RD6 pin.
Check out the DEMO video here: