Você está na página 1de 26

Lingayas Institute of Management And Technology









In this project we show that, if any body tries to start the car without entering a password then car is to be start but at the same time alarm is on. If the person enter right password then alarm is off. But in the case of theft, it is not possible for thief to enter a proper password and in this case controller connected to the system is automatic on. Once the controller is on then controller immediately send a SMS through GSM modem to concerned person automatically. It is also possible to SWITCH off the car by sending a reverse SMS. to car. In this project we use one GSM modem to control the incoming and outgoing SMS. We use Siemens 300 based GSM modem and max232 to INTERFACE modem to microcontroller in this project. Modem connected to the controller via serial connector RS232 in DB9 mode. We use 89s52 controller with a UART feature inside.

Password section of 12 switches is connected to the controller. Car key is also connected to the controller. DC motor for representing car is connected to the controller. When car key is pressed an input pulse is given to the controller then controller immediately starts the motor and waits for a password input. If the password signal is not coming for next 30 second then alarm is on and system sends a command to the gsm modem. GSM modem operation system based on AT command. With the help of AT command it is possible for us to connect a gsm modem directly to the controller.


GSM MODEM:Used to Send SMS using AT commands Some advanced GSM modems like WaveCom and Multitech, support the SMS text mode. This mode allows you to send SMS

messages using AT commands, without the need to encode the binary PDU field of the SMS first. This is done by the GSM modem.

AT-Command set The following section describes the AT-Command set. The commands can be tried out by connecting a GSM modem to one of the PCs COM ports. Type in the test-command, adding CR + LF (Carriage return + Line feed = \r\n) before executing. Table gives an overview of the implemented AT-Commands in this application. The use of the commands is described in the later sections.

AT-Command set overview Command AT Description Check if serial interface and

GSM modem is working. Turn echo off, less traffic on ATE0 AT+CNMI AT+CPMS serial line. Display of new incoming SMS. Selection of SMS memory. SMS string format, how they AT+CMGF are compressed. Read new message from a AT+CMGR given memory location. Send message to a given AT+CMGS AT+CMGD recipient. Delete message.

When we have to learn about a new computer we have to familiarize about the machine capability we are using, and we can do it by studying the internal hardware design (devices architecture), and also to know about the size, number and the size of the registers.

A microcontroller is a single chip that contains the processor (the CPU), non-volatile memory for the program (ROM or flash), volatile memory for input and output (RAM), a clock and an I/O control unit. Also called a "computer on a chip," billions of microcontroller units (MCUs) are embedded each year in a myriad of products from toys to appliances to automobiles. For example, a single vehicle can use 70 or more microcontrollers. The following picture describes a general block diagram of microcontroller.

The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash

memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pinout . The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller, which provides a highly flexible and costeffective solution to many, embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash 256 bytes of RAM 32 I/O lines Watchdog timer Two data pointers Three 16-bit timer/counters A six-vector two-level interrupt architecture A full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes.











timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt. The hardware is driven by a set of program instructions, or software. Once familiar with hardware and software, the user can then apply the microcontroller to the problems easily. The pin diagram of the 8051 shows all of the input/output pins unique to microcontrollers:

The following are some of the capabilities of 8051 microcontroller. Internal ROM and RAM I/O ports with programmable pins Timers and counters Serial data communication

The 8051 architecture consists of these specific features: 16 bit PC &data pointer (DPTR) 8 bit program status word (PSW)

8 bit stack pointer (SP) Internal ROM 4k Internal RAM of 128 bytes. 4 register banks, each containing 8 registers 80 bits of general purpose data memory 32 input/output pins arranged as four 8 bit ports: P0-P3

Two 16 bit timer/counters: T0-T1 Two external and three internal interrupt sources Oscillator and clock circuits.

BASIC COMPONENTS:STEP DOWN TRANSFORMER Step down transformer converts 220 volt Ac to 9-0-9 ac. We use step down transformer to step down the voltage from 220 to 9 volt ac. This AC is further

