seat belt security using arduino report

25
The objective of the project is to provide security to driver by intoducing the mechanism of no drive without seat belt. The work is focussed towards sensing wheather the seat belt is locked by the user or not. If the belt is not on than the user is not allowed to switch on the ignition of the vehicle. Once the vehicle starts moving, the belt is locked with an extra calibre lock such that the belt can not be opened by the user while driving. When the vehicle stops, the extra lock is opened which allows the user to remove his belt. Once the belt is removed, the vehicle is not allowed to be driven.

Upload: rupam-das

Post on 26-Oct-2014

183 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Seat Belt Security using Arduino report

The objective of the project is to provide security to driver by intoducing the mechanism of no drive without seat belt. The work is focussed towards sensing wheather the seat belt is locked by the user or not. If the belt is not on than the user is not allowed to switch on the ignition of the vehicle. Once the vehicle starts moving, the belt is locked with an extra calibre lock such that the belt can not be opened by the user while driving. When the vehicle stops, the extra lock is opened which allows the user to remove his belt. Once the belt is removed, the vehicle is not allowed to be driven.

Page 2: Seat Belt Security using Arduino report

Block Diagram

1) A 12v/1.3Ah dry cell battery is the main power source for the system.

2) The controlling board comprises of 3 Relays, 2 are used for the lock and 1 is used for vehicle movement

3) 12v and - lines are connected to alternative poles of two relays. Hence for Moving the motor is clock wise direction, both relays are turned off. for making it to move in the other direction, both relays are turned on.

4) Relays are driven by optocouplers which isolates the 5v logic at the microcontroller to that of 12 v logic.

5) A LDR Sensor is used for sensing the insert of seat belt. when the belt is on, output of LDR is high, otherwise it is low.

6) A 100rpm geared motor based sample vehicle is used to demonstrate the movement.

7) Open Source Arduino board is used for controlling the entire system. It is powered by ATMeg328 Microcontroller.

Sensor for Detecting the Open and Close of the Belt

Microcontroller Unit Relay Unit

Lock Open and Close

Simple Vehicle Move Motor with Geared Motor

Accelarator Sensor

12 V Battery

Page 3: Seat Belt Security using Arduino report

Logic Discussion

1. When Key is inserted, the system opens the calibre lock.

2. If user tries to move the vehicle without seat belt, it does not move.

3. When key is taken off, the lock is Opened

4. When user insert the seat belt after key is inserted, the lock is closed, so that user can not open the seat belt again.

5. When user clicks the touch switch for vehicle movement, the vehicle is moved. when it is stopped, the lock is opened temporarily. If user presses the movement button, lock is closed, before vehicle is moved.

Page 4: Seat Belt Security using Arduino report

Belt insert Sensing with LDR Sensor

LDR is a light dependent sensor. When Light intensity is more, it produces low voltage and when it is low, it produces high voltage. The sensor is arranged such that as soon as the belt is inserted, the sensors surface is denied any light. Hence the voltage is changed abruptly. This is sensed by the microcontroller and an event is triggered.

An LED can be connected(Optional) to pin 13 of the digital ports of Arduino board to produce constant light near the sensor. Pin 13 can be programmatically controlled.

The LDR is given power supply through a 1K resistor from board power out +5v VCC and Ground pin. LDR’s positive output is taken as input for reading the Light variation. The program continuesly

Page 5: Seat Belt Security using Arduino report

reads the value of pin 5 of the analog ports. Where there are no objects in between, voltage across pin 5 is low, and when an object is placed, it is very high. Based on this information product is counted.

LDR ( Light Dependent Resistor)

A photoresistor or light dependent resistor (LDR) is a resistor whose resistance decreases with increasing incident light intensity; in other words, it exhibits photoconductivity. It can also be referred to as a photoconductor or CdS device, from "cadmium sulfide," which is the material from which the device is made and that actually exhibits the variation in resistance with light level. Note that CdS is not a semiconductor in the usual sense of the word (not doped silicon).

A photoresistor is made of a high resistance semiconductor. If light falling on the device is of high enough frequency, photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. The resulting free electron (and its hole partner) conduct electricity, thereby lowering resistance.

A photoelectric device can be either intrinsic or extrinsic. An intrinsic semiconductor has its own charge carriers and is not an efficient semiconductor, e.g. silicon. In intrinsic devices the only available electrons are in the valence band, and hence the photon must have enough energy to excite the electron across the entire bandgap. Extrinsic devices have impurities, also called dopants, added whose ground state energy is closer to the conduction band; since the electrons do not have

