+ All Categories
Home > Education > AIR BAG CRASH USING MEMS

AIR BAG CRASH USING MEMS

Date post: 12-Aug-2015
Category:
Upload: ganesh-gani
View: 278 times
Download: 2 times
Share this document with a friend
Popular Tags:
62
i Mini project report on AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS Submitted in partial fulfillment of mini project for the award of the degree of BACHELOR OF TECHNOLOGY IN ELECTRONICS AND COMMUNICATION ENGINEERING Submitted By K.NAVYA REGD.NO:11631A0449 S.HARI KRISHNA REGD.NO:11631A0421 P.GANESH REGD.NO:11631A0418 N.RAJIV REGD.NO:11631A0458 Under the esteemed guidance of B.SWETHA M.tech Department of Electronics & Communication Engineering SRI VENKATESWARA ENGINEERING COLLEGE Amarvadi Nagar, Sponsored by the exhibition society, HYDERABAD, Approved by AICTE, Affiliated to Jawaharlal Nehru Technological University, HYDERABAD, Suryapet-508213, Nalgonda Dist. 2014-2015
Transcript
Page 1: AIR BAG CRASH USING MEMS

i

Mini project report on

AIR BAG CRASH SENSOR DEVELOPMENT USING

MEMS

Submitted in partial fulfillment of mini project for the award of the degree of

BACHELOR OF TECHNOLOGY

IN

ELECTRONICS AND COMMUNICATION ENGINEERING

Submitted By

K.NAVYA REGD.NO:11631A0449

S.HARI KRISHNA REGD.NO:11631A0421

P.GANESH REGD.NO:11631A0418

N.RAJIV REGD.NO:11631A0458

Under the esteemed guidance of

B.SWETHA M.tech

Department of Electronics & Communication Engineering

SRI VENKATESWARA ENGINEERING COLLEGE

Amarvadi Nagar, Sponsored by the exhibition society, HYDERABAD, Approved by AICTE,

Affiliated to Jawaharlal Nehru Technological University, HYDERABAD, Suryapet-508213,

Nalgonda Dist. 2014-2015

Page 2: AIR BAG CRASH USING MEMS

ii

SRI VENKATESWARA ENGINEERING COLLEGE

Amaravadi Nagar, Sponsored by The Exhibition Society, HYDERABAD, Approved by AICTE, Affiliated to

Jawaharlal Nehru Technological University, Hyderabad Suryapet-508213, Nalgonda Dist.

2014-2015

Department of Electronics & Communication Engineering

CERTIFICATE

This is to certify that the project report titled as "AIR BAG CRASH

SENSOR DEVELOPMENT USING MEMS" being submitted by K.NAVYA

(11631A0449), S.HARIKRISHNA (11631A0421), P.GANESH (11631A0418), and

N.RAJIV (1631A0458) from IV B.Tech I semester of Electronics and Communication

Engineering is a record bonafide work carried out by us. The results embodied in this

report have not been submitted to any other University for the award of any degree.

Signature of the Guide Signature of the H.O.D

Signature of the External Signature of the Principal

Page 3: AIR BAG CRASH USING MEMS

iii

DECLARATION

We the Students of B.Tech in ELECTRONICS & COMMUNICATION

ENGINEERING of Sri Venkateswara Engineering College, Suryapet, hereby declare that

the project with title “GSM BASED WIRELESS NOTICE BOARD” Is the original

work done by us.

To the Best of us Knowledge and belief we hereby declare that this project bears

no resemblance to any other project submitted at Sri Venkateswara Engineering College,

Suryapet or any other college affiliated to Jawaharlal Nehru Technological University,

Hyderabad for the award of the degree.

Place:

Date:

Project associates

K.NAVYA - 11631A0449

S.HARI KRISHNA - 11631A0421

P. GANESH - 11631A0418

N.RAJIV - 11631A0458

Page 4: AIR BAG CRASH USING MEMS

iv

ACKNOWLEDGEMENT

we sincerely thank our principal Dr.A.SRUJANA for her timely suggestions,

which helped me to complete this work successfully.

It is my privilege to thank Mr. E.NARENDRA, Associate Professor &I/C HOD

of ECE Department for her encouragement during the progress of this project work.

we express my sincere thanks to my supervisor B. SWETHA for giving me moral

support, kind attention and valuable guidance to me throughout this project work.

we thank to both teaching and non-teaching staff members of ECE Department

for their kind cooperation and all sorts of help to bring out this project work successfully.

By

K.NAVYA - 11631A0449

S.HARI KRISHNA - 11631A0421

P. GANESH - 11631A0418

N.RAJIV - 11631A0458

Page 5: AIR BAG CRASH USING MEMS

v

ABSTRACT

An airbag crash sensor system is a vehicle safety device. It is an occupant

restraint consisting of a flexible envelope designed to inflate rapidly during an

automobile collision, to prevent occupants from striking interior objects such as the

steering wheel or a window.

Modern vehicles may contain multiple airbags in various side and frontal

locations of the passenger seating positions, and sensors may deploy one or more airbags

in an impact zone at variable rates based on the type and severity of impact the airbag is

designed to only inflate in mild to severe frontal crashes. Airbags are normally designed

with the intention of supplementing the protection of an occupant who is correctly

restrained with a seatbelt. Air bag operation in this project is shown by tripping the relay

in which led or a DC motor turns on. When ever any accident occur means any

Disturbance caused to MEMS sensor which was arranged in critical angle detects and

sends mechanical force to controller hence the air bag release in the form of relay

tripping.

Page 6: AIR BAG CRASH USING MEMS

i

INDEX

CONTENTS PAGE NO

CHAPTER 1: INTRODUCTION 1

1.1 EMBEDDED SYSTEM 1

1.2 CHARACTERISTICS OF EMBEDDED SYSTEM 1

1.3 APPLICATION 2

1.4 CLASSSIFICATION 2

1.4.1 RTS CLASSIFICATION 3

1.4.1.1 HARD REAL TIME SYSTEM 3

1.4.1.2 SOFT REAL TIME SYSTEM 3

CHAPTER 2: BLOCK DIAGRAM 4

CHAPTER 3: HARDWARE REQUIREMENTS 5

3.1 TRNSFORMER 6

3.1.1 IDEAL POWER EQUATION 7

3.2 VOLTAGE REGULATOR (LM7805) 8

3.2.1 INTERNAL BLOCK DIAGRAM 9

3.2.2 ABSOLUTE MAXIMUM RATINGS 9

3.3 RECTIFIER 10

3.4 FILTER 10

3.5 MICROCONTROLLER (AT89S52/C51) 11

3.5.1 BLOCK DIAGRAM OF AT89S52 13

3.5.2 PIN CONFIGURATIONS OF AT89S52 14

3.5.3 OSCILLATOR CHARACTERISTICS 16

3.6 MEMS 17

3.6.1 PIN DESCRIPTION 19

3.6.2 ELECTRO STATIC DISCHARGE (ESD) 19

3.6.3 PRINCIPLE OF OPERATION 20