connected to the rectifier circuit for AC to DC conversion. Transformer current rating is 750 ma.

In this project we use IN 4007 diode as a rectifier. IN 4007 is special diode to convert the AC into DC. In this project we use two diode as a rectifier. Here we use full wave rectifier. Output of rectifier is pulsating DC. To convert the pulsating dc into smooth dc we use Electrolytic capacitor as a main filter. Capacitor converts the pulsating dc into smooth dc and this DC is connected to the Regulator circuit for Regulated 5 volt DC.


Output of the diode is pulsating dc .So to convert the pulsating dc into smooth dc we use electrolytic capacitor. Electrolytic capacitor converts the pulsating dc into smooth dc. This Dc is further regulated by the IC 7805 regulator. IC 7805 regulator provide a regulated 5 volt dc to the microcontroller circuit and LCD circuit. Pin no 40 of the controller is connected to the positive supply. Pin no 20 is connected to the ground. Pin no 9 is connected to external resistor capacitor to provide a automatic reset option when power is on.

Reset Circuitry:
Pin no 9 of the controller is connected to the reset circuit. In the circuit we connect one resistor and capacitor circuit to provide a reset option when power is ON.
As soon as you give the power supply the 8051 doesnt start. You need to restart for the microcontroller to start. Restarting the microcontroller is nothing but giving a Logic 1 to the reset pin at least for the 2 clock pulses. So it is good to go for a small circuit which can provide the 2 clock pulses as soon as the microcontroller is powered.

This is not a big circuit we are just using a capacitor to charge the microcontroller and again discharging via resistor.

Pin no 18 and 19 is connected to external crystal oscillator to provide a clock to the circuit.
Crystals provide the synchronization of the internal function and to the peripherals. Whenever ever we are using crystals we need to put the capacitor behind it to make it free from noises. It is good to go for a 33pf capacitor.

We can also resonators instead of costly crystal which are low cost and external capacitor can be avoided. But the frequency of the resonators varies a lot. And it is strictly not advised when used for communications projects.

How is this time then calculated?

The speed with which a microcontroller executes instructions is determined by what is known as the crystal speed. A crystal is a component connected externally to the microcontroller. The crystal has different values, and some of the used values are 6MHZ, 10MHZ, and 11.059 MHz etc. Thus a 10MHZ crystal would pulse at the rate of 10,000,000 times per second.

The time is calculated using the formula No of cycles per second = Crystal frequency in HZ / 12. For a 10MHZ crystal the number of cycles would be, 10,000,000/12=833333.33333 cycles. This means that in one second, the microcontroller would execute 833333.33333 cycles.

PIN DESCRIPTION OF MICROCONTROLLER:Pin no 1 to pin no 8 is PORT 1 and Pin no 10 to 17 is PORT 3. Pin no 18 and 19 of the IC is connected to the external crystal to provide a external clock to run the internal CPU of controller. Pin no 20 is ground pin. Pin no 21 to 28 is PORT 2 pins. Pin no 29,30,31 is not use in this project. We use these pin when we require a extra memory for the project. If we internal memory of the 89s51 ( which is 4k rom) then we connect pin no 31 to the positive supply.




P1. 3



D0 D0 D0

+5 V 10K PO T

P1. 6

D7 RS R/ W E

P1. P1. 0 P1. 1 2


Pin 1 2 3 4


I/O ------I

Description Ground +5V Power Supply Contrast control RS=0 to select command register, RS=1 to select data register


0 = for write, 1 = for read

6 7 8 9 10 11 12 13 14



Enable (Clock) The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus

LCD Command Codes Code (Hex)

1 2 4 6 5 7 8 A C E F 10 14 18 1C 80 C0 38

