You are on page 1of 25

CHAPTER 1

INTRODUCTION

The main aim of this project is to get the immediate intimation of occurrence of accidents; this system uses GPS receiver/transmitter, GSM receiver/transmitter with a micro controller. When an accident occurs, sensor will sense and send the intimation to microcontoller. Microcontroller will get the position where the accident has occurred through GPS-Global Positioning System. The number to which message has to be sent is stored in EEPROM. Microcontroller fetch the number from EEPROM and will send message through GSM-Global System For Mobile Communication.

CHAPTER 2 BLOCK DIAGRAM

CHAPTER 3 COMPONENTS USED


Power Supply 5v DC Micro controller External EEPROM memory Serial Communication 7805

- AT89C51-Atmel (www.Atmel.Com) - AT24C04 MAX 232

GSM modem (900/1800 MHz) DB9 connector

3.1 POWER SUPPLY


The microcontroller and other devices get power supply from AC to Dc adapter through voltage regulator. The adapter output voltage will be 13V DC non-regulated. The 7805 voltage regulators are used to convert 13 V to 5VDC.

AC Power

AC/DC Adapter

Regulator (7805)

Filter

DC Output

Fig.3.1(a) The operation of power supply circuits built using filters, rectifiers, and then voltage regulators. Starting with an AC voltage, a steady DC voltage is obtained by rectifying the AC voltage, Then filtering to a DC level, and finally, regulating to obtain a desired fixed DC voltage. The regulation is usually obtained from an IC voltage regulator Unit, which takes a DC voltage and provides a somewhat lower DC voltage, Which remains the same even if the input DC voltage varies, or the output Load connected to the DC voltage changes.

3.2 Power Supply Circuit

D J P 2 1 2 2 0 V A 2 2 -

V + 4 1 V GND IV N O U 7 u F 8 2 2 0 C 1 5 0 6 0 u C F0 . 1 D 7 u 2 R 2 F U T

D V 4

D D D

C 3

C 4

0 3

Fig.3.1 (b)

3.3 Microcontroller
3.3.1 Introduction Despite its relatively old age, the 8051 is one of the most popular micro controllers in use today. Many derivative micro controllers have since been developed that are based on--and compatible with--the 8051. Thus, the ability to program an 8051 is an important skill for anyone who plans to develop products that will take advantage of micro controllers.

3.3.2 NEED OF MICROCONTROLLER A microcontroller (also MCU or C) is a functional computer system-on-a-chip. It contains a processor core, memory, and programmable input/output peripherals. Microcontrollers include an integrated CPU, memory (a small amount of RAM, program memory, or both) and peripherals capable of input and output.

3.3.3 AT89S51 PIN DIAGRAM

P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 RST (RXD)P3.0 (TXD)P3.1 (INT0)P3.2 (INT1)P3.3 (T0)P3.4 (T1)P3.5 (WR)P3.6 (RD)P3.7 XTAL2 XTAL1 GND

1 2 3 4 5 6 7 8 9 1 1 0 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 2 9 0

8051 (8031 )

4 3 0 3 9 3 8 3 7 3 6 3 5 3 4 3 2 31 3 2 0 2 9 2 8 2 7 2 6 2 5 2 4 2 3 2 1

Vcc P0.0(AD 0) P0.1(AD1) P0.2(AD P0.3(AD3 2) P ) 0.4(AD4 ) P0.5(AD5) P0.6(AD6) P0.7(AD7 ) EA/VPP ALE/PROG PSEN P2.7(A15) P2.6(A14 P ) 2.5(A13 P ) 2.4(A12 P ) 2.3(A11 ) P2.2(A10) P2.1(A9) P2.0(A8)

Fig.3 (a)

3.3.4 FEATURES

8-bit control unit 8-bit arithmetic logic unit (ALU) with 8 x 8-bit multiplication and division Instruction decoder Four 8-bit input/output ports Two 16-bit timers/counters Serial peripheral interface in full duplex mode Two-level priority interrupt system Five interrupt sources Internal clock prescaler and phase generator 256 bytes of read/write data memory 64 Kbytes of external program memory space