3.6.4 MODES OF OPERATION 21

3.6.5 POWER SAVING FEATURES 21

Page 7: AIR BAG CRASH USING MEMS

ii

3.6.6 TESTING THE LOGIC CHAIN 22

3.6.7 TAP DETECTION 22

3.6.8 TAP DETECTION SETUP 22

3.6.9 SHAKE DETECTION 23

3.6.10 AUTO WAKE/SLEEP 23

3.6.11 START AND STP CONDITIONS 25

3.6.12 MESSAGE FORMAT FOR WRITING MMA7660FC 26

3.6.13 MESSAGE FORMAT FOR READING MMA7660FC 27

3.7LCD MODULE 27

CHAPTER 4: SOFTWARE REQUIREMENTS 31

4.1 INTRODUCTION TO KEIL MICRO VISION 31

4.2 CONCEPT OF COMPILER 31

4.3 CONCEPT OF CROSS COMPILER 32

4.4 KEIL C CROSS COMPILER 32

4.5 BUILDING AN APPLICATION UVISION2 32

4.6 CREATING YOUR OWN APPLICATION UVISION2 33

4.7 DEBUGGING AN APPLICATION IN UVISION2 33

4.8 STARTING UVISION2 & CREATING A PROJECT 33

4.9 WINDOWS_ FILES 34

4.10 BUILDING PROJECTS & CREATING HEX FILTERS 34

4.11 CPU SIMULATION 34

4.12 DATA SELECTION 35

4.13 START DEBUGGING 35

4.14 DISASSEMBLY WINDOW 35

4.15 EMBEDDED C 36

CHAPTER 5: SCHEMATIC DIAGRAM 37

5.1 OPERATION 38

CHAPTER 6: CODING 39

6.1 SOURCE CODE 39

6.2 FLOW CHART 46

Page 8: AIR BAG CRASH USING MEMS

iii

CHAPTER 7: HARDWARE TESTING 47

7.1 CONTINUITY TEST 47

7.2 POWER ON TEST 47

CHAPTER 8: CONCLUSION 48

CHAPTER 9: ADVANTAGES AND APPLICATIONS 50

CHAPTER 10: BIBILOGRAPHY 51

Page 9: AIR BAG CRASH USING MEMS

iv

LIST OF FIGURES

FIG NO NAME OF THE FIGURE PAGE NO

2.1 BLOCK DIAGRAM OF AIR BAG CRASH SENSOR 4

3.1.1 A TYPICAL TRANSFORMER 6

3.1.2 IDEAL POWER EQUATION 7

3.2.1 CIRCUIT DIAGRAM OF VOLTAGE REGULATOR 8

3.2.2 BLOCK DIAGRAM OF VOLTAGE REGULATOR 9

3.2.3 RATING OF THE VOLTAGE REGULATOR 9

3.3 BRIDGE RECTIFIER 10

3.4 FILTER OUTPUT 11

3.5 BLOCK DIAGRAM OF AT89S52 13

3.5.1 PIN DIAGRAM OF AT89S52 14

3.5.2 OSCILLATOR CONNECTIONS 17

3.5.3 EXTERNAL CLOCK DRIVE CONFIGURATION 17

3.6.1 AXIS ORIENTATION/MOTION DETECTION SENSOR 17

3.6.2 BOTTOM VIEW MMA 7660FC 18

3.6.3 PIN CONNECTIONS MMA 7660FC 18

3.6.5 MMA CONNECTIONS TO MCU 19

3.6.7 SIMPLIFIED TRANSDUCER PHYSICAL MODEL 20

3.6.11 BIT TRANSFER 25

3.6.12 ACKNOWLEDGE 26

3.6.13 SINGLE BYTE WRITE 26

3.6.14 MULTIPLE BYTES WRITE 27

3.6.15 SINGLE BYTE READ 27

3.6.16 MULTIPLE BYTES READ 27

3.7.1 2X16 LINE ALPHANUMERIC LCD DISPLAY 28

3.7.3 CONTROLLER TO LCD INTERPRETS 30

5 SCHEMATIC DIAGRAM OF AIR BAG CRUSH 37

6.2 FLOW CHART OF AIR BAG CRUSH SENSOR 46

Page 10: AIR BAG CRASH USING MEMS

v

LIST OF TABLES

TABLE NO NAME OF THE FIGURE PAGENO

3.2.3 RATING OF THE VOLTAGE REGULATOR 9

3.6.4 PIN DESCRIPTION MMA 7660FC 19

3.6.6 ESD AND LATCH-UP PROTECTION

CHARACTERISTICS 20

3.6.8 STATE MACHINE MODES 21

3.6.9 FEATURE SUMMARY TABLE 22

3.6.10 AUTO WAKE/SLEEP TRUTH TABLE 24

3.7.2 2*16 LCD PINS 29

Page 11: AIR BAG CRASH USING MEMS

vi

ABBREVIATIONS

ADDRESS LATCH ENABLE ALE

PROGRAM STORE ENABLE PSEN

EXTERNAL ACCESS EA

MICRO-ELECTRO-MECHANICAL SYSTEM MEMS

READ/WIRTE R/W

TIMER/COUNTERS C/T

ELECTRO STATIC DISCHARGE ESD

LIQUID CRYSTAL DISPLAY LCD

INTEGRATED DEVELOPMENT ENVIRONMENT IDE

HIGH LEVEL LANGUAGE HLL

IN-SYSTEM PROGRAMMABLE ISP

Page 12: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 1

CHAPTER-1

INTRODUCTION

1.1 EMBEDDED SYSTEMS

An Embedded System is a combination of computer hardware and software, and

perhaps additional mechanical or other parts, designed to perform a specific function. An

embedded system is a microcontroller-based, software driven, reliable, real-time control

system, autonomous, or human or network interactive, operating on diverse physical

variables and in diverse environments and sold into a competitive and cost conscious

market.

An embedded system is not a computer system that is used primarily for

processing, not a software system on PC or UNIX, not a traditional business or scientific

application. High-end embedded & lower end embedded systems. High-end embedded

system - Generally 32, 64 Bit Controllers used with OS. Examples Personal Digital

Assistant and Mobile phones etc.Lower end embedded systems - Generally 8,16 Bit

Controllers used with an minimal operating systems and hardware layout designed for the

specific purpose. Examples Small controllers and devices in our everyday life like

Washing Machine, Microwave Ovens, where they are embedded in.

1.2 CHARACTERISTICS OF EMBEDDED SYSTEMS

An embedded system is any computer system hidden inside a product other than a

computer.

They will encounter a number of difficulties when writing embedded system

software in addition to those we encounter when we write applications.

Throughput – Our system may need to handle a lot of data in a short period of

time.

Response–Our system may need to react to events quickly.

Testability–Setting up equipment to test embedded software can be difficult.

Debug ability–Without a screen or a keyboard, finding out what the software is

doing wrong (other than not working) is a troublesome problem.

Page 13: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 2

Reliability – embedded systems must be able to handle any situation without

