GSM Vehicle Control and Security System using SMS

I did this project for my 5th semester for "Microcontroller based Systems". It was done on an 89C51 microcontroller which belongs to 8051 family, using a sony ericsson T290i mobile inter-connected with a serial cable. It was implemented on my Honda Civic.
The user could control some functions of the vehicle by sending
specific sms commands to the T2920i.

Some of these functions were:
  • start and stop the engine (without using the key)
  • stop the engine if somebody starts it with a key ( by cutting off ignition)
  •  lock and unlock the doors
  •  send a text message to the owner if an intruder is detected (by monitoring the doors)
  •  switch the heater/air conditioner on and off


DESCRIPTION

SMS is checked by monitoring the phone memory by using AT+CPMS command which sets the preferred phone memory location for storing sms and returns status of phone memory.

When an SMS is received its text is dumped into microcontroller's RAM using a very calibrated approach. Therefore the 7th character(7th was chosen randomly) always lands at location 57H of RAM. This was determined by connecting the phone to PC's serial port and debugging using the Proteus Simulation. The RAM was monitored as the phone sent the SMS text and it was dumped.

So the 7th character is compared using the below table and the appropriate function is called for performing the action using relays.



############## SMS COMMANDS ###################

 SMS COMMAND         7TH CHARACTER                HEX EQUIVALENT


start engine                                     e                                       65h    
stop engine                                     n                                       6eh    
car lock                                            c                                       63h    
car unlock                                        l                                        6ch    
on heater                                         t                                        74h    
off heater                                         a                                       61h    
panic mode                                    m                                       6dh    


Two Interrupts are used, Timer 0 overflow interrupt and External interrupt. The program checks for sms every time Timer 0 overflows. External Interrupt is connected to door switch for detecting intrusion and sending sms to owner. If external interrupt happens while sms is being checked, the program will get stuck due to unexpected reply from mobile. To avoid this situation, both interrupts are set to high priority using IT0 bit in TCON register. Now if one Interrupt occurs while the other is being serviced, it will have to wait until control returns from first interrupt.      

Here are the Hardware connections.

 P0.0 = for locking car (attached to security sys remote)
 P0.1 = for unlocking car (attached to security sys remote)
 P0.2 = for switching on heater
 P0.3 = connected to IGNITION RELAY 1 (CRANK or START engine)
 P0.4 = connected to IGNITION RELAY 2 (ON)
 P0.5 = connected to IGNITION RELAY 3 (ACC)
 P0.6 = connected to IGNITION CUT RELAY (Used for switching off engine when someone is running with your car!! i.e PANIC MODE)
 P3.2(INT0) = Door switch relay(for detecting if door is opened) 

Download Section

Here are the project files:
-Source code (Assembly language-Compiler: Keil uVision 3)
-Proteus Simulation  (works with Proteus 7.4 and above)
-Sony Ericsson AT command manual

Hardware:

