0% found this document useful (0 votes)
6 views62 pages

BLACK BOX REPORT

This document outlines the development of a Vehicle Black Box System (VBBS) designed to enhance vehicle safety and assist in crash investigations globally. The system utilizes various sensors and a PIC microcontroller to monitor vehicle parameters, detect accidents, and provide real-time data for analysis, ultimately aiming to reduce road fatalities. The VBBS also includes features for alerting emergency services and vehicle maintenance checks to prevent accidents.

Uploaded by

dilipkumarvfc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views62 pages

BLACK BOX REPORT

This document outlines the development of a Vehicle Black Box System (VBBS) designed to enhance vehicle safety and assist in crash investigations globally. The system utilizes various sensors and a PIC microcontroller to monitor vehicle parameters, detect accidents, and provide real-time data for analysis, ultimately aiming to reduce road fatalities. The VBBS also includes features for alerting emergency services and vehicle maintenance checks to prevent accidents.

Uploaded by

dilipkumarvfc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

CHAPTER – 1

INTRODUCTION

The main purpose of this paper is to develop a prototype of the vehicle black box system
VBBS that can be installed into any vehicle all over the world. This prototype can be designed
with minimum number of circuits. The VBBS can contribute to constructing safer vehicles,
improving the treatment of crash victims, helping insurance companies with their vehicle crash
investigations, and enhancing road status in order to decrease the death rate
According to the World Health Organization, more than a million people in the world die each
year because of transportation-related accidents. In order to react to this situation, the black box
system draws the first step to solve this problem that crosses national boundaries and threatens
the safety and health of people worldwide. Introduced to a part of the United States market in
1999, the black box system proved to be efficient. However in the latter case, the system was
embedded in the vehicle. Therefore, in addition to improving the treatment of crash victims and
the road status in order to decrease the death rate, constructing safer vehicles, and helping
insurance companies with their vehicle accidents investigations, the main purpose of this paper
is to develop a black box system that can be installed to any vehicle all over the world. Like
flight data recorders in aircraft, ―black box‖ technology can now play a key role in motor
vehicle crash investigations. A significant number of vehicles currently on the roads contain
electronic systems that record information in the event of a crash. That is why it is so important
to have recorders that objectively track what goes on in vehicles before, during and after a crash
as a complement to the subjective input that is taken usually from victims, eye witnesses and
police reports. This system is committed mainly to two approaches. The first one is how to
detect and record data from the vehicle. The second is how to present the data recorded to the
user in a simplified way. To implement the first approach, some major components and different
type of sensors were used. While the second approach was implemented using Internet of
Things. This program receives the data serially from the black box memory, presents it in real-
time graphics and finally saves it to a formal excel report for future use.

Many police cases related to road accidents remain pending due to unknown reason of an
accident. To avoid these problems, a black box is designed which is used to analyse the status of
the vehicle at the time of occurrence of accidents. Black box is a digital electronic device, which
records and store vehicle speed, real time and vehicle's other status information. It helps to
discover and to analyses the reason of an accident easily and to settle many disputes related to
car accident such as crash litigation, insurance settlements. It can be used to not only reconstruct
what happened before an accident by Insurance agents and police but improve vehicle design,
roadway design and emergency medical service by automakers, government and hospital. Hence
a combined system is essential to provide the solution for all the above problems).
CHAPTER – 2

BLOCK DIAGRAM

Since majority of our population uses two-wheelers it is essential to implement a system


that is compact in size and cost-effective .The system employs analysis of vehicle parameters
such as alcohol content, pressure, temperature of the vehicle and storing the parameters in the
short memory for future analysis.

Our proposed design mainly concentrates on designing a low cost and effective vehicle
analyzing system.

In our proposed system a compact, cost effective and real –time monitoring black box is
designed. The black box we have developed uses PIC16F877A which is Programmable IC,
accident sensor is interfaced to check whether is occurred or not. Accident sensor indicate the
occurrence of accident and alert the public via alarm. Therefore, timely assistance can be
achieved preventing life loss. The accident information system will alert relative of the vehicle
owner relative or nearby hospital through IoT module with the accident location using GPS
module. If the accident is a minor one then driver can press the reset switch which prevents
delivering of false information and drive normally. The ultrasonic sensor is used to measure
distance between two vehicles automatically to prevent the accidents.
The main reason for occurrence of accidents is the failure of vehicle maintenance. Our
system checks the status of the vehicle using sensors and if any abnormality is detected alerts the
driver. Brake failure sensor, will indicate if the brake wire is connected properly or not and
temperature sensor will check the correct air pressure of the tyre, and the temperature senor is
used to sense the temperature on the tyre. Accelerator, brake clutch and steering position sensor
indicate the position of accelerator, brake clutch steering respectively. The entire process is
monitored in PC.

CHAPTER – 3

CIRCUIT DIAGRAM AND DESCRIPTION

In our proposed system a compact, cost effective and real –time monitoring black box is
designed. The black box we have developed uses PIC16F877A which is Programmable IC. The
PIC microcontroller transmit and receive the data with respect to clock pulses, the PIC
microcontroller operates with 4MHz crystal frequency. Two capacitors are connected to the
crystal oscillator with range of 20pf to 40pf which is used to stabilize the clock signals. At some
times, the PIC microcontroller goes to block state or missing time calculation, at that time we
need to reset the microcontroller. If a microcontroller is reset for 3sec time delay, 10k resistor
and 10uf capacitor are connected to the respective pins. The 5v DC supply is given to the 11 pin
of the microcontroller which drives the circuit. The crystal is connected to the 13 and 14 pins of
the microcontroller. The reset circuit is interfaced at 1 pins of the microcontroller. , accident
sensor is interfaced to check whether is occurred or not. Accident sensor indicates the occurrence
of accident and connected with PIC microcontroller (RA1) and alerts the public via buzzer which
is connected PIC controller (PORTC). The accelerator, brake, clutch are connected with PIC
microcontroller (RA2- RA3). Therefore, timely assistance can be achieved preventing life loss.
The accident information system will alert relative of the vehicle owner relative or nearby
hospital through PC with the accident location using GPS module. The GPS module transmitter
is connected with PIC (RC7) and PC module receives the data from PIC controller. If the
accident is a minor one then driver can press the reset switch which prevents delivering of false
information and drive normally. In this system, we use serial communication to communicate
between the PC and PIC microcontroller using USB to UART converter. The PIC
microcontroller RX (RC7) pin connected with PC TX pin and vice versa. The accident detected
is received and decoded by the PIC microcontroller through PC serially and then vehicle parked
left side with help of ultrasonic sensor. The Analog output voltage of accident sensor is given to
the Analog Input pin RA0 of the PIC Microcontroller. The result of the 10-bit Analog to Digital
(A/D) Conversion is read using the function ADC Read(0) and then the Voltage is converted to
corresponding character to Display it in LCD and alert the with help of buzzer. The main reason
for occurrence of accidents is the failure of vehicle maintenance. Our system checks the status of
the vehicle using sensors and if any abnormality is detected alerts the driver. Brake failure
sensor, will indicate if the brake wire is connected properly or not and temperature sensor will
check the correct air pressure of the tyre, and the temperature senor is used to sense the
temperature on the tyre. Accelerator, brake clutch and steering position sensor indicate the
position of accelerator, brake clutch steering respectively. The entire process is monitored in PC.

CHAPTER – 4

HARDWARE DESCRIPTION

4.1. ACCELERETOR SENSOR, BRAKE SENSOR & CLUTCH SENSOR

One of the most common inertial sensors is the accelerometer, a dynamic sensor capable of a
vast range of sensing. Accelerometers are available that can measure acceleration in one, two, or
three orthogonal axes. They are typically used in one of three modes: As an inertial measurement
of velocity and position; As a sensor of inclination, tilt, or orientation in 2 or 3 dimensions, as
referenced from the acceleration of gravity (1 g = 9.8m/s2 );As a vibration or impact (shock)
sensor. There are considerable advantages to using an analog accelerometer as opposed to an
inclinometer such as a liquid tilt sensor – inclinometers tend to output binary information
(indicating a state of on or off), thus it is only possible to detect when the tilt has exceeded some
thresholding angle.

Car controls are the components in automobiles and other powered road vehicles, such
as trucks and buses, used for driving and parking.

While controls like steering wheels and pedals have existed since the invention of cars, other
controls have developed and adapted to the demands of drivers. For example, manual
transmissions became less common as technology relating to semi-automatic and automatic
transmissions advanced.

The throttle, which controls fuel and air supply to the engine and is also known as the
"accelerator" or "gas pedal", is normally the right-most floor pedal. It has a fail-safe design – a
spring, which returns it to the idle position when not depressed by the driver. Normally the
throttle and brake are operated by the right foot, while the clutch is operated by the left foot. In
the US, drivers mistake the accelerator for the brake, leading to sudden unintended acceleration,
cause 16,000 accidents per year.[4] However, there are drivers who practice left-foot braking.
In modern cars the four-wheel braking system is controlled by a pedal to the left of
the accelerator pedal. There is usually also a parking brake which operates the rear brakes only.
On manual cars this is a lever between the front seats, but can be a pedal on some automatic
transmission vehicles. In rallying the handbrake lever is long and vertical, extending to near the
steering wheel, to facilitate handbrake turns.
A potentiometer is a manually adjustable resistor. The way this device works is
relatively simple. One terminal of the potentiometer is connected to a power source. Another is
hooked up to ground (a point with no voltage or resistance and which serves as a neutral
reference point), while the third terminal runs across a strip of resistive material. This resistive
strip generally has a low resistance at one end; its resistance gradually increases to a maximum
resistance at the other end. The third terminal serves as the connection between the power
source and ground, and is usually interfaced to the user by means of a knob or lever. The user
can adjust the position of the third terminal along the resistive strip in order to manually
increase or decrease resistance. By controlling resistance, a potentiometer can determine how
much current flows through a circuit. When used to regulate current, the potentiometer is
limited by the maximum resistivity of the strip.