human intervention.

Memory space – Memory is limited on embedded systems, and you must make

the software and the data fit into whatever memory exists.

Program installation – you will need special tools to get your software into

embedded systems.

Power consumption – Portable systems must run on battery power, and the

software in these systems must conserve power.

Processor hogs – computing that requires large amounts of CPU time can

complicate the response problem.

Cost – Reducing the cost of the hardware is a concern in many embedded system

projects; software often operates on hardware that is barely adequate for the job.

Embedded systems have a microprocessor/ microcontroller and a memory. Some

have a serial port or a network connection. They usually do not have keyboards,

screens or disk drives.

1.3 APPLICATIONS

Military and aerospace embedded software applications.

Communication applications.

Industrial automation and process control software.

Mastering the complexity of applications.

Reduction of product design time.

Real time processing of ever increasing amounts of data.

Intelligent, autonomous sensors.

1.4 CLASSIFICATION

Real Time Systems.

RTS is one which has to respond to events within a specified deadline.

A right answer after the dead line is a wrong answer.

Page 14: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 3

1.4.1 RTS CLASSIFICATION

Hard Real Time Systems.

Soft Real Time System.

1.4.1.1 HARD REAL TIME SYSTEM

"Hard" real-time systems have very narrow response time.

Example: Nuclear power system, Cardiac pacemaker.

1.4.1.2 SOFT REAL TIME SYSTEM

"Soft" real-time systems have reduced constrains on "lateness" but still must

operate very quickly and repeatable.

Example: Railway reservation system – takes a few extra seconds the data

remains valid.

Page 15: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 4

CHAPTER-2

BLOCK DIAGRAM

Figure 2.1: Block diagram of air bag crash sensor development using mems

AT89S52

MICRO

CONTROLLER

POWER SUPPLY

AIR BAG

INDICATORS

MEMS

LCD

DISPLAY

Page 16: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 5

CHAPTER-3

HARDWARE REQUIREMENTS

HARDWARE COMPONENTS

POWER SUPPLY

MICROCONTROLLER (AT89S52/AT89C51)

MEMS

LCD MODULE

Page 17: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 6

POWER SUPPLY

3.1 TRANSFORMER

Transformers convert AC electricity from one voltage to another with a little loss

of power. Step-up transformers increase voltage, step-down transformers reduce voltage.

Most power supplies use a step-down transformer to reduce the dangerously high voltage

to a safer low voltage.

Figure 3.1.1: A typical transformer

The input coil is called the primary and the output coil is called the secondary.

There is no electrical connection between the two coils; instead they are linked by an

alternating magnetic field created in the soft-iron core of the transformer. The two lines

in the middle of the circuit symbol represent the core. Transformers waste very little

power so the power out is (almost) equal to the power in. Note that as voltage is stepped

down and current is stepped up.

The ratio of the number of turns on each coil, called the turn’s ratio, determines

the ratio of the voltages. A step-down transformer has a large number of turns on its

primary (input) coil which is connected to the high voltage mains supply, and a small

number of turns on its secondary (output) coil to give a low output voltage.

TURNS RATIO = (Vp / Vs) = (Np / Ns)

Where,

Vp = primary (input) voltage.

Vs = secondary (output) voltage

Np = number of turns on primary coil

Page 18: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 7

Ns = number of turns on secondary coil

Ip = primary (input) current

Is = secondary (output) current.

3.1.1 IDEAL POWER EQUATION

Figure 3.1.2: Ideal power equation

The ideal transformer as a circuit element If the secondary coil is attached to a

load that allows current to flow, electrical power is transmitted from the primary circuit

to the secondary circuit. Ideally, the transformer is perfectly efficient; all the incoming

energy is transformed from the primary circuit to the magnetic field and into the

secondary circuit. If this condition is met, the incoming electric power must equal the

outgoing power:

Giving the ideal transformer equation

Transformers normally have high efficiency, so this formula is a reasonable

approximation.

If the voltage is increased, then the current is decreased by the same factor. The

impedance in one circuit is transformed by the square of the turn’s ratio. For example, if

an impedance Zs is attached across the terminals of the secondary coil, it appears to the

primary circuit to have an impedance of (Np/Ns)2Zs. This relationship is reciprocal, so that

the impedance Zp of the primary circuit appears to the secondary to be (Ns/Np)2Zp.

Page 19: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 8

3.2 VOLTAGE REGULATOR 7805

FEATURES

• Output Current up to 1A.

• Output Voltages of 5v.

• Thermal Overload Protection.

• Short Circuit Protection.

• Output Transistor Safe Operating Area Protection.

Figure 3.2.1: Circuit diagram of voltage regulator

DESCRIPTION

The LM78XX/LM78XXA series of three-terminal positive regulators are

available in the TO-220/D-PAK package and with several fixed output voltages, making

them useful in a Wide range of applications. Each type employs internal current limiting,

thermal shutdown and safe operating area protection, making it essentially indestructible.

If adequate heat sinking is provided, they can deliver over 1A output Current. Although

designed primarily as fixed voltage regulators, these devices can be used with external

components to obtain adjustable voltages and currents.

Page 20: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 9

3.2.1 INTERNAL BLOCK DIAGRAM

Figure 3.2.2: Block diagram of voltage regulator

3.2.2 ABSOLUTE MAXIMUM RATINGS

Table 3.2.3: Rating of the voltage regulator

Page 21: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 10

3.3 RECTIFIER

A rectifier is an electrical device that converts alternating current (AC), which

periodically reverses direction, to direct current (DC), current that flows in only one

direction, a process known as rectification. Rectifiers have many uses including as

components of power supplies and as detectors of radio signals. Rectifiers may be made

of solid state diodes, vacuum tube diodes, mercury arc valves, and other components. The

output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C.

The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier

is used because of its merits like good stability and full wave rectification. In positive half

cycle only two diodes( 1 set of parallel diodes) will conduct, in negative half cycle

remaining two diodes will conduct and they will conduct only in forward bias only.

Figure 3.3: Bridge rectifier

3.4 FILTER

Capacitive filter is used in this project. It removes the ripples from the output of

rectifier and smoothens the D.C. Output received from this filter is constant until the

mains voltage and load is maintained constant. However, if either of the two is varied,

D.C. voltage received at this point changes. Therefore a regulator is applied at the output

stage.

The simple capacitor filter is the most basic type of power supply filter. The use

of this filter is very limited. It is sometimes used on extremely high-voltage, low-current

power supplies for cathode-ray and similar electron tubes that require very little load

current from the supply. This filter is also used in circuits where the power-supply ripple

Page 22: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 11

frequency is not critical and can be relatively high. Below figure can show how the

capacitor charges and discharges.

Figure 3.4: Filter output

3.5 Microcontroller AT89S52

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 Atmel’s high-density non volatile memory technology and is compatible with the

industry standard 80C51 instruction set and pin out. The on-chip Flash allows the

program memory to be reprogrammed in-system or by a conventional non volatile

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 cost-effective 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. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial

