A little black box for your motorcycle Cas Craven Nick Paine Glen Rhodes Lev Shuhatovich Joe Zugelter • Concept • Hardware Design o o o 9S12 Microcontroller Fonera Wireless Router Motorcycle • Software Design o o o o 9S12 Microcontroller Fonera Wireless Router iPhone Interface Web Display • Hardware and Software to track motorcycle state over time o State GPS Location RPM Velocity Acceleration Gear Motologger Accelerometer GPS Battery Function Switch Ignition Coil Speed Sensor Gear Position Sensor System Diagram Motologger Battery Accelerometer GPS Function Switch Ignition Coil Speed Sensor Gear Position Sensor Data Flow Wifi SoC Atheros AR2315 Data Acquisition Board Serial SPI Wifi • Hardware Required o o o o o o o Motorcycle GPS Reciever Accelerometer SD Card Freescale 9S12X @ 40MHz Fonera Wireless Router iPhone Fonera Router Atheros MIPS-based SOC@180MHz Redboot OpenWRT SD MMC Driver User Application Kernel Panics are free Trashing JFFS2 Made Easy! External Inputs Power Distribution Battery Power Ignition Switch Speed Sensor Analog Conditioning Analog Conditioning Gear Position Analog Conditioning Power LED Status LEDs Analog Conditioning Ignition Coil External Outputs Microcontroller MC9S12XD512 Tach Output GPIO Function Switch Accelerometer Input Capture Input Capture A/D Converter GPIO GPIO PWM Internal Outputs GPIO SPI Serial Wifi SoC Processor Interface Motorcycle Interface Switching Power Supply Fonera Internals Placement Routing PCB on top of Fonera Fonera on Motorcycle (Cas) • Microcontroller - For things Linux won't do well o Real-time data capture peripheral for Linux Input capture timers Timer interrupts Pulse width modulation High precision, high accuracy timing GPIO Serial host communication o Motorcycle management Output data to tachometer dial Spedometer output Indicator lights (Cas) • Freescale HS12XA256 as Real-Time subsystem • Real-time event scheduler o Interrupt-driven Sampling o Arbitrary periodic events o Timestamping to GPS UTC +- 1ms • Foreground process o Binary serial communication with Fonera o Update outputs to motorcycle (tach, speedo, indicator light) (Nick) • A parametric periodic scheduler was used for many of the repetitive tasks on the 6812. (Nick) • GPS o determines absolute position at 1hz • Accelerometer (not implemented) o measures acceleration at higher frequencies (Glen) • Sockets are file descriptors -> file descriptors for everything! Network Connections (sockets) log files (.txt) serial port( /dev/ttyS0) • Standard structs for data serialization: typedef struct _velData{ char tag; char dummy; unsigned short time_stamp; unsigned short velocity; }velDataType; case vel_tag: tag=((velDataType*)buf)->tag; time_stamp = ((velDataType*)buf)->time_stamp; data1= ((velDataType*)buf)->velocity; sprintf(output,"%c,%d,%d,\n",tag,time_stamp,data1); break; (Glen) • iPhone • Used Sockets for network communication (Joe) • Post Processing with Python • Presentation with Excel • Presentation with Google Maps • Bandwidth limitations o Atheros SoC(Fonera) couldn't process large amounts of data. o 9S12 lost serial data when sending large number of samples. • Log more types of data o We are only logging a subset of what we planned • Increase sampling rates o Optimize communication protocol o Decrease Bootup Time o Add more bugs (features) o Integrate Data Post-Processing to iPhone Work Breakdown Lev – Hardware/Motorcycle interfacing, Drivers Glen – iPhone SW, Comms Nick – Microcontroller SW (Task Scheduler, GPS) Cas – Microcontroller SW (Comms, Drivers) Joe – Data Processing uP debugger