Construction and working:

Manufactured potentiometers enclose a resistive strip inside a metal or plastic housing, and
provide some kind of mechanism for moving a "wiper" across the length of that resistive strip.
Here is an illustration of a rotary potentiometer's construction:

Some rotary potentiometers have a spiral resistive strip, and a wiper that moves axially as it
rotates, so as to require multiple turns of the shaft to drive the wiper from one end of the
potentiometer's range to the other. Multi-turn potentiometers are used in applications where
precise setting is important.

Linear potentiometers also contain a resistive strip, the only difference being the wiper's
direction of travel. Some linear potentiometers use a slide mechanism to move the wiper, while
others a screw, to facilitate multiple-turn operation:
It should be noted that not all linear potentiometers have the same pin assignments. On some,
the middle pin is the wiper.

4.2. MICROCONTROLLER

PIC is a family of Harvard architecture microcontrollers made by Microchip Technology,


derived from the PIC1640. Originally developed by General Instrument's Microelectronics
Division. The name PIC initially referred to "Programmable Interface Controller".

PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide
availability, large user base, extensive collection of application notes, availability of low cost or
free development tools, and serial programming (and re-programming with flash memory)
capability.Microchip announced on February 2008 the shipment of its six billionth PIC
processor.

The PIC microcontroller PIC16f877a is one of the most renowned microcontrollers in the
industry. This controller is very convenient to use, the coding or programming of this controller
is also easier. One of the main advantages is that it can be write-erase as many times as possible
because it use FLASH memory technology. It has a total number of 40 pins and there are 33 pins
for input and output. PIC16F877A is used in many pic microcontroller projects. PIC16F877A
also have many application in digital electronics circuits.
FIG 4.3 .1IC PIN
PIC16f877a finds its applications in a huge number of devices. It is used in remote sensors,
security and safety devices, home automation and in many industrial instruments.
An EEPROM is also featured in it which makes it possible to store some of the information
permanently like transmitter codes and receiver frequencies and some other related data. The
cost of this controller is low and its handling is also easy. Its flexible and can be used in areas
where microcontrollers have never been used before as in coprocessor applications and timer
functions etc.
Microcontroller is a general purpose device, which integrates a number of the components of
a microprocessor system on to single chip. It has inbuilt CPU, memory and peripherals to make
it as a mini computer. A microcontroller combines on to the same microchip:

 CPU core

 Memory (both ROM and RAM)

 Some parallel digital input/output

Microcontrollers will combine other devices such as:

 A timer module to allow the microcontroller to perform tasks for certain time periods.

 A serial I/O port to allow data to flow between the controller and other devices such as a
PIC or another microcontroller.

 An ADC to allow the microcontroller to accept analogue input data for processing.
Microcontrollers are:

 Smaller in size

 Consumes less power

 Inexpensive

Microcontroller is a standalone unit, which can perform functions on its own without any
requirements for additional hardware like I/O ports and external memory.

The heart of the microcontroller is the CPU core. In the past, this has traditionally been
based on an 8 bit microprocessor unit. For example, Motorola uses a basic 6800 microprocessor
core their 6805/6808 microcontroller devices. In the recent years, microcontrollers have been
developed around specifically designed CPU cores, for example the microchip PIC range of
microcontrollers.

Introduction to PIC:

The microcontroller that has been used for this project is from PIC series. PIC
microcontroller is the first RISC based microcontroller fabricated in CMOS (complementary
metal oxide semiconductor) that uses separate bus for instruction and data allowing
simultaneous access of program and data memory. The main advantage of CMOS and RISC
combination is low power consumption resulting in a very small chip size with a small pin
count. The main advantage of CMOS is that has immunity to noise than other fabrication
techniques.

PIC 16877A:

Various microcontrollers offer different kinds of memories. EEPROM, EPROM,


FLASH etc. are some of the memories of which FLASH is the most recently developed.
Technology that is used in PIC 16877 is flash technology, so that data is retained even when the
power is switched off. Easy programming and erasing are other features of PIC 16F877.
PIC16F877A microcontroller is used in the project. The following are some of the important
features of the controller.
Core features:

 High performance RISC CPU

 Only 35 single word instructions to learn

 All single cycle instructions except for program branches which are two cycle

 Operating speed: DC- 20MHz clock input

DC- 200 ns instruction cycle

 Up to 8K x 14 words of FLASH Program Memory,

Up to 368 x 8 bytes of Data Memory (RAM)

Up to 256 x 8 bytes of EEPROM data memory

 Pin out compatible to the PIC 16c73/74/76/77

 Interrupt capability (up to 14 external/internal)

 Eight level deep hardware stack

 Direct, indirect and relative dressing modes

 Power –On Reset

 Power – Up Timer (PWRT) and Oscillator Start – Up Timer (OST)

 Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation

 Programmable code operation

 Power saving SLEEP mode


 Selectable oscillator options

 Low-power, high speed CMOS EPROM/EEPROM technology

 Fully static design

 In-circuit Serial Programming (ISCP) via two pins

 Only single 5V source needed for programming capability

 In-circuit Debugging via two pins

 Processor read/write access to program memory

 Wide operating voltage range: 2.5v - 5.5v

 High sink source current: 25mA

 Commercial and industrial temperature ranges

 Low-power consumption:

<2mA typical at 5V, 4MHz

20mA typical at 3V, 32 kHz

<1mA typical standby current

Peripheral features:

 Timer0: 8bit timer/counter with 8-bit prescaler

 Timer1: 16-bit timer/counter with prescaler, can be incremented during sleep via external
clock/crystal

 Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler

 10-bit multichannel Analog-to-Digital converter

 Synchronous Serial Port (SSP) with SPI (Master mode) and 12C (Master/ Slave)
 Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit
address detection

 Brown – out detection circuitry for Brown out Reset (BOR)

Pin Description:

PIC16F877A consists of 40 pins enclosed in 5 ports. Each port holds 8 pins which are
bidirectional input/output pins. Pin diagram of PIC 16F877 is represented in Fig.

FIG 4.3.2 PIN DESCRIPTION

PIN 1: MCLR
The first pin is the master clear pin of this IC. It resets the microcontroller and is active low,
meaning that it should constantly be given a voltage of 5V and if 0 V are given then the
controller is reset. Resetting the controller will bring it back to the first line of the program that
has been burned into the IC.

A push button and a resistor is connected to the pin. The pin is already being supplied by
constant 5V. When we want to reset the IC we just have to push the button which will bring the
MCLR pin to 0 potential thereby resetting the controller.

PIN 2: RA0/AN0
PORTA consists of 6 pins, from pin 2 to pin 7, all of these are bidirectional input/output pins.
Pin 2 is the first pin of this port. This pin can also be used as an analog pin AN0. It is built
in analog to digital converter.
PIN 3: RA1/AN1
This can be the analog input 1.

PIN 4: RA2/AN2/Vref-
It can also act as the analog input2. Or negative analog reference voltage can be given to it.

PIN 5: RA3/AN3/Vref+
It can act as the analog input 3. Or can act as the analog positive reference voltage.

PIN 6: RA0/T0CKI
To timer0 this pin can act as the clock input pin, the type of output is open drain.

PIN 7: RA5/SS/AN4
This can be the analog input 4. There is synchronous serial port in the controller also and this pin
can be used as the slave select for that port.

PIN 8: RE0/RD/AN5
PORTE starts from pin 8 to pin 10 and this is also a bidirectional input output port. It can be the
analog input 5 or for parallel slave port it can act as a ‗read control‘ pin which will be active low.

PIN 9: RE1/WR/AN6
It can be the analog input 6. And for the parallel slave port it can act as the ‗write control‘ which
will be active low.

PIN 10: RE2/CS/A7


It can be the analog input 7, or for the parallel slave port it can act as the ‗control select‘ which
will also be active low just like read and write control pins.

PIN 11 and 32: VDD


These two pins are the positive supply for the input/output and logic pins. Both of them should
be connected to 5V.

PIN 12 and 31: VSS


These pins are the ground reference for input/output and logic pins. They should be connected to
0 potential.

PIN 13: OSC1/CLKIN


This is the oscillator input or the external clock input pin.

PIN 14: OSC2/CLKOUT


This is the oscillator output pin. A crystal resonator is connected between pin 13 and 14 to
provide external clock to the microcontroller. ¼ of the frequency of OSC1 is outputted by OSC2
in case of RC mode. This indicates the instruction cycle rate.
PIN 15: RC0/T1OCO/T1CKI
PORTC consists of 8 pins. It is also a bidirectional input output port. Of them, pin 15 is the first.
It can be the clock input of timer 1 or the oscillator output of timer 2.

PIN 16: RC1/T1OSI/CCP2


