Tiny GSM alarm system using PIC16F84A
After GSM call alarm and GSM SMS alarm as two independent modules, I introduce the Tiny GSM alarm system. The main characteristic of this new version is that this device can operate standalone or as a module for existing alarm system. In previous versions we had only the “enable” pin that armed/disarmed the system. Now, aside from that pin we can arm/disarm the system by calling it with our phone.
UPDATE 2: New PCB with only DIP components (no SMD) is added to the archive for download. Thanks [eDo] for designing this PCB.
UPDATE 1: Since many people have trouble finding the PIC16F84A, I re-compiled the code to work with PIC16F628(A). It should work but I have not tested it yet on this uC so let me know if you have any problems with it!
I used a very popular microcontroller from Microchip: PIC16F84A. This time I didn’t bother with external EEPROM memory for SMS storage because I used phone’s SIM SMS storage and phonebook memory.
GSM phone that I used for development of this device is Siemens M35i (19200bps 8-N-1). It must work with other Siemens phones such as: S25, C35(i) (tested and works), A65 and so on (X35, X45)… It is very recommended to modify the phone so that it can be powered and turned on by the device. Also, the SIM PIN code request should be disabled!
After powering up the device, LED will blink once after it reads some settings from EEPROM. Now, after 2 seconds it will turn on the phone with a 2 second-impulse and pause for 6 seconds to allow phone to turn on. After that, initialization follows with the AT commands stored in EEPROM. They are in EEPROM only to save FLASH memory because this PIC has only 1 kb of FLASH for program. If during the serial communication between the PIC and the GSM some data is lost or never received (3 seconds timeout), the GSM phone will be reinitialized. After the fourth failure, PIC will execute that 2 seconds impulse that will turn the phone on because it thinks it has turned itself off. Also, PIC will do a 5 minute gsm-alive check and turn it on if it doesn’t receive data. During those 5 minutes if alarm condition occurs, the PIC will turn the phone on immediately and report the alarm.
Arming and disarming the system
System can be armed and disarmed by calling it from the other phone (who’s number is stored in system’s gsm’s phonebook of course) if it is configured properly with option opt 3, and/or by using the hardware “enable” pin (it is possible to use both at the same time but it might get confusing). If only arming/disarming by call is used, than the “enable” pin must be connected to ground at all times. This can be done with switch who’s options is opt 7. In case where calling arm/disarm is not used, than options opt 4 and 5 have other meaning: delayed armed state entering and delayed alarm condition, respectively.
When system is being armed/disarmed with calling function there are two methods of reporting that action: siren beeping (chirping), just like in car-alarms or by callback function. Callback function is activated only when system is disarmed. It will call back the user who have just disarmed the system to let him know what happened. This is helpful when you call your alarm by accident and disarm it! The system can only be disarmed either by the first number in SIM phonebook memory or any stored number. That choice is configured with option opt 4. Note: this option does not effect the number of alarm condition recipients.
For more detail: Tiny GSM alarm system using PIC16F84A
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
JLCPCB Prototype: Only $2 for 10pcs 10×10cm, 24 hours Quick Turn, DHL Delivery in 3 days
Current Project / Post can also be found using:
- micro controller projects
- gsm alarm
- gsm programme for pic microcontroller