Você está na página 1de 81

Dromography for Smart Vehicles

INTRODUCTION
The project includes the development of the software and hardware for a Micro controller based tracking system based on the technique Dromography. Here dromos' means [way, street, route, corridor] + 'graphos' [to write], so Dromography is the study of geography and logistics of transportation, movement and communication routes. In this project we are adding digital dashboard which will display the speed, distance traveled, engine temperature, mileage and fuel level of the vehicle. All the parameters are displayed

in 16x2 LCD display.

Here the project comes under the embedded systems, which is the combination of software and hardware and perhaps some sensors, which are used to perform a specific tracing function. The project is done using Microchips Microcontroller PIC16F877. Micro controller programming is done using assembly language in Microchips integrated development environment MPLAB version 5.60.

The hardware part keeps on monitoring the speed and the direction of the vehicle. The hardware sends the data to computer via serial port and track is plotted with the help of interface software. Again the hardware section can be divided in to microcontroller, input unit, output unit, and the display unit .The software section have the microcontroller coding and the user interface window programming. Using Visual Basic language the window is developed. The route is traced on this window. Some additional push buttons such as SAVE, LOAD and CLEAR are also provided to perform some useful tasks.This project is very helpful to make a map to plot and retrace the route of a vehicle. And it takes care of displaying speed, distance, engine temperature, fuel level and mileage. This is very useful method for
Dept of ECE Maliankara 1 SNMIMT

Dromography for Smart Vehicles

town planning and road survey .Again these maps are also used to trace our position in the map. Being an independent gadget it works accurately with a high precision.

CHAPTER 1

NEED AND REQUIREMENT


In this technological era many advanced tracking systems are available in market .Which are mostly based on Global Positioning System. But if anyone wants to enjoy these facilities, they have to pay a lot for the receiver and other service charges. Also there are many other limitations like geographical position of the place, satellite coverage etc, which affects the service. Here the necessity comes to develop an efficient tracking system, with a least cost. The system should work effectively any ware, having user friendly interaction with the facility to store and load the data which are collected previously. The system also monitors various parameters of vehicle and it will be displayed in 16x2 LCD display by using only limited space for dashboard. The main disadvantage of using analog meters is that it is not very accurate and it is very difficult to read out for displaying various parameters like speed, total distance, mileage, fuel level, temperature etc, a number of analog meters are needed. By using number of meters, more dashboard space is wasted. Hence by using digital dashboard we can save the dashboard space.

Dept of ECE Maliankara

SNMIMT

Dromography for Smart Vehicles

CHAPTER 2

MICROCONTROLLERS AND MICROPROCESSORS

The contrast between a Microprocessor and Microcontroller is best exemplified by the fact that most microprocessors have many opcodes for moving data from external memory to CPU; Microcontroller have one or two. Microprocessor may have one or two types of bit handling instructions; Microcontroller will have many. Microprocessors are concerned with rapid movement of code and data from external address to the chip. Microprocessor must have many additional parts to be optional. Micro controllers can function as a computer with addition of no external digital parts. Microprocessors are intended to be general-purpose digital computer where as Microcontroller are intended to be special purpose digital controllers. Microprocessors contain a CPU, memory, addressing circuits and interrupt handling data. Micro controllers have these features as well as timers, parallel and serial I\O, Internal RAM and ROM.

2.1 INTRODUCTION TO EMBEDDED SYSTEMS

Dept of ECE Maliankara

SNMIMT

Dromography for Smart Vehicles

Embedded system is any electronic equipment built in intelligence and dedicated software. All embedded systems use either a microprocessor or a microcontroller. The application of these micro controllers makes user-friendly cheaper solutions and enables to add features otherwise impossible to provide by other means. Embedded devices can be defined as any devices with a microprocessor or microcontroller embedded in it that has a relatively focused functionality. The software for the Embedded System is called firmware.

The firmware is written in Assembly language for time or resource critical operation or using higher-level languages like C or Embedded C. The software will be simultaneously micro code simulations for the largest processor. Since they are supported to perform only specific task, these programs are stored in Read Only Memories (ROMs). Moreover they may need no or minimal inputs from the user, hence the user interface like monitor, mouse & large keyboard etc. may be absent.Embedded system is also known as Real time Systems since they respond to an input or event and produce the result within the guaranteed time period. This time period can be a few microseconds to days or months.

2.2 EMBEDDED SYSTEM DEVELOPMENTS


In the development of Embedded System application the hardware and software must go hand in hand. The software created by the software engineers must be burnt into or micro coded into the hardware or the micro controller produced by VLSI engineers. The micro controller and the software micro coded in it together form the system for the particular application.
Dept of ECE Maliankara 4 SNMIMT

Dromography for Smart Vehicles

The software program for real time system is written either in assembly or high-level language such as C. The assembly language is used in the case of some critical applications. Now days high-level languages replace most of the assembly language constructs.

2.3 EMEBEDDED SYSTEM MARKETS

Embedded technology is present in almost every electronic device we use today. There is embedded software inside the cellular phone, automobiles and thermostat in air conditioners, industrial control equipments and scientific & medical equipments, defense uses communication satellites etc. Embedded technology thus covers a broad range of products of which generalization is difficult.

The embedded intelligence can be found in five broad markets. The first is consumer segment, which includes home appliances and entertainment equipment. The second is automotive segment-where a modern car has nearly 50 micro controllers providing intelligence and control, like keyless entry, antilock braking and air bags. The third is office automation, which includes PCs, keyboards, machines. 2.4 ADVANTAGES OF EMBEDDED SYSTEM Higher Performance: The integration of various ICs shortens the copiers and printers. The fourth market, telecommunications, includes cellular phones, pagers and answering

traveling route and time of data to be transmitted resulting in higher performance. Lower Power Consumption: The integration of various ICs eliminates buffers and other interface circuits. As the number of components is reduced, less power will be consumed.
Dept of ECE Maliankara 5 SNMIMT

Dromography for Smart Vehicles

Slimmer and more compact: Housed in a single separate package,

the chip is smaller in size and therefore occupies less space on the PCB. Hence products using embedded system are slimmer and more compact. Reduced design and development: The system on a chip provides all functionality required by the system. System designers need not worry about the basic function the system-right from the beginning of the basic phase, they can focus on the development features. As a result, the time spends on research and development is reduced and this in turn reduces the time to market of their products. Lower system costs: In the past, several chips in separate packages where required to configure a system. Now, just one system on-chip can replace all of these, dramatically reducing the packaging cost.There are many MCU manufacturers. To understand apply general concepts, it is necessary to study one type in detail. In our project, we use PIC series IC PIC16F873 from microchip.

CHAPTER 3

BLOCK DIAGRAM

Dept of ECE Maliankara

SNMIMT

Dromography for Smart Vehicles

CHAPTER 4

BLOCK DESCRIPTION
A very simple logic is used to develop this device. The PIC we used here is 16F877A. Here the external interrupt is enabled for a high to low pulse and also initialized the ADC for the channel 0. The system is getting the analog voltage continuously from the high
Dept of ECE Maliankara 7 SNMIMT

Dromography for Smart Vehicles

precision potentiometer connected at the steering of the vehicle, and the ADC is kept continuously busy for converting the analog voltage from channel 0 in to hex equivalent. The system didnt use the hex value directly, but it uses some generated codes for the each specific range of hex values. These codes are transmitted for different steering positions. Serial port is used for transmissions. These codes are used to trace the route on the displaying device using the user interface window. The second transducer is an optical speed sensor which is connected at the wheel. This sensor keeps producing pulses on each rotation of the wheel, the pulses are sent to the RB0 pin as an external interrupt. On each external interrupt the ASCII code is produced with the help of the hex ADC value and is transmitted to MAX232 for serial communication. The mode of serial communication is asynchronous in nature. The transmitted codes are used to plot the map on the interface window. Here the switches are placed in order to mark the emergency destinations.

