Linux and Telematics: Building a Passenger Heatstroke Warning System
Industry experts predict that in-car computing, or telematics, will become a multibillion-dollar business in the next few years. Despite economic downturn conditions, this hypothesis may not be completely unrealistic, considering the recent growth: sixfold in a year for telematics equipment alone--from $60 million in 1999 to $380 million in 2000, according to Frost & Sullivan.
Independent software developers today essentially are excluded from the in-vehicle market. The closed systems being offered don't provide mechanisms for building or installing your own applications. Although many enterprising individuals have taken the home-brew approach, shoe-horning off-the-shelf PCs into the trunks of their cars, that solution is fraught with integration issues and ultimately isn't practical for most of us.
The EarthLink Simple Plug-and-Play Automotive Research Kit (SPARK) is a turn-key development system, based on Linux and open standards. It's designed to let developers easily test, evaluate and develop automotive applications using familiar technologies. The in-vehicle hardware (Figure 1) includes:
Motorola Reflex wireless network interface
16MHz 32-bit Dragonball processor
2MB Flash memory
8MB RAM
12-channel GPS receiver
vehicle I/O consisting of two optically isolated inputs, two relay outputs and one analog input
RS-232 serial port
Ethernet port

Figure 1. SPARK In-Vehicle Unit
The in-vehicle device runs µClinux, a special version of Linux that runs on MMU-less CPUs (see http://www.uclinux.org/).
Developing software for the in-vehicle device requires a development host. The EarthLink SPARK kit supports workstation PCs running any Linux distribution based on libc6. The PC must have a serial port and a LAN connection. The kit includes a set of tools for developing embedded Linux applications for the target in-vehicle platform. In particular, a modified version of the GNU compiler is supplied, along with customized libraries specifically intended for a small-footprint embedded environment. The kit also includes tools for installing your applications to Flash on the in-vehicle device.
Software must be downloaded to the in-vehicle device from the development host. The Ethernet port on the in-vehicle telematic device must be initialized by connecting to the DIAG serial port and logging in, using a communications program, such as minicom. The kit includes instructions for accomplishing this initial device configuration. The Ethernet port on the in-vehicle telematic device is a 10Base-T port (10Mb/sec), so the LAN must support 10Base-T Ethernet. Once the Ethernet port is configured, we're ready to start developing our telematics application software.
According to the National SAFE KIDS Campaign, at least 120 children died as a result of overheated vehicles from 1996 to 2000. The Humane Society says the number of pets that die the same way is far greater. What's more, the research reveals that deaths frequently occur in weather most people would not characterize as particularly hot. Temperatures inside a parked car can soar rapidly above 100°F when the temperature outside is just 80°F.
A startling 10% of parents polled think it's okay to leave an unattended child in a locked car. Children seem to have a knack for getting into dangerous situations. An unattended parked car can appear as an ideal place for a child to play.
Our application uses the EarthLink SPARK kit as the basis for a heatstroke detection and warning system. We connect a motion sensor and a temperature sensor to the SPARK in-vehicle device inputs and produce a software application designed to monitor the sensors and take action if the vehicle becomes hot enough to put the occupants at risk.
Developing applications for the SPARK in-vehicle µClinux platform is similar to developing applications for desktop Linux systems. The kernel and libraries of the in-vehicle device are a subset of the typical full Linux system. The overall process is similar, using familiar tools like GNU make and the GNU compiler.
The SPARK kit includes a Makefile to create a working environment for a new project:
mkdir heatwarn cd heatwarn cp /opt/AVL-sdkmaster/Makefile . make
This creates a basic working environment for our heatstroke warning system. The top-level Makefile in this default model is a sort of super-make. It first builds all applications from source code. Then it installs appropriate files into a ROM disk template directory and builds a ROM disk filesystem image. We cover these various actions in more detail in sections below. For now, let's focus on the src subdirectory that contains the source code to our applications.
In the src directory we will find a default Makefile to be used as a template. This Makefile is designed to build all applications in named subdirectories. The only such subdirectory in the default configuration is one called lcdoper, a sample application designed to interface to a Matrix Orbital serial LCD via the DIAG serial port. It is provided to demonstrate the use of the avlio library and as a basis for other applications. We won't need the lcdoper application for our heatstroke warning system, but we'll use it as a guide for our application.
For our heatstroke warning system application, we'll simply copy the model used by the standard Makefile to build and install the sample lcdoper application. We'll place our source code in a directory called heatwarn under the src directory, and we'll modify the default src Makefile to build our heatwarn application instead of the lcdoper application.










This week 5 lucky Members will receive a Root Superhero T-shirt, as modeled by
Hack Editor Kyle Rankin. No entry necessary. Check back here early next week
to find out who the lucky Online Members are.




Comments
Post new comment