Mobile Urban Pollution: Prototype One
Summary |
Pollution Device |
GPS Device |
Jornada |
Software |
Critique
This prototype which is near completion, reads and record GPS
position, time from GPS unit, pollution data (CO in parts per million)
and temperature.
The pollution device comes from Learian.
Protocol
In Continuous mode device reports:
CO_ppm CO_base_ppm temperature battery_level\n\n
every second. It stops after 10 minutes. E.G. :
2.5 1.1 26.3 12.0
2.5 1.1 26.3 12.0
2.6 1.1 26.3 12.0
2.6 1.1 26.3 12.0
2.6 1.1 26.3 12.0
2.4 1.0 26.4 12.0
The device is based around a PIC, and it generates a menu over the
serial line, if it is not in continuous mode and you send a "\n".
Learian Designs Ltd.
Micro-Logger
Software version 1.00
Program checksum D872
Setup menu
A - Set Real Time Clock
B - Enter serial no.
C - Display input data
D - Calibrate Logger
E - Current Logger status
F - Upload data records
G - Clear records
Please make your selection -
to initialise, and or re-initialise after 10 minutes, you send
"C\r". For the first initialisation, you need to read four lines of
0.0 0.0 0.0 0.0
you may be able (based on experience with hyperterminal and
preliminary testing with complete device) to keep sending a "C\r"
every second, but that occasionally generates a series of dozens of
echoed "C"s the first time you do it.
Connection
Device support 9600 8-N-1 rs232. The box itself has a non-standard
round connector, that supplies rs232 as well as power pins. The
recharger cable is separate to the cable we have for rs232.
Here is the data wiring diagram (5-pin, 9-pin and also USB sync
cable).
Protocol
The current GPS unit is a Garmin Etrex Vista. It talks NMEA/ASCII
4800. The current software includes a customised version of the JEEPS
library to do NMEA parsing and also WGS84 to OSGB coordinate
conversion.
Connection
The ETrex has a custom connector.
We are using a HP Jornada 568. This currently run Pocket PC 2002. The
device usually comes with a USB cradle for synchronising to a
device. We have (via Cliff Randell) a cable to connect to the cradle
socket on the Jornada and give a female DB9 serial connector. The
connector is has the "dumb terminal" wiring since usually it is for
connecting to a PC. Thus a male-male cross-over cable is required to
make this into a connector suitable for connecting devices. This port
is named COM1 under Pocket PC 2002.
CF Serial Card
The Jornada only has one serial connector, so we added a 2nd with a
Socket Serial I/O CF Card, available from www.peak-uk.co.uk. This adds
a 2nd, flexible COM port. A driver needs installing via a desktop, but
then it can be configured under the Pocket PC system menu to present
any serial port name. We call it COM2.
Run-Time
For real-time display on the Jornada, we use currently the "gpsread"
read software written by AJS. This supports rendering on Pocket PC
using PocketGL and on Win32 with GLUT. This means that as a backup or
test, the devices can be plugged into a laptop. The Win32 version can
also be build in PocketPC simulation mode, which allows small-form
factor rendering issues to be sorted out without resorting to the slow
debuggining cycle on the PocketPC. The application supports logging,
and the applications support test modes where they read from two
captured serial stream, or from their own logging data.
Win32 Operation
TBD options.
PocketPC Operation
TBD options.
Software Projects
There are two main workspaces:
- gps_read.sln for Visual Studio.Net
- gps_read.vcm for Embedded Visual Studio
In gps_read.sln there are three projects:
- gps_read.Net - demonstration of GPS reading using pre-recorded or direct serial access
- jeeps - library to read NMEA strings from GPS and convert between coordinate systems
- gps_read.PGL - Win32 simulation of PocketPC device
Note that for the gps_read.PGL, the PocketGL simulator is built
directly into the application project since it had not yet been
successfully extracted as an external library.
In gps_read.vcm there are three projects:
- gps_readWCE - Pocket PC executable
- jeeps - library to read NMEA strings from GPS and convert between coordinate systems
- PocketGLLib - PocketGL as an external library.
all three support file loading and serial access.
Configuration is straightforward for gps_read.Net, it supports command
line arguments such as "-f gps_filename pollution_filename" for
pre-recorded NMEA data (e.g. generated by VisualGPS) and pollution
data , or "-c COM1 COM2" for setting the serial port for the GPS and
the serial port for the ICOM respectively. In PocketGL versions, since
these are designed for use on PocketPC which has no user-configurable
command line, the choice is hard-coded in Main.cpp.
Notes
Jeeps was originally written for UNIX - much functionality has been
disabled to get it to compile for Win32. In particular we replaced
jeeps' serial functionality. Writing cross-platform serial code isn't
fun and it should be imported from a cross-platform library. However
these libraries rarely support WinCE (NSPR and VRJuggler/Gadgeteer
apparently don't).
Timing functionality may be broken in WinCE (see comments in code),
but Win32 isnt't tested either to see if standard time.h functions as
expected.
Uploading
Currently log files are uploaded by hand.
Device does give all the data required for interesting experiments on
modelling and visualisation of . It gives accurate time logs
- Cabling 1. Which ever device is plugged into docking socket
requires three cables and four connectors. This needs replacing with a
custom cable, direct from, e.g. docking port to Etrex socket. This
could be expensive as the plugs themselves are not available and two
cables might need to be canabalised.
- Cabling 2. CF card has a ruggedised cable which doesn't
unplug. This means that there must be a connector. If rebuilding this
prototype investigate buying non-ruggedised and making custom
cable. Again this might be expensive.
- Power 1. Power is limited. GPS needs batteries every 6-8 hours (AA
rechargable. Jornada needs re-charging every 6-8 hours. If either is
left on when being used the device will not function later in the day
or the next morning.
- Power 2. There are three power switches. The GPS has a few screens
to scroll past.
- Upload. Data is uploaded by hand. This is a work item for
prototype two.