Page 6: Seat Belt Security using Arduino report

as far to jump, lower energy photons (i.e., longer wavelengths and lower frequencies) are sufficient to trigger the device. If a sample of silicon has some of its atoms replaced by phosphorus atoms (impurities), there will be extra electrons available for conduction. This is an example of an extrinsic semiconductor. Photoresistors are basically photocells.

The main principle is, as light increases, resistance also increase which leads to voltage drop across two pins of LDR. As intensity decreases, resistance decreases which leads to intensity increase. Therefore when an object is placed between a LDR and a Light source, the voltage is increased.

Page 7: Seat Belt Security using Arduino report

Voltage Line Selection

1. One digital pin (13) is used to select the voltage line2. When the pin is high, OC pin 1 is high, it makes the voltage at pin 5 of the

optocoupler to reach pin 4, which is connected with the relay.3. When Relay’s A is +12v, output of realay at pin 5 is the supplied voltage at pin 1 (i.e.

+12v)4. It is the voltage applied to pin 2(i.e. -12v) when pin 13 of MCU is low.

Page 8: Seat Belt Security using Arduino report

Main Relay unit With optocoupler

1) Microcontroller Selects a stage of OC of DPDT line selection2) It selects HIGH for the pin that is connected with the OC of the Relay driver3) When OC pin is high, relay is on, it carries the voltage which is at the output stage of

DPDT. The same is supplied to motor. Accordingly the motor moves in forward or reverse direction for the period that the OC is high through MCU pin.

Page 9: Seat Belt Security using Arduino report

Simple Vehicle

base consists of a chassis with 3 dummy wheels and 1 geared motor with 100 rpm. The motors are connected to each other with anodes and ground poles are shorted. When anode is supplied with -12v these motors moves anticlockwise otherwise clock wise. The same principle is applicable to all other assembly motors. The reason for selecting DC motor for the chassis is, geared motors takes more load and start and stop are without jerk which is so important for the base of the motor.

In this project we have used only a single directional motion for demonstration purpose.

Page 10: Seat Belt Security using Arduino report

Microcontroller Unit

About Arduino

Arduino is a popular open-source single-board microcontroller, descendant of the open-source Wiring platform, designed to make the process of using electronics in multidisciplinary projects more accessible. The hardware consists of a simple open hardware design for the Arduino board with an Atmel AVR processor and on-board input/output support. The software consists of a standard programming language compiler and the boot loader that runs on the board.

Arduino hardware is programmed using a Wiring-based language (syntax and libraries), similar to C++ with some simplifications and modifications, and a Processing-based integrated development environment.

Current versions can be purchased pre-assembled; hardware design information is available for those who would like to assemble an Arduino by hand. Additionally, variations of the Italian-made Arduino—with varying levels of compatibility—have been released by third parties; some of them are programmed using the Arduino software.