port, and interrupt system to continue functioning. The Power-down mode saves the

Page 23: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 12

RAM contents but freezes the oscillator, disabling all other chip functions until the next

interrupt or hardware reset.

FEATURES

Compatible with MCS®-51 Products

8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 10,000

Write/Erase Cycles

4.0V to 5.5V Operating Range

Fully Static Operation: 0 Hz to 33 MHz

Three-level Program Memory Lock

256 x 8-bit Internal RAM

32 Programmable I/O Lines

Three 16-bit Timer/Counters

Eight Interrupt Sources

Full Duplex UART Serial Channel

Low-power Idle and Power-down Modes

Interrupt Recovery from Power-down Mode

Watchdog Timer

Dual Data Pointer

Power-off Flag

Fast Programming Time

Flexible ISP Programming (Byte and Page Mode)

Green (Pb/Halide-free) Packaging Option

Page 24: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 13

3.5.1 BLOCK DIAGRAM OF AT89S52

Figure 3.5 : Block diagram of AT89S52

Page 25: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 14

3.5.2 PIN CONFIGURATIONS OF AT89S52

Figure 3.5.1: Pin diagram of AT89S52

PIN DESCRIPTION

VCC

Supply voltage.

GND

Ground.

Port 0

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can

sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-

impedance inputs. Port 0 can also be configured to be the multiplexed low-order

address/data bus during accesses to external program and data memory. In this mode, P0

has internal pull-ups. Port 0 also receives the code bytes during Flash programming and

Page 26: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 15

outputs the code bytes during program verification. External pull-ups are required during

program verification.

Port 1

Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output

buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are

pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that

are externally being pulled low will source current (IIL) because of the internal pull-ups.

In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count

input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX).

Port 2

Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output

buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are

pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that

are externally being pulled low will source current (IIL) because of the internal pull-ups.

Port 2 emits the high-order address byte during fetches from external program memory

and during accesses to external data memory that uses 16-bit addresses (MOVX @

DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During

accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits

the contents of the P2 Special Function Register.

Port 3

Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output

buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are

pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that

are externally being pulled low will source current (IIL) because of the pull-ups.

RST

Reset input. A high on this pin for two machine cycles while the oscillator is

running resets the device. This pin drives high for 98 oscillator periods after the

Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to

disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is

enabled.

Page 27: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 16

ALE/PROG

Address Latch Enable (ALE) is an output pulse for latching the low byte of the

address during accesses to external memory. This pin is also the program pulse input

(PROG) during Flash programming.

In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator

frequency and may be used for external timing or clocking purposes. Note, however, that

one ALE pulse is skipped during each access to external data memory.

PSEN

Program Store Enable (PSEN) is the read strobe to external program memory.

When the AT89S52 is executing code from external program memory, PSEN is activated

twice each machine cycle, except that two PSEN activations are skipped during each

access to external data memory.

EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the

device to fetch code from external program memory locations starting at 0000H up to

FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on

reset. EA should be strapped to VCC for internal program executions. This pin also

receives the 12-volt programming enable voltage (VPP) during Flash programming.

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating

circuit.

XTAL2

Output from the inverting oscillator amplifier

3.5.3 OSCILLATOR CHARACTERISTICS

XTAL1 and XTAL2 are the input and output, respectively, of an inverting

amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1.

Either a quartz crystal or ceramic resonator may be used. To drive the device from an

external clock source, XTAL2 should be left unconnected while XTAL1 is driven as

shown in Figure 6.2. There are no requirements on the duty cycle of the external clock

Page 28: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 17

signal, since the input to the internal clocking circuitry is through a divide-by-two flip-

flop, but minimum and maximum voltage high and low time specifications must be

observed.

Fig 3.5.2: Oscillator Connections Fig 3.5.3: External Clock Drive Configuration

3.6 MEMS

The MMA7660FC is a ±1.5 g 3-Axis Accelerometer with Digital Output(I2C). It

is a very low power, low profile capacitive MEMS sensor featuring a low pass filter,

compensation for 0g offset and gain errors, and conversion to 6-bit digital values at user

configurable samples per second. The device can be used for sensor data changes,

product orientation, and gesture detection through an interrupt pin (INT). The device is

housed in a small 3mm x 3mm x 0.9mm DFN package.

Fig 3.6.1: Axis Orientation/Motion Detection Sensor

Page 29: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 18

FEATURES

• Digital Output (I2C)

• 3mm x 3mm x 0.9mm DFN Package

• Low Power Current Consumption: Off Mode: 0.4 μA, Standby Mode: 3 μA, Active

Mode: 47 μA at 1 ODR

• Configurable Samples per Second from 1 to 120 samples a second.

• Low Voltage Operation:

Analog Voltage: 2.4 V - 3.6 V

Digital Voltage: 1.71 V - 3.6 V

• Auto-Wake/Sleep Feature for Low Power Consumption

• Tilt Orientation Detection for Portrait/Landscape Capability

• Gesture Detection Including Shake Detection and Tap Detection

• Robust Design, High Shocks Survivability (10,000 g)

• RoHS Compliant

• Halogen Free

• Environmentally Preferred Product

• Low Cost

Fig 3.6.2: Bottom view Fig 3.6.3: Pin connections

MMA 7660FC MMA 7660FC

Page 30: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 19

3.6.1 PIN DESCRIPTION

Table 3.6.4: Pin Description MMA 7660FC

Figure 3.6.5: MMA Connections to MCU

3.6.2 ELECTRO STATIC DISCHARGE

WARNING: This device is sensitive to electrostatic discharge. Although the Free

scale accelerometer contains internal 2000 V ESD protection circuitry, extra precaution

must be taken by the user to protect the chip from ESD. A charge of over 2000 V can

accumulate on the human body or associated test equipment. A charge of this magnitude

can alter the performance or cause failure of the chip. When handling the accelerometer,

proper ESD.

Page 31: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 20

Precautions should be followed to avoid exposing the device to discharges which may be

detrimental to its performance.

Table 3.6.6: ESD and Latch-up Protection Characteristics

3.6.3 PRINCIPLE OF OPERATION

The Free scale Accelerometer consists of a MEMS capacitive sensing g-cell and a

signal conditioning ASIC contained in a single package. The sensing element is sealed

hermetically at the wafer level using a bulk micro machined cap wafer. The g-cell is a

mechanical structure formed from semiconductor materials (polysilicon) using masking

and etching processes.

The sensor can be modeled as a movable beam that moves between two

mechanically fixed beams). Two gaps are formed; one being between the movable beam

and the first stationary beam and the second between the movable beam and the second

stationary beam.

The ASIC uses switched capacitor techniques to measure the g-cell capacitors and

extract the acceleration data from the difference between the two capacitors. The ASIC

also signal conditions and filters (switched capacitor) the signal, providing a digital

output that is proportional to acceleration.

Fig:3.6.7 Simplified Transducer Physical Model

Page 32: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 21

3.6.4 MODES OF OPERATION

Table 3.6.8: State Machine Modes

3.6.5 POWER SAVING FEATURES