CHAPTER 5

HARDWARE DESCRIPTION

5.1 INPUT UNIT:


Dept of ECE Maliankara 8 SNMIMT

Dromography for Smart Vehicles

This is the section where sensing elements are used to sense various parameters for processing and keys to accept some instructions which are provided by the user. Here in this system mainly four sensors are used.

ROTATION SENSOR
An IR LED is placed somewhere in the wheel. In line with it, a photodiode is placed. As the wheel rotate, the IR LED cuts with the photodiode. This makes the photodiode to conduct. Thus every time when the IR LED cuts with photo diode current pulses occur at the output of the photo diode. These pulses are given to the 0-pin of PORTB (RB0). The interrupt register of PIC is configured in such a way that an interrupt is generated when a high to low transition takes place in RB0.

STEERING SENSOR
It is used to sense the steering position of the vehicle, which is a rotatory high precision potentiometer. The voltages provided by this are given to ADC of PIC16F877 microcontroller and ultimately the microcontroller will generate the codes for transmission. The transducer connected at the steering produces voltage which varies according to the rotation of the steering. For a specific angular position it produces a specific voltage level as output. The keys are the input medium to this device .Which are used to point out certain locations and our position on the ongoing way.

Dept of ECE Maliankara

SNMIMT

Dromography for Smart Vehicles

TEMPERATURE SENSOR
A thermistor is used as the temperature sensor. It is a semiconducting device whose resistance varies with the absolute temperature. Also, it has a negative coefficient of resistance. That is, the resistance decreases as the temperature increases. Its resistance range is 100 to 100 K for a temperature range of 50 0Cto s s +150 0C. The thermistor used for temperature sensing gives current output, which is directly proportional to the absolute temperature variation. This temperature sensor works over a wide range of voltages starting from +4V to +40V, which adds to the versatility of its application in various temperature sensing circuits. Another feature of this device is that at any given temperature it acts as a constant current source (i.e. a source with infinite output impedance), which makes this sensor suitable for remote sensing. The temperature transducer can be used for temperature monitoring at far off places without a drop in signal level. For digital temperature display the current output of the transducer needs to be converted to suitable proportional voltage level. This is achieved by utilizing the resistor connected in series with thermistor will result in 1mV/ K drop across the resistor. This voltage drop is fed to the micro controller through analog input pin for further processing and display.

FUEL SENSOR
For fuel sensing we use a float. A float is a variable resistor, whose resistance varies with its arm position. The one end of arm is connected to the variable resistor and the other end is connected to a hollow cylinder, which is made of plastic. This will float over the floating surface. As the fuel level increases or decreases position of float also changes. The corresponding movement of arm is producing a variation in the variable resistor. This analog signal is given as the
Dept of ECE Maliankara 10 SNMIMT

Dromography for Smart Vehicles

input signal of PIC of the through its analog input. This analog C input is given into the ADC of the C to produce a digital signal. The digital signal is then converted into corresponding ASCII code for the LCD to display the output.

Dept of ECE Maliankara

11

SNMIMT

Dromography for Smart Vehicles

5.2 PIC MICRO CONTROLLER

The

system

is

controlled

by

the

PIC

microcontroller

PIC16F877A from microchip. This microcontroller is having a 10-bit ADC feature which is our prime requirement. This particular version of microcontroller is used because of its lower cost, easy availability and stability after several flash programming. PIC16F877 gets the voltage produced by the high precision potentiometer connected on the steering. Here the ADC gets the analog voltage on the channel 0 (RA0/AN0) PIN. The ADC produces the HEX output continuously according to the steering position. But we cant send the HEX codes as it is to the displaying unit. For that we are converting these codes to ASCII codes .The important thing to note here is that the steering is always changing the positions due to jerk or driving limitations. These deviations may also be traced on the displaying window .To avoid the tracing due to minor steering variation oversensitivity we are dividing the total steering movement in to 14 sectors of approximately 150 and for each sector an ASCII code is assigned. The total angular deviation of the steering is assigned as 1800 and the vehicle will move straightly when the steering is at 900. When the steering position is in a particular sector the assigned ASCII is being ready to send via serial port for displaying unit. As already said the single round of the wheel is detected by the optical sensor .which is generating a pulse on every rotation. Here on each pulse the steering position which is indicated by the ASCII value is send to the displaying unit, were according to these codes the tracing is performed. The keys are used to mark the places on the route and to find out the current position of the vehicle on the route map.

Dept of ECE Maliankara

12

SNMIMT

Dromography for Smart Vehicles

OVERVIEW OF PIC16F877A: High performance RISC CPU:


Only 35 single word instructions to learn All single cycle instructions except for program Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle Up to 4K x 14 words of FLASH Program Memory, Interrupt capability (up to 13 sources) Eight level deep hardware stack Direct, Indirect and Relative Addressing modes Up to 192 x 8 bytes of Data Memory (2 k RAM)

branches which are two-cycle

Special Microcontroller Features:


Power-on Reset (POR) 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 protection Power saving SLEEP mode Selectable oscillator options In-Circuit Serial Programming. (ICSP.) via two pins

Peripheral Features:
Dept of ECE Maliankara 13 SNMIMT

Dromography for Smart Vehicles

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


Timer1: 16-bit timer/counter with prescaler can be incremented during SLEEP via external crystal/clock. Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler Two Capture, Compare, PWM modules Capture is 16-bit, max. Resolution is 12.5 ns Compare is 16-bit, max. Resolution is 200 ns PWM max. Resolution is 10-bit 10-bit, up to 5-channel Analog-to-Digital converter Synchronous Serial Port (SSP) with SPI (Master mode) and I2C(Slave) Universal (USART/SCI) Parallel Slave Port (PSP), 8-bits wide with external RD, WR and CS controls (40/44-pin only) Synchronous Asynchronous Receiver Transmitter

Brown-out detection circuitry for Brown-out Reset (BOR)


CMOS Technology:

Low power, high speed CMOS FLASH technology Wide operating voltage range: 2.0V to 5.5V Industrial temperature

Dept of ECE Maliankara

14

SNMIMT

Dromography for Smart Vehicles

PIC16F877A PIN CONFIGURATION

Dept of ECE Maliankara

15

SNMIMT

Dromography for Smart Vehicles

Dept of ECE Maliankara

16

SNMIMT

Dromography for Smart Vehicles

PIC16F877A ARCHITECTURE

Dept of ECE Maliankara

17

SNMIMT

Dromography for Smart Vehicles

MEMORY ORGANIZATIONS:
There are two memory blocks-program memory and data memory. Each block has its own bus, so that access to each block can occur during the same oscillator cycle. The data memory can further be broken down in to general purpose RAM and Special Function Registers (SFRs).

PROGRAM MEMORY ORGANIZATION:


Mid range MCU devices have a 13-bit program counter of addressing and 4k x14 program memory space. The width of the program memory bus is 14 bits. Since all instruction is a single word, a device with a 4k x14 program memory has a space for 4k of instruction. This program memory space is divided into 2 pages of 2k words each. Depending on the device only a portion of this memory may be implemented. To jump between the program memory pages, the high bits of program counter must be modified. Writing the desired value into the SFR called program counter latch high does this. If the sequential instruction is executed, the program counter will cross the page boundaries without any user interaction.

DATA MEMORY ORGANIZATION:


Data memory is made up of Special Function Register area and General Purpose Register area. The SFRs control the operation of the device, while GPRs are the general area for data storage and scratch pad operations. The data memory is banked for both the Special Function Register and General Purpose Register areas. The GPR area is banked to allow greater than 96 bytes of general purpose RAM to be addressed. SFR is for the registers that control the peripheral and the
Dept of ECE Maliankara 18 SNMIMT