-PCB Layout 8051 board  (works with Proteus 7.4 and above)
-Relay board demo (simulation) (works with Proteus 7.4 and above)
-Custom Serial adapter 
(The custom serial adapter as seen in the last picture; connected between the mobile phone serial cable and 8051 board, is used to provide power to the MAX232 IC present inside the mobile phone serial cable by giving +5V at pins 7(RTS) and 4(DTR) of the phone serial cable. The cable won't work without this custom adapter)

Some snapshots of the hardware. From the pictures it may seem that the project is incomplete or something but I actually drove the car around for a couple of months with the system working!




The setup was placed in the dashboard

The relays connected to the ignition

The microcontroller board with the serial port and the relay board.

 The 8051 board connected to the phone through serial cable.


The code has been tidied before uploading so if you can interpret it, it can be ported easily to an AVR or PIC. If anybody wants any help with this stuff, just drop a comment or "Contact me". I'll be happy to help.

229 comments:

  1. Hi....
    U r grt dear...
    Plz help me
    i need ppt on sms controlled vehicle iginitaion system for safty

    ReplyDelete
  2. Hi Umar,
    Great Work!!
    Would it be possible for you to clear my doubts regarding my code for similar applicaion using PIC18F4520. I am trying to start the car using a switch after ensuring some safety conditions. Please refer my start function below:
    void start()
    {
    swi=10;
    Delay100TCYx(10);
    do{
    TRISDbits.TRISD0=0;
    }while(alt==1);
    Delay10KTCYx(18);
    LATDbits.LATD0=0;
    }

    Please help.

    ReplyDelete
  3. Thanks on your marvelous posting! I actually enjoyed reading it; you might be a great author. I will make certain to bookmark your blog and may come back very soon. I want to encourage you to continue your great work, have a nice weekend.
    Top Alarms

    ReplyDelete
  4. I appreciate when I see well writen material. Your time isn't going to waste with your posts. Thanks so much and stick with it No doubt you will defintely reach your goals! have a great day!
    alarm systems companies

    ReplyDelete
  5. actully,i want to connect proteus and j2me plzzz...could you tell me how to connect it?

    ReplyDelete
  6. Can i have the circuit block diagram of your project?

    ReplyDelete
  7. can u please send me the coding detail ,block diagram and circuit diagram of this project.

    ReplyDelete
  8. can u plz guide me by sending the proper codes(AT commands) for the GSM MODEM......

    ReplyDelete
  9. hey.. I am doing a similar project.. Could you elaborate about how the relay works when cutting off the engine?
    Don't they reset if power to the micro controller is lost?

    ReplyDelete
  10. Hello Umar,
    Our project is very much similar to the one you've discussed earlier. To the car security system, we use the GPS to give the car location and GSM modem to send this location SMS to the car owner. Now, we are in a fix. We are not understanding how to send SMS to the owner every 30 seconds.

    Please suggest us as soon as possible..........

    ReplyDelete
  11. Hi
    i am a 10th class student and i am interested in working with microcontrollers. I have an atmega32 microcontroller. I know c programming. Could you suggest a book that can help me knowing all about microcontrollers(a begginners guide)

    ReplyDelete
  12. im Yuva here... i working on final year project regarding car security system via sms.. i want to make vehicle security system which get sms through handphone when any damage is happened to the car or if car theft. will this project will work wd my idea... can u kindly email me the details at yuvarani_5532@hotmail.com . i will be highly grateful to u...

    ReplyDelete
  13. he bro ,i want send the sms for on/off the bike without using the cable connection it is possible ,

    ReplyDelete
  14. hi sir am planned to do as your project and when am looking for something related to my project ,I found your website ,I felt happy so can I use Samsung s2 or Iphone 5 or4

    ReplyDelete
  15. Great post; thanks for sharing..This informative post has the potent to give
    precise info about GPS Vehicle tracking system, here is a company gives you centralize tracking tool for Vehicle Tracking in India. تتبع الأسطول

    ReplyDelete
  16. hai umar.. can you help me regarding this project?? actually i'm working through this kind this project.. i hope that u can help me..

    1) i have a design the schematic for the circuit, but actually how can i try to simulate the circuit either the circuit are fully function or not? because im using the GSM system, not using the cellphone as you done.

    2) sorry for asking, but i really need to know that your circuit are fully function or not? are the interrupt are really function?

    3) how about the total duration time to make this project successful?

    ReplyDelete
  17. bro aim using ATmega 8535 Micro controller as a same project...how to do c coding???can u help me

    ReplyDelete
  18. plz post details like circuit diagram, block diagram, paper ,ppt for the project vehicle theft intimation to the owner on his cell phone by gsm with user programmable number features

    ReplyDelete
  19. mounicatangirala@gmail.comFeb 21, 2014, 2:10:00 PM

    please send me source code of gps and gsm based vehicle tracking system for my mail in pdf format.

    ReplyDelete
  20. mounicatangirala@gmail.comFeb 21, 2014, 2:15:00 PM

    sir, i need source code in assembly format with keil microvision3 compactibility and please do send to my mail id mounicatangirala@gmail.com in word or pdf format

    ReplyDelete
  21. I need idea about this question, which language we will use for this kind of security system.

    Suppose we want to build a car security system with the following features:
    a. Auto door lock after 5 minutes
    b. GPS tracking system shutting the engine while we left from our city
    c. Sound/Jerks detection and raising alarm

    We want to provide all of above features making use of XYZ micro-controller with the following specifications:
    a. 4 I/O ports
    b. 1 Serial port
    c. 512 KB of code memory

    Should we use any higher level or assembly language in above scenario? Support your selection with logical reasoning.

    ReplyDelete
  22. hey brother i am final year student , and my project is gsm based advanced car security system in which i m using piezo sensor to detect in sumone sits on the seat on the car to start it, ir sesnsor for door locking system and flammable gas detector sensor and i want to add feature such as engine stop if sumone tries to start the engine without the knwong of the owner..i want to programming for it in AT Mega 16..plzz send me the source code for the project if you can and also plz help to know how the interfacing of these sensor can be done with a gsm module..plz inform me if you can do any favour to my mail id:ashishkatiyan11@gmail.com or contact me on 9041570616..its really urgent plzz give me suggestion regarding dis project..wu be grateful to you!!

    ReplyDelete
  23. Hi nice post, got a valuable information about security systems in the car. Thanks for the post.

    ReplyDelete
  24. Hi nice post, got valuable information about security system in vehicles. Thank you for the post.

    ReplyDelete
  25. Protection Concepts began in 1998 with one simple principle…To offer excellent customer service, quality equipment and monitoring all at an affordable price while conducting business with honesty and integrity.

    Marietta commercial security

    ReplyDelete
  26. Lloyd Security has the solution to keep your system active without the need of a phone line Minnesota commercial security Our cellular connection module takes the place of a phone line, whether you have one or not. It can also act as a backup to your existing phone line, recommended when using a digital line.
    Minnesota contracted surveillanc

    ReplyDelete
  27. I am currently on my final year project titled GSM based security system.for replacing the car alarm system. please help me to make the circuit required and the source code needed. email id .sibi.insuz@gmail.com

    ReplyDelete
  28. i am currently on my final year project titled GSM based security system. GSM car alarm system. For this I need your source code and circuit diagram. please help me.

    ReplyDelete

If anybody wants any help with this stuff, just drop a comment or use the "Contact me" button at the top of the page . I'll be happy to help.