The MMA7660FC includes a range of user configurable power saving features.

The device’s samples per second can be set over a wide range from 1 to 120 samples a

second; the operating current is directly proportional to samples per second. The analog

supply AVDD can be powered down to put the MMA7660FC into Off Mode, which

typically draws 0.4 μA. The Auto-Wake/Sleep feature can toggle the sampling rate from

a higher user selected samples per second to a lower user selected samples per second,

changing based on if motion is detected or not. The user can choose to use any of the

above options to configure the part and make it have the optimal power consumption

level for the desired application.

Page 33: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 22

3.6.6 TESTING THE LOGIC CHAIN

MMA7660FC can be put into Test Mode, which disables accelerometer

measurements and instead allows the user to write 6-bit values directly to the three axis

data registers, thus simulating real time accelerometer measurements. The state machine

will respond to these values according to the enabled features and functions, allowing

them to be validated.

NOTE: MMA7660FC does not include an accelerometer self test function, which is

typically an electrostatic force applied to each axis to cause it to deflect.

Table 3.6.9: Feature Summary Table

3.6.7 TAP DETECTION

The MMA7660FC also includes a Tap Detection feature that can be used for a

number of different customer applications such as button replacement. For example, a

single tap can stop a song from playing and a double tap can play a song. This function

detects a fast transition that exceeds a user-defined threshold (PDET (0x09) register) for a

set duration (PD (0x0A) registers).

3.6.8 TAP DETECTION SETUP

In order to enable Tap detection in the device the user must enable the Tap

Interrupt in the INTSU (0x06) register and AMSR[2:0] = 000 in the SR (0x08) register.

In this mode, TILT (0x03) register, XOUT (0x00), YOUT (0x01), and ZOUT (0x02)

registers will update at the 120 samples/second. The user can configure Tap Detection to

Page 34: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 23

be detected on X and/or Y and/or Z axes. The Customer can configure this by changing

the XDA, YDA, and/or ZDA bit in the PDET (0x09) register. Detection for enabled axes

is decided on an OR basis: If the PDINT bit is set in the INTSU (0x06) register, the

device reports the first axis for which it detects a tap by the Tap bit in the TILT (0x03)

register. When the Tap bit in the TILT (0x03) register is set, tap detection ceases, but the

device will continue to process orientation detection data. Tap detection will resume

when the TILT (0x03) register is read.

NOTE: Delta G is available with any AMSR setting, when XDA = YDA = ZDA = 1

(PDET = 1). When the sampling rate is less than 120 samples/second, the device can not

detect tapping, but can detect small tilt angles (30 degree angle change) which can not be

detected by orientation detection.

3.6.9 SHAKE DETECTION The shake feature can be used as a button replacement to perform functions such

as scrolling through images or web pages on a Mobile Phone/PMP/PDA. The customer

can enable the shake interrupt on any of the 3 axes, by enabling the SHINTX SHINTX,

SHINTY, and/or SHINTZ in the INTSU (0x06) register. MMA7660FC detects shake by

examining the current 6-bit measurement for each axis in XOUT, YOUT, and ZOUT.

The axes that are tested for shake detection are the ones enabled by SHINTX, SHINTY,

and/or SHINTZ. If a selected axis measures greater that 1.3 or less than -1.3g, then a

shake is detected for that axis and an interrupt occurs. All three axes are checked

independently, but a common Shake bit in the TILT register is set when shake is detected

in any one of the selected axes. Therefore when all 3 (SHINTX, SHINTY, and/or

SHINTZ) are selected the sensor will not know what axis the shake occurred.

When the TILT register is read the Shake bit is cleared during the acknowledge bit of the

read access to that register and shake detection monitoring starts again.

3.6.10 AUTO WAKE/SLEEP

The MMA7660FC has the Auto-Wake/Sleep feature that can be enabled for

power saving. In the Auto-Wake function, the device is put into a user specified low

Page 35: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 24

samples per second (32 samples/second, 16 samples/second, 8 samples/second, or 1

sample/second) in order to minimize power consumption. When the Auto-Wake is

enabled and activity is detected such as a change in orientation, pulse event, Delta G

acceleration or a shake event, then the device wakes up. Auto-Wake will automatically

enable Auto-Sleep when the device is in wake mode and can therefore be configured to

cause an interrupt on wake-up, by configuring the part to either wake up with a change in

orientation, shake, or if using the part at 120 samples/second tap detection. When the

device is in Auto-Wake mode, the MODE (0x07) register, bit AWE is high. When the

device has detected a change in orientation, a tap shake, or Delta G (change in

acceleration), the device will enter Auto-Sleep mode. In the Auto-Sleep function, the

device is put into any of the following user specified samples per seconds (120

samples/second, 64 samples/second, 32 samples/second, 16 samples/second, 8

samples/second, 4 samples/second, 2 samples/second, and 1 sample/second). In the Auto-

Sleep mode, if no change in the orientation, shake or tap has occurred and the sleep

counter has elapsed, the device will go into the Auto-Wake mode. When the device is in

the Auto-Sleep mode, the MODE (0x07) register, bit ASE is high. The device can be

programmed to continually cycle between Auto-Wake/Sleep.

NOTE: The device can either be powered on in Wake/Sleep state depending on

ASE/AWE settings. If the AWE bit is set, the device is powered on in, in sleep state. If

the ASW bit is set, the device is powered on in, in wake state.

Table 3.6.10: Auto Wake/Sleep Truth Table

Page 36: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 25

3.6.11 START AND STP CONDITIONS

Both SCL and SDA remain high when the interface is not busy. A master signals

the beginning of a transmission with a START (S) condition by transitioning SDA from

high to low while SCL is high. When the master has finished communicating with the

slave, it issues a STOP (P) condition by transitioning SDA from low to high while SCL is

high. The bus is then free for another transmission.

Bit Transfer

One data bit is transferred during each clock tap.. The data on SDA must remain

stable while SCL is high.

Figure 3.6.11: Bit Transfer

Acknowledge

The acknowledge bit is a clocked 9th bit, which the recipient uses to handshake a

receipt of each byte of data. Thus each byte transferred effectively requires 9 bits. The

master generates the 9th clock tap, and the recipient pulls down SDA during the

acknowledge clock tap, such that the SDA line is stable low during the high period of the

clock tap. When the master is transmitting to MMA7660FC, it generates the acknowledge

bit because it is the recipient. When the device is transmitting to the master, the master

generates the acknowledge bit because the master is the recipient.

Page 37: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 26

Figure 3.6.12: Acknowledge

3.6.12 Message Format for Writing MMA7660FC

A write to MMA7660FC comprises the transmission of the device’s key scan

slave address with the R/W bit set to 0, followed by at least one byte of information. The

first byte of information is the register address of the first internal register that is to be

updated. If a STOP condition is detected after just the register address is received, then

MMA7660FC takes no action. MMA7660FC clears its internal register address pointer

to register 0x00 when a STOP condition is detected, so a single byte write has no net