Command on LCD
Clear display screen Return home Decrement cursor (shift cursor to left) Increment cursor (Shift cursor to right) Shift display right Shift display left Display off, cursor off Display off, cursor on Display on, cursor off Display on, cursor on Display on, cursor blinking Shift cursor position to left Shift cursor position to right Shift the entire display to left Shift the entire display to right Force cursor to beginning of 1st line Force cursor to beginning of 2nd line 2 lines and 5x7 matrix


Port Declaration: Port 0:- LCD Port2:- KEY 1-7, 9

Port 3.4-3.7:-KEY 8, 0, SET, RESET Port3.3:- Enter (Motor Starting Switch) Port1.1:- To Indicate Switching ON/OFF Motor Port1.0:- Password Set Indicator

STEPS TO PREPARE MICRO-CONTROLLER FOR PROGRAM EXECUTION:STEP1. Move #00H to PSW -Carry, Auxiliary carry, Overflow, Parity Flag = 0. -Register Bank 0 STEP2. Move SP, #70H -To Use Memory locations 70H-78H as Stack STEP3. Move TMOD, #20H -Timer 1 in Mode 2 STEP4. Move TCON, #00H -To Reset All Timer Flag & Run Control Bits -To Reset All Interrupt Edge Flag & Type Control Bits

1. Prepare microcontroller For Operation. 2. Load Timer 1 for Required Baud rate. 3. Configure All Ports as Input Port. 4. Make LCD To Show ENTER MOBILE NO 5. Allocate Memory to Store the Enter No. 6. Activate Keypad To Enter No. 7. Store No. If of 10 Digits else Show INCorrect No. 8. Show Stop on LCD. 9. Put 0 At P1.0 To Show Mobile No. Is Stored. 10. 11. 12. 13. 14. 15.

Wait For Starting Of Motor (Logic 0 at P3.3). Make LCD To Show ENTER PASSWORD Allocate Memory to Store the Enter No. Activate Keypad To Enter No. . Compare With Stored Password.

Grant Access if Password Is Valid & Wait Until Motor Is Switched OFF. When Motor Is Switched ON Go to Step 10.



If Password Is Incorrect Make LCD To Show INVALID PASSWORD. Put Logic 0 on P1.1 & P1.0.

18. 19.

Activate GSM Modem To Alert The OWNER & Wait For Response.

STEPS TO SHOW MESSAGE ON LCD 1. Activate LCD in 4-bit Mode. 2. Configure LCD as 16*2 Matrix of 5*7. 3. Clear LCD. 4. Put Data/Command Information On Data Bus Of LCD. Issue Control Signal.

STEPS TO WRITE Data/Command Information ON LCD 1. Put Logic 0 on bit P0.0 For Command & Logic 1 for Data. 2. Put Logic 0 on bit P0.2. 3. Put Logic 0 on bit P0.1. 4. Move Data to Accumulator.

5. Move Upper Nibble of A to Data Bus of LCD. 6. Apply HIGH to LOW Pulse On Enable Pin Of LCD. 7. Data Sending Complete Return Else Rotate A & Go Back To Step4.

STEPS TO READ DATA FROM KEYPAD 1. Check For Logic 0 on Key If Found Go To Step 2 Else To Step 5. 2. Check Again After Appropriate Delay For Logic 0 on Key If Found Go To Step 3 Else To Step 5. 3. Store and Move ASCII Code if Numeric Keys write on LCD else call for appropriate subroutines. 4. Check For Debounce Of Key If Debounces Go To Step 5 To Check For Next Key Input Else Wait. 5. Check For Key Logic 0 On Next Key IF Found Go To Step 2.

STEPS TO COMMUNICATE WITH MODEM 1. Initialize Modem & Microcontroller to Communicate Serially.

2. To Transmit Data Move Data from Memory to Acc & Then to SBuf Register & Clear tr0. 3. Wait For Setting Of T1. 4. To Receive Data Wait For Rising of R1 If Raises Go To Next Step Else Wait. 5. Move Data from SBuf to Acc Then to Required Memory Location.

Register Declaration LCD_Data:- To Communicate Data to LCD Trans_Data:- To Communicate with MODEM