Dromography for Smart Vehicles

core functions. Banking requires the use of control bits for bank selection. These control bits are located in the status register.

To move values from one register to another register the value must pass through the working register (w). This means that for all register-to-register moves two instruction cycles are required. The entire data memory can be accessed either directly or indirectly. Direct addressing may require the use of RP0 and RP1 bits. Indirect addressing uses Indirect Register Pointer (IRP) bit if the STATUS registers for access in to Bank0/Bank1 or Bank2/Bank3 areas of data memory.

2k

2k

SFR

SFR

SFR

SFR

128
GPR GPR GPR GPR

BANK 0

BANK 1

BANK 2

BANK 3

Fig: BANK ORGANIZATION

REGISTERS:
Status register is used for checking status of working register. It is an 8-bit register. It is also used for bank selection.

STATUS REGISTER
Dept of ECE Maliankara 19 SNMIMT

Dromography for Smart Vehicles

IRP

RP1

RP0

T0

PD

DC

C/B

IRP: Register bank select bit is used for indirect addressing. 1: Bank 2, 3 0: Bank 0, 1 RP1: -Register pointer for group selection 1:Group2 0:Group1 RP0: -Register pointer for bank selection 1: Higher bank 0: Lower bank TO: -Time out bit 1: Watch dog timer set 0: Watch dog timer reset PD: -Power down bit 1: Normal mode of operation 0: System in low power mode Z: -Zero flag 1: Zero flag set 0: Zero flag clear DC: Digit carry C/B: Carry/Borrow
Dept of ECE Maliankara 20 SNMIMT

Dromography for Smart Vehicles

1: Carry 0: Borrow

Dept of ECE Maliankara

21

SNMIMT

Dromography for Smart Vehicles

TRIS is data direction control register. TRIS register is used to configure port pins as input or output. Ports are in Bank 0 and corresponding TRIS are in Bank 1Setting TRIS register bit put corresponding output drive in high impedance mode. Clearing a bit in the TRIS register puts the content of the output latch on the selected pin. Microcontroller possess three internal timers-timer 0,timer 1 and timer 2.These timers are in Bank 0 and their control registers are in Bank 1.Timer 0 is 8 bit, timer 1 is 16 bit and timer 2 is 8 bit. OPTION register is the control register for timer 0.It is an 8-bit register. T1CON and T2CON are the control registers of timer 1 and timer 2 respectively.

RBP U 7 1

INTED G 0

TOCS 6

TOSE 5

PSA 4

PS2

PS1 3

PS0 2

Fig: OPTION REGISTER


RBPU: -Port B pulls up enable bit 1: Not enable 0: Port B high INTEDG:-Interrupt edge select bit 1: Rising edge interrupts 0: Falling edge interrupts TOCS: -Timer 0 clock source 1: Counter 0: Timer TOSE: -Timer 0 source edge 1: High to low 0: Low to high
Dept of ECE Maliankara 22 SNMIMT

Dromography for Smart Vehicles

PSA: -Pre scalar alignment 1: Applicable for watch dog timer 0: Applicable for timer PS2 PS1 PS0: - Pre scalar value assignment bits

0 0 0 0 1 1 1 1

0 0 1 1 0 0 1 1

0 1 0 1 0 1 0 1

1:2 1: 4 1:8 1:16 1:32 1:64 1:128 1:256

Delay of the timer is calculated using the formula Delay = 1/(fosc/4) x pre scalar value x (255-x) Fosc: 4MHz X: value loaded to the timer ADC inside the microcontroller converts the analog value to

corresponding 8-bit digital value. ADCON0 and ADCON1 are the control registers for ADC.ADCON0 is in Bank 0 and ADCON1 is in Bank 1.ADRES which is in bank 0 is the result register. ADC uses PORT B as the channel. Both ADCON0 and ADCON1 are 8 bit registers. But ADRES is a 16-bit register.

ADC ADCS0 S1 7 1 0 6

CHS2

CHS1 5

CHS0

GO/DO NE 4 3

ADO N 2

Fig: ADCON0
Dept of ECE Maliankara 23 SNMIMT

Dromography for Smart Vehicles

ADCS1 ADCS0: -Analog to digital conversion clock select bits. 0 0: fosc/2 0 1: fosc/8 1 0: fosc/32 1 1: FRC CHS2 CHS1 CHS0: -Analog channel select bit 0 0 0: RA0 0 0 1: RA1 0 1 0: RA2 0 1 1: RA3 1 0 0: RA4 1 0 1: RA5 GO/DONE: -Analog to digital conversion status bit 1: Start/progress 0: Done ADON: -ADC module ON bit 1: ON 0: OFF 7 1 ADF M 0 PCFG 3 PCFG PCFG 2 1 CFG 0 6 5 4 3 2

Fig: ADCON1 ADFM: -AD result format select bit 1: ADRESH 000000xx ADRESL xxxxxxxx 0: ADRESH xxxxxxxx ADRESL xx000000
Dept of ECE Maliankara 24 SNMIMT

Dromography for Smart Vehicles

PCFG3 PCFG2 PCFG1 PCFG0: AD Port configuration control bits

CSR C 7 1

TX9

TXEN 6 0

SYNC 5

BRGH 4

TRMT 3

TX9 D 2

Fig: TXSTA
CSRC: -It is clock source select bit. It is used in synchronous. TX9: -Transmission bit select. 1: It will send 9 bit data i.e. 8bit + 1 parity. 0: It will send 8 bit. TXEN: -Transmission enable. 1: Enable. 0: Disable. SYNC: -Mode select bit. 1: synchronous 0: asynchronous BRGH: -Baud rate high speed select. 1: high speed [fosc/16(x+1)]. 0: low speed [fosc/64(x+1)]. TMRT: -Transmit shift register status bit. 1: TSR empty. 0: TSR full. TX9D:- It is the parity used in 9 bit transmission.
Dept of ECE Maliankara 25 SNMIMT

Dromography for Smart Vehicles

SPEN RX9 7 1 0 6

SREN

CREN 5

ADDEN 4 Fig: RCSTA

FERR

OFRR 3

RX9 D 2

SPEN: -Serial port enable bit. RX9: -Reception bit select. 1: It will receive 9 bit data i.e. 8bit + 1 parity. 0: It will receive 8 bit. SREN: - Single reception enable. It is not used in asynchronous. CREN: -Continuous receive enable. It is mainly used in asynchronous. ADDEN: -Address detect enable. Not commonly used. FERR: -Faming error. Not commonly used. RX9D:- It is the 9 bit of received data.

GIE 7 1

PEIE E 6 0

TOI E

INT E 5

RBI F 4

TOI

INTF F 3

RBI 2

Fig: INTCON
Dept of ECE Maliankara 26 SNMIMT

Dromography for Smart Vehicles

GIE: -Global interrupt enable bit. 1: Enables all unmarked interrupts. 0: Disable all interrupt.

Dept of ECE Maliankara

27

SNMIMT

Dromography for Smart Vehicles

PEIE: -Peripheral interrupt enable bit. 1: It will send 9 bit data i.e. 8bit + 1 parity. 0: It will send 8 bit. TOIE: -TIMER 0 enable. 1: Enable. 0: Disable. INTE: -INTERRUPT ENABLE 1: Enable. 0: Disable. RBIE: -RB0 INT ENABLE 1: Enable. 0: Disable. INTF: -INT TIMER FLAG 1: Enable. 0: Disable. RBIF:- RB0 INT FLAG 1: Enable. 0: Disable.

INPUT/OUTPUT PORTS:
Input/Output ports allow the PIC microcontroller to monitor and control other devices. To add flexibility and functionality to a device, some pins are multiplexed with alternate functions. These functions depend on which peripheral features are on the device. In general when a pin is functioning, that pin may not be used as a general-purpose I/O pin.