The Arduino project received an honorary mention in the Digital Communities category at the 2006 Prix Ars Electronica.[

Hardware

An Arduino board consists of an 8-bit Atmel AVR microcontroller with complementary components to facilitate programming and incorporation into other circuits. An important aspect of the Arduino is the standard way that connectors are exposed, allowing the CPU board to be connected to a variety of interchangeable add-on modules (known as shields). Official Arduinos have used the megaAVR series of chips, specifically the ATmega8, ATmega168, ATmega328, ATmega1280, and ATmega2560. A handful of other processors have been used by Arduino compatibles. Most boards include a 5 volt linear regulator and a 16 MHz crystal oscillator (or ceramic resonator in some variants), although some designs such as the LilyPad run at 8 MHz and dispense with the onboard voltage regulator due to specific form-factor restrictions. An Arduino's microcontroller is also pre-

Page 11: Seat Belt Security using Arduino report

programmed with a boot loader that simplifies uploading of programs to the on-chip flash memory, compared with other devices that typically need an external programmer.

At a conceptual level, when using the Arduino software stack, all boards are programmed over an RS-232 serial connection, but the way this is implemented varies by hardware version. Serial Arduino boards contain a simple inverter circuit to convert between RS-232-level and TTL-level signals. Current Arduino boards are programmed via USB, implemented using USB-to-serial adapter chips such as the FTDI FT232. Some variants, such as the Arduino Mini and the unofficial Boarduino, use a detachable USB-to-serial adapter board or cable, Bluetooth or other methods. (When used with traditional microcontroller tools instead of the Arduino IDE, standard AVR ISP programming is used.)

The Arduino board exposes most of the microcontroller's I/O pins for use by other circuits. The Diecimila, now superseded by the Duemilanove, for example, provides 14 digital I/O pins, six of which can produce pulse-width modulated signals, and six analog inputs. These pins are on the top of the board, via female 0.1 inch headers. Several plug-in application "shields" are also commercially available.

The Arduino Nano, and Arduino-compatible Bare Bones Board and Boarduino boards provide male header pins on the underside of the board to be plugged into solderless breadboards.

Arduino Board Models

Arduino ProcessorVoltag

e

Flash

kB

EEPROM

kB

SRA

M

kB

Digital

I/O

pins

...with

PWM

Analog

input

pins

USB

Interface

type

Dimension

s

inches

Dimensions

mm

Diecimila ATmega168 5 V 16 0.5 1 14 6 6 FTDI2.7 in ×

2.1 in

68.6 mm ×

53.3 mm

[11] ATMEL SAM3U 256 0[12] 50 54 16 16

DuemilanovATmega168/328P 5 V 16/32 0.5/1 1/2 14 6 6 FTDI

2.7 in ×

2.1 in

68.6 mm ×

53.3 mm

ATmega328P 5 V 32 1 2 14 6 6 ATmega8U22.7 in ×

2.1 in

68.6 mm ×

53.3 mm

Leonardo Atmega32u4 5 V 32 1 2 14 6 12 Atmega32u42.7 in ×

2.1 in

68.6 mm ×

53.3 mm

Page 12: Seat Belt Security using Arduino report

Mega ATmega1280 5 V 128 4 8 54 14 16 FTDI 4 in × 2.1 in101.6 mm ×

53.3 mm

Mega2560 ATmega2560 5 V 256 4 8 54 14 16 ATmega8U2 4 in × 2.1 in101.6 mm ×

53.3 mm

ATmega328P 3.3 V 32 1 2 14 6 8 None1.6 in ×

1.1 in

40.6 mm ×

27.9 mm

Nano ATmega168 or ATmega328 5 V 16/32 0.5/1 1/2 14 6 8 FTDI1.70 in ×

0.73 in

43 mm ×

18 mm

LilyPadATmega168V or

ATmega328V

2.7-5.5 

V16 0.5 1 14 6 6 None 2 in ⌀ 50 mm

The board with marked color is used for this project.

Arduino Software

The Arduino IDE is a cross-platform application written in Java, and is derived from the IDE for the Processing programming language and the Wiring project. It is designed to introduce programming to artists and other newcomers unfamiliar with software development. It includes a code editor with features such as syntax highlighting, brace matching, and automatic indentation, and is also capable of compiling and uploading programs to the board with a single click. There is typically no need to edit makefiles or run programs on a command-line interface. Although building on command-line is possible if required with some third-party tools such as Ino.

Page 13: Seat Belt Security using Arduino report

The Arduino IDE comes with a C/C++ library called "Wiring" (from the project of the same name), which makes many common input/output operations much easier. Arduino programs are written in C/C++, although users only need define two functions to make a runnable program:

setup() – a function run once at the start of a program that can initialize settings

loop() – a function called repeatedly until the board powers off

A typical first program for a microcontroller simply blinks a LED on and off. In the Arduino environment, the user might write a program like this:[14]

#define LED_PIN 13

void setup () {

pinMode (LED_PIN, OUTPUT); // enable pin 13 for digital output

}

void loop () {

digitalWrite (LED_PIN, HIGH); // turn on the LED

delay (1000); // wait one second (1000 milliseconds)

digitalWrite (LED_PIN, LOW); // turn off the LED

delay (1000); // wait one second

}

For the above code to work correctly, the positive side of the LED must be connected to pin 13 and the negative side of the LED must be connected to ground. The above code would not be seen by a standard C++ compiler as a valid program, so when the user clicks the "Upload to I/O board" button in the IDE, a copy of the code is written to a temporary file with an extra include header at the top and a very simple main() function at the bottom, to make it a valid C++ program.

The Arduino IDE uses the GNU toolchain and AVR Libc to compile programs, and uses avrdude to upload programs to the board.

For educational purposes there is third party graphical development environment called Minibloq available under a different open source license.

Arduino Duemilanove

Page 14: Seat Belt Security using Arduino report

Overview

The Arduino Duemilanove ("2009") is a microcontroller board based on

the ATmega168 or ATmega328. It has 14 digital input/output pins (of which 6 can

be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB

connection, a power jack, an ICSP header, and a reset button. It contains

everything needed to support the microcontroller; simply connect it to a computer

with a USB cable or power it with a AC-to-DC adapter or battery to get started.

"Duemilanove" means 2009 in Italian and is named after the year of its release. The

Duemilanove is the latest in a series of USB Arduino boards; for a comparison with

previous versions.

Summary

Microcontroller ATmega168

Operating Voltage 5V

Input Voltage

(recommended)7-12V

Input Voltage (limits) 6-20V

Digital I/O Pins 14 (of which 6 provide PWM output)

Analog Input Pins 6

Page 15: Seat Belt Security using Arduino report

DC Current per I/O Pin 40 mA

DC Current for 3.3V Pin 50 mA

Flash Memory16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB

used by bootloader

SRAM 1 KB (ATmega168) or 2 KB (ATmega328)

EEPROM 512 bytes (ATmega168) or 1 KB (ATmega328)

Clock Speed 16 MHz

Power

The Arduino Duemilanove can be powered via the USB connection or with an

external power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or

battery. The adapter can be connected by plugging a 2.1mm center-positive plug

into the board's power jack. Leads from a battery can be inserted in the Gnd and

Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less

than 7V, however, the 5V pin may supply less than five volts and the board may be

unstable. If using more than 12V, the voltage regulator may overheat and damage

the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

VIN. The input voltage to the Arduino board when it's using an external power

source (as opposed to 5 volts from the USB connection or other regulated power

source). You can supply voltage through this pin, or, if supplying voltage via the

power jack, access it through this pin.

5V. The regulated power supply used to power the microcontroller and other

components on the board. This can come either from VIN via an on-board regulator,

or be supplied by USB or another regulated 5V supply.

3V3. A 3.3 volt supply generated by the on-board FTDI chip. Maximum current

draw is 50 mA.

GND. Ground pins.

Memory

Page 16: Seat Belt Security using Arduino report

The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used

for the bootloader); the ATmega328has 32 KB, (also with 2 KB used for the

bootloader). The ATmega168 has 1 KB of SRAM and 512 bytes of EEPROM (which

can be read and written with the EEPROM library); the ATmega328 has 2 KB of

SRAM and 1 KB of EEPROM.

Input and Output

Each of the 14 digital pins on the Duemilanove can be used as an input or output,

using pinMode(), digitalWrite(), anddigitalRead() functions. They operate at 5 volts.

Each pin can provide or receive a maximum of 40 mA and has an internal pull-up

resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have

specialized functions:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.

These pins are connected to the corresponding pins of the FTDI USB-to-TTL Serial

chip.

External Interrupts: 2 and 3. These pins can be configured to trigger an

interrupt on a low value, a rising or falling edge, or a change in value. See

the attachInterrupt() function for details.

PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with

the analogWrite() function.

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI

communication using the SPI library.

LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH

value, the LED is on, when the pin is LOW, it's off.

The Duemilanove has 6 analog inputs, each of which provide 10 bits of resolution

(i.e. 1024 different values). By default they measure from ground to 5 volts, though

is it possible to change the upper end of their range using the AREF pin and

the analogReference() function. Additionally, some pins have specialized

functionality:

I2C: analog input pins A4 (SDA) and A5 (SCL). Support I2C (TWI)

communication using the Wire library.

There are a couple of other pins on the board:

AREF. Reference voltage for the analog inputs. Used with analogReference().

Reset. Bring this line LOW to reset the microcontroller. Typically used to add a

reset button to shields which block the one on the board.

Page 17: Seat Belt Security using Arduino report

See also the mapping between Arduino pins and ATmega168 ports.

Communication

The Arduino Duemilanove has a number of facilities for communicating with a

computer, another Arduino, or other microcontrollers.

The ATmega168 and ATmega328 provide UART TTL (5V) serial communication,

which is available on digital pins 0 (RX) and 1 (TX). An FTDI FT232RL on the board

channels this serial communication over USB and the FTDI drivers (included with

the Arduino software) provide a virtual com port to software on the computer. The

Arduino software includes a serial monitor which allows simple textual data to be

sent to and from the Arduino board. The RX and TX LEDs on the board will flash

when data is being transmitted via the FTDI chip and USB connection to the

computer (but not for serial communication on pins 0 and 1).

A SoftwareSerial library allows for serial communication on any of the

Duemilanove's digital pins.

The ATmega168 and ATmega328 also support I2C (TWI) and SPI communication.

The Arduino software includes a Wire library to simplify use of the I2C bus; see

the documentation for details. For SPI communication, use the SPI library.

Programming

The Arduino Duemilanove can be programmed with the Arduino software

(download). Select "Arduino Diecimila or Duemilanove w/ ATmega168" or "Arduino

Duemilanove w/ ATmega328" from the Tools > Board menu (according to the

microcontroller on your board).

