GPS & Sensor Telemetry Formula SAE Ryan Langley 2104584 HPV Sensor Suite Thomas Cross 2107294
Jan 18, 2016
GPS & Sensor Telemetry
Formula SAE
Ryan Langley
2104584
HPV Sensor Suite
Thomas Cross
2107294
HPV Super Series
• Human Powered Vehicle
• Multiple riders per vehicle
• Endurance races
• Manual lap timing
Project Aims
• Sensor suite onboard vehicle
• Location, speed and lap times
• Data logging
• Display data to pit crew
Pit Module•Graphical User Interface
•View real-time data
•Log/display lap times
•Data communications
Vehicle Module•GPS + Accelerometer
•Speed display
•Data logging
•Data communications
GUI
Firmware
Hardware
GUI
Firmware
Hardware
RF Module
Reverse Polarity & Overvoltage Protection
Switched-Mode Power Supply (5V)
Linear Regulator(3.3V)
Liquid Crystal Display
Microcontroller
SD Card
Microcontroller
I2CUART
UART I2C SPI
Input Power
GPS Module Accelerometer
RF Module
Reverse Polarity & Overvoltage Protection
Switched-Mode Power Supply (5V)
Linear Regulator(3.3V)
Liquid Crystal Display
Microcontroller
SD Card
Microcontroller
I2CUART
UART I2C SPI
Input Power
GPS Module Accelerometer
Circuit Protection
• Reverse polarity protection
• Overvoltage protection
• Transient suppression
RF Module
Reverse Polarity & Overvoltage Protection
Switched-Mode Power Supply (5V)
Linear Regulator(3.3V)
Liquid Crystal Display
Microcontroller
SD Card
Microcontroller
I2CUART
UART I2C SPI
Input Power
GPS Module Accelerometer
Power Supply
• 3.3V and 5V rails– Linear regulator for each rail – 5V SMPS powering 3.3V linear regulator– SMPS for each rail– 3.3V @ 0.1A– 5V @ 0.9A
Ploss (W) Efficiency Cost($AU)
2 x Linear 7.17 40.3% $3.30
1 x SMPS1 x Linear
1.42 77.3% $9.41
2 x SMPS 1.21 80% $15.52
RF Module
Reverse Polarity & Overvoltage Protection
Switched-Mode Power Supply (5V)
Linear Regulator(3.3V)
Liquid Crystal Display
Microcontroller
SD Card
Microcontroller
I2CUART
UART I2C SPI
Input Power
GPS Module Accelerometer
Inputs
• GPS Module– Updates at 10Hz– UART - NMEA Data and checksum– 2.5m location accuracy
• Accelerometer– MMA8451Q– 3-Axis– I2C
RF Module
Reverse Polarity & Overvoltage Protection
Switched-Mode Power Supply (5V)
Linear Regulator(3.3V)
Liquid Crystal Display
Microcontroller
SD Card
Microcontroller
I2CUART
UART I2C SPI
Input Power
GPS Module Accelerometer
Outputs
• RF Module - RFD900– UART– 40km LOS
• LCD– I2C– Displays data to rider
• SD Card– SPI– microSD
RF Module
Reverse Polarity & Overvoltage Protection
Switched-Mode Power Supply (5V)
Linear Regulator(3.3V)
Liquid Crystal Display
Microcontroller
SD Card
Microcontroller
I2CUART
UART I2C SPI
Input Power
GPS Module Accelerometer
Microcontroller
• 2 x UART - GPS & RF Module
• 1 x SPI - SD Card (SPI Mode)
• 1 x I2C - Accelerometer, LCD
• PIC18F46K22– 2 x UART, 2 x SPI/I2C– 64KB Program Memory– 64MHz oscillator
AccelerometerSD Card
GPS
Protection Circuitry
5V SMPS
3.3V LinearRegulator
Programming Header
GUI
Firmware
Hardware
GUI
Firmware
Hardware
Formula SAE
• Design & build race car
• Students of all disciplines
• Annual competition
• Flinders’ first year
GPS Telemetry Project
• Basis for sensor addition
• Build car and driver feedback
• Improve performance of team
Firmware Goals
• Configure sensors
• Read in, send and process data
• Log data
• Handle errors
• All in real time – or close to
GPS
• Configure UART peripheral
• Configure GPS module
• Receive NMEA data
• Process & Send data
Configure UART
• 1 start – 8 data – 1 stop – no parity
• 115,200 baud
• Interrupt based
• Ring buffer
TAIL
HEAD
$ G P R M C
Configure UART
GPS
• Configure UART peripheral
• Configure GPS module
• Receive NMEA data
• Process & Send data
Configure GPS Module
• Send only GPRMC and GPGSA– Lat & long– Date & time– Speed, heading– Precision
• Configure baud to 115,200
• Send data at 10 Hz
GPS
• Configure UART peripheral
• Configure GPS module
• Receive NMEA data
• Process & Send data
Receive NMEA Data
$
\n
GPS_msg_flag
N
YY
N
Receive ISR
GPS
• Configure UART peripheral
• Configure GPS module
• Receive NMEA data
• Process & Send data
Process & Send Data
• Pull msg from RX buffer
M C … \n$ G P R 0
N
NY
Y
Accelerometer
• Configure I2C peripheral
• Configure Accelerometer module
• Obtain data
Configure I2C
• 400 kHz speed
• Set as Master device
• Generic code
Accelerometer
• Configure I2C peripheral
• Configure Accelerometer module
• Obtain data
Configure Accelerometer
• Read latest data (not FIFO)
• 8G, 4G, or 2G mode
• 8-bit resolution
Accelerometer
• Configure I2C peripheral
• Configure Accelerometer module
• Obtain data
Obtain data
• Read the values at 10 Hz
• Use ‘get’ functions to access
X, Y, and Z values.
The Main Loop
The Results
The Results
ACC IN
RFD OUT
GPS IN
Data Logging
• Easy to use
• Windows compatible file system
• Different files for GPS and ACC data
SD_Card.hSD_Card.c
Data Logging
SPI.hSPI.c
FatFsFiles
Main Loop
diskio.hdiskio.c
SD_Card.hSD_Card.c
diskio.hdiskio.c
SPI.hSPI.c
FatFsFiles
Main Loop
SD Card
• Provides high-level logging functions– Create/open files– Log ACC data– Log GPS data– Save files
SD_Card.hSD_Card.c
SPI.hSPI.c
FatFsFiles
diskio.hdiskio.c
Main Loop
FatFs
• Generic FAT File System Module
• Designed for embedded systems
• 3rd party open source
• Platform independent
SD_Card.hSD_Card.c
SPI.hSPI.c
FatFsFiles
diskio.hdiskio.c
Main Loop
Disk IO
• Provides low-level disk IO functions– Initialize– Read– Write– Disk Status
SD_Card.hSD_Card.c
SPI.hSPI.c
FatFsFiles
diskio.hdiskio.c
Main Loop
SPI
• Portable SPI peripheral code
• Various initialization options
• Byte transmit, receive and exchange
Logging Result
GUI
Firmware
Hardware
GUI
Firmware
Hardware
Yes
No
Get Message TypeValid Message Header?No
Yes
New Message Received?
Yes
Valid Message?
Extract Message Data
No
Update Lap/Race Timer
10 Hz
Plot GPS Location Display Acceleration
Lap Detected?
Log Lap Time
Yes
Re
se
t
Receiving Data
• Scan until new message is received
• Check for valid header e.g. “$GPRMC…”
• Check for correct length and checksum
• Extract message data– Lat & long– Date & time– Speed, heading
Update GUI
• Update lap/race counter every 0.1s
• Plot most recent GPS location
• Display accelerometer data
• Display heading/speed
Lap Detection
• Check if travel line crosses finish line
• Log lap time and display on graph/table
• Reset lap timer
GUI
Summary
• Designed generic hardware
• Data processing and transmission
• Display real-time data on user interface
• Autonomously log lap times