Dept of ECE Maliankara

28

SNMIMT

Dromography for Smart Vehicles

For most ports I/O the data direction register called TRIS register controls pins directions. The TRIS<x> controls the direction of PORT <x> .A 1 in the TRIS bit corresponds to that pin being an input while a 0 corresponds to that pin being an output. The PORT register is the latch for the data to be output. When the PORT is read, the device reads the level present on the I/O pin.

INSTRUCTION SET:
There are 35 instructions. All operations are instructions can be classified in to three categories. Byte oriented instructions Bit oriented instructions Literal and control instructions through the

working register .No register to register transfer is possible. The

BYTE ORIENTED INSTRUCTIONS:


CLRW-Clear working register CLRF-Clear file register MOVF-Move the content of file register to working register MOVWF-Move content of working register to file register ADDWF-Add content of file register to working register SUBWF-Subtract working register from file register ANDWF-Bit wise manipulation of working register with file register IORWF-Bit wise addition of working register with file register
29 SNMIMT

Dept of ECE Maliankara

Dromography for Smart Vehicles

XORWF-Exclusive ORing of content of working register with file register RLF-Rotate left with carry RRF-Rotate right with carry DECF-Decrement the content of file register DECFSZ-Decrement the content of file register and skip the next instruction if zero INCF-Increment file register content

INCFSZ-Increment the content of file register and skip the next instruction if zero COMF-Ones complement SWAPF-Interchange the nibbles NOP-No operations

BIT ORIENTED INSTRUCTIONS:


BCF-Bit clear flag BSF-Bit set flag BTFSC-Bit test flag and skip if clear BTFSS-Bit test flag and skip if set

Dept of ECE Maliankara

30

SNMIMT

Dromography for Smart Vehicles

LITERAL AND CONTROL INSTRUCTIONS:


MOVLW-Direct loading of working register ADDLW-Direct adding of working register with a constant value SUBLW-Direct subtraction of working register with a constant value ANDLW-Bit wise manipulation of working register with a constant value IORLW-Bit wise addition of working register with a constant value XORLW-Bit wise exclusive ORing of working register with a constant value CALL-Call subroutine RETURN-Back to main program from subroutine GOTO-Go to RETFIE-Return from interrupt RETLW-Return with a literal value CLRWDT-Clear watch dog timer

5.3 OUTPUT UNIT:


For plotting the route the datas are gathered via the serial port from the system .For that the MAX232 interface IC is used .The codes are gathered by the displaying device and according to the VB program the track is traced on the user interface window. We can use any graphical LCD for the compact implementation of the application .But here we are using laptop, PDA, or computer. By using this we can avoid the tedious graphical LCD programming. Also these systems give an excellent performance. The displaying unit is connected to the devise using a com1 or com2 port. We can also
Dept of ECE Maliankara 31 SNMIMT

Dromography for Smart Vehicles

check

the

data

transfer

using

the

windows

utility

called

HyperTerminal.

CHAPTER 6

CIRCUIT DIAGRAM

Dept of ECE Maliankara

32

SNMIMT

Dromography for Smart Vehicles

CHAPTER 7

CIRCUIT DESCRIPTION
Here the clock source for this microcontroller is 4MHz.The MCLR/VPP is connected to the Vcc always because here no reset
Dept of ECE Maliankara 33 SNMIMT

Dromography for Smart Vehicles

feature is used. The on chip 10-Bit ADC is used to convert the analog voltage into the HEX value the result is 8-Bit in length. The voltage is applied to the channel 0 (RA0/AN0) of the PIC16f877.The external interrupt is provided by the clock pulse generated by the optical sensor connected at the RB0/INT pin. The input keys are used to send some messages to the microcontroller. The keys are connected to the 4, 5, 6and 7th pin of the PORT D .The program is always scanning the keys ,when a particular key is pressed the PORT pin get a high voltage and when this event happens the particular task will be performed. The communication between the device and the display unit is a serial mode of communication. Since RS232 is not compatible with the PIC here we are using MAX 232 to convert the TTL of the Microcontroller to RS232 voltage levels and vice versa. It uses a +5v power source which is the same as the source voltage for the PIC. Any invention of latest technology cannot be activated without the source of power. All the electronic components starting from diode to ICs only work with a DC supply ranging from +/-5v to +/-12v. The regulation is usually obtained using an IC voltage regulator unit, which takes a DC voltage and provides a somewhat lower DC voltage, which remains the same even if the input DC voltage varies or the output load connected to the DC voltage changes. There are extra 3 LEDs used in the circuit any future used such as low level indication, increased speed indication etc. Here we are connected fuel sensor to channel 1 which is a float sensor. It is a variable resistor whose resistance varies with its arm. One end of arm is connected to a hollow cylinder (plastic). Movement of float produces a corresponding movement in variable resistor. This output voltage is fed to microprocessor through analog input pin for further processing and display.

Dept of ECE Maliankara

34

SNMIMT

Dromography for Smart Vehicles

Also we are connected a thermistor as a temperature sensor as it is connected to channel 2. Thermistor is a semiconducting device varies with absolute temperature. The resistance range is 100 ohm to 100 kilo ohm for the temperature range of -50 deg. to +150 deg Celsius. Temperature sensor we are using will give output current proportional to absolute temperature variation. For digital display output current is converted into suitable proportional voltage by connecting a series resistor connected with thermistor will result in 1mV/K drop across resistor. This voltage drop is fed to microcontroller through analog input pin for further processing and display. The rotation sensor we used is an opto coupler. It contains one IR LED for producing IR rays and it also contains one photodiode which will get triggered when the IR rays falls on the base of the phototransistor. This sensor is placed anywhere in the wheel and as the wheel rotates it will cuts the IR ray send from IR LED and this produces a pulse occurring at the collector output of phototransistor. These pulses are given to RB0 pin of PIC which is the interrupt enable bit. The interrupt register of PIC is so configured that, an interrupt is generated when a high to low transition takes place in RB0. The series 78 regulators provide fixed regulated voltages from 5 to 24v.Figure shows how one such IC, a LM 317 is connected to provide voltage

Dept of ECE Maliankara

35

SNMIMT

Dromography for Smart Vehicles

CHAPTER 8

VB FRONTEND

Dept of ECE Maliankara

36

SNMIMT

Dromography for Smart Vehicles

CHAPTER 9

COMPONENT LAY OUT

Dept of ECE Maliankara

37

SNMIMT

Dromography for Smart Vehicles

CHAPTER 10

PCB LAYOUT

CHAPTER 11
Dept of ECE Maliankara 38 SNMIMT

Dromography for Smart Vehicles

PCB FABRICATION
PRINTED CIRCUIT BOARD
ARES (Advanced Routing and Editing Software) forms the PCB lay out module of the PROTEUS system and offers net listed based PCB design complete with a suite of high performance design automation tools. The latest version is compatible with Windows 998/Me/2k/XP and later. It includes a brand new Auto-placer, improved auto-placing, automatic gate swap optimization and even more support for power plans

PCB FABRICATION
The various steps involved in the preparation of PCB are explained below: 1) PCB fabrication. 2) Soldering of components. 1) PCB fabrication. Materials required: Copper clad sheet, paint, ferric chloride solution, drilling machine. The steps involved in making PCB: a) Preparation of the lay out of the track: The track lay out of the circuit is drawn using pcb designing software. The layout should be made in such a way that the parts are in easy roots which will be done automatically by the use of the software. This enables PCB more economical and compact. The softwares commonly used are Or CAD, Proteus, PCB express etc. b) Transferring of layout to the copper clad: Plain, copper clad PC board can be purchased from many different retailers. If necessary, cut down the board to the approximate size. A table saw with a diamond blade or a shear are the best choices. In any case, be sure to wear googles and a breathing mask. Always clean the board with
Dept of ECE Maliankara 39 SNMIMT