The ATmega168 or ATmega328 on the Arduino Duemilanove comes preburned with

a bootloader that allows you to upload new code to it without the use of an external

hardware programmer. It communicates using the original STK500protocol

(reference, C header files).

You can also bypass the bootloader and program the microcontroller through the

ICSP (In-Circuit Serial Programming) header; see these instructions for details.

Automatic (Software) Reset

Rather then requiring a physical press of the reset button before an upload, the

Arduino Duemilanove is designed in a way that allows it to be reset by software

running on a connected computer. One of the hardware flow control lines (DTR) of

the FT232RL is connected to the reset line of the ATmega168 or ATmega328 via a

100 nanofarad capacitor. When this line is asserted (taken low), the reset line drops

long enough to reset the chip. The Arduino software uses this capability to allow

Page 18: Seat Belt Security using Arduino report

you to upload code by simply pressing the upload button in the Arduino

environment. This means that the bootloader can have a shorter timeout, as the

lowering of DTR can be well-coordinated with the start of the upload.

This setup has other implications. When the Duemilanove is connected to either a

computer running Mac OS X or Linux, it resets each time a connection is made to it

from software (via USB). For the following half-second or so, the bootloader is

running on the Duemilanove. While it is programmed to ignore malformed data (i.e.

anything besides an upload of new code), it will intercept the first few bytes of data

