This is a very simple module that will log the NMEA data from a GPS receiver to a micro SD card. I know what many people are saying “but there is an iPhone/Android App that does exactly that”, well the short reply is “so what”, this is all about experimenting and building. Besides I think my circuit would cost me about £25, cheaper than any phone and it could also conceivably be permanently mounted in a vehicle as a route tracker.
It really does not do anything very clever as most of it’s active features are performed by the pre-made modules.
The GPS Receiver
This Sirf II GPS module was listed as used and tested on eBay for a fiver (so cheap that I bought two). It has a simple 3 wire interface – ground, power (+5v) and Data Out, the seller was also kind enough to give me a very artistic and unique hand-drawn pinout along with a totally confusing specification in fluent Chinglish. The module also has an onboard red led that will stay on solidly whilst acquiring a fix and blink when a GPS fix has been acquired. The tricky bit about this specific module was the fact that the output data was at RS232 levels. This means that although the voltage of the unit was only +5V, the output would be coming out at +12v and -12V levels (the unit obviously has a built in voltage pump aboard)
The Micro SD Card logger
Although this functionality is possible (and quite easy) to implement yourself using a microcontroller and SD socket, I used the lazy option and used a Openlog SD module, this has a variety of features, configurations and modes and thankfully one of them (the default) will simply accept whatever data is thrown at it on the input pin and write it to a sequentially numbered text file. There is of course a bit of configuration required to set the correct baud rate etc. It also has a small SMT blue LED to show write status, errors etc. This unit is capable of a lot more (although I found it to be buggy) and is completely open source. It can be bought from Coolcomponents. The full specification can be found on the openlog website (dont know if still active). Using this unit hugely simplified the circuit.
The GPS module and the Openlog module both required an input voltage of 5v so a standard power supply consisting of a diode, 7805 voltage regulator and a few capacitors would be fine (at least so I thought… see below) a red power indicating LED was also added.
As I mentioned, the specific GPS unit I was using output it’s data at RS232 levels, the SD module however expects the data to arrive at TTL levels (0 / 5V) this means that I had to convert the data to TTL levels as if it was coming from a standard PC serial port. For this I simply used a MAX232 driver IC. The full Datasheet for the MAX232 can be found online.
Of course a text file with raw NMEA data is not really worth much and although there are many GPS analysis tools out there, I considered them all to be useless and opted for writing something myself.
The data is in normal human-readable text format and after the initial header records, the NMEA data is made up of simple CSV records . The first field specifies the type of the record to follow so using the NMEA specification you can determine the detail you wish to extract from the record. I have included a full version of the NMEA specification although only a few of the available record types were used in my code.
That really is as simple as it is… no complicated microcontrollers or programming required. The data is neatly written to a text file on the SD card ready for analysis. If the power is cycled, a new file is created… perfect!!
Because this was such a simple circuit, I did not create a schematic for it. After the various components had been breadboarded and tested on the bench I simply designed the PCB in DipTrace and etched the board.
To be honest, the circuit board ended up looking like a total dogs breakfast. I am going to blame this on rushing it, having some etching issues and using old PCB laminate stock. The board was left with some residual copper (almost invisible to the naked eye) which bridged two tracks, effectively shorting out the power supply output. The 7805 naturally got very upset about this and burnt my finger to remind me to test the board before soldering in the components. The errror was really hard to find and I only managed to clear the problem after running a scalpel between the tracks and the backplane (you can see this on the image below when enlarged). Once the short was sorted out, it was as simple as using hot glue melt to secure the GPS Unit to the board (I left space for this in my design) I also used a SIL socket to plug the Openlog module into (rather than direct soldering to the board), this is of course so that I can pull it out and use it in other projects easily. I made a short cable to connect the GPS to the board and put a Molex connector on it and also soldered a car cigarette lighter plug to a length of 2-core wire and a power plug to connect the circuit to a car’s power source.
Once the unit was ready I did a field-test. I inserted a microSD card, plugged it all in, put it on a piece of anti-static sponge in the back of the Landrover and took it out for a spin….
At first the unit took a while to acquire a GPS fix (I had to look at the LED in my rear view mirror), mostly because it had been powered down for a while had to rebuild its almanac of the satellites and was also hindered by me rushing off and giving the unit a moving target to get a fix on. On the second try, the signal was acquired really quickly (< 40sec) and the data logged without any problems.
I copied the raw data to my laptop by simply using a microSD adapter and then analysed it with the software.
Although I am yet to complete the software (eg. to show the position and signal strength from the satellites) - the overall results were pretty impressive. The recorded route (extracted from the raw NMEA data) was pretty spot-on the actual route travelled.
As can be see from the images above, the polygon of the route follows me quite neatly on my journey with very little drift, This is nicely demonstrated with me going around a roundabout and then taking the slipway onto the M40 in north-west London.
I will probably complete the software at some stage, package it up and release it as a freeware utility.
PLEASE NOTE... due to this device being homemade and uncertified, the data displayed cannot be used in any way as proof of me speeding :-)
The minimum voltage requirement to power the circuit is about 7v as the input voltage will be dropped down by a polarity protection diode before it goes into the 7805 voltage regulator, this requires about 6v minimum to give a regulated output of 5v. The big problem is that when powering this from a car's 12v supply, it leaves the regulator with a lot of volts to get rid of.... in the form of HEAT....
The unit gets very hot when plugged into a 12v automotive source, the polarity protection diode on the input will only drop the input voltage by about 1v leaving 11v to reduce to 5v. The complete circuit only draws about 110mA but the 7805 still got hot enough to burn your finger and to burn a mark onto the anti-static sponge the board was laying on - thankfully I did not just leave it on my cars parcel shelf as I would normally do. This is of course no good and will have to be addressed.
So that said I plan to tweak the design and have a new version with 2 minor changes:
- The 7805 could do with a proper heatsink (the current board layout is too tight for this)
- The input can be put through more diodes, probably a rectifying bridge to drop the voltage even more before the 7805 has to deal with it
The rectifying bridge will also have the effect of the device not minding what polarity is given to it.
I’ll post an update as soon as this has been attempted.