effect because the register address given in this first and only byte is replaced by 0x00 at

the STOP condition. The internal register address pointer is not, however, cleared on a

repeated start condition. Use a single byte write followed by a repeated start to read back

data from a register. Any bytes received after the register addresses are data bytes. The

first data byte goes into the internal register of the device selected by the register

address..

Figure 3.6.13: Single Byte Write

If multiple data bytes are transmitted before a STOP condition is detected, these

bytes are generally stored in subsequent MMA7660FC internal registers because the

register addresses generally auto-increments.

Page 38: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 27

Figure 3.6.14: Multiple Bytes Write

3.6.13 Message Format for Reading MMA7660FC

MMA7660FC is read using it’s internally stored register address as address

pointer, the same way the stored register address is used as address pointer for a write.

The pointer generally auto-increments after each data byte is read using the same rules as

for a write. Thus, a read is initiated by first configuring the device’s register address by

performing a write followed by a repeated start. The master can now read 'n' consecutive

bytes from it, with the first data byte being read from the register addressed by the

initialized register address.

Figure 3.6.15: Single Byte Read

Figure 3.6.16: Multiple Bytes Read

3.7 LCD MODULE

To display interactive messages we are using LCD Module. We examine an

intelligent LCD display of two lines,16 characters per line that is interfaced to the

controllers. The protocol (handshaking) for the display is as shown. Whereas D0 to D7th

bit is the Data lines, RS, RW and EN pins are the control pins and remaining pins are

Page 39: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 28

+5V, -5V and GND to provide supply. Where RS is the Register Select, RW is the Read

Write and EN is the Enable pin.

The display contains two internal byte-wide registers, one for commands (RS=0) and the

second for characters to be displayed (RS=1). It also contains a user-programmed RAM

area (the character RAM) that can be programmed to generate any desired character that

can be formed using a dot matrix. To distinguish between these two data areas, the hex

command byte 80 will be used to signify that the display RAM address 00h will be

chosen.Port1 is used to furnish the command or data type, and ports 3.2 to3.4 furnish

register select and read/write levels.

The display takes varying amounts of time to accomplish the functions as listed.

LCD bit 7 is monitored for logic high (busy) to ensure the display is overwritten.

Liquid Crystal Display also called as LCD is very helpful in providing user

interface as well as for debugging purpose. The most common type of LCD controller is

HITACHI 44780 which provides a simple interface between the controller & an LCD.

These LCD's are very simple to interface with the controller as well as are cost effective.

Figure 3.7.1: 2x16 Line Alphanumeric LCD Display

The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16

characters), 2x16 (Double Line & 16 character per line) & 4x20 (four lines & Twenty

characters per line). The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data

lines. The number on data lines depends on the mode of operation. If operated in 8-bit

mode then 8 data lines + 3 control lines i.e. total 11 lines are required. And if operated in

4-bit mode then 4 data lines + 3 control lines i.e. 7 lines are required. How do we decide

which mode to use? It’s simple if you have sufficient data lines you can go for 8 bit mode

& if there is a time constrain i.e. display should be faster then we have to use 8-bit mode

because basically 4-bit mode takes twice as more time as compared to 8-bit mode.

Page 40: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 29

Pin Symbol Function

1 Vss Ground

2 Vdd Supply Voltage

3 Vo Contrast Setting

4 RS Register Select

5 R/W Read/Write Select

6 En Chip Enable Signal

7-

14

DB0-

DB7 Data Lines

15 A/Vee Gnd for the

backlight

16 K Vcc for backlight

Table 3.7.2 : 2*16 LCD Pins

When RS is low (0), the data is to be treated as a command. When RS is high (1),

the data being sent is considered as text data which should be displayed on the screen.

When R/W is low (0), the information on the data bus is being written to the LCD. When

RW is high (1), the program is effectively reading from the LCD. Most of the times there

is no need to read from the LCD so this line can directly be connected to Gnd thus saving

one controller line.

The ENABLE pin is used to latch the data present on the data pins. A HIGH -

LOW signal is required to latch the data. The LCD interprets and executes our command

at the instant the EN line is brought low. If you never bring EN low, your instruction will

never be executed.

Page 41: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 30

Figure 3.7.3: Controller to LCD Interprets

Page 42: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 31

CHAPTER-4 SOFTWARE REQUIREMENTS

4.1 INTRODUCTION TO KEIL MICRO VISION

Keil an ARM Company makes C compilers, macro assemblers, real-time kernels,

debuggers, simulators, integrated environments, evaluation boards, and emulators for

ARM7/ARM9/Cortex-M3, XC16x/C16x/ST10, 251, and 8051 MCU families.

Keil development tools for the 8051 Microcontroller Architecture support every

level of software developer from the professional applications engineer to the student just

learning about embedded software development. When starting a new project, simply

select the microcontroller you use from the Device Database and the µVision IDE sets all

compiler, assembler, linker, and memory options for you.

Keil is a cross compiler. So first we have to understand the concept of compilers

and cross compilers. After then we shall learn how to work with keil.

4.2 CONCEPT OF COMPILER

Compilers are programs used to convert a High Level Language to object code.

Desktop compilers produce an output object code for the underlying microprocessor, but

not for other microprocessors. I.E the programs written in one of the HLL like ‘C’ will

compile the code to run on the system for a particular processor like x86 (underlying

microprocessor in the computer). For example compilers for Dos platform is different

from the Compilers for Unix platform So if one wants to define a compiler then compiler

is a program that translates source code into object code.

The compiler derives its name from the way it works, looking at the entire piece

of source code and collecting and reorganizing the instruction. See there is a bit little

difference between compiler and an interpreter. Interpreter just interprets whole program

at a time while compiler analyses and execute each line of source code in succession,

without looking at the entire program.

The advantage of interpreters is that they can execute a program immediately.

Secondly programs produced by compilers run much faster than the same programs

executed by an interpreter. However compilers require some time before an executable

Page 43: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 32

program emerges. Now as compilers translate source code into object code, which is

unique for each type of computer, many compilers are available for the same language.

4.3 CONCEPT OF CROSS COMPILER

A cross compiler is similar to the compilers but we write a program for the target

processor (like 8051 and its derivatives) on the host processors (like computer of x86). It

means being in one environment you are writing a code for another environment is called

cross development. And the compiler used for cross development is called cross

compiler. So the definition of cross compiler is a compiler that runs on one computer but

produces object code for a different type of computer.

4.4 KEIL C CROSS COMPILER

Keil is a German based Software development company. It provides several

development tools like

IDE (Integrated Development environment)

Project Manager

Simulator

Debugger

C Cross Compiler, Cross Assembler, Locator/Linker

The Keil ARM tool kit includes three main tools, assembler, compiler and linker.

An assembler is used to assemble the ARM assembly program. A compiler is used to

compile the C source code into an object file. A linker is used to create an absolute object

module suitable for our in-circuit emulator.

4.5 BUILDING APPLICATIONS IN µVISION2

To build (compile, assemble, and link) an application in µVision2, you must:

Select Project - (for example, 166\EXAMPLES\HELLO\HELLO.UV2).

Select Project - Rebuild all target files or Build target.µVision2 compiles,

assembles, and links the files in your project.

Page 44: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 33

4.6 CREATING YOUR OWN APPLICATION IN µVISION

To create a new project in µVision2, you must:

Select Project - New Project.

Select a directory and enter the name of the project file.

Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from

the Device Database™.

Create source files to add to the project.

Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and

add the source files to the project.

Select Project - Options and set the tool options. Note when you select the target

device from the Device Database™ all special options are set automatically. You

typically only need to configure the memory map of your target hardware. Default

memory model settings are optimal for most applications.

Select Project - Rebuild all target files or Build target.

4.7 DEBUGGING AN APPLICATION IN µVISION2

To debug an application created using µVision2, you must:

Select Debug - Start/Stop Debug Session.

Use the Step toolbar buttons to single-step through your program. You may enter

G, main in the Output Window to execute to the main C function.

Open the Serial Window using the Serial #1 button on the toolbar.

Debug your program using standard options like Step, Go, Break, and so on.

4.8 STARTING µVISION2AND CREATING A PROJECT

µVision2 is a standard Windows application and started by clicking on the

program icon. To create a new project file select from the µVision2 menu Project – New

Project. This opens a standard Windows dialog that asks you for the new project file

name. We suggest that you use a separate folder for each project. You can simply use the

icon Create New Folder in this dialog to get a new empty folder. Then select this folder

Page 45: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 34

and enter the file name for the new project, i.e. Project1. µVision2 creates a new project

file with the name PROJECT1.UV2 which contains a default target and file group name.

You can see these names in the Project.

4.9 WINDOW-FILES

Now use from the menu Project – Select Device for Target and select a CPU for

your project. The Select Device dialog box shows the µVision2 device data base. Just

select the microcontroller you use. We are using for our examples the Philips 80C51RD+

CPU. This selection sets necessary tool Options for the 80C51RD+ device and simplifies

in this way the tool Configuration.

4.10 BUILDING PROJECTS AND CREATING HEX FILES

Typical, the tool settings under Options – Target are all you need to start a new

application. You may translate all source files and line the application with a click on the

Build Target toolbar icon. When you build an application with syntax errors, µVision2

will display errors and warning messages in the Output Window – Build page. A double

click on a message line opens the source file on the correct location in a µVision2 editor

window. Once you have successfully generated your application you can start debugging.

After you have tested your application, it is required to create an Intel HEX file to

download the software into an EPROM programmer or simulator. µVision2 creates HEX

files with each build process when Create HEX files under Options for Target – Output is

enabled. You may start your PROM programming utility after the make process when

you specify the program under the option Run User Program #1.

4.11 CPU SIMULATION

µVision2 simulates up to 16 Mbytes of memory from which areas can be mapped

for read, write, or code execution access. The µVision2 simulator traps and reports illegal

memory accesses. In addition to memory mapping, the simulator also provides support

for the integrated peripherals of the various 8051 derivatives. The on-chip peripherals of

the CPU you have selected are configured from the Device.

Page 46: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 35

4.12 DATABASE SELECTION

You have made when you create your project target. Refer to page 58 for more

Information about selecting a device. You may select and display the on-chip peripheral

components using the Debug menu. You can also change the aspects of each peripheral

using the controls in the dialog boxes.

4.13 START DEBUGGING

You start the debug mode of µVision2 with the Debug – Start/Stop Debug

Session Command. Depending on the Options for Target – Debug Configuration,

µVision2 will load the application program and run the startup code µVision2 saves the

editor screen layout and restores the screen layout of the last debug session. If the

program execution stops, µVision2 opens an editor window with the source text or shows

CPU instructions in the disassembly window. The next executable statement is marked

with a yellow arrow. During debugging, most editor features are still available.

For example, you can use the find command or correct program errors. Program

source text of your application is shown in the same windows. The µVision2 debug mode

differs from the edit mode in the following aspects.

The “Debug Menu and Debug Commands” described on page 28 are available.

The additional debug windows are discussed in the following.

The project structure or tool parameters cannot be modified. All build commands are

disabled.

4.14 DISASSEMBLY WINDOW

The Disassembly window shows your target program as mixed source and

assembly program or just assembly code. A trace history of previously executed

instructions may be displayed with Debug – View Trace Records. To enable the trace

history, set Debug – Enable/Disable Trace Recording.

If you select the Disassembly Window as the active window all program step

commands work on CPU instruction level rather than program source lines. You can

select a text line and set or modify code breakpoints using toolbar buttons or the context

menu commands.

Page 47: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 36

You may use the dialog Debug – Inline Assembly… to modify the CPU

instructions. That allows you to correct mistakes or to make temporary changes to the

target program you are debugging. Numerous example programs are included to help you

get started with the most popular embedded 8051 devices.

