WZab's animated logo

GPS logger with voice recording

This is the very first and rough description of my GPS logger with voice recording function. I've built it almost one year ago, and I'm still successfully using it, but I have no time to clean up the firmware and to document it properly. So finally I've decided to release it AS IS - preparing this WWW page. I'm afraid, that there may be many mistakes in my documentation. The schematic diagram (there are also the gschem sources of the schematic diagram) was prepared after the device was built and debugged (which the long incremental process ;-) ) - so I could have missed something.
I've decided to release this design in hope, that it may be inspiring for someone, but please use it only if you understand how does it work. I do not give you any warranty.
The whole design is published by me on the free BSD license. However some software components were written by others, which may impose other license conditions.
During my hiking or biking tours, or when I drove my car, I wanted to record my way, to use it for the OpenStreetMap project. However entering of additional information, like road numbers, street names and other points of interests by keyboard is tiring when hiking, difficult when biking, and deadly dangerous when driving.
Therefore I have decided to create the GPS logger with voice recording.
Main assumptions were:

Data format on the SD/MMC card

To minimize the complexity of the firmware, I have decided to avoid implementing of any filesystem on the memory card. The information is written starting from the begining of the card.
When device starts with partially filled card, it finds the first free page basing on the following assumptions:

Reception of data

The device receives two data streams in parallel - the first one via UART from the GPS module, the second one via ADC from the microphone, when voice recording is on. To keep the time correlation between data from both streams, the data are multiplexed immediately, as they are received. Data received from the UART in the UART interrupt routine are placed in the data buffer. Voice samples received from the ADC in the ADC interrupt routine, are encoded into two bytes (as described below) and placed into the same data buffer. The main thread of the program receives the data from the data buffer and transfers them to the SD/MMC card.

Formatting of the data stream

The data originated from the NMEA stream provided by the GPS module are simple ASCII characters with b7 bit set to 0. However the NMEA stream should not contain the 0x00 bytes either. It allows to distinguish between the recorded and erased pages on the memory card. The structure of the recording is marked with special markings encoded in the characters with b7=1:
Markerbyte (bytes) creating the markerRemarks
Start of recording 0xc0, 0xc0  
End of recording 0xc1, 0xc1 Early vesion of firmware do not record this marker
Start of voice message 0x80, 0x80  
End of voice message 0x81, 0x81  
Voice sample B'11xxxxxx', B'10yyyyyy' xxxxxx - 6 more significant bits of the voice sample, yyyyyy - 6 less significant bits of the voice sample.

Firmware sources

The current firmware is the total mess. I had to write the firmware in assembly language to assure the sufficient throughput. At the same time I needed the free/open source implementation of the USB firmware to assure transmission of data to the PC. The only free USB firmware written in assembly was the "Lab 2 peripheral firmware for PIC18F2455" published by Brad Minch at: http://pe.ece.olin.edu/ece/projects.html . Because I needed to compile it with gputils, I have used the version modified for gpasm by Ben Dugan and available here: http://www.curdes.com/gnupic/lab2_gpasm.zip This original USB firmware uses the "structured macros", while my original code was written in standard assembly. In fact I was not sure if these macros are able to correctly handle the bank switching issues, so I didn't try to convert my code to use them. Therefore the code is a real mess and needs significant clean up, but I have no time to do it :-(. You can download my code here.

PC communication software

Because the information in the SD/MMC memory card is stored without any filesystem, special software has been written for transmission of recorded data into the PC.
To download the stored data to the PC I use simple programs written in Python, which are based on the "usbenum.py" program provided as the part of the pyusb package. Currently there are three programs available:
Wojciech M. Zabołotny
Last modified: Sun Oct 19 15:44:48 CEST 2008