Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor:...

34
Bus Tracking Bus Tracking System System Fianl Part A Fianl Part A presentation presentation Presented by: Gal gavish and Yuval Presented by: Gal gavish and Yuval Peled Peled Supervisor: Hen Broodney Supervisor: Hen Broodney Winter 2003-2004 Winter 2003-2004 High Speed Digital Systems Lab High Speed Digital Systems Lab

Transcript of Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor:...

Page 1: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Bus Tracking Bus Tracking SystemSystem

Fianl Part A presentationFianl Part A presentation

Presented by: Gal gavish and Yuval Presented by: Gal gavish and Yuval PeledPeled

Supervisor: Hen BroodneySupervisor: Hen BroodneyWinter 2003-Winter 2003-20042004

High Speed Digital Systems LabHigh Speed Digital Systems Lab

Page 2: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Project’s GoalsProject’s Goals Create a system that tracks a bus and

gathers the arrival times to each station along its route.

The system includes 3 modules: bus, station and central-station.

Communication between bus and stations is done using the Bluetooth protocol.

Page 3: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

General System General System RequirementsRequirements

Independent of human intervention. Gathers the time of arrival only to stations that

belong to the bus’s route. Transfers all the data to the central-station’s

database for later analysis. Low power consumption.

Page 4: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Wireless Wireless communication communication architecture - architecture -

reminderreminderAll stations and the central-station are Masters and buses are Slaves.

• A station searches constantly for oncoming buses.• When a bus is recognized, the station ID is

transferred to it. • If the station is in the route, it is written in the

bus’s memory along with the current time.• The bus recognizes central stations and sends all

the information it gathered.

Page 5: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Block diagram for Block diagram for the bus and station the bus and station

modulesmodules

PIC18F452 microprocessor Bluetooth

Phillips

Serial EEPROM

Entries exits

Battery

9V

Clock Generator

10MHz

Development board:LCD

Page 6: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Block diagram for Block diagram for the central-station the central-station

modulemoduleBluetooth

Phillips

The info from each bus is transferred to the computer and stored in a data sheet.

Page 7: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Software Software designdesign

We have 3 main modules:1. The station module (master).2. The bus module (slave).3. The central-station module (master).And 5 utility modules:1. UART module2. BT module3. I2C module4. LCD module5. Timer module

Page 8: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Software Software ArchitectureArchitecture

StationStation BusBus

Inquire

Connect

Disconnect

Initialization

Inquire

Connect

Disconnect

Initialization

EEPROM

Search and write

Timer

module

LCD

module

I2C

module

BT

module

UART

module

Page 9: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Bus module

Bluetooth module

Station module

UART module controls the BT

unit

LCD module

Central-station module

Output, debug

Output, debug

Interrupt driven

Timer module

I2C module

Page 10: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Utility modulesUtility modulesI2C module:• Write to and read from a shift register inside the PIC18F. • No interrupts needed.BT module:• Treated as software I/O buffers that transfer the

information (events and data). Implemented by a previous project

• Use high priority interruptsTimer module:• Use a counter inside the PIC18F.• Use low priority interrupts

Page 11: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Multi-Multi-connectionsconnections

Two possible implementations:

1. Because the data transfer between the bus and the station is minimal, the station disconnects after sending its ID and searches for other busses.

2. If more than one bus was found, save the BD address of all the buses and connect to them by order.

• The first way is implemented in our code.

• The second way needs a change to the software buffers written by the previous project

Page 12: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Station moduleStation moduleprogram flowprogram flow

Set station IDFoundA Bus?

NO

YES

Send station ID

Search oncoming

Buses

Page 13: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Bus moduleBus moduleprogram flowprogram flow

TimerLow priority interrupt

Connectionrequest

BluetoothHigh priority interrupt

Enable new connections

Disable new Connections,

Connect ,Get ID and Search itRegularStation

Check if it’sMy station

YES

Print speedTo LCD

Write timeIn memory

NOCentralstation

Send route Table tocomputer

BackTo

start

Page 14: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Bus module - Bus module - interruptsinterrupts

TimerLow priority interrupt

BluetoothHigh priority interrupt

Initialize…Search…

Connect…

Connected

EEPROMPhase

Page 15: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Connection flowConnection flow

Search

Enable

connection

Connected!!

Send ID

Search in

memory

Search other

buses

Display speed

Write time and station ID in

memory

Page 16: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

PC – BluetoothPC – Bluetooth• The PC-BT represents the Central Station.

• Designed for independent use.

• Implemented as a separate thread from the current PC-BT implementation.

• Used as much of the existing functionality as possible.

Page 17: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

PC – Bluetooth PC – Bluetooth cont.cont.

How it all works:• To start the system, press the “Initialize

Device” button.– The system starts looking for BT devices.

• When a BT device is found (a bus), the system connects to it.– If more than one device is found, its BD address

and additional information is stored in an array.– At most 7 devices can be stored.

Page 18: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

PC – Bluetooth PC – Bluetooth cont.cont.

• Send to the bus a message containing the Central Station name.

• Receive from bus its line number.

• Receive from bus its route.

• Store all information in a text file.

• Disconnect from the bus.

• Prepare to find new buses.

Page 19: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Central Station Central Station modulemoduleprogram flowprogram flow

Initialize BT FoundA Bus?

NO

YES

Connect,Send station ID

Search oncoming

Buses

Press“Initialize Device”

button

Receive line numberand route table.

Write to fileDisconnect

Page 20: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Central Station Central Station modulemoduleconnection flowconnection flow

Search

Enable

connection

Connected!!

Send

ID

Search in

memory

Search other

buses

Send route table in 8-

bit blocks

Write info to

file

Page 21: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

TimingTimingEEPROM timing:• Write/read 8 bytes from serial 8 bit bus using