Dromography for Smart Vehicles

water (perhaps some cleaning solution) and a scouring pad. The scrubbing removes grime and oxidation, thus preparing the surface for a crisp transfer and ultimately firm soldering. After drying the copper board, place the blue transfer paper with the image or toner side against the copper. Carefully position the image the clinging of the plastics to the clean copper helps. c) Etching: Ferric chloride solution is popularly used as the etching solution. The ferric chloride powder is made in to a solution using water and kept in a plastic tray. Now carefully immerse the marked copper clad sheet in the solution for a period of 1-2 hours. Due to reaction the solution becomes weak and it cant be used for further etching process. The copper in the unmarked area will be etched out. Take out the etched sheet from the tray containing the solution and wash it in clean water and dry out in sunlight for an hour. Later remove the paint over the tracks using turpentine. d)Drilling: The holes are made in the etched out copper clad sheet using a drilling machine with drill bits of size 0.5mm, 0.6mm, 0.9mm etc are depending on the leads of the components used in the circuit

SOLDERING OF COMPONENTS
Soldering is the process of joining two or dissimilar metals by melting another metal having low melting point. In order to make the surfaces accept the soldering readily the component terminals should be oxides and other obstructing films. Soldering flux cleans the oxides from the surfaces of the metal; the lead should be cleaned chemically or by scrapping using a blade or knife. Small amount of lead should be coated on the cleaned position of leads and the bits of soldering iron. This process is called tinning. Zinc chloride, ammonium chloride, rosin are commonly used fluxes. The solder is used for joining two metals at temperature below the melting point
Dept of ECE Maliankara 40 SNMIMT

Dromography for Smart Vehicles

.The popularly used alloys of tin and lead that melts at375degree F and solidifies when it cools. The most of the solder wires are flux core type. Soldering iron is the tool used to melt the solder and apply at the joint of the circuit. It operates at 230v main supply. The power ratings of the soldering iron are 10W, 25W, 35W, 65W, 125W. CHAPTER 12

SOFTWARE
In the software section two types of programming languages are considered. The first one is the assembly coding of the PIC microcontroller. A total of 35 instructions are used to code controller IC. The coding is performed on a MPLAB simulator version 5.60.00. The codes are programmed to the PIC microcontroller version PIC16F877 using a flash PIC programmer and a PIC ISP software. The source code for PIC16F877 is given in APPENDIX. 12.1 FLOWCHART (PROGRAM)

Dept of ECE Maliankara

41

SNMIMT

Dromography for Smart Vehicles

Dept of ECE Maliankara

42

SNMIMT

Dromography for Smart Vehicles

Dept of ECE Maliankara

43

SNMIMT

Dromography for Smart Vehicles

Dept of ECE Maliankara

44

SNMIMT

Dromography for Smart Vehicles

Dept of ECE Maliankara

45

SNMIMT

Dromography for Smart Vehicles

12.2 FLOWCHART (Interrupt service routine)

Dept of ECE Maliankara

46

SNMIMT

Dromography for Smart Vehicles

12.3 PROGRAM

LIST P=PIC16F877A #INCLUDE "P16F877A.INC" CBLOCK 0X20 HEXDATA DEC1 DEC2 DEC3 R3 R1 R0 ASCI0 ASCI1 ASCI2 ASCI3 ASCI4 DR1 DR2 DR3 COUNTER DIS1 DIS2 DIS3 DIS4 DIS5 SPEED DATAO DATAI NUM ADDRE TEMP VAL1,VAL2,VAL3,VAL4,VAL5 TEM,FUEL,CNT
Dept of ECE Maliankara 47 SNMIMT

;REG FOR HEX DATA ; ; ;REG FOR DECIMAL DATA

; ; ;REG FOR ASCII VALUE ; ; ;REG FOR LCD

Dromography for Smart Vehicles

R4,R5,R6 MIF MIF1 MIL SPEED1 ENDC LINIT MACRO INIT MOVLW INIT MOVWF DR1 BCF DR2,3 CALL SUB ENDM LCHAR MACRO CHAR MOVLW CHAR MOVWF DR1 BSF DR2,3 CALL SUB ENDM LINT MACRO INT MOVF INT,0 MOVWF DR1 BSF DR2,3 CALL SUB ENDM ORG 0 GOTO FIRST ORG 4 MOVWF TEMP GOTO INTR ADC1 CLRF DEC1 CLRF DEC2 CLRF DEC3 CLRF R3 MOVF HEXDATA,0 MOVWF R3 MOVLW D'100' INCF DEC1,1 SUBWF R3,1 ;LCD INIT MACRO

;LCD CHAR MACRO

;LCD INT MACRO

Dept of ECE Maliankara

48

SNMIMT

Dromography for Smart Vehicles

BTFSC STATUS,0 GOTO $-3 DECF DEC1,1 ADDWF R3,1 MOVLW D'10' INCF DEC2,1 SUBWF R3,1 BTFSC STATUS,0 GOTO $-3 DECF DEC2,1 ADDWF R3,0 MOVWF DEC3 MOVLW 0X30 ADDWF DEC1,0 MOVWF ASCI1 MOVLW 0X30 ADDWF DEC2,0 MOVWF ASCI2 MOVLW 0X30 ADDWF DEC3,0 MOVWF ASCI3 RETURN FUNSET MOVLW B'00110000' MOVWF PORTB BSF PORTB,1 NOP NOP NOP BCF PORTB,1 RETURN SUB BCF STATUS,6 BSF STATUS,5 MOVLW B'11110001' MOVWF TRISB BCF STATUS,6 BCF STATUS,5 BSF PORTB,3 NOP NOP NOP BSF PORTB,1 ;FUNCTION SET FOR LCD

;SUBROUTINE FOR LCD

Dept of ECE Maliankara

49

SNMIMT

Dromography for Smart Vehicles

NOP NOP NOP BTFSC PORTB,7 GOTO $-1 BCF STATUS,6 BSF STATUS,5 MOVLW B'00000001' MOVWF TRISB BCF STATUS,6 BCF STATUS,5 CLRF PORTB MOVLW 0XF0 ANDWF DR1,0 MOVWF PORTB BTFSC DR2,3 BSF PORTB,2 NOP NOP NEXT3 BSF PORTB,1 NOP NOP NOP BCF PORTB,1 SWAPF DR1,1 MOVLW 0XF0 ANDWF DR1,0 MOVWF PORTB BTFSC DR2,3 BSF PORTB,2 NOP NOP NEXT2 BSF PORTB,1 NOP NOP NOP BCF PORTB,1 CLRF DR2 BCF PORTB,2 RETURN DELAY BCF STATUS,5 BCF STATUS,6 MOVLW 0XEB MOVWF TMR0

;5M DELAY

Dept of ECE Maliankara

50

SNMIMT

Dromography for Smart Vehicles

MOVF TMR0,0 BTFSS STATUS,2 GOTO $-2 NOP RETURN DELAY2 BCF STATUS,5 BCF STATUS,6 MOVLW D'254' MOVWF TMR0 MOVF TMR0,0 BTFSS STATUS,2 GOTO $-2 NOP RETURN TRANS: bcf STATUS,RP0 bcf STATUS,RP1 btfss PIR1,TXIF goto $-1 movf R0,0 movwf TXREG RETURN INTR BTFSS INTCON,1 RETFIE BCF INTCON,1 INCF SPEED,1 INCF SPEED1,1 INCF DIS5,1 MOVLW D'10' SUBWF DIS5,0 BTFSS STATUS,2 GOTO RET CLRF DIS5 INCF DIS4,1 MOVLW D'10' SUBWF DIS4,0 BTFSS STATUS,2 GOTO RET ;20uS DELAY