The Keil µVision Debugger accurately simulates on-chip peripherals (I²C, CAN,

UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of

your 8051 device. Simulation helps you understand hardware configurations and avoids

time wasted on setup problems. Additionally, with simulation, you can write and test

applications before target hardware is available.

4.15 EMBEDDED C

Use of embedded processors in passenger cars, mobile phones, medical

equipment, aerospace systems and defense systems is widespread, and even everyday

domestic appliances such as dish washers, televisions, washing machines and video

recorders now include at least one such device.

Because most embedded projects have severe cost constraints, they tend to use

low-cost processors like the 8051 family of devices considered in this book. These

popular chips have very limited resources available most such devices have around 256

bytes (not megabytes!) of RAM, and the available processor power is around 1000 times

less than that of a desktop processor. As a result, developing embedded software presents

significant new challenges, even for experienced desktop programmers. If you have

some programming experience - in C, C++ or Java - then this book and its accompanying

CD will help make your move to the embedded world as quick and painless as possible.

Page 48: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 37

CHAPTER-5

SCHEMATIC DIAGRAM

Figure 5 : Schematic diagram of air bag crush

Page 49: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 38

5.1 OPERATION

Modern vehicles may contain multiple airbags in various side and frontal

locations of the passenger seating positions, and sensors may deploy one or more airbags

in an impact zone at variable rates based on the type and severity of impact the airbag is

designed to only inflate in mild to severe frontal crashes. Airbags are normally designed

with the intention of supplementing the protection of an occupant who is correctly

restrained with a seatbelt. Air bag operation in this project is shown by tripping the relay

in which led or a DC motor turns on.

When ever any accident occur means any Disturbance caused to MEMS sensor

which was arranged in critical angle detects and sends mechanical force to controller

hence the air bag release in the form of relay tripping.

Page 50: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 39

CHAPTER-6

PROJECT CODE

6.1 SOURCE CODE

#include<reg51.h>

#include"I2C_MEM.c"

sfr ldata=0X90;//PORT 1

sbit rs=P2^6;

sbit en=P2^7;

sbit Air_Bag=P2^4;

LcdCmd(unsigned char);

LcdData_Chr(unsigned char);

LcdData_Str(char *temp);

Lcd_Init();

LcdData_Display();

Delay(unsigned int);

XY_Movements(unsigned char f_b,unsigned char l_r);

bit play_flag=1;

main()

{

Air_Bag=1;

Lcd_Init();

Page 51: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 40

LcdCmd(0x80);

LcdData_Str(" I2C MEMS TEST ");

MEMS_Init();

LcdCmd(0x80);

LcdData_Str(" Mem inited ");

Delay(250);

LcdCmd(0x80);

LcdData_Str(" MEMS BASED ");

LcdCmd(0xC0);

LcdData_Str("Air Bag System");

while(1)

{

x=RrByte_MEMS(0x00);

Delay(5);

//u_x=(x%10)+48;

//t_x=(x/10)+48;

//Lcd_Data_Chr(1,2,2,&t_x);

//Lcd_Data_Chr(1,2,3,&u_x);

Delay(15);

y=RrByte_MEMS(0x01);

Delay(5);

Page 52: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 41

//u_y=(y%10)+48;

//t_y=(y/10)+48;

//Lcd_Data_Chr(1,2,8,&t_y);

//Lcd_Data_Chr(1,2,9,&u_y);

Delay(15);

XY_Movements(x,y);

}

}

XY_Movements(unsigned char f_b,unsigned char l_r)

{

if((f_b>15&&f_b<25))

{

Air_Bag=0;

LcdCmd(0x80);

LcdData_Str(" Alert! ");

LcdCmd(0xC0);

LcdData_Str("Air Bag Released");

}

if(f_b<50&&f_b>45)

{

Page 53: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 42

Air_Bag=0;

LcdCmd(0x80);

LcdData_Str(" Alert! ");

LcdCmd(0xC0);

LcdData_Str("Air Bag Released");

}

if(l_r>15&&l_r<25)

{

Air_Bag=0;

LcdCmd(0x80);

LcdData_Str(" Alert! ");

LcdCmd(0xC0);

LcdData_Str("Air Bag Released");

}

if(l_r<50&&l_r>45)

{

Air_Bag=0;

LcdCmd(0x80);

LcdData_Str(" Alert! ");

LcdCmd(0xC0);

LcdData_Str("Air Bag Released");

}

Page 54: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 43

}

Lcd_Init()

{

LcdCmd(0x38);

LcdCmd(0x0E);

LcdCmd(0x01);

LcdCmd(0x80);

}

Lcddata_Chr(unsigned char value)

{

ldata=value;

rs=1;

en=1;

Delay(1);

en=0;

Delay(1);

return;

}

//Delay(unsigned int k)

// {

// int i,j;

// for (i=0;i<=k;i++)

Page 55: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 44

// for (j=0;j<=1275;j++);

// }

LcdCmd(unsigned char value)

{

ldata=value;

rs=0;

en=1;

Delay(1);

en=0;

return;

}

LcdData_Str(char *temp)

{

unsigned int s;

for(s=0;temp[s]!='\0';s++)

{

ldata=tem p[s];

rs=1;

en=1;

Delay(1);

en=0;

Page 56: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 45

}

}

EN=0;

}

Page 57: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 46

6.2 FLOW CHART

Figure 6.2: Flow chart of air bag crush sensor

START

INITIALIZE

MICROCONTROLLER

INITIALIZE MEMS

IF MEMS=1

MONITOR MEMS

RELEASE AIR BAG

AGAIN MONITOR

CONDITIONS

STOP

NO

Page 58: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 47

CHAPTER-7

HARDWARE TESTING

7.1 CONTINUITY TEST

In electronics, a continuity test is the checking of an electric circuit to see if

current flows (that it is in fact a complete circuit). A continuity test is performed by

placing a small voltage (wired in series with an LED or noise-producing component such

as a piezoelectric speaker) across the chosen path. If electron flow is inhibited by broken

conductors, damaged components, or excessive resistance, the circuit is "open".

Devices that can be used to perform continuity tests include multi meters which

measure current and specialized continuity testers which are cheaper, more basic devices,

generally with a simple light bulb that lights up when current flows.

An important application is the continuity test of a bundle of wires so as to find the two

ends belonging to a particular one of these wires; there will be a negligible resistance

between the "right" ends, and only between the "right" ends.

This test is the performed just after the hardware soldering and configuration has

been completed. This test aims at finding any electrical open paths in the circuit after the

soldering. Many a times, the electrical continuity in the circuit is lost due to improper

soldering, wrong and rough handling of the PCB, improper usage of the soldering iron,

component failures and presence of bugs in the circuit diagram. We use a multi meter to

perform this test. We keep the multi meter in buzzer mode and connect the ground

terminal of the multi meter to the ground. We connect both the terminals across the path

that needs to be checked. If there is continuation then you will hear the beep sound.

7.2 POWER ON TEST

This test is performed to check whether the voltage at different terminals is

according to the requirement or not. We take a multi meter and put it in voltage mode.

Remember that this test is performed without microcontroller. Firstly, we check the

output of the transformer, whether we get the required 12 v AC voltage.

Page 59: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 48

CHAPTER-8

ADVANTAGES AND APPLICATIONS

ADVANTAGES

The system is completely automatic and requires no human supervision to carry

out the necessary actions.

The main advantage of this system is it is economical and reliable.

The system is best for guiding the perimeter of a house or a business center the

point s where an intruder would enter the building

.

DISADVANTAGES

1. When Power Is Off, Then the Total System is Off, So always Required Battery

APPLICATIONS

Air Craft Applications

Accident Prevention Applications

Medical Applications

Military and aerospace embedded software applications

Communication Applications

Industrial automation and process control software

Mastering the complexity of applications.

Reduction of product design time.

Real time processing of ever increasing amounts of data.

Page 60: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 49

FUTURE SCOPE

Air bags are very important as it is absolutely crucial to ensure protection of

human life. Thus they must be implemented for saving precious lives and it should be

made necessary for automobile manufacturer to implement this mechanism

Page 61: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 50

CHAPTER-9

CONCLUSION

The “AIR BAG CRASH SENSOR DEVELOPMENT” has been achieved

successfully using microcontroller unit. The circuit has been tested and verified.

It has been developed by integrating features of all the hardware components

used. Presence of every module has been reasoned out and placed carefully thus

contributing to the best working of the unit.

Secondly, using highly advanced IC’s and with the help of growing technology

the project has been successfully implemented.

Page 62: AIR BAG CRASH USING MEMS

AIR BAG CRASH SENSOR DEVELOPMENT USING MEMS

SVES ECE Dept. 51

CHAPTER-10

BIBLIOGRAPHY

TEXT BOOKS REFERED

1. “The 8051 Microcontroller and Embedded systems” by Muhammad Ali Mazidi and

Janice Gillispie Mazidi, Pearson Education.

2. ATMEL 89S52 Data Sheets.

WEBSITES

www.atmel.com

www.beyondlogic.org

www.wikipedia.org

www.howstuffworks.com

www.alldatasheets.com


Recommended