It can be the oscillator input of timer 1 or the capture 2 input/compare 2 output/ PWM 2 output.

PIN 17: RC2/CCP1


It can be the capture 1 input/ compare 1 output/ PWM 1 output.

PIN 18: RC3/SCK/SCL


It can be the output for SPI or I2C modes and can be the input/output for synchronous serial
clock.

PIN 23: RC4/SDI/SDA


It can be the SPI data in pin. Or in I2C mode it can be data input/output pin.

PIN 24: RC5/SDO


It can be the data out of SPI in the SPI mode.

PIN 25: RC6/TX/CK


It can be the synchronous clock or USART Asynchronous transmit pin.

PIN 26: RC7/RX/DT


It can be the synchronous data pin or the USART receive pin.
PIN 19,20,21,22,27,28,29,30:
All of these pins belong to PORTD which is again a bidirectional input and output port. When
the microprocessor bus is to be interfaced, it can act as the parallel slave port.

PIN 33-40: PORT B


All these pins belong to PORTB. Out of which RB0 can be used as the external interrupt pin and
RB6 and RB7 can be used as in-circuit debugger pins.

Architecture of PIC 16F877:

The basic building block of PIC 16F877A is based on Harvard architecture. The memory of a
PIC 16F877A is divided into 3 sections. They are:

 Program memory

 Data Memory

 Data EEPROM

Program memory

The PIC 16F877A devices have a 13-bit program counter capable of addressing an 8K
word x 14 bit program memory space. The PIC16F877A devices have 8K words x 14 bits of
flash program memory.

Data memory

The data memory is partitioned into multiple banks which contain the General Purpose
Registers and the Special Function Registers. Bits RP1 and RP0 are the bank select bits. The
lower locations of each bank are reserved for the Special Function Registers. Above the Special
Function Registers are General Purpose Registers, implemented as static RAM. All
implemented banks contain Special Function Registers.

Data EEPROM
The data EEPROM and flash program memory is readable and writing during normal
operation. This memory is not directly mapped in the register file space. Instead, it is indirectly
addressed through the special function registers. The EEPROM data memory allows single-byte
reads and writes. The flash memory allows single-word reads and four-word block writes.

Registers:

The module has four registers for operation. These are:

 Control Register
 Status Register
 Serial Receive/Transmit Buffer Register
 Shift Register
CR and SR are the control and status registers used in operation. The CS register is
readable and writable. The lower six bits of the SR are read only. The upper two bits of SR are
read/write. SSPSR is the shift register used for shifting data in or out. SSPBUF is the buffer
register to which data bytes are written to or read form. In receive operations: SSPSR and
SSPBUF together create a double-buffered receiver. During transmission, the SSPBUF is not
double-buffered.

Timer Modules:

The PIC16F877A incorporates timer modules for the purpose of producing software interrupts.
These interrupts are part and parcel of microcontroller programming. There are three timers
available. They are:

 Timer0 module
 Timer1 module
 Timer2 module
Architecture of PIC 16F877
Master Synchronous Serial Port (MSSP) Module:

The Master Synchronous Serial Port (MSSP) module is a serial interface, useful for
communicating with other peripheral or microcontroller devices. These peripheral devices may
be serial EEPROMs, shift registers, display drivers, A/D converters, etc. The MSSP module can
operate in one of two modes:

 Serial Peripheral Interface (SPI)


 Inter- Integrated Circuit (I2C)
 Full Master mode
 Slave mode (with general address call)
The I2C interface supports the following modes in hardware:

 Master mode
 Multi-Master mode
 Slave mode
Control Registers:

The MSSP module has three associated registers. These include a status register (SSPSTAT)
and two control registers (SSPCON and SSPCON2). The use of these registers and their
individual configuration bits differ significantly, depending on whether the MSSP module is
operated in SPI or I2C mode.

Analog to Converter Module:

The Analog-to-Digital Converter module has five inputs for the 28-pi devices and eight for the
40/44 pin devices. The conversion of an analog input signal results in a corresponding 10-bit
digital number. The A/D module has high and low voltage reference input that is software
selectable to some combination of VDD, VSS, RA2 or RA3. The A/D converter has a unique
feature of being able to operate while the device is in sleep mode. To operate in sleep mode, the
A/D clock must be derived from the A/D internal RC oscillator.

Core architecture

The PIC architecture is characterized by the following features:

 Separate code and data spaces (Harvard architecture) for devices other than PIC32, which
has a Von Neumann architecture.
 A small number of fixed length instructions
 Most instructions are single cycle execution (2 clock cycles), with one delay cycle on
branches and skips
 One accumulator (W0), the use of which (as source operand) is implied (i.e. is not
encoded in the opcode)
 All RAM locations function as registers as both source and/or destination of math and
other functions.
 A hardware stack for storing return addresses
 A fairly small amount of addressable data space (typically 256 bytes), extended through
banking
 Data space mapped CPU, port, and peripheral registers
 The program counter is also mapped into the data space and writable (this is used to
implement indirect jumps).

There is no distinction between memory space and register space because the RAM serves the
job of both memory and registers, and the RAM is usually just referred to as the register file or
simply as the registers.

Data space (RAM)

PICs have a set of registers that function as general purpose RAM. Special purpose control
registers for on-chip hardware resources are also mapped into the data space. The addressability
of memory varies depending on device series, and all PIC devices have some banking
mechanism to extend addressing to additional memory. Later series of devices feature move
instructions which can cover the whole addressable space, independent of the selected bank. In
earlier devices, any register move had to be achieved via the accumulator.

To implement indirect addressing, a "file select register" (FSR) and "indirect register" (INDF)
are used. A register number is written to the FSR, after which reads from or writes to INDF will
actually be to or from the register pointed to by FSR. Later devices extended this concept with
post- and pre- increment/decrement for greater efficiency in accessing sequentially stored data.
This also allows FSR to be treated almost like a stack pointer (SP).

External data memory is not directly addressable except in some high pin count PIC18 devices.

Code space

The code space is generally implemented as ROM, EPROM or flash ROM. In general, external
code memory is not directly addressable due to the lack of an external memory interface. The
exceptions are PIC17 and select high pin count PIC18 devices.

Word size

The word size of PICs can be a source of confusion. All PICs handle (and address) data in 8-bit
chunks, so they should be called 8-bit microcontrollers. However, the unit of addressability of
the code space is not generally the same as the data space. For example, PICs in the baseline and
mid-range families have program memory addressable in the same wordsize as the instruction
width, i.e. 12 or 14 bits respectively. In contrast, in the PIC18 series, the program memory is
addressed in 8-bit increments (bytes), which differs from the instruction width of 16 bits.

In order to be clear, the program memory capacity is usually stated in number of (single word)
instructions, rather than in bytes.

Stacks

PICs have a hardware call stack, which is used to save return addresses. The hardware stack is
not software accessible on earlier devices, but this changed with the 18 series devices.
Hardware support for a general purpose parameter stack was lacking in early series, but this
greatly improved in the 18 series, making the 18 series architecture more friendly to high level
language compilers.

Instruction set

A PIC's instructions vary from about 35 instructions for the low-end PICs to over 80
instructions for the high-end PICs. The instruction set includes instructions to perform a variety
of operations on registers directly, the accumulator and a literal constant or the accumulator and
a register, as well as for conditional execution, and program branching.

Some operations, such as bit setting and testing, can be performed on any numbered register, but
bi-operand arithmetic operations always involve W (the accumulator) ; writing the result back to
either W or the other operand register. To load a constant, it is necessary to load it into W before
it can be moved into another register. On the older cores, all register moves needed to pass
through W, but this changed on the "high end" cores.

HOW TO PROGRAM THE INPUT AND OUTPUT PORTS of PIC16F877A

As we have studied 5 input and output ports namely PORTA, PORTB, PORTC, PORTD and
PORTE which can be digital as well as analog. We will configure them according to our
requirements. But in case of analog mode, the pins or the ports can only act as inputs. There is a
built in A to D converter which is used in such cases. Multiplexer circuits are also used.

But in digital mode, there is no restriction. We can configure the ports as output or as input. This
is done through programming. For PIC the preferable compiler is mikro C pro which can be
downloaded from their website.

There is a register named as ‗TRIS‘ which controls the direction of ports. For different ports
there are different registers such as TRISA, TRISB etc.

 If we set a bit of the TRIS register to 0, the corresponding port bit will act as the digital
output.
 If we set a bit of the TRIS register to 1, the corresponding port bit will act as the digital
input.
For example to set the whole portb to output we can write the program statement as:

TRISB=0;

Now the port will act as the output port and we can send any value on the output such as

PORTB=0XFF;

FF represents all 1‘s in binary i.e. FF=11111111, now all the pins of port b are high. If we
connect LEDs at all the pins then they will all start glowing in this condition.

If we want to negate the values of the port b we can use the statement:

PORTB=~PORTB;

Now all the pins of the port b will be low.

CODE TO LIGHT UP A SINGLE LED/ FLASHING LED

void main()

TRISB.F0 = 0 // the direction of RB0 is set as output

//or TRISB = 0xFE (0xFE = 11111110)

do // setting the infinite loop

PORTB.F0 = 1; // setting the RB0 pin to high

Delay_ms(500); // delay of 500 milli seconds


PORTB.F0 = 0; // setting the RB0 pin to low

Delay_ms(500); // again a delay of 500 milli seconds

}while(1);