3.3.5 DISCRIPTION The 8051 microcontroller unit is a fast, single-chip, and is a derivative of the 80C51 microcontroller family. It is a fully functional 8-bit embedded controller that executes all ASM51 instructions and has the same instruction set as the 80C51. The 8051 accesses instructions from two kinds of program memory, serves software and hardware interrupts, and provides serial communications interface and timer systems. The 8051 microcontroller unit is a high-performance, synthesizable 80C51 function specifically designed for reusability. It can operate at frequencies up to 14 MHz in FLEX devices. The 8051 consists of the following modules:

Functional core8051 mega function Program memoryInternal_Program_Memory

Data memoryInternal_Data_Memory Open-drain I/O pinsOPNDRN

The 8051 is an 8-bit microprocessor originally designed in the 1980's by Intel that has gained great popularity since its introduction. Its standard form includes several standard on-chip peripherals, including timers, counters, and UART's, plus 4kbytes of on-chip program memory and 128 bytes (note: bytes, not Kbytes) of data memory, making singlechip implementations possible. Its hundreds of derivatives, manufactured by several different companies (like Philips) include even more on-chip peripherals, such as analogdigital converters, pulse-width modulators, I2C bus interfaces, etc. Costing only a few dollars per IC, the 8051 is estimated to be used in a large percentage (maybe 1/2?) all embedded system products. The 8051 memory architecture includes 128 bytes of data memory that are accessible directly by its instructions. A 32-byte segment of this 128-byte memory block is bit addressable by a subset of the 8051 instructions, namely the bit-instructions. External memory of up to 64 Kbytes is accessable by a special "movx" instruction. Up to 4 Kbytes of program instructions can be stored in the internal memory of the 8051, or the 8051 can be configured to use up to 64 Kbytes of external program memory The majority of the 8051's instructions are executed within 12 clock cycles

3.4 RS 232 CONVERTER (MAX 232N) Serial Port: This is the device, which is used to convert TTL/RS232 vice versa. 3.4.1 RS-232Protocol In telecommunications, RS-232 is a standard for serial binary data interconnection between a DTE (Data terminal equipment) and a DCE (Data Circuit-terminating Equipment). It is commonly used in computer serial ports. The RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels. Valid signals are plus or minus 3 to 15 volts. The range near zero volts is not a valid RS-232 level; logic one is defined as a

negative voltage, the signal condition is called marking, and has the functional significance of OFF. RS-232 was created for one purpose, to interface between Data Terminal Equipment (DTE) and Data Communications Equipment (DCE) employing serial binary data interchange. So as stated the DTE is the terminal or computer and the DCE is the modem or other communications device. RS-232 pin-outs for IBM compatible computers are shown below. There are two configurations that are typically used: one for a 9-pin connector and the other for a 25-pin connector.

Fig3.4(a)

3.5 DB9 CONNECTOR The term "DB9" refers to a common connector type, one of the D-Subminiature or D-Sub types of connectors. DB9 has the smallest "footprint" of the D-Subminiature connectors, and houses 9 pins (for the male connector) or 9 holes (for the female connector). DB9 connectors were once very common on PCs and servers. DB9 connectors are designed to work with the EIA/TIA 232 serial interface standard, which determined the function of all nine pins as a standard, so that multiple companies could design them into their products. DB9 connectors were commonly used for serial peripheral devices like keyboards, mice, joysticks, etc. Today, the DB9 has mostly been replaced by more modern interfaces such as USB, PS/2, Firewire, and others. However, there are still many legacy devices that use the DB9 interface for serial communication

Fig.3.5(a)