the shift register.• 5 msec each read/write action.• Search a station in table: takes up to a

minute. (before displaying the speed)• Send route table to central station: takes up to 10 secondsBT timing:• takes about 5-15 seconds to create a

connection.

Page 22: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Goals Goals accomplishedaccomplished

Implementing Hardware and software interfaces: EEPROM interface using I²C protocol and 24 hours Timer.

Learning MFC and implement the connection between a bus and central station

Order all wire wrap components and design the final boards

Page 23: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Future goalsFuture goals Do the wire-wrap and deal with wire-wrap

bugs

Set up a simulation using constructed boards

Check stability and robustness of the system

Page 24: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Bus Tracking Bus Tracking SystemSystem

midtermmidterm presentationpresentation

Presented by: Gal Gavish and Yuval Presented by: Gal Gavish and Yuval PeledPeled

Supervisor: Hen BroodneySupervisor: Hen BroodneyWinter 2003-Winter 2003-20042004

High Speed Digital Systems LabHigh Speed Digital Systems Lab

Page 25: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Bus module

Bluetooth module

Station module

UART module controls the BT

unit

LCD module

Central-station module

Output, debug

Output, debug

Output, debug

Interrupt driven

Timer module

Page 26: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

HardwareHardware Microchip PIC18F452 – a 40-pin chip.

Bluetooth chip by Phillips. Serial EEPROM (24LC256) by Microchip

- 256K x 8bit. Clock generator – 10MHz. LCD Battery – 9V.

Page 27: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

SpecificationsSpecificationsPhillips BluetoothPhillips Bluetooth

Operating Frequency2.4GHz to 2.4835GHz

Transmit Output PowerClass 2 (0 dBm nominal)

Operating rangeUp to 15m (with integral antenna)Receiver SensitivityLess than –80dBm ~ 0.001 BEREmbedded SoftwareEmbedded software stack supporting an HCI

interfaceNetwork TopologyPoint to Multipoint (up to 7 slaves) Master/Slave

switching supportedInterfaceUSB v1.1, UART at up to 921 kbps (low voltage

serial interface)Power Supply3 to 3.4V (or direct power from USB connection)Current consumptionIdle: < 2mA

File transfer: 70mAPeak: < 100mA

Operating Temperature-10 to + 55°CStorage Temperature-40 to + 85°CDimensions45 x 48 x 7mm

Page 28: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Specifications – ContSpecifications – Cont..Microchip PIC18F452Microchip PIC18F452Operating Frequency

DC – 10 MHz

Internal Program Memory

32KBytes

Data Memory1536 Bytes

Data EEPROM Memory

256 Bytes

Interrupt Sources18

I/O Ports5

Timers4

MSSP, Serial Communications

Addressable USART, MSSP

Parallel Communications (PSP)

Yes

10-bit Analog-to-Digital Converter

8 input channels

Programmable Low Voltage Detect

Yes

Programmable Brown-out Reset

Yes

Instruction Set75 Instructions

Package40-pin DIP

Page 29: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Specifications – ContSpecifications – Cont..Microchip 24LC256 EEPROMMicrochip 24LC256 EEPROM

Max. Operating Frequency

400 KHz

Data Memory256K x 8 bits.Vcc range2.5-5.5 VMax. write current3 mA at 5.5VMax. read current0.4 mA at 5.5VTypical standby current

100 nA at 5.5V

I/O2-wire serial interface bus, I2C™ compatible

Schmitt Trigger inputs for noise suppression

yes

Page write mode64 Byte

Max. write cycle time

5 ms

Endurance1 million write/read cycles

Electrostatic discharge protection

> 4000V

Data retention> 200 years

Temperature range

-40°C to +85°C

Package8-pin DIP

Hardware write-protect for entire array

yes

Page 30: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

EEPROM - MemoryEEPROM - Memory

List of all stations:• Up to 2000 stations, Average of 8 lines in each and 1

speed mark = 2000 x (6 + 8 x 3 + 1) = ~ 60KB

List of stations in route:• Up to 400 stations and arrival times

= 400 x (6 + 2) = ~ 2.5KB

Stations IDs6 bytesTime counter2 bytes

Line number3 bytesSpeed1 byte

Page 31: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

EEPROM life EEPROM life expectancyexpectancy

Serial EEPROMs are typically rated to endure 1 million write operations per byte.

Every time the bus enters the central-station it clears the entire EEPROM memory.

Assume the bus returns to the central-station 20 times a day, 5 days a week.

Life_expectancy = 10^6 / (20x5x52) ~ 192 yearsBefore BER increases dramatically.

Page 32: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Software toolsSoftware tools We’ll be using the C18 C compiler from the

MPLab IDE (Integrated Development Environment) to write our C code for the programs running on the PIC.

We’ll be using the MPLab ICD 2 (In Circuit Debugger) to program the PIC.

Page 33: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Debugging toolsDebugging tools To debug the application programmed on

the PIC we’ll use the in-circuit debugger (ICD) supplied with the PICDEM 2 Plus development board.

Since debugging with the ICD is slow, we’ll also be using the LCD and the LEDs on the development board for faster and easier debugging.

Page 34: Bus Tracking System Fianl Part A presentation Presented by: Gal gavish and Yuval Peled Supervisor: Hen Broodney Winter 2003-2004 High Speed Digital Systems.

Bus Tracking Bus Tracking SystemSystem

midtermmidterm presentationpresentation

Presented by: Gal Gavish and Yuval Presented by: Gal Gavish and Yuval PeledPeled

Supervisor: Hen BroodneySupervisor: Hen BroodneyWinter 2003-Winter 2003-20042004

High Speed Digital Systems LabHigh Speed Digital Systems Lab