Relay Driver:

A relay is an electro-magnetic switch which is useful if you want to use a low voltage
circuit to switch on and off a light bulb (or anything else) connected to the 220v mains supply.

The diagram below shows a typical relay (with ―normally-open‖ contacts).

The current needed to operate the relay coil is more than can be supplied by most chips (op.
amps etc), so a transistor is usually needed.
Relay Driver using single transistor:

This circuit will drive a relay coil from a low power output, usually from an IC like 555
or a TTL/CMOS. It is used to switch high loads or loads that needs AC current to operate. The
relay will be actuated when the input of the circuit goes high. The protection diode Dp is used to
protect the transistor from the reverse current generated from the coil of the relay during the
switch off time. The values for Rb and Qs vary accordingly. The way to calculate them is:

First we calculate the load current:

IL = VS / RL

Then we calculate the transistor hFE. It must be at least 5 times the load current IL
divided by the maximum output current from the Input to the base of the transistor

IL
hFE(min) > 5 X
IINPUT
Now you can choose the transistor Qs. You must select it according to it's Ic that must be
greater than IL and it's current gain hFE.

Then you calculate the base resistor RB, If the input is taken from a component (possible
an IC) that uses the same power supply as the transistor (that is Vs), then the form is:

RB = 0.2 X RL X hFE

Otherwise, if the component uses another power source (like VCC) then the form is:

VCC X hFE
RB =
5 X IL

The protective diode could be the 1N4001 or any general purpose diode.

An example:

The output from a 74LS series TTL IC is required to operate a relay with a 160 Ohm
coil. The supply voltage is 12V for the transistor and 5V for the IC. The IC can supply a
maximum current of 2mA.

IL = Vs / RL => IL = 12 / 160 = 75mA

The transistor must have an hFE greater than 5 X 75 / 2 => hFE > 187.5. So we choose a
transistor with hFE = 200 and IC = 100mA.

Now for the RB resistor. Because the power supplies of transistor and IC are different,
we use the second formula:
VCC X hFE
RB =
5 X IL

With the use of some basic maths, this will produce RB = 2666.6 Ohm. You choose the
closest resistor possible to this value.

4.3. DARLINGTON PAIR

A Darlington pair is two transistors that act as a single transistor but with a much higher
current gain.

The Darlington transistor (often called a Darlington pair) is a compound structure


consisting of two bipolar transistors (either integrated or separated devices) connected in such a
way that the current amplified by the first transistor is amplified further by the second one. This
configuration gives a much higher current gain (written β, hfe, or hFE) than each transistor taken
separately and, in the case of integrated devices, can take less space than two individual
transistors because they can use a shared collector. Integrated Darlington pairs come packaged
in transistor-like integrated circuit packages.

The Darlington configuration was invented by Bell Laboratories engineer Sidney