3.6 EEPROM 24C04 3.6.1 FEATURES Low-voltage and Standard-voltage Operation 2.7 (VCC = 2.7V to 5.5V) 1.8 (VCC = 1.8V to 5.5V) Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K), 1024 x 8 (8K) or 2048 x 8 (16K) 2-wire Serial Interface Schmitt Trigger, Filtered Inputs for Noise Suppression Bi-directional Data Transfer Protocol 100 kHz (1.8V, 2.5V, 2.7V) and 400 kHz (5V) Compatibility Write Protect Pin for Hardware Data Protection 8-byte Page (1K, 2K), 16-byte Page (4K, 8K, 16K) Write Modes Partial Page Writes are Allowed Self-timed Write Cycle (10 ms max) High-reliability Endurance: 1 Million Write Cycles Data Retention: 100 Years Automotive Grade, Extended Temperature and Lead-Free Devices Available 8-lead PDIP, 8-lead JEDEC SOIC, 8-lead MAP, 5-lead SOT23, 8-lead TSSOP and 8-ball dBGA2 Packages 3.6.2 DESCRIPTION The AT24C01A/02/04/08/16 provides 1024/2048/4096/8192/16384 bits of serial electrically erasable and programmable read-only memory (EEPROM) organized as128/256/512/1024/2048 words of 8 bits each. The device is optimized for use in many industrial and commercial applications where low-power and low-voltage operation are

essential. The AT24C01A/02/04/08/16 is available in space-saving 8-lead PDIP, 8-lead JEDEC SOIC, 8-lead MAP, 5-lead SOT23 (AT24C01A/AT24C02/AT24C04), 8-lead TSSOP and 8-ball dBGA2 packages and is accessed via a 2-wire serial interface. In addition, the entire family is available in 2.7V (2.7V to 5.5V) and 1.8V (1.8V to 5.5V) versions. PIN DIAGRAM

Fig.3.6(a)

3.7 GSM MODEM (900/1800 MHz) 3.7.1 GSM MODEM A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a dial-up modem. The main difference between them is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves. A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically, an external GSM modem is connected to a computer through a serial cable or a USB cable. Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate.

3.7.2 AT COMMANDS Computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands. GSM modems support an extended set of AT commands. 3.7.3OPERATIONS Reading, writing and deleting SMS messages. Sending SMS messages. Monitoring the signal strength. Monitoring the charging status and charge level of the battery. Reading, writing and searching phone book entries. GSM phone or modem supports SMS text mode Check if your GSM phone or modem supports SMS text mode To check if your modem supports this text mode, you can try the following command: AT+CMGF=1 <ENTER> If the modem responds with "OK" this mode is supported.

3.7.4 HOW TO SEND SMS USING AT COMMANDS Sending the message.. To send the SMS message, type the following command:

AT+CMGS="+31638740161" <ENTER> Replace the above phone number with your own cell phone number. The modem will respond with: > You can now type the message text and send the message using the <CTRL>-<Z> key combination: Hello World ! <CTRL-Z> After some seconds the modem will respond with the message ID of the message, indicating that the message was sent correctly: +CMGS: 62

3.3.8 PRESSURE SENSOR

The effect is explained by the displacement of ions in crystals that have a nonsymmetrical unit cell When the crystal is compressed, the ions in each unit cell are displaced, causing the electric polarization of the unit cell. Because of the regularity of crystalline structure, these effects accumulate, causing the appearance of an electric potential difference between certain faces of the crystal. When an external electric field is applied to the crystal, the ions in each unit cell are displaced by electrostatic forces, resulting in the mechanical deformation of the whole crystal.

Examples --- Quartz, Barium titanate, tourmaline

Fig.3.7(a)

This sensor buffers a piezoelectric transducer. As the transducer is displaced from the mechanical neutral axis, bending creates strain within the piezoelectric element and generates voltages. If the assembly is supported by its mounting points and left to vibrate in free space the device will behave as a form of vibration sensor. The sensing element should not be treated as a flexible switch, and is not intended to be bent. Sensor Value 500 roughly corresponds to 0g acceleration. Acceleration will deflect the sensing element up or down, causing Sensor Value to swing either way. This sensor is not meant to measure precise acceleration and vibration - use it to detect an acceleration impulse, or the presence of vibration.