; load data to transmit

Dept of ECE Maliankara

51

SNMIMT

Dromography for Smart Vehicles

CLRF DIS5 CLRF DIS4 INCF DIS3,1 MOVLW D'10' SUBWF DIS3,0 BTFSS STATUS,2 GOTO RET CLRF DIS5 CLRF DIS4 CLRF DIS3 INCF DIS2,1 MOVLW D'10' SUBWF DIS2,0 BTFSS STATUS,2 GOTO RET CLRF DIS5 CLRF DIS4 CLRF DIS3 CLRF DIS2 INCF DIS1,1 MOVLW D'10' SUBWF DIS1,0 BTFSS STATUS,2 GOTO RET CLRF CLRF CLRF CLRF CLRF DIS5 DIS4 DIS3 DIS2 DIS5

RET NOP MOVF R6,0 MOVWF R0 CALL TRANS MOVF TEMP,0 BCF INTCON,1 RETFIE FIRST CLRF DIS1 CLRF DIS2 CLRF DIS3 CLRF DIS4 CLRF DIS5
Dept of ECE Maliankara 52 SNMIMT

Dromography for Smart Vehicles

CLRF SPEED CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF CLRF VAL1 VAL2 VAL3 VAL4 VAL5 PORTA PORTB PORTC PORTE

MOVLW B'11010000' MOVWF INTCON MOVLW 0X04 MOVWF DR3 DISPLAY BCF STATUS,6 BSF STATUS,5 MOVLW 0X00 MOVWF ADCON1 MOVLW B'10000111' MOVWF OPTION_REG MOVLW B'00000001' MOVWF TRISB BSF TRISD,0 BSF TRISD,1 BSF TRISD,2 BSF TRISD,3 BCF TRISC,2 BCF STATUS,6 BCF STATUS,5 CALL DELAY CALL DELAY CALL DELAY CALL FUNSET CALL DELAY CALL FUNSET MOVLW D'75' MOVWF COUNTER DECFSZ COUNTER,1 ;LCD ROUTINE

Dept of ECE Maliankara

53

SNMIMT

Dromography for Smart Vehicles

GOTO $-1 CALL FUNSET LINIT 0X21 LINIT 0X0C LINIT 0X06 LINIT 0X02 LINIT 0X01 DECFSZ DR3,1 GOTO DISPLAY BCF STATUS,6 BSF STATUS,5 BSF TRISC,7 BCF TRISC,6 MOVLW 0X24 MOVWF TXSTA MOVLW D'25' MOVWF SPBRG BCF STATUS,6 BCF STATUS,5 CLRF PORTC MOVLW 0X80 MOVWF RCSTA LINIT 0X01 LINIT 0X80 LCHAR'D' LCHAR'R' LCHAR'O' LCHAR'M' LCHAR'O' LCHAR'G' LCHAR'R' LCHAR'A' LCHAR'P' LCHAR'H' LCHAR'Y' LINIT 0XC0 LCHAR's' LCHAR'm' LCHAR'a' LCHAR'r' LCHAR't' LCHAR' '

Dept of ECE Maliankara

54

SNMIMT

Dromography for Smart Vehicles

LCHAR'v' LCHAR'e' LCHAR'h' LCHAR'i' LCHAR'c' LCHAR'l' LCHAR'e' CALL DEL1 START CALL SWITCH CALL STEER NOP DSP BCF STATUS,6 BSF STATUS,5 MOVLW 0X00 MOVWF ADCON1 MOVLW B'10000111' MOVWF OPTION_REG MOVLW B'11111111' MOVWF TRISA BCF STATUS,6 BCF STATUS,5 MOVLW B'10000001' MOVWF ADCON0 CALL DELAY2 BSF ADCON0,2 BTFSC ADCON0,2 GOTO $-1 MOVF ADRESH,0 MOVWF FUEL MOVWF MIF CLRF SPEED1 CLRF CNT MOVLW 0X02 INCF CNT,1 SUBWF FUEL,1 BTFSC STATUS,0 GOTO $-3 DECF CNT,1

Dept of ECE Maliankara

55

SNMIMT

Dromography for Smart Vehicles

MOVF CNT,0 SUBLW D'100' BTFSC STATUS,0 GOTO LOP MOVLW D'100' MOVWF CNT LOP MOVF CNT,0 MOVWF HEXDATA CALL ADC1 DISP1 NOP LINIT 0X01 LINIT 0X80 LCHAR'F' LCHAR'U' LCHAR'E' LCHAR'L' LCHAR' ' LCHAR'L' LCHAR'E' LCHAR'V' LCHAR'E' LCHAR'L' LCHAR' ' LINT ASCI1 LINT ASCI2 LINT ASCI3 LCHAR'%' CALL DEL1 CALL SWITCH CALL STEER CALL DEL1 DISP2 MOVLW B'10010001' MOVWF ADCON0 CALL DELAY2 BSF ADCON0,2 BTFSC ADCON0,2 GOTO $-1 MOVF ADRESH,0 MOVWF TEM MOVLW D'113'

Dept of ECE Maliankara

56

SNMIMT

Dromography for Smart Vehicles

SUBWF TEM,1 MOVF TEM,0 MOVWF HEXDATA CALL ADC1 LINIT 0X01 LINIT 0X80 LCHAR'T' LCHAR'E' LCHAR'M' LCHAR'P' LCHAR'E' LCHAR'R' LCHAR'A' LCHAR'T' LCHAR'U' LCHAR'R' LCHAR'E' LINIT 0XC5 LINT ASCI1 LINT ASCI2 LINT ASCI3 LCHAR' ' LCHAR' ' LCHAR'c' CALL DEL1 CALL SWITCH CALL STEER CALL DEL1 DISP3 MOVLW 0X30 ADDWF DIS5,0 MOVWF ASCI4 MOVLW 0X30 ADDWF DIS4,0 MOVWF ASCI3 MOVLW 0X30 ADDWF DIS3,0 MOVWF ASCI2 MOVLW 0X30 ADDWF DIS2,0 MOVWF ASCI1 MOVLW 0X30

Dept of ECE Maliankara

57

SNMIMT

Dromography for Smart Vehicles

ADDWF DIS1,0 MOVWF ASCI0 LINIT 0X01 LINIT 0X80 LCHAR'D' LCHAR'I' LCHAR'S' LCHAR'T' LCHAR'A' LCHAR'N' LCHAR'C' LCHAR'E' LINIT 0XC0 LINT ASCI0 LINT ASCI1 LINT ASCI2 LINT ASCI3 LINT ASCI4 LCHAR' ' LCHAR' ' LCHAR'm' CALL DEL1 CALL SWITCH CALL STEER CLRF SPEED CALL DEL1 MOVF SPEED,0 MOVWF HEXDATA CALL ADC1 LINIT 0X01 LINIT 0X80 LCHAR'S' LCHAR'P' LCHAR'E' LCHAR'E' LCHAR'D' LCHAR' ' LINT ASCI1 LINT ASCI2 LINT ASCI3 LCHAR' ' LCHAR' '

Dept of ECE Maliankara

58

SNMIMT

Dromography for Smart Vehicles

LCHAR'm' LCHAR'/' LCHAR's' CALL CALL CALL CALL DEL1 SWITCH STEER DEL1