Darlington in 1953. He patented the idea of having two or three transistors on a single chip (and
sharing a single collector), but not that of an arbitrary number (which might have covered all
modern integrated circuits.
The circuit shows ‗Darlington Pair‘ driver. The first transistor‘s emitter feeds into the
second transistor‘s base and as a result the input signal is amplified by the time it reaches the
output.

This circuit is used for amplifying currents, i.e., the amplified current from the first
transistor is further amplified by the second transistor. Needless to say, this transistor
combination exhibits a much higher current gain than if only one transistor was used.

The important point to remember is that the Darlington Pair is made up of two transistors
and when they are arranged as shown in the circuit they are used to amplify weak signals.

Use of Darlington Pair

In some application the amount of input current available to switch on a transistor is very
low. This may mean that a single transistor may not be able to pass sufficient current required
by the load.

As stated earlier this equals the input current x the gain of the transistor (hFE). If it is
not be possible to increase the input current then we need to increase the gain of the transistor.
This can be achieved by using a Darlington Pair.

A Darlington Pair acts as one transistor but with a current gain that equals:
Total current gain (hFE total) = current gain of transistor 1 (hFE t1) x current gain of transistor
2(hFE t2)

So for example if you had two transistors with a current gain (hFE) = 100:

(hFE total) = 100 x 100

(hFE total) = 10,000

You can see that this gives a vastly increased current gain when compared to a single transistor.

Therefore this will allow a very low input current to switch a much bigger load current.

Base Activation Voltage

Normally to turn on a transistor the base input voltage of the transistor will need to be
greater than 0.7V. As two transistors are used in a Darlington Pair this value is doubled.

Therefore the base voltage will need to be greater than 0.7V x 2 = 1.4V.

It is also worth noting that the voltage drop across collector and emitter pins of the
Darlington Pair when the turn on will be around 0.9V Therefore if the supply voltage is 5V (as
above) the voltage across the load will be will be around 4.1V (5V – 0.9V)

Circuit Diagram:
A Darlington pair behaves like a single transistor with a high current gain
(approximately the product of the gains of the two transistors). In fact, integrated devices have
three leads (B, C and E) broadly equivalent to those of a standard transistor.

A general relation between the compound current gain and the individual gains is given by:

If β1 and β2 are high enough (hundreds), this relation can be approximated with:

A typical modern device has a current gain of 1000 or more, so that only a small base
current is needed to make the pair switch on. However, this high current gain comes with
several drawbacks.

One drawback is an approximate doubling of base-emitter voltage. Since there are


two junctions between the base and emitter of the Darlington transistor, the equivalent base-
emitter voltage is the sum of both base-emitter voltages:

For silicon-based technology, where each VBEi is about 0.65 V when the device is
operating in the active or saturated region, the necessary base-emitter voltage of the pair is 1.3 V.
Another drawback of the Darlington pair is its increased saturation voltage. The output
transistor is not allowed to saturate (i.e. its base-collector junction must remain reverse-biased)
because its collector-emitter voltage is now equal to the sum of its own base-emitter voltage and
the collector-emitter voltage of the first transistor, both positive quantities in normal operation.
(In symbols, VCE2 = VBE2 + VCE1, so VC2 > VB2 always.) Thus the saturation voltage of a
Darlington transistor is one VBE (about 0.65 V in silicon) higher than a single transistor
saturation voltage, which is typically 0.1 - 0.2 V in silicon. For equal collector currents, this
drawback translates to an increase in the dissipated power for the Darlington transistor over a
single transistor.

Another problem is a reduction in switching speed, because the first transistor cannot
actively inhibit the base current of the second one, making the device slow to switch off. To
alleviate this, the second transistor often has a resistor of a few hundred ohms connected
between its base and emitter terminal. This resistor provides a low impedance discharge path for
the charge accumulated on the base emitter junction, allowing a faster transistor turn-off.

The Darlington pair has more phase shift at high frequencies than a single transistor and
hence can more easily become unstable with negative feedback.

A Darlington pair can be sensitive enough to respond to the current passed by skin
contact even at safe voltages. Thus it can form the input stage of a touch-sensitive switch.

When current to the coil is switched off the magnetic field around the coil collapses very
quickly. This can cause a phenomenon called "Back emf" where a very high voltage

Specification:

BC 547

1. Current - 100 mA
2. Voltage - max. 65 V
SL 100

1. Current – 500mA
2. Voltage – max. 50V

SPECIFICATION

45RPM 12V DC geared motors for robotics applications. Very easy to use and available in
standard size. Nut and threads on shaft to easily connect and internal threaded shaft for easily
connecting it to wheel.

Features

 45RPM 12V DC motors with Gearbox


 6mm shaft diameter with internal hole
 125gm weight
 Same size motor available in various rpm
 2kgcm torque
 No-load current = 60 mA(Max), Load current = 300 mA(Max)

4.4. RELAYS

Circuit symbol for a relay


A relay is an electrically operated switch. Current
flowing through the coil of the relay creates a magnetic
field which attracts a lever and changes the switch
contacts. The coil current can be on or off so relays have two
switch positions and most have double throw
(changeover) switch contacts as shown in the diagram.

Relays allow one circuit to switch a second circuit which


can be completely separate from the first. For example a
low voltage battery circuit can use a relay to switch a 230V
AC mains circuit. There is no Relays electrical connection inside the
relay between the two circuits, the link is magnetic
and mechanical.

The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be
as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot
provide this current and a transistor is usually used to amplify the small IC current to the larger
value required for the relay coil. The maximum output current for the popular 555 timer IC is
200mA so these devices can supply relay coils directly without amplification.

Relays are usuallly SPDT or DPDT but they can have many more sets of switch contacts, for
example relays with 4 sets of changeover contacts are readily available.

The coil will be obvious and it may be connected either way round. Relay coils produce brief
high voltage 'spikes' when they are switched off and this can destroy transistors and ICs in the
circuit. To prevent damage you must connect a protection diode across the relay coil.

The relay's switch connections are usually labeled COM, NC and NO:

 COM = Common, always connect to this, it is the moving part of the switch.
 NC = Normally Closed, COM is connected to this when the relay coil is off.
 NO = Normally Open, COM is connected to this when the relay coil is on.
 Connect to COM and NO if you want the switched circuit to be on when the relay coil is
on.
 Connect to COM and NC if you want the switched circuit to be on when the relay coil is
off.

Choosing a relay

You need to consider several features when choosing a relay:

1. Physical size and pin arrangement

If you are choosing a relay for an existing PCB you will need to ensure that its
dimensions and pin arrangement are suitable. You should find this information in the
supplier's catalogue.

2. Coil voltage
The relay's coil voltage rating and resistance must suit the circuit powering the
relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also
readily available. Some relays operate perfectly well with a supply voltage which is a
little lower than their rated value.

3. Coil resistance

The circuit must be able to supply the current required by the relay coil. You can
use Ohm's law to calculate the current:

supply voltage
Relay coil current =
coil resistance

For example: A 12V supply relay with a coil resistance of 400 Ohm passes a
current of 30mA. This is OK for a 555 timer IC (maximum output current 200mA), but it
is too much for most ICs and they will require a transistor to amplify the current.
4. Switch ratings(voltage and current)

The relay's switch contacts must be suitable for the circuit they are to control. You
will need to check the voltage and current ratings. Note that the voltage rating is usually
higher for AC, for example: "5A at 24V DC or 125V AC".

5. Switch contact arrangement(SPDT,DPDT etc)

Most relays are SPDT or DPDT which are often described as "single pole
changeover" (SPCO) or "double pole changeover" (DPCO).

Protection diodes for relays

Transistors and ICs must be protected from the


brief high voltage produced when a relay coil is
switched off. The diagram shows how a signal
diode (eg 1N4148) is connected 'backwards' across
the relay coil to provide this protection.

Current flowing through a relay coil creates a


magnetic field which collapses suddenly when the
current is switched off. The sudden collapse of the magnetic field induces a brief high voltage
across the relay coil which is very likely to damage transistors and ICs. The protection diode
allows the induced voltage to drive a brief current through the coil (and diode) so the magnetic
field dies away quickly rather than instantly. This prevents the induced voltage becoming high
enough to cause damage to transistors and ICs.

Relays and transistors compared

Like relays, transistors can be used as an electrically operated switch. For switching small DC
currents (< 1A) at low voltage they are usually a better choice than a relay. However, transistors
cannot switch AC (such as mains electricity) and in simple circuits they are not usually a good
choice for switching large currents (> 5A). In these cases a relay will be needed, but note that a
low power transistor may still be needed to switch the current for the relay's coil! The main
advantages and disadvantages of relays are listed below:

Advantages of relays:

 Relays can switch AC and DC, transistors can only switch DC.
 Relays can switch higher voltages than standard transistors.
 Relays are often a better choice for switching large currents (> 5A).
 Relays can switch many contacts at once.

Disadvantages of relays:

 Relays are bulkier than transistors for switching small currents.


 Relays cannot switch rapidly (except reed relays), transistors can switch many times per
second.
 Relays use more power due to the current flowing through their coil.
 Relays require more current than many ICs can provide, so a low power transistor
may be needed to switch the current for the relay's coil.

4.5. DC MOTOR

DC motors are part of the electric motors using DC power as energy source. These
devices transform electrical energy into mechanical energy. The basic principle of DC motors
is same as electric motors in general, the magnetic interaction between the rotor and the stator
that will generate spin.

Simple motor has six parts:

1. Armature or rotor

2. Commutator
3. Brushes
4. Axle
5. Field magnet
6. DC power supply of some sort

Working Principle of DC motor

Graphically, the working principles of DC motors can be seen in Figure 1 below.

Figure 1. Principle of DC motor

When DC electric current flowing in the coil in accordance with the direction of the arrow,
while the direction of the magnetic field B is from north to south pole, the coil will be driven
by the force F in the direction as shown in Figure 1. This condition occurs continuously so
will result in rotation on the axis of the coil. The direction of the electric current in the coil is
fixed, because of the split ring on the end of the coil.
The major classes of DC motors are

 Shunt wound.
 Series wound.
 Compound wound.
 Separately excited.

These types of motors differ only in the connection of the field circuits The armatures,
commutators, and so forth are nearly identical with each other and with those of the generators.
All four major classes of motors are widely used. This is in contrast to the generators, in which
the compound wound type is used for nearly all general power applications.
LEVEL CONVERTER (SERIAL RS232):

In telecommunication and computer science, serial communication is the process of


sending data one bit at one time, sequentially, over a communication channel or computer bus.

In order to make two devices communicate, whether they are desktop computers,
microcontrollers, or any other form of integrated circuit, we need a method of communication
and an agreed-upon language. The most common form of communication between electronic
devices is serial communication. Communicating serially involves sending a series of digital
pulses back and forth between devices at a mutually agreed-upon rate. The sender sends pulses
representing the data to be sent at the agreed-upon data rate, and the receiver listens for pulses at
that same rate. This is what‘s known as asynchronous serial communication. There isn‘t one
common clock in asynchronous serial communication; instead, both devices have their own
clock and agree on a rate to which to set their clocks.

For example, let‘s say two devices are to exchange data at a rate of 9600 bits per second.
First, we would make three connections between the two devices:

 a common ground connection, so both devices have a common reference point to measure
voltage by;
 one wire for the sender to send data to the receiver on (transmit line for the sender);
 One wire for the receiver to send date to the sender on (receive line for the sender).

Now, since the data rate is 9600 bits per second (sometimes called 9600 baud), the receiver
will continually read the voltage that the sender is putting out, and every 1/9600th of a second,
and it will interpret that voltage as a new bit of data. If the voltage is high (+5V in the case of
Wiring/Arduino, the PIC, and BX-24), it will interpret that bit of data as a 1. If it is low (0V in
the case of Wiring/Arduino, the PIC, and BX-24), it will interpret that bit of data as a 0. By
interpreting several bits of data over time, the receiver can get a detailed message from the
sender at 9600 baud, for example, 1200 bytes of data can be exchanged in one second. If you
have a home computer and a modem, you‘ve seen serial communication in action. Your
computer‘s modem exchanges information with your service provider‘s modem serially.
Let‘s look at a byte of data being exchanged. Imagine we want to send the number 90 from
one device to another. First, we have to convert the number from the decimal representation 90
to a binary representation. In binary, 90 are 01011010. So my sending device will pulse it‘s
transmit line as follows:

From this diagram, both devices also have to agree on the order of the bits. Usually the
sender sends the highest bit (or most significant bit) first in time, and the lowest (or least
significant bit) last in time. As long as we have an agreed upon voltage, data rate, and order of
interpretation of bits, we can exchange any data we want serially.

For the data transmission above, a high voltage indicates a bit value of 1, and a low
voltage indicates a voltage of 0. This is known as true logic. Many serial protocols use inverted
logic, meaning that a high voltage indicates logic 0, and a low voltage indicates logic 1. It‘s
important to know whether your protocol is true or inverted. For example, RS-232, described
below, uses inverted logic.

The RS-232 standard defines voltages and general baud rate ranges for serial
communications between devices using it. We won‘t be getting the voltages exactly right, but
for most applications, we‘ll be close enough. Until recently, most desktop computers had an RS-
232 or similar serial port. Now, many desktop computers are shifting to other forms of serial
communication such as USB, or Universal Serial Bus, and Firewire, which allow for more
flexible configurations and faster data rates. the RS-232 standard is still very common in other
devices, though, as it is cheaper to use than USB, simpler to implement, consumes less power,
and provides more than adequate speeds for exchanging control data (i.e. data that allows one
device to control another).

UART (Universal Asynchronous Receiver Transmitter) or USART (Universal


Synchronous Asynchronous Receiver Transmitter) are one of the basic interfaces which you
will find in almost all the controllers available in the market till date. This interface provides a
cost effective simple and reliable communication between one controller to another controller or
between a controller and PC.

In telecommunications, RS-232 (Recommended Standard 232) is a standard for serial


binary data signals connecting between a DTE (Data Terminal Equipment) and a DCE (Data
Circuit-terminating Equipment). It is commonly used in computer serial ports. A similar ITU-T
standard is V.24.

MAX232:

PIN DIAGRAM:

Description:

The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to
signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual
driver/receiver and typically converts the RX, TX, CTS and RTS signals.
The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single + 5 V
supply via on-chip charge pumps and external capacitors. This makes it useful for implementing
RS-232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range, as
power supply design does not need to be made more complicated just for driving the RS-232 in
this case.

The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to standard 5 V
TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of 0.5 V.

The later MAX232A is backwards compatible with the original MAX232 but may
operate at higher baud rates and can use smaller external capacitors – 0.1 μF in place of the
1.0 μF capacitors used with the original device.

When a MAX232 IC receives a TTL level to convert, it changes a TTL Logic 0 to


between +3 and +15V, and changes TTL Logic 1 to between -3 to -15V, and vice versa for
converting from RS232 to TTL. The RS232 Data Transmission voltages at a certain logic state
are opposite from the RS232 Control Line voltages at the same logic state.

RS232 TTL Voltage to/from


RS232 Line Type & Logic Level
Voltage MAX232

Data Transmission (Rx/Tx) Logic 0 +3V to +15V 0V


Data Transmission (Rx/Tx) Logic 1 -3V to -15V 5V

Control Signals (RTS/CTS/DTR/DSR)


-3V to -15V 5V
Logic 0

Control Signals (RTS/CTS/DTR/DSR)


+3V to +15V 0V
Logic 1

RS232 PIN DETAILS:

Abbreviation Full Name Function

1 TD Transmit Data Serial Data Output (TXD)


2 RD Receive Data Serial Data Input (RXD)

This line indicates that the Modem is ready to


3 CTS Clear to Send
exchange data.
When the modem detects a "Carrier" from the
Data Carrier
4 DCD modem at the other end of the phone line, this
Detect
Line becomes active.
This tells the UART that the modem is ready to
5 DSR Data Set Ready
establish a link.
Data Terminal This is the opposite to DSR. This tells the
6 DTR
Ready Modem that the UART is ready to link.
This line informs the Modem that the UART is
7 RTS Request To Send
ready to exchange data.
Goes active when modem detects a ringing
8 RI Ring Indicator
signal from the PSTN.
Advantages:

 Serial Cables can be longer than Parallel cables. The serial port transmits a '1' as -3 to -25
volts and a '0' as +3 to +25 volts where as a parallel port transmits a '0' as 0v and a '1' as
5v. Therefore the serial port can have a maximum swing of 50V compared to the parallel
port which has a maximum swing of 5 Volts. Therefore cable loss is not going to be as
much of a problem for serial cables as they are for parallel.

 Wires are less than parallel transmission.


 Serial transmission is used where one bit is sent at a time.
Microcontrollers have also proven to be quite popular recently. Many of these have in built SCI
(Serial Communications Interfaces) which can be used to talk to the outside world. Serial
Communication reduces the pin count of these MPU's.
4.6. GLOBAL POSITIONING SYSTEM (GPS)

The Global Positioning System (GPS) is a space-based global navigation satellite system that
provides reliable location and time information in all weather and at all times and anywhere on
or near the Earth when and where there is an unobstructed line of sight to four or more GPS
satellites. It is maintained by the United States government and is freely accessible by anyone
with a GPS receiver. In addition to GPS other systems are in use or under development. The
Russian GLObal NAvigation Satellite System (GLONASS) is for use by the Russian military.
There are also the planned Chinese Compass navigation system and Galileo positioning system
of the European Union (EU). GPS was created and realized by the U.S. Department of Defense
(DOD) and was originally run with 24 satellites. It was established in 1973 to overcome the
limitations of previous navigation systems.

Structure

GPS consists of three parts: the space segment, the control segment, and the user segment. The
U.S. Air Force develops, maintains, and operates the space and control segments. GPS satellites
broadcast signals from space, which each GPS receiver uses to calculate its three-dimensional
location (latitude, longitude, and altitude) plus the current time.

The space segment is composed of 24 to 32 satellites in medium Earth orbit and also includes
the payload adapters to the boosters required to launch them into orbit. The control segment is
composed of a master control station, an alternate master control station, and a host of dedicated
and shared ground antennas and monitor stations. The user segment is composed of hundreds of
thousands of U.S. and allied military users of the secure GPS Precise Positioning Service, and
tens of millions of civil, commercial, and scientific users of the Standard Positioning Service
(see GPS navigation devices).

Basic concept of GPS

A GPS receiver calculates its position by precisely timing the signals sent by GPS satellites high
above the Earth. Each satellite continually transmits messages that include

 the time the message was transmitted


 precise orbital information (the ephemeris)
 the general system health and rough orbits of all GPS satellites (the almanac).

The receiver utilizes the messages it receives to determine the transit time of each message and
computes the distance to each satellite. These distances along with the satellites' locations are
used with the possible aid of trilateration, depending on which algorithm is used, to compute the
position of the receiver. This position is then displayed, perhaps with a moving map display or
latitude and longitude; elevation information may be included. Many GPS units show derived
information such as direction and speed, calculated from position changes.

Three satellites might seem enough to solve for position, since space has three dimensions and a
position near the Earth's surface can be assumed. However, even a very small clock error
multiplied by the very large speed of light — the speed at which satellite signals propagate —
results in a large positional error. Therefore receivers use four or more satellites to solve for the
receiver's location and time. The very accurately computed time is effectively hidden by most
GPS applications, which use only the location. A few specialized GPS applications do however
use the time; these include time transfer, traffic signal timing, and synchronization of cell phone
base stations.

Although four satellites are required for normal operation, fewer apply in special cases. If one
variable is already known, a receiver can determine its position using only three satellites. For
example, a ship or aircraft may have known elevation. Some GPS receivers may use additional
clues or assumptions (such as reusing the last known altitude, dead reckoning, inertial
navigation, or including information from the vehicle computer) to give a less accurate
(degraded) position when fewer than four satellites are visible.

System segmentation

The current GPS consists of three major segments. These are the space segment (SS), a control
segment (CS), and a user segment (US).

Space segment
The space segment (SS) is composed of the orbiting GPS satellites, or Space Vehicles (SV) in
GPS parlance. The GPS design originally called for 24 SVs, eight each in three circular orbital
planes, but this was modified to six planes with four satellites each. The orbital planes are
centered on the Earth, not rotating with respect to the distant stars. The six planes have
approximately 55° inclination (tilt relative to Earth's equator) and are separated by 60° right
ascension of the ascending node (angle along the equator from a reference point to the orbit's
intersection).The orbits are arranged so that at least six satellites are always within line of sight
from almost everywhere on Earth's surface.

Orbiting at an altitude of approximately 20,200 kilometers (about 12,550 miles or 10,900


nautical miles; orbital radius of approximately 26,600 km (about 16,500 mi or 14,400 NM)),
each SV makes two complete orbits each sidereal day, repeating the same ground track each
day.This was very helpful during development, since even with just four satellites, correct
alignment means all four are visible from one spot for a few hours each day. For military
operations, the ground track repeat can be used to ensure good coverage in combat zones.

As of March 2008, there are 31 actively broadcasting satellites in the GPS constellation, and two
older, retired from active service satellites kept in the constellation as orbital spares. The
additional satellites improve the precision of GPS receiver calculations by providing redundant
measurements. With the increased number of satellites, the constellation was changed to a
nonuniform arrangement. Such an arrangement was shown to improve reliability and availability
of the system, relative to a uniform system, when multiple satellites fail. About eight satellites
are visible from any point on the ground at any one time (see animation at right).

Control segment

The control segment is composed of

1. a master control station (MCS),


2. an alternate master control station,
3. four dedicated ground antennas and
4. six dedicated monitor stations.
The MCS can also access U.S. Air Force Satellite Control Network (AFSCN) ground antennas
(for additional command and control capability) and NGA (National Geospatial-Intelligence
Agency) monitor stations. The flight paths of the satellites are tracked by dedicated U.S. Air
Force monitoring stations in Hawaii, Kwajalein, Ascension Island, Diego Garcia, Colorado
Springs, Colorado and Cape Canaveral, along with shared NGA monitor stations operated in
England, Argentina, Ecuador, Bahrain, Australia and Washington DC. The tracking information
is sent to the Air Force Space Command's MCS at Schriever Air Force Base 25 km (16 miles)
ESE of Colorado Springs, which is operated by the 2nd Space Operations Squadron (2 SOPS) of
the United States Air Force (USAF). Then 2 SOPS contacts each GPS satellite regularly with a
navigational update using dedicated or shared (AFSCN) ground antennas (GPS dedicated ground
antennas are located at Kwajalein, Ascension Island, Diego Garcia, and Cape Canaveral). These
updates synchronize the atomic clocks on board the satellites to within a few nanoseconds of
each other, and adjust the ephemeris of each satellite's internal orbital model. The updates are
created by a Kalman filter, which uses inputs from the ground monitoring stations, space weather
information, and various other inputs.

Satellite maneuvers are not precise by GPS standards. So to change the orbit of a satellite, the
satellite must be marked unhealthy, so receivers will not use it in their calculation. Then the
maneuver can be carried out, and the resulting orbit tracked from the ground. Then the new
ephemeris is uploaded and the satellite marked healthy again.

User segment

The user segment is composed of hundreds of thousands of U.S. and allied military users of the
secure GPS Precise Positioning Service, and tens of millions of civil, commercial and scientific
users of the Standard Positioning Service. In general, GPS receivers are composed of an antenna,
tuned to the frequencies transmitted by the satellites, receiver-processors, and a highly stable
clock (often a crystal oscillator). They may also include a display for providing location and
speed information to the user. A receiver is often described by its number of channels: this
signifies how many satellites it can monitor simultaneously. Originally limited to four or five,
this has progressively increased over the years so that, as of 2007, receivers typically have
between 12 and 20 channels.
GPS receivers may include an input for differential corrections, using the RTCM SC-104 format.
This is typically in the form of an RS-232 port at 4,800 bit/s speed. Data is actually sent at a
much lower rate, which limits the accuracy of the signal sent using RTCM. Receivers with
internal DGPS receivers can outperform those using external RTCM data. As of 2006, even low-
cost units commonly include Wide Area Augmentation System (WAAS) receivers.

Many GPS receivers can relay position data to a PC or other device using the NMEA 0183
protocol, or the newer and less widely used NMEA 2000. Although these protocols are officially
defined by the National Marine Electronics Association (NMEA),[55] references to these
protocols have been compiled from public records, allowing open source tools like gpsd to read
the protocol without violating intellectual property laws. Other proprietary protocols exist as
well, such as the SiRF and MTK protocols. Receivers can interface with other devices using
methods including a serial connection, USB, or Bluetooth.

Communication

The navigational signals transmitted by GPS satellites encode a variety of information including
satellite positions, the state of the internal clocks, and the health of the network. These signals
are transmitted on two separate carrier frequencies that are common to all satellites in the
network. Two different encodings are used, a public encoding that enables lower resolution
navigation, and an encrypted encoding used by the U.S. military.

Message format

GPS message format


Subframes Description
Satellite clock,
1
GPS time relationship
Ephemeris
2–3
(precise satellite orbit)
Almanac component
4–5 (satellite network synopsys,
error correction)
Each GPS satellite continuously broadcasts a navigation message at a rate of 50 bits per second.
Each complete message is composed of 30-second frames, distinct groupings of 1,500 bits of
information. Each frame is further subdivided into 5 sub frames of length 6 seconds and with
300 bits each. Each sub frame contains 10 words of 30 bits with length 0.6 seconds each. Each
30 second frame begins precisely on the minute or half minute as indicated by the atomic clock
on each satellite.

The first part of the message encodes the week number and the time within the week, as well as
the data about the health of the satellite. The second part of the message, the ephemeris, provides
the precise orbit for the satellite. The last part of the message, the almanac, contains coarse orbit
and status information for all satellites in the network as well as data related to error correction.

All satellites broadcast at the same frequencies. Signals are encoded using code division multiple
access (CDMA) allowing messages from individual satellites to be distinguished from each other
based on unique encodings for each satellite (which the receiver must be aware of). Two distinct
types of CDMA encodings are used: the coarse/acquisition (C/A) code, which is accessible by
the general public, and the precise (P) code, that is encrypted so that only the U.S. military can
access it.

The ephemeris is updated every 2 hours and is generally valid for 4 hours, with provisions for
updates every 6 hours or longer in non-nominal conditions. The almanac is updated typically
every 24 hours. Additionally data for a few weeks following is uploaded in case of transmission
updates that delay data upload.

4.7. SATELLITE FREQUENCIES

All satellites broadcast at the same two frequencies, 1.57542 GHz (L1 signal) and 1.2276 GHz
(L2 signal). The satellite network uses a CDMA spread-spectrum technique where the low-
bitrate message data is encoded with a high-rate pseudo-random (PRN) sequence that is different
for each satellite. The receiver must be aware of the PRN codes for each satellite to reconstruct
the actual message data. The C/A code, for civilian use, transmits data at 1.023 million chips per
second, whereas the P code, for U.S. military use, transmits at 10.23 million chips per second.
The L1 carrier is modulated by both the C/A and P codes, while the L2 carrier is only modulated
by the P code.[59] The P code can be encrypted as a so-called P(Y) code which is only available
to military equipment with a proper decryption key. Both the C/A and P(Y) codes impart the
precise time-of-day to the user. GPS Modernization added a third frequency, 1.17645 GHZ (L5
signal). The L5 consists of two carrier components that are in phase quadrature with each other.
Each carrier component is bi-phase shift key (BPSK) modulated by a separate bit train.

Demodulation and decoding

Since all of the satellite signals are modulated onto the same L1 carrier frequency, there is a need
to separate the signals after demodulation. This is done by assigning each satellite a unique
binary sequence known as a Gold code. The signals are decoded, after demodulation, using
addition of the Gold codes corresponding to the satellites monitored by the receiver.[60][61]

If the almanac information has previously been acquired, the receiver picks which satellites to
listen for by their PRNs, unique numbers in the range 1 through 32. If the almanac information is
not in memory, the receiver enters a search mode until a lock is obtained on one of the satellites.
To obtain a lock, it is necessary that there be an unobstructed line of sight from the receiver to
the satellite. The receiver can then acquire the almanac and determine the satellites it should
listen for. As it detects each satellite's signal, it identifies it by its distinct C/A code pattern.
There can be a delay of up to 30 seconds before the first estimate of position because of the need
to read the ephemeris data.

Processing of the navigation message enables the determination of the time of transmission and
the satellite position at this time.

4.8. LCD DISPLAY

INTRODUCTION:

Liquid crystal cell displays (LCDs) are used in similar applications where LEDs are used.
These applications are display of display of numeric and alphanumeric characters in dot matrix
and segmental displays.
LCDs are of two types:

I. Dynamic scattering type


II. Field effect type

The construction of a dynamic scattering liquid crystal cell:

The liquid crystal material may be one of the several components, which exhibit optical
properties of a crystal though they remain in liquid form. Liquid crystal is layered between
glass sheets with transparent electrodes deposited on the inside faces.

When a potential is applied across the cell, charge carriers flowing through the liquid
disrupt the molecular alignment and produce turbulence. When the liquid is not activated, it
is transparent. When the liquid is activated the molecular turbulence causes light to be
scattered in all directions and the cell appear to be bright.

This phenomenon is called dynamic scattering.

The construction of a field effect liquid crystal display is similar to that of the dynamic
scattering type, with the exception that two thin polarizing optical filters are placed at the
inside of each glass sheet. The liquid crystal material in the field effect cell is also of
different type from employed in the dynamic scattering cell. The material used is twisted
numeric type and actually twists the light passing through the cell when the latter is not
energised.

A liquid crystal display (LCD) is an electronically-modulated optical device shaped into


a thin, flat panel made up of any number of color or monochrome pixels filled with liquid
crystals and arrayed in front of a light source (backlight) or reflector. It is often utilized in
battery-powered electronic devices because it uses very small amounts of electric power. LCD
has material, which continues the properties of both liquids and crystals. Rather than having a
melting point, they have a temperature range within which the molecules are almost as mobile
as they would be in a liquid, but are grouped together in an ordered from similar to a crystal.
LCD consists of two glass panels, with the liquid crystal materials sandwiched in
between them. The inner surface of the glass plates is coated with transparent electrodes which
define in between the electrodes and the crystal, which makes the liquid crystal molecules to
maintain a defined orientation angle. When a potential is applied across the cell, charge carriers
flowing through the liquid will disrupt the molecular alignment and produce turbulence.

When the liquid is not activated, it is transparent. When the liquid is activated the
molecular turbulence causes light to be scattered in all directions and the cell appears to be
bright. Thus the required message is displayed. When the LCD is in the off state, the two
polarizer‘s and the liquid crystal rotate the light rays, such that they come out of the LCD
without any orientation, and hence the LCD appears transparent.

Working:

When sufficient voltage is applied to the electrodes the liquid crystal molecules would be
aligned in a specific direction. The light rays passing through the LCD would be rotated by the
polarizer, which would result in activating/highlighting the desired characters. The power supply
should be of +5v, with maximum allowable transients of 10mv. To achieve a better/suitable
contrast for the display the voltage (VL) at pin 3 should be adjusted properly. A module should
not be removed from a live circuit.

The ground terminal of the power supply must be isolated properly so that voltage is
induced in it. The module should be isolated properly so that stray voltages are not induced,
which could cause a flicking display. LCD is lightweight with only a few, millimeters thickness
since the LCD consumes less power, they are compatible with low power electronic circuits,
and can be powered for long durations. LCD does not generate light and so light is needed to
read the display. By using backlighting, reading is possible in the dark. LCDs have long life and
a wide operating temperature range. Before LCD is used for displaying proper initialization
should be done.

LCDs with a small number of segments, such as those used in digital watches and pocket
calculators, have individual electrical contacts for each segment. An external dedicated circuit
supplies an electric charge to control each segment. This display structure is unwieldy for more
than a few display elements. Small monochrome displays such as those found in personal
organizers, or older laptop screens have a passive-matrix structure employing super-twisted
nematic (STN) or double-layer STN (DSTN) technology—the latter of which addresses a color-
shifting problem with the former—and color-STN (CSTN)— wherein color is added by using
an internal filter. Each row or column of the display has a single electrical circuit.

The pixels are addressed one at a time by row and column addresses. This type of
display is called passive-matrix addressed because the pixel must retain its state between
refreshes without the benefit of a steady electrical charge. As the number of pixels (and,
correspondingly, columns and rows) increases, this type of display becomes less feasible.

Very slow response times and poor contrast are typical of passive matrix addressed
LCDs. High-resolution color displays such as modern LCD computer monitors and televisions
use an active matrix structure. A matrix of thin-film transistors (TFTs) is added to the polarizing
and color filters. Each pixel has its own dedicated transistor, allowing each column line to
access one pixel. When a row line is activated, all of the column lines are connected to a row of
pixels and the correct voltage is driven onto all of the column lines.

The row line is then deactivated and the next row line is activated. All of the row lines
are activated in sequence during a refresh operation. Active-matrix addressed displays look
"brighter" and "sharper" than passive-matrix addressed displays of the same size, and generally
have quicker response times, producing much better images. A general purpose alphanumeric
LCD, with two lines of 16 characters. So the type of LCD used in this project is16 characters * 2
lines with 5*7 dots with cursor, built in controller, +5v power supply, 1/16 duty cycle.
PIN DESCRIPTION FOR LCD:

PIN SYMBOL FUNCTION


NO
1 Vss Ground terminal of Module
2 Vdd Supply terminal of Module, +
5v
3 Vo Power supply for liquid crystal drive
4 RS Register select
RS=0…Instruction register
RS=1…Data register
5 R/W Read/Write
R/W=1…Read
R/W=0…Write
6 EN Enable

7-14 DB0-DB7 Bi-directional Data Bus.


Data Transfer is performed once ,thru DB0-DB7,incase of interface data
length is 8-bits;and twice, thru DB4-DB7 in the case of interface data
length is 4-bits.Upper four bits first then lower four bits.

15 LAMP-(L-) LED or EL lamp power supply terminals

16 LAMP+(L+) Enable
(E2)
LCD PIN DESCRIPTIONS:

The function of each pins of LCD is described below VCC, VSS and VEE while v and v
provide +5v and ground, respectively, v is used for controlling LCD contrast.

RS, register select

There are two very important registers inside the LCD. The RS pin is used for their
selection as follows. If RS=0, the instruction code register is selected, allowing the user to send
a command such as clear display, cursor at home,etc.if RS=1 the data register is selected,
allowing the user to send data to be displayed on the LCD.

R/W, read/write

R/W input allows the user to write information to the LCD or read information from it.
R/W=1 when reading; R/W=0 when writing.

E, enable

The enable pin is used by the LCD to latch information presented on its data pins. When
data is supplied to data pins, a high to low pulse must be applied to this pin in order for the LCD
to latch in the data present at the data pins.

D0 - D7

The 8-bit data pins, D0 – D7, are used to send information to the LCD or read contents
of the LCD‘S internal registers. There are also instruction codes that can be sent to the LCD to
clear the display or force the cursor to the home position or blink the cursor. RS=0 is used to
check the busy flag bit to see if the LCD is ready to receive information. The busy flag is D7
and can be read when R/W=1 and RS=0, as follows: if R/W=1, RS=0.when D7=1, the LCD is
busy taking care of internal operation and will not accept any new information, when D7=0, the
LCD is ready to receive new information.
LCD INTERFACING WITH MICROCONTROLLER:

ADVANTAGES:
1. Consume much lesser energy (i.e. low power) when compared to LEDs.
2. Utilizes the light available outside and no generation of light.
3. Since very thin layer of liquid crystal is used, more suitable to act as display elements
(in digital watches, pocket calculators, ect.)
4. Since reflectivity is highly sensitive to temperature, used as temperature measuring
sensor.
5. Very cheap.

DISADVANTAGES:

1. Angle of viewing is very limited.


2. External light is a must for display.
3. Since not generating its own light and makes use of external light for display, contrast is
poor.
4. Cannot be used under wide range of temperature.
APPLICATIONS:

1. Watches

2. Fax & Copy machines & Calculators.

CHAPTER – 5

SOFTWARE DESCRIPTION

MPLAB IDE SOFTWARE

INTRODUCTION
MPLAB is a proprietary freeware integrated development environment for the
development of embedded applications on PIC and dsPIC microcontrollers, and is developed
by Microchip Technology.

MPLAB X is the latest edition of MPLAB, and is developed on the NetBeans platform. MPLAB
and MPLAB X support project management, code editing, debugging and programming of
Microchip 8-bit, 16-bit and 32-bit PIC microcontrollers.

MPLAB is designed to work with MPLAB-certified devices such as the MPLAB ICD
3 and MPLAB REAL ICE, for programming and debugging PIC microcontrollers using
a personal computer. PICKit programmers are also supported by MPLAB.

MPLAB 8.X is the last version of the legacy MPLAB IDE technology, custom built
by Microchip Technology in Microsoft Visual C++. MPLAB supports project management,
editing, debugging and programming of Microchip 8-bit, 16-bit and 32-bit PICmicrocontrollers.
MPLAB only works on Microsoft Windows. MPLAB is still available from Microchip's
archives, but is not recommended for new projects.

MPLAB supports the following compilers:

 MPLAB MPASM Assembler


 MPLAB ASM30 Assembler
 MPLAB C Compiler for PIC18
 MPLAB C Compiler for PIC24 and dsPIC DSCs
 MPLAB C Compiler for PIC32
 HI-TECH C

MPLAB X is the latest version of the MPLAB IDE built by Microchip Technology, and is based
on the open-source NetBeans platform. MPLAB X supports editing, debugging and
programming of Microchip 8-bit, 16-bit and 32-bit PIC microcontrollers.

MPLAB X is the first version of the IDE to include cross-platform support for Mac OS
X and Linux operating systems, in addition to Microsoft Windows.

MPLAB X supports the following compilers:

 MPLAB XC8 — C compiler for 8-bit PIC devices


 MPLAB XC16 — C compiler for 16-bit PIC devices
 MPLAB XC32 — C/C++ compiler for 32-bit PIC devices
 HI-TECH C — C compiler for 8-bit PIC devices
 SDCC — open-source C compiler

HI-TECH C compiler for PIC10/12/16 MCUs (PRO)

This compiler has been discontinued and is no longer supported. This compiler has been
replaced by the MPLAB® XC8 PRO (SW006021-2).
HI-TECH C Compiler for PIC10/12/16 MCUs - PRO fully implements the optimizations of
Omniscient Code Generation™ - a whole-program compilation technology - to provide denser
code and better performance on PIC MCUs. This ANSI C compiler integrates into Microchips
MPLAB(R) IDE and is compatible with Microchip debuggers and emulators.
CHAPTER – 6

ADVANTAGES & APPLICATION

ADVANTAGE

 Cost effective
 Real- time vehicle monitoring
 Reduces vehicle accidents
 Increases the vehicle accident cases evidence

APPLICATION

Stolen Vehicle Recovery: Both consumer and


commercial vehicles can be outfitted with RF or GPS
units to allow police to do tracking and recovery. The
police can activate the tracking unit in the vehicle
directly and follow tracking signals.

Fleet Management: When managing a fleet of vehicles, knowing the real-time location of all
drivers allows management to meet customer needs more efficiently. Whether it is delivery,
service or other multi-vehicle enterprises, drivers now only need a mobile phone with
telephony or Internet connection to be inexpensively tracked by and dispatched efficiently.

Asset Tracking: Companies needing to track valuable assets for insurance or other
monitoring purposes can now plot the real-time asset location on a map and closely monitor
movement and operating status.

Field Sales: Mobile sales professionals can access real-time locations. For example, in
unfamiliar areas, they can locate themselves as well as customers and prospects, get driving
directions and add nearby last-minute appointments to itineraries. Benefits include increased
productivity, reduced driving time and increased time spent with customers and prospects.
Transit Tracking: This is the temporary tracking of assets or cargoes from one point to
another. Users will ensure that the assets do not stop on route or do a U-Turn in order to
ensure the security of the assets.

CHAPTER – 7

CONCLUSION
This paper has presented a new vision for the vehicles industry, which is the Black Box
system used for vehicles. A full and detailed description was made for every part of this system.
This paper has also offered a user Internet of thing based data of the accident. In addition, the
transmission method between the two parts has been introduced and developed. The Black Box
system built can be implemented in any vehicle. As soon as the driver runs the motor, this
system will begin saving the events of the corresponding vehicle. The last 21 seconds are
always saved in the EEPROM of the Black Box, and in case of an accident, an additional 10
seconds of events after this accident will be saved. The data saved can be retrieved only after the
accident for privacy purposes. Using serial transmission, a PIC program will read the data from
the EEPROM and display it to the user in Graphical format in the cloud server. In addition, a
detailed report will be given to the user containing all necessary information.

CHAPTER – 8

REFERENCES

[1] M. Corno, G. Panzani, and S. M. Savaresi, ―Single-track vehicle dynamics control: state of
the art and perspective,‖ IEEE/ASME Transactions on Mechatronics, vol. 20, no. 4, pp. 1521–
1532, 2015.

[2] P. Gasp ´ ar, Z. Szabo, and J. Bokor, ―A grey-box identification of an ´ lpv vehicle model for
observer-based side slip angle estimation,‖ in American Control Conference, 2007. ACC‘07.
IEEE, 2007, pp. 2961– 2966.
[3] D. Piyabongkarn, R. Rajamani, J. A. Grogg, and J. Y. Lew, ―Development and experimental
evaluation of a slip angle estimator for vehicle stability control,‖ IEEE Transactions on Control
Systems Technology, vol. 17, no. 1, pp. 78–88, 2009.

[4] V. Cerone, D. Piga, and D. Regruto, ―Set-membership lpv model identification of vehicle
lateral dynamics,‖ Automatica, vol. 47, no. 8, pp. 1794–1799, 2011.

[5] D. Selmanaj, M. Corno, G. Panzani, and S. M. Savaresi, ―Vehicle sideslip estimation: A


kinematic based approach,‖ Control Engineering Practice, vol. 67, pp. 1–12, 2017. [6] A.
Teerhuis and S. Jansen, ―Motorcycle state estimation for lateral dynamics,‖ Vehicle System
Dynamics, vol. 50, no. 8, pp. 1261–1276, 2012.

[7] B. van Daal, ―Design and automatic tuning of a motorcycle state estimator,‖ Ph.D.
dissertation, Eindhoven University of Technology, 2009.

[8] M. E.-H. Dabladji, D. Ichalal, H. Arioui, and S. Mammar, ―Unknowninput observer design
for motorcycle lateral dynamics: Ts approach,‖ Control Engineering Practice, vol. 54, pp. 12–
26, 2016.

[9] W. Wei, B. Shaoyi, Z. Lanchun, Z. Kai, W. Yongzhi, and H. Weixing, ―Vehicle sideslip
angle estimation based on general regression neural network,‖ Mathematical Problems in
Engineering, vol. 2016, 2016. [10] H. Pacejka, Tire and vehicle dynamics. Elsevier, 2005.

[10] Amitava Choudhury, Alok Negi, ―A New Zone Based Algorithm for Detection of License
Plate from Indian Vehicle‖, PDGC conf. , pp. 370- 374, Dec 2016.

You might also like