CHAPTER 4 SOFTWARE TOOLS USED

KEIL IDE Compiler Linker Simulator Debugger Flash Programmer ORCAD DESIGN Schematic Layout

Embedded C

4.1 KEIL IDE Integrated development environment popularly known as IDE is a suite of software tools that facilitates microcontroller programming. The Keil IDE enables the embedded professional to develop the program in C and assembly as well. The IDE passes through the source code to check the syntax. The compilation leads to a hex file to be dumped in the microcontroller on-chip ROM. A quick session of simulation and debugging using the IDE ensures the working of the program beforehand. The user can verify the results as the package presents screenshots of on-chip resources. This chapter presents in-depth discussion on using the Vision 2 package of Keil IDE on MS Windows platform. It is recommended that while going through the discussion the user should access the Vision 2 package of the Keil. A step-by-step working as discussed in this chapter will empower the user to get familiar with the Keil IDE.

Fig.4.1(a) KEIL IDE

4.2 ORCAD OrCAD is a proprietary software tool suite used primarily for electronic design automation. The software is used mainly to create electronic prints for manufacturing of printed circuit boards, by electronic design engineers and electronic technicians to manufacture electronic schematics and diagrams, and for their simulation. The name OrCAD is a portmanteau, reflecting the software's origins: Oregon + CAD. The OrCAD product line is fully owned by Cadence Design Systems. The latest iteration has the ability to maintain a database of available integrated circuits. This database may be updated by the user by downloading packages from component manufacturers, such as Analog Devices or Texas Instruments.

Fig.4.2

4.3 FLASH PROGRAMER Straightforward and intuitive user interface Five simple steps to erasing and programming a device and setting any options desired Programs Intel Hex Files Automatic verifying after programming Fills unused Flash to increase firmware security Ability to automatically program checksums. Using the supplied checksum calculation routine your firmware can easily verify the integrity of a Flash block, ensuring no unauthorized or corrupted code can ever be executed Program security bits Check which Flash blocks are blank or in use with the ability to easily erase all blocks in use Read the device signature Read any section of Flash and save as an Intel Hex File Reprogram the Boot Vector and Status Byte with the help of confirmation features that prevent accidentally programming incorrect values Display the contents of Flash in ASCII and Hexadecimal formats

Single-click access to the manual, Flash Magic home page and NXP Microcontrollers home page Ability to use high-speed serial communications on devices that support it. Flash Magic calculates the highest baudrate that both the device and your PC can use and switches to that baudrate transparently 4.4 EMBEDDED C The C for microcontrollers and the standard C syntax and semantics are slightly different. The former is aimed at the general purpose programming paradigm whereas the latter is for a specific target microcontroller such as 8051 or PIC. The underlying fact is that everything will be ultimately mapped into the microcontroller machine code. If a certain feature such as indirect access to I/O registers is inhibited in the target microcontroller, the compiler will also restrict the same at higher level. Similarly some C operators which are meant for general purpose computing are also not available with the C for microcontrollers. Even theoperators and constructs which may lead to memory inefficiency are not available in C programming meant for microcontrollers. Be aware that the target code should fit in the limited on-chip memory of the processor. Even the I/O functions available in standard C such as printf() or scanf() are either not made available in C compilers for microcontrollers or advised not to use them. These functions eat up lot of memory space and are not time-efficient owing to the dragging of supporting functions like floating point routines and lot of delimiters. Another striking difference in case of embedded systems programs is that they do nothave the umbrella or support of the operating system. The programmer has to be accustomed with the absence of system calls which makes life easy in traditional C.

CHAPTER 5 GSM (GLOBAL SYSTEM FOR MOBILE COMMUNICATIONS)