MOVLW B'10000001' MOVWF ADCON0 CALL DELAY2 BSF ADCON0,2 BTFSC ADCON0,2 GOTO $-1 MOVF ADRESH,0 MOVWF MIF1 MOVF MIF1,0 SUBWF MIF,0 BTFSS STATUS,0 GOTO START BTFSC STATUS,2 GOTO START MOVWF MIF CLRF MIL MOVF MIF,0 INCF MIL,1 SUBWF SPEED1,1 BTFSC STATUS,0 GOTO $-3 DECF MIL,1 MOVF MIL,0 MOVWF HEXDATA CALL ADC1 LINIT 0X01 LINIT 0X80 LCHAR'M' LCHAR'I' LCHAR'L' LCHAR'E' LCHAR'A'

Dept of ECE Maliankara

59

SNMIMT

Dromography for Smart Vehicles

LCHAR'G' LCHAR'E' LCHAR' ' LINT ASCI1 LINT ASCI2 LINT ASCI3 CALL DEL1 CALL SWITCH CALL STEER CALL DEL1 GOTO START STEER MOVLW B'10001001' MOVWF ADCON0 CALL DELAY2 BSF ADCON0,2 BTFSC ADCON0,2 GOTO $-1 MOVF ADRESH,0 MOVWF R4 MOVLW D'20' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO A1 MOVLW D'40' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO B1 MOVLW D'60' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO C1 MOVLW D'80' MOVWF R5 MOVF R4,0 SUBWF R5,0

Dept of ECE Maliankara

60

SNMIMT

Dromography for Smart Vehicles

BTFSC STATUS,0 GOTO D1 MOVLW D'100' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO E1 MOVLW D'120' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO F1 MOVLW D'140' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO G1 MOVLW D'160' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO H1 MOVLW D'180' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO I1 MOVLW D'200' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO J1

Dept of ECE Maliankara

61

SNMIMT

Dromography for Smart Vehicles

MOVLW D'220' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO K1 MOVLW D'240' MOVWF R5 MOVF R4,0 SUBWF R5,0 BTFSC STATUS,0 GOTO L1 GOTO M1 A1 MOVLW 'A' MOVWF R6 GOTO LAST B1 MOVLW 'B' MOVWF R6 GOTO LAST C1 MOVLW 'C' MOVWF R6 GOTO LAST D1 MOVLW 'D' MOVWF R6 GOTO LAST E1 MOVLW 'E' MOVWF R6 GOTO LAST F1 MOVLW 'F' MOVWF R6 GOTO LAST G1 MOVLW 'G' MOVWF R6 GOTO LAST H1 MOVLW 'H' MOVWF R6

Dept of ECE Maliankara

62

SNMIMT

Dromography for Smart Vehicles

GOTO LAST I1 MOVLW 'I' MOVWF R6 GOTO LAST J1 MOVLW 'J' MOVWF R6 GOTO LAST K1 MOVLW 'K' MOVWF R6 GOTO LAST L1 MOVLW 'L' MOVWF R6 GOTO LAST M1 MOVLW 'M' MOVWF R6 GOTO LAST LAST NOP RETURN DEL65 MOVLW D'1' MOVWF NUM FSS MOVLW D'1' MOVWF TMR0 MOVF TMR0,0 BTFSS STATUS,2 GOTO $-2 DECFSZ NUM,1 GOTO FSS NOP RETURN DEL150 MOVLW D'150' MOVWF R1 NOP DECFSZ R1,1 GOTO $-2 RETURN DEL1 MOVLW D'10'

Dept of ECE Maliankara

63

SNMIMT

Dromography for Smart Vehicles

MOVWF R1 MOVLW 0X01 MOVWF TMR0 MOVF TMR0,0 BTFSS STATUS,2 GOTO $-2 DECFSZ R1,1 GOTO $-6 NOP RETURN SWITCH BTFSC PORTD,4 CALL HOS BTFSC PORTD,5 CALL HOT BTFSC PORTD,6 CALL JUN BTFSC PORTD,7 CALL PET NOP RETURN HOS BTFSS PORTD,4 GOTO $-1 MOVLW '+' MOVWF R0 CALL TRANS NOP RETURN HOT BTFSS PORTD,5 GOTO $-1 MOVLW 'T' MOVWF R0 CALL TRANS NOP RETURN JUN BTFSS PORTD,6 GOTO $-1 MOVLW 'X' MOVWF R0 CALL TRANS NOP RETURN

Dept of ECE Maliankara

64

SNMIMT

Dromography for Smart Vehicles

PET BTFSS PORTD,7 GOTO $-1 MOVLW 'P' MOVWF R0 CALL TRANS NOP RETURN END ;----------------------------------------------------;FUEL LEVEL --RA0 ;TEMPERATURE --RA1 ;SPPED IR --RB0 ;LCD --PORTB ;-----------------------------------------------------

Dept of ECE Maliankara

65

SNMIMT

Dromography for Smart Vehicles

12.4 FLOWCHART (for interface window)

Dept of ECE Maliankara

66

SNMIMT

Dromography for Smart Vehicles

12.5 SOURCE CODE FOR USER INTERFACE WINDOW:


Dim data Delay As String 'The string to store the whole retrieved data. Dim x1, y1, x2, y2, x3, y3 As Double ' first four used to draw a line last two as temp variables. Dim i, running, xmove, ymove As Integer ' i is counter, running control the execution(flag), last two for scrolling purpose Const XSIZE = 8000, YSIZE = 8000, STEP = 100 'size of the canvas to draw, step is the size of single division Private Sub read() Dim data As String ' to read a single character data = MSComm1.Input ' reads and clears the port. COM port 'data = Text1.text 'uses for testing. need a textbox in the name text1 in form 'Text1.text = "" If Not (IsNull(data) Or IsEmpty(data) Or data = "") Then dataDelay = dataDelay & data ' adds to the string to print if there is any data 'MsgBox (dataDelay) plot ' plots what is in the string End If End Sub Private Sub Command2_Click() dataDelay = "" ' empty the available string to reset the trip plot End Sub Private Sub start_Click() running = 1 ' activates running MSComm1.PortOpen = True While running = 1 read ' reads data
Dept of ECE Maliankara 67 SNMIMT

Dromography for Smart Vehicles

DoEvents

Dept of ECE Maliankara

68

SNMIMT

Dromography for Smart Vehicles

Wend MSComm1.PortOpen = False End Sub Private Sub stop_Click() running = 0 'stops running End Sub Private Sub form_load() MSComm1.CommPort = 1 'set initial port settings MSComm1.Settings = "9600,N,8,1" MSComm1.InBufferSize = 1 xmove = 0 'initial scrolling is 0 ymove = 0 End Sub Private Sub plot() Dim deg As Double ' the degree of rotation Dim plotData As String 'char to plot Dim xdiff, ydiff As Integer 'temp variable to calculate the new position i = 1 'initialise counter canvas.Cls 'clears canvas x1 = XSIZE / 2 + xmove 'setting initial position y1 = YSIZE / 2 + STEP + ymove x2 = XSIZE / 2 + xmove y2 = YSIZE / 2 + ymove While True ' infinite loop plotData = Mid(dataDelay, i, 1) 'takes each bit to plot If IsNull(plotData) Or IsEmpty(plotData) Or plotData = "" Then Exit Sub ' breaks when data finishes i=i+1 Select Case plotData ' plotting of the movements Case "A"

Dept of ECE Maliankara

69

SNMIMT

Dromography for Smart Vehicles

deg = -75 '75d left Case "B" deg = -60 '60d left Case "C" deg = -45 '45d left Case "D" deg = -30 '30d left Case "E" deg = -15 '15d left Case "F" deg = -5 '5d left Case "G" deg = 0 Case "H" deg = 5 Case "I" deg = 15 '15d right Case "J" deg = 30 '30d right Case "K" deg = 45 '45d right Case "L" deg = 60 '60d right Case "M" deg = 75 '75d right Case Else GoTo MARK 'going to mark locations End Select xdiff = x2 - x1 'keys for translation ydiff = y2 - y1 x1 = x1 + xdiff 'translation of line y1 = y1 + ydiff
Dept of ECE Maliankara 70 SNMIMT