sent to the board after a connection is opened. If a sketch running on the board

receives one-time configuration or other data when it first starts, make sure that

the software with which it communicates waits a second after opening the

connection and before sending this data.

The Duemilanove contains a trace that can be cut to disable the auto-reset. The

pads on either side of the trace can be soldered together to re-enable it. It's labeled

"RESET-EN". You may also be able to disable the auto-reset by connecting a 110

ohm resistor from 5V to the reset line; see this forum thread for details.

USB Overcurrent Protection

The Arduino Duemilanove has a resettable polyfuse that protects your computer's

USB ports from shorts and overcurrent. Although most computers provide their

own internal protection, the fuse provides an extra layer of protection. If more than

500 mA is applied to the USB port, the fuse will automatically break the connection

until the short or overload is removed.

Physical Characteristics

The maximum length and width of the Duemilanove PCB are 2.7 and 2.1 inches

respectively, with the USB connector and power jack extending beyond the former

dimension. Three screw holes allow the board to be attached to a surface or case.

Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even

multiple of the 100 mil spacing of the other pins.

Pin Configuration

Page 19: Seat Belt Security using Arduino report

Advantages and Limitations

* The system brings more safety to drivers

* The system provides option of coming out of car without ignition needs to be closed

* The system gets the supply through 12V battery which can be easily put inside any vehicle.

* The system's response time is barely 2ms which makes it respond faster.

Limitations:

* The system does not adher to other safety aspects like control of the belt lock under collision

* The system sensor is based on light variation, which can be imitated by other objects.

Page 20: Seat Belt Security using Arduino report

Conclusion

In modern automobiles, all the cars come equipped with microcontrollers and DSP processors for various sensing and control operations. Taking advantage of this phenomenon, we have developed a mechanism for providing driver with more security through an extra layer of lock along the seat belts. The driver is not permitted to drive with the belts. This reduces the risk of drivers in accidents. The ignition locking without the belt comes aboard with several high end cars now. But adding extra lock with the belt which does not permit the user to remove the lock whicle driving is missing in such systems. Through our testing, we have provided mechanism for safety even during conditions where a driver applies break.

The system can be further tested by incorporating the same in real cars.

Page 21: Seat Belt Security using Arduino report