GSM (Global System for Mobile Communications), is a standard set developed by the European Telecommunications Standards Institute (ETSI) to describe technologies for second generation (or "2G") digital cellular networks. Developed as a replacement for first generation analog cellular networks, the GSM standard originally described a digital, circuit switched network optimized for full duplex voice telephony. 2G GSM networks operating in the 900 MHz or 1800 MHz bands. Where these bands were already allocated, the 850 MHz and 1900 MHz bands were used instead. In rare cases the 400 and 450 MHz frequency bands are assigned in some countries because they were previously used for first-generation systems. The protocol used by GSM modems for setup and control is based on the Hayes AT-Command set. The GSM modem specific commands are adapted to the services offered by a GSM modem such as: text messaging, calling a given Phone number, deleting memory locations etc. Since the main objective for this application note is to show how to send and receive text messages, only a subset of the AT-Command set needs to be implemented. The European Telecommunication Standard Institute (ETSI) GSM 07.05 defines the AT-Command interface for GSM compatible modems. From this document some selected commands are chosen, and presented briefly in this section. This command subset will enable the modem to send and receive SMS messages.

Fig 5.a GSM Architecture

A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a dial-up modem. The main difference between them is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves. A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically, an external GSM modem is connected to a

computer through a serial cable or a USB cable. A GSM modem in the form of a PC Card / PCMCIA Card is designed for use with a laptop computer. It should be inserted into one of the PC Card / PCMCIA Card slots of a laptop computer. Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate. As mentioned in earlier sections of this SMS tutorial, computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands. You can use a GSM modem just like a dial-up modem. In addition to the standard AT commands, GSM modems support an extended set of AT commands. These extended AT commands are defined in the GSM standards. With the extended AT commands, you can do things like: Reading, writing and deleting SMS messages. Sending SMS messages. Monitoring the signal strength. Monitoring the charging status and charge level of the battery. Reading, writing and searching phone book entries. The number of SMS messages that can be processed by a GSM modem per minute is very low only about six to ten SMS messages per minute.

5.1 SERVICE PROVIDED BY GSM From the beginning, the planners of GSM wanted ISDN compatibility in terms of the services offered and the control signalling used. However, radio transmission limitations, in terms of bandwidth and cost, do not allow the standard ISDN B-channel bit rate of 64 kbps to be practically achieved. Using the ITU-T definitions, telecommunication services can be divided into bearer services, teleservices, and supplementary services. The most basic teleservice supported by

GSM is telephony. As with all other communications, speech is digitally encoded and transmitted through the GSM network as a digital stream. There is also an emergency service, where the nearest emergency-service provider is notified by dialing three digits (similar to 911). A variety of data services is offered. GSM users can send and receive data, at rates up to 9600 bps, to users on POTS (Plain Old Telephone Service), ISDN, Packet Switched Public Data Networks, and Circuit Switched Public Data Networks using a variety of access methods and protocols, such as X.25 or X.32. Since GSM is a digital network, a modem is not required between the user and GSM network, although an audio modem is required inside the GSM network to interwork with POTS. Other data services include Group 3 facsimile, as described in ITU-T recommendation T.30, which is supported by use of an appropriate fax adaptor. A unique feature of GSM, not found in older analog systems, is the Short Message Service (SMS). SMS is a bidirectional service for short alphanumeric (up to 160 bytes) messages. Messages are transported in a store-and-forward fashion. For point-to-point SMS, a message can be sent to another subscriber to the service, and an acknowledgement of receipt is provided to the sender. SMS can also be used in a cell-broadcast mode, for sending messages such as traffic updates or news updates. Messages can also be stored in the SIM card for later retrieval . Supplementary services are provided on top of teleservices or bearer services. In the current (Phase I) specifications, they include several forms of call forward (such as call forwarding when the mobile subscriber is unreachable by the network), and call barring of outgoing or incoming calls, for example when roaming in another country. Many additional supplementary services will be provided in the Phase 2 specifications, such as caller identification, call waiting, multi-party conversations.

You might also like