'Straight '5d right

Dromography for Smart Vehicles

x2 = x2 + xdiff y2 = y2 + ydiff deg = (deg / 180) * 3.14 'convertion to radians x3 = x2 * Cos(deg) - y2 * Sin(deg) - x1 * Cos(deg) + y1 * Sin(deg) + x1 'rotaion y3 = x2 * Sin(deg) + y2 * Cos(deg) - x1 * Sin(deg) - y1 * Cos(deg) + y1 'x3 = (x2 - x1) * Cos(deg) - (y2 - y1) * Sin(deg) + x1 'y3 = (x2 - x1) * Sin(deg) + (y2 - y1) * Cos(deg) + y1 x2 = x3 y2 = y3 If x1 >= 0 And y1 >= 0 And x2 >= 0 And y2 >= 0 Then canvas.Line (x1, y1)-(x2, y2) GoTo REPEAT ' skipping the following part MARK: Dim location As String 'plotting different locations on map Select Case plotData Case "+" location = "Hospital" Case "P" location = "Petrol Bunk" Case "T" location = "Hotel" Case "X" location = "Junction" Case Else GoTo REPEAT ' invalid data input End Select canvas.CurrentX = x2 ' locating the point and printing data canvas.CurrentY = y2 canvas.Circle (x2, y2), 10 canvas.Circle (x2, y2), 20 canvas.Circle (x2, y2), 30
Dept of ECE Maliankara 71 SNMIMT

Dromography for Smart Vehicles

canvas.Print (location) REPEAT: Wend End Sub Private Sub HS_Change() 'scrolling xmove = HS.Value * -1 ' 'set motion in opposite of scrolling plot End Sub Private Sub VS_Change() ymove = VS.Value * -1 plot End Sub Private Sub load_Click() On Error GoTo LoadEnd dlgOpen.ShowOpen 'loads a pre saved file Open dlgOpen.FileName For Input As #1 Line Input #1, dataDelay Close #1 plot LoadEnd: End Sub Private Sub save_Click() On Error Resume Next dlgOpen.ShowSave 'save the current file Open dlgOpen.FileName For Output As #1 If dlgOpen.FileName = "" Then Exit Sub Print #1, dataDelay MsgBox "File saved..."

Dept of ECE Maliankara

72

SNMIMT

Dromography for Smart Vehicles

Close #1 plot End Sub

12.6 PROGRAM EXPLANATION:


The software is intended to plot the data received from the electronic circuit connected through the COM port of the computer. Also there are some provisions to mark specific locations on the map on the way.

The plotting is done according to the following data in the table below: ANGLE FROM THE REFERENCE POSITION 750 600 450 300 150 50 00 50 150 300 450 600 750 DIRECTIN FROM THE REFERENCE POSITION left left left left left left Straight right right right right right right

CODE SEND A B C D E F G H I J K L M

TO

Dept of ECE Maliankara

73

SNMIMT

Dromography for Smart Vehicles

Also marking of locations using keys are made according to the data in the below table: PLACE TO MARK Hospital Petrol pump Here ( Present location) Junction CODE TO SEND + P T X

The software continuously checks the port for the availability of any data. When ever a data is available it will plot or locate on a picture box with name canvas. The plotting starts from the centre of the canvas with the assumption that the vehicle is parked in the vertically upward direction. The ports are initialized at the loading of the program. The plotting is done with the help of two 2D graphics transformations- Translation and rotation. Translation: The currently available line is translated in the forward direction of the vehicles path. Initially it is assumed that the vehicle is traveling through the vertical path upward. xdiff = x2 - x1 'keys for translation ydiff = y2 - y1 x1 = x1 + xdiff 'translation of line y1 = y1 + ydiff x2 = x2 + xdiff y2 = y2 + ydiff Rotation: The translated line is rotated with the degree measure obtained as data from the circuit. This is done in three steps. Translation to the origin and rotated and then translated back.

Dept of ECE Maliankara

74

SNMIMT

Dromography for Smart Vehicles

x3 = x2 * Cos(deg) - y2 * Sin(deg) - x1 * Cos(deg) + y1 * Sin(deg) + x1 y3 = x2 * Sin(deg) + y2 * Cos(deg) - x1 * Sin(deg) - y1 * Cos(deg) + y1 Now this available new line is plotted as the representation of the received data. On the reception of a signal to locate corresponding text is decided and marked at the current position. Also some small circles are drawn in order to indicate it.

Actions of different buttons: i. Start: Starts the process of reading data from the port ii. Stop: Stops the process of reading data from the port iii. Clear: Clears the available data. iv. Save: Saves the available data to a file for future use. v. Load: Loads a file and plots the data available from that. The picture box will be redrawn on each and every change of the data or a scroll on the screen. The source code for the interface window is given in APPENDIX.

Dept of ECE Maliankara

75

SNMIMT

Dromography for Smart Vehicles

CHAPTER 13

TESTING AND VALIDATION


Being an independent gadget the there are negligible chances of errors due to the atmospheric conditions and other supporting instruments. It works very smoothly in a testing environment. Before implementing in real time the system is thoroughly tested under controlled environment by manually providing the voltage and clock pulses to the device. The proper flow of data is checked by the looking availability of codes in the ports of the computer. A windows utility named HyperTerminal is used for this purpose. The VB software is also tested for its plotting accuracy. This is done by entering sample data in to the text box which was optionally provided in the testing.

Dept of ECE Maliankara

76

SNMIMT

Dromography for Smart Vehicles

CHAPTER 14

ADVANTAGES High accuracy of parameters displayed. Easy to read. Laptop or palmtop interface to view the route. The system works on 12 V power supply from the automobile battery.
Highly reliable, and compact in size.

Simple to install and easy to maintain.


digital display has lot of advantages with respect to analog meters. In ordinary dashboard mileage is not indicated but in digital dashboard mileage is also displayed. Since we are using dromography based tracking system there is no need of GPS and hence cost is further reduced.

Dept of ECE Maliankara

77

SNMIMT

Dromography for Smart Vehicles

CHAPTER 15

FUTURE SCOPE
System can be modified by using wireless data transmission systems to pc which can be useful in monitoring of path and position of vehicles. This can be easily implemented in cars by using LCD screens and new generation microcontrollers. By modifyying t VB program we can make the system more user friendly. This system can also be used in ships with small modifications. It can able to replace the GPS system in future by further developing more accurate data transmission systems through air.

Dept of ECE Maliankara

78

SNMIMT

Dromography for Smart Vehicles

CHAPTER 16

CONCLUSION
In this technological era many advanced tracking systems are available in market which is mostly based on Global Positioning System. But if anyone wants to enjoy these facilities, they have to pay a lot for the receiver and other service charges. Also there are many other limitations like geographical position of the place, satellite coverage etc. These factors determine the effectiveness of the service. But here this Dromography based traking system provides a cheap solution for traking a vehicle in a map .Also this system ease the tracing of a new route map of unknown places. We can create backup of the map as well in a short time. Being an independent gadget it works accurately with a high precision. Also this system is very much upgradable such as we can make this system as an assistant which can provide information about the current location, the distance from the target place, the speed etc. of the vehicle.

Dept of ECE Maliankara

79

SNMIMT

Dromography for Smart Vehicles

CHAPTER 17

BIBLIOGRAPHY
o www.wikipedia.org/dromography.php o www.alldatasheet.com/pic/16F877a.html o Op amps and Linear Integrated Circuits by Ramakand A.Gayakwad. Vol 3

Dept of ECE Maliankara

80

SNMIMT

Dromography for Smart Vehicles

APPENDIX A: DATA SHEETS

Dept of ECE Maliankara

81

SNMIMT

Você também pode gostar