Silicon ChipBuild A GPS Tracker & Record Your Journeys - November 2013 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Hybrid cars might not endure
  4. Feature: Raspberry Pi XBMC Solution For Multimedia by Ross Tester
  5. Feature: DRM Digital Radio: What It’s All About by Jim Rowe
  6. Project: Build A GPS Tracker & Record Your Journeys by Geoff Graham
  7. Project: Dual-Channel Audio Delay For PA Systems by Nicholas Vinen
  8. Feature: Using the SiDRADIO to receive DRM30 broadcasts by Jim Rowe
  9. Project: Alscolyser: For Accurate Alcohol Analysis by Allan Linton-Smith
  10. Project: SiDRADIO: Integrated SDR With DVB-T Dongle, Pt.2 by Jim Rowe
  11. Product Showcase
  12. Review: Gratten Spectrum Analyser & Signal Generator by Jim Rowe
  13. Vintage Radio: The Australian 123 & Dutch 283A "twin" receivers by Rodney Champness
  14. Order Form
  15. Subscriptions
  16. Advertising Index
  17. Outer Back Cover

This is only a preview of the November 2013 issue of Silicon Chip.

You can view 23 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Build A GPS Tracker & Record Your Journeys":
  • GPS Tracker PCB [05112131] (AUD $12.50)
  • PIC32MX270F256B-I/SP programmed for the GPS Tracker [0511213A.HEX] (Programmed Microcontroller, AUD $15.00)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • Firmware (C and HEX) files for the GPS Tracker [0511213A.HEX] (Software, Free)
  • GPS Tracker PCB pattern (PDF download) [05112131] (Free)
  • GPS Tracker panel artwork (PDF download) (Free)
Items relevant to "Dual-Channel Audio Delay For PA Systems":
  • Dual-Channel Audio Delay / Stereo Echo & Reverb / Digital Effects Processor PCB [01110131] (AUD $15.00)
  • PIC32MX470F512H-I/PT programmed for the Stereo Echo & Reverb Unit / Dual-Channel Audio Delay [0111013B.HEX] (Programmed Microcontroller, AUD $20.00)
  • Extra parts for the Dual-Channel Audio Delay / Stereo Echo & Reverb / Digital Effects Processor (Component, AUD $20.00)
  • Firmware (C and HEX) files for the Dual-Channel Audio Delay [0111013A.HEX] (Software, Free)
  • Dual-Channel Audio Delay / Stereo Echo & Reverb / Digital Effects Processor PCB pattern (PDF download) [01110131] (Free)
  • Dual-Channel Audio Delay panel artwork (PDF download) (Free)
Items relevant to "SiDRADIO: Integrated SDR With DVB-T Dongle, Pt.2":
  • SiDRADIO main PCB [06109131] (AUD $20.00)
  • SMD parts for SiDRADIO (Component, AUD $27.50)
  • SiDRADIO front & rear panels [06109132/3] (PCB, AUD $20.00)
  • SiDRADIO PCB pattern (PDF download) [06109131] (Free)
  • SiDRADIO panel artwork (PDF download) (Free)
Articles in this series:
  • SiDRADIO: An Integrated SDR Using A DVB-T Dongle, Pt.1 (October 2013)
  • SiDRADIO: An Integrated SDR Using A DVB-T Dongle, Pt.1 (October 2013)
  • SiDRADIO: Integrated SDR With DVB-T Dongle, Pt.2 (November 2013)
  • SiDRADIO: Integrated SDR With DVB-T Dongle, Pt.2 (November 2013)

Purchase a printed copy of this issue for $10.00.

Precisely record & plot your journeys with this GPS Tracker By GEOFF GRAHAM This little gadget will precisely record where your car, boat or aeroplane has travelled over time. Using software such as Google Earth you can then see your trips mapped onto the surface of the Earth with a resolution of just a few metres. It’s a great device for off-road drivers, sailors, farmers and grey nomads and can record a lifetime of travelling onto a single SD card. 24  Silicon Chip siliconchip.com.au All the parts mount on a single PCB. The GPS module can be seen sitting over the SD card socket on the left, the power supply is on the top right of the board and at the far right are the connectors for power, the optional inputs and the USB socket. T HIS PROJECT was originally created for a couple who were going to do the “grey nomad” trek anticlockwise around Australia in a 4WD and caravan around Australia. Why anticlockwise? Because it’s shorter, as you are driving on the left side of the road and on the inside of a circle! During their journey, they wanted a foolproof method of recording their route without the complications of keeping a log or constantly running a laptop computer with a GPS dongle. This GPS Tracker is the result. Basically, it’s a small box that can be wired to the vehicle’s ignition and then forgotten. Each time the vehicle is used, the GPS Tracker automatically records the time, date and the route taken on its SD card. This SD card can be removed later and inserted into a computer so that the stored history can be displayed in Google Earth or some other mapping software. If you are not a grey nomad, this device can be used for many other tasks – from farmers wanting to know which paddock they ploughed (and when) to boaties or fishermen who would like to know where they have been in the past. It could even be installed in the family car – imagine being able to see precisely the route taken on a particular day some time in the past! But there’s more! The GPS Tracker can also record points of interest (POI) and automatically build a spreadsheet that records a diary of your vehicle’s business and private use in a format that (hopefully) not even the tax department could argue with. A lifetime of detailed travel data can siliconchip.com.au Main Features • • • Records the route, time & date on an SD card each time the vehicle is used. • Record formats: Google Earth KML, GPS Exchange, raw NMEA data & two Microsoft Excel compatible formats. • Can record POI locations in a spreadsheet called LOG.XLS and can record a travel diary with private & business entries in a spreadsheet called DIARY.XLS. • When diary recording is turned on, pressing the POI button during a trip means that the distance travelled (in km) is recorded in the “Business” column of DIARY.XLS. • Powered from the vehicle’s 12V battery and can be permanently wired into circuit. Stored SD card data can be displayed in Google Earth or other mapping software. Records points of interest (POI) at the press off a button. In Google Earth, each POI marker is displayed as a yellow pin with an associated time & distance from the start. be recorded on a single standard SD card, so the entire history of a vehicle could be recorded for posterity. This data could be useful at some time in the future, especially for a business vehicle. File formats The GPS Tracker can record data in five different formats: Google Earth KML, GPS Exchange, raw NMEA data and two Microsoft Excel-compatible formats. The Google Earth formatted file has an extension of .KML. If you have Google Earth installed on your computer (PC, Mac, or Linux) you only need to double click on the file and it will automatically open in Google Earth and display the track, with markers showing the start, end and points of interest (POI). Google Earth is free and has many features that assist in displaying your track. These include the ability to zoom in and see detail, combine many separate trips into one overall view and turn visual features on and off. The second file format is the GPS Exchange Format (ie, file extension .GPX). This is an open XML data format for the interchange of GPS data (waypoints, routes, and tracks) between applications. Many open applications available on the internet use this format. Google Earth also supports this format but its main use is with software that can automatically work out where you have taken photographs and insert the latitude and longitude into the EXIF data area of the photographs. The software does this by comparing the date and time that your photograph was taken with the date and time in the GPX format file. The third file format supported is the raw NMEA (National Maritime Electronics Association) 0183 data which is stored in a file with a .TXT November 2013  25 Fig.1: the GPS Tracker can be configured to record POI (point of interest) locations in a spreadsheet called LOG.XLS which makes them easy to reference later on. it is enabled, the data is saved in an Excel spreadsheet called DIARY.XLS (see Fig.2). This spreadsheet includes the date/time of each trip, the start and end latitude/longitude, the trip duration and the total kilometres. If the POI button is pressed during the trip, the kilometres travelled will be recorded in the business column; otherwise they will be recorded in the private column. So, all you need do is press the POI button sometime during each business trip and your complete travel diary will be automatically created, ready to be attached to your tax return. Design Fig.2: for the tax man, the GPS Tracker can also be configured to record a travel diary in another spreadsheet called DIARY.XLS. In this mode, a trip is deemed to be for business if the POI button is pressed during the journey. extension. This consists of the RMC (latitude/longitude co-ordinates) and GGA (GPS fix) data records as generated by the GPS module. This format is also used by many applications that can process and display GPS data in interesting ways. You can configure the GPS Tracker to record the data in one, two or all three of these formats, with a specified interval between records. By default, the GPS Tracker records KML data once every five seconds and GPX data once every minute but this, along with other parameters, can be easily changed (more on that later). The POI button As well as recording the track in the three formats listed above, the GPS Tracker can also record data in two different Excel spreadsheets based on the POI input. This input would normally be connected to a switch that would short the input to ground when pressed. The switch could be mounted on the lid of the GPS Tracker itself or more likely, the dashboard of the vehicle or boat. Pressing the switch causes up to three actions to be carried out. The first is to insert a marker in the KML track. In Google Earth, this marker 26  Silicon Chip is displayed as a yellow pin symbol with an associated time and distance from the start. This could be used, for example, to record the location of a likely camping spot or the place that you dropped your lobster pot. You can also configure the GPS Tracker to record the date, time, latitude and longitude in an Excel spreadsheet (named LOG.XLS) each time the POI button is pressed. This is handy if you want to keep a convenient list of specific locations (see Fig.1). For example, if you are a farmer driving around your property, you could press the POI button every time you came across a patch of weeds. You could then later print out the spreadsheet and give it to a contractor as a starting list for weed spraying. Business vs private diary The second type of spreadsheet file that can be linked to the POI button is a business/private travel diary. As anyone who uses their car for business knows, you have to keep a diary of your business and private use for the tax man. This can be very tedious to say the least but it is necessary so that you can justify the tax deduction. Diary recording can be turned either on or off and is off by default. When Because of its intended use, the GPS Tracker was designed to be as simple and foolproof as possible. As shown in the photos, it’s housed in a small ABS case with a power cable (+12V from the vehicle’s ignition) feeding in at one end and a slot to insert the SD card at the other. There are also three indicating LEDs on the front panel and that’s it. The firmware is designed to be as forgiving as possible and will automatically recover from events such as loss of the GPS signal and power failure. Circuit details Take a look now at Fig.3 which shows the complete circuit. It consists of three main sections: a microcontroller (IC1), a GPS module and a switching power supply. The microcontroller used is a PIC32MX250F128B, the latest variant from the Microchip PIC32 stable. This was chosen because of its performance – it has a 32-bit processor, the clock runs at 40MHz and it has a large integrated flash memory (128KB). When you think of it, the microcontroller has quite a heavy workload. Primarily, it must implement a full FAT16 or FAT32 file system on the SD card, with the ability to create subdirectories and navigate through them. It also must be fast enough to close any open files and flush the data to the SD card if the power fails. But the best features of this highperformance chip are that it is cheap and comes in a standard 28-pin DIP package that can plug into an IC socket. Power supply The GPS Tracker is intended to be siliconchip.com.au siliconchip.com.au November 2013  27 A ZD1 16V 1W K A K D1 1N4004 S1 S1, S2 OPTIONAL – OFF BOARD 1W 10 µF 25V GPS TRACKER 82Ω A 8.2k 27k A D3 FASTRAX UP501 GPS RECEIVER MODULE 1 LED1 6 5 4 3 2 POWER 1PPS B/UV Vin GND TxD RxD CERAMIC PATCH ANTENNA A D2 1N5819 A CON6 100nF G S 82Ω 1F* 5VW K A 5 4 LED3 FAULT K λ K K λ λ K A A A K D1, D2, D4 22pF 22pF X1 8.00MHz 82Ω 9 10 17 11 18 A ZD1 AVss 27 OSC1 28 AVdd K Vss 8 23 Vss 19 K A Vcap D+ D– Vbus RB3 RPA4 SCK2 RPB5 RB2 RB13 S3 BOOTLOAD 10k CARD ENABLE 20 21 22 15 7 10k 6 5 1 2 3 4 MC P1 63 0 1 10 µF 25V CARD W/P 12 DATA FROM CARD 26 CLOCK TO CARD 14 DATA TO CARD 6 24 CARD PRESENT 3 2 1 100nF LEDS PGEC3 PGED3 MCLR VUSB IC1 PIC32MX250PIC3 2 MX250F128B 13 Vdd OSC2 RB8 RB4 RB9 B14 RB7 RPB1 RPB0 100nF +3.3V * SUPERCAP 47Ω D4 Q1 1N5819 IRF540, STP16NE06, D ETC. 2x 10 µF 25V 16 GPS 3 LED2 VFB K 100nF L1 15 µH K D3 1N4148 25 10k GND IC2 6 MCP SW 16301 BOOST 1 RECORD POI 2 EN Vin NEW TRACK CONTROL CON2 4700 µF 25V 4 5 Fig.3: the GPS Tracker consists of three main sections – a microcontroller (IC1), a power supply (IC2) and a GPS module. The power supply is designed to provide a regulated 3.3V supply for up to two seconds after the 12V supply has been removed. 2013 SC  RECORD POI S2 NEW TRACK 0V +12V CON1 POWER 10Ω 3 2 9 1 2 3 4 5 6 7 8 G 4 1 D WP CD 5 S Q1 D USB SD CARD SOCKET CON4 6 CON3 NC PCC 4 3 GND PGD 2 Vcc 1 OPTIONAL ICSP HEADER CON5 MCLR 100nF Fig.4: this is the default configuration file created by the GPS Tracker if a blank SD card is used. You can use any ASCII editor (Notepad in this example) to change the settings to your preference. powered directly from the vehicle’s ignition supply. It can either be hardwired to the fuse block or it can be powered from a cigarette lighter socket (ie, via a flying lead fitted with a cigarette lighter plug). In practice, the power supply must protect the microcontroller and the GPS module from spikes and reverse voltage. It must also keep supplying power for a short time after the external supply is removed, to allow data to be written to the SD card. As a result, it’s more complicated than a simple 3-terminal regulator circuit. Transient protection is provided by a 10Ω resistor and 16V zener diode ZD1. These serve to clip any transients while diode D1 (1N4004) provides reverse polarity protection and isolates the main filter capacitor (4700µF) from the vehicle supply when power is removed. IC2, an MCP16301, is an efficient step-down voltage regulator. This supplies the microcontroller, the GPS module and the SD card with a regulated 3.3V rail. When power is removed, the charge on the 4700µF input capacitor will decay and the regulator will track this falling voltage while still delivering a stable 3.3V output. In operation, IC2 can keep its 3.3V output stable for almost two seconds after power has been removed. The microcontroller needs only about 0.3s to flush its data and close the files on the SD card, so using a 4700µF capacitor sounds excessive. However, there’s sufficient space on the PCB to accommodate it and using such a high value provides a wide safety margin that will accommodate the inevitable reduction in its capacitance due to heat and aging. When power is removed from the unit, we need to minimise its current drain so that the 3.3V supply can be maintained for as long as possible. This is achieved by Q1 which immediately disconnects the power to the LEDs and the GPS module (which is Fig.5: this is the directory structure created to hold the data. It consists of three top level directories (GEarth, GPX and NMEA) with sub directories for each month. A file is created within these sub­directories for each trip. 28  Silicon Chip not required during shut-down) when the power is removed. As shown, Q1 is an N-channel Mosfet which has its gate connected to the supply rail (ie, before reverse polarity protection diode D1). When the ignition is on, this holds Q1’s gate at about +9V with respect to its source and therefore Q1 is turned fully on. When the ignition is subsequently turned off, Q1’s gate voltage immediate­ ly falls to zero. As a result, Q1 quickly turns off and in turn removes power to the LEDs and the GPS module. The main requirement of Q1 in this role is that it should have a low drain-source resistance when turned on. There are many SMD FETs that have this feature but it is easier to use a commonly-available power FET, even though we are only switching about 50mA. New track input When the input power is removed, IC1 detects this on its RB7 input (pin 16) and immediately commences its shut-down routine. This involves terminating the current track and writing the cached data to the SD card. RB7 of IC1 is also connected to CON2 to provide the “NEW TRACK” input but note that a new track is also automatically started if the unit loses power. Shorting this input to ground signals that the current trip has finished. When the short is released, the unit will then start recording a new track. This facility is provided so that the Tracker can be permanently connected to power if required. The advantage of this is that there will be no delay in it recording the current location, as would otherwise initially occur when power is first applied. Also, because of the efficient power supply design, the GPS Tracker only consumes about siliconchip.com.au 50mA and that level of permanent drain is acceptable in a vehicle that’s driven regularly. LEDs1 & 2 (green) indicate power and correct GPS operation respectively. These are connected between Q1’s source and the microcontroller which pulls its RB9 & RB4 outputs low to turn them on. LED3 (red) is the fault indicator and its drive arrangement is a little different. As shown, it’s connected between the RB8 output and ground. Normally, the microcontroller turns LED3 off by pulling its RB8 output low, which shorts out the LED. This means that the LED is off as long as the microcontroller is working normally. However, if anything goes wrong with the microcontroller, the LED turns on to indicate a fault. The firmware also monitors other components such as the GPS module and the SD card and if anything is wrong, it will turn on the fault LED. That way, the user is immediately warned that data is not being recorded – important in a device that is supposed to work automatically. GPS module The GPS Tracker is primarily designed for use with the UP501 GPS module from the Finnish company Fastrax. This amazingly small module is cheap, available from many sources and plugs neatly into the PCB. However, if you want to use an alternative, the firmware will also work with the Globalsat EM-408 module that’s been used in many of our projects in the past. The advantage of the EM-408 is that it is a little more sensitive and it has an MMCX connector for attaching an external antenna. However, it is more expensive than the UP501 and is difficult to mount securely inside the case. The UP501 needs a back-up supply to keep the internal memory of the module alive when power is removed. This is important because it can take a long time for the module to get all the data it needs from the GPS satellites. Provided the back-up supply is maintained above 2V, the module will remember this information and can get a fix on the satellites and your location more quickly. Therefore, a 1-farad super-capacitor has been included to keep the module’s memory alive for up to a week. As shown on Fig.1, this is connected siliconchip.com.au A typical track as displayed in Google Earth. You can zoom in to see the detail of the track or you can zoom out as in this image to see the whole route. The start marker records the start time and date, while the end marker records the end time, the distance travelled and the duration of the trip. between the GPS receiver’s VDD_B pin (pin 5) and ground. On the other hand, the EM-408 has an internal super-capacitor, so the external supercapacitor, diode D5 and the associated 47Ω resistor can be omitted if this module is used. USB port & ICSP IC1 provides a USB port at pins 15, 22 & 21 (Vbus, D- & D+ respectively). This is used only for debugging, as discussed later. The PCB layout also has provision for an ICSP (in-circuit serial programming) connector (CON5) which is not normally fitted. However, if you purchase a blank microcontroller, you can fit this connector and use a programmer such as Microchip’s PICkit 3 to program the chip in circuit. Configuring the tracker When the GPS Tracker starts up, the first thing the firmware does is read its configuration settings from a file called “Tracker.txt” in the root directory of the SD card. If that file is not found the firmware will automatically create it using its default settings. Fig.4 shows the typical contents of this file and as you can see, the comments make the file reasonably self-explanatory. In fact, the best way to create a custom configuration for the GPS Tracker is to insert a blank SD card and let the firmware create the default configuration file. You can then edit that file to suit your preferences. The main parameter that you might want to change is the time zone that you are operating in. The GPS Tracker gets an accurate time from the GPS satellites but it needs to know your time zone so that it can convert the GPS time to local time for time stamping its records. Another parameter that you might like to adjust is how often the GPS data is recorded on the SD card. This can be independently set for each of the three main data formats (KML, GPX November 2013  29 05112131 5819 L1 15 µH 10 µF LED2 IC1 PIC32MX250F128B LED3 10k 22pF 100nF 14 CON2 10 µF 10k 10k 82Ω 82Ω LED1 A X1 2 100nF A 22pF 3 A BOOTLOAD IRF540 100nF 1 66 CON3 4 S1 CON6 GPS CON1 GROUND RECORD POI NEW TRACK 28 1 Q1 FASTRAX UP501 GPS RX 1 CON5 (PATCH ANT) D3 1 SUPERCAP 100nF 82Ω MULTI - USE SD 2GB + D1 10 µF 4148 1F GND +12V 10 µF ZD1 CON4 16V + IC2 27k 4700µF 25V 100nF D4 8. 2k 47Ω 5819 MCP16301 10Ω 1W D2 4004 GPS Tracker 15 Fig.6: follow this parts layout to build the PCB (note: if you are using the EM-408 GPS module, you can leave out D4, the 47Ω resistor and the supercap). The completed assembly is mounted in the bottom of the case, with the three LEDs at bottom left protruding through holes drilled in the lid. and NMEA) and can be as often as once a second for accurate recording all the way up to many minutes if you want to keep the data files small. The KLMARK parameter controls how often (in seconds) a timed marker is placed on the KML track. This can be handy for long trips as it gives you an indication in Google Earth of your progress during the trip. A setting of zero will disable this feature. The parameters POIPIN, POILOG and POIDIARY are associated with the POI input and don’t have an associated value. Just their presence in the configuration file means that that feature will be turned on. POIPIN means that a marker pin will be placed on the KML track when the POI input is pulled low. POILOG Capacitor Codes Value µF Value IEC Code EIA Code 10µF 10µF 10u 106 100nF 0.1µF 100n 104 22pF NA 22p   22 means that the date, time, latitude and longitude of the current location will be recorded in the log file (LOG.XLS) when this happens. Finally, POIDIARY means each trip will be recorded in a travel diary (DIARY.XLS). If POIDIARY is enabled and the POI input is pulled low at any time during a trip, it will be recorded as a business trip. Directory structure Over time, the GPS Tracker can accumulate a lot of data, so a directory structure is used to make it easier to locate a particular trip. Fig.5 illustrates this structure. Starting with a blank SD card, the firmware will create three directories called GEARTH, GPX and NMEA – one for each of the three data formats to be recorded. Within each directory, it will create a subdirectory for each month. The format of the subdirectory name is year-month. For example, the directory “2013-12” will contain the records for December 2013. Finally, within these subdirectories, each trip will be recorded as a separate file. The file name starts with the day of the month followed by a sequence number for that day. So a file with the name “12--#03.KML” is the third trip recorded on the 12th day of the month. If required, the Excel spreadsheet files (LOG.XLS and DIARY.XLS) will also be created in the root directory of the SD card. They just accumulate data so if you want to reset them, it’s just a matter of deleting them and the firmware then recreates these two .xls files with zero size the next time it starts up. The firmware keeps these and other files open while it’s recording a journey. This means that you must not remove the card while it is being used, as that will result in a corrupted file system. Instead, you must always make sure that the power has been removed for a second or two (or the NEWTRACK input pulled low) before removing the card. The firmware will work with most SD cards up to 32GB in size and formatted with FAT16 or FAT32. Larger Resistor Colour Codes o o o o o o o No.   1   3   1   3   1   1 30  Silicon Chip Value 27kΩ 10kΩ 8.2kΩ 82Ω 47Ω 10Ω 4-Band Code (1%) red violet orange brown brown black orange brown grey red red brown grey red black brown yellow violet black brown brown black black brown 5-Band Code (1%) red violet black red brown brown black black red brown grey red black brown brown grey red black gold brown yellow violet black gold brown brown black black gold brown siliconchip.com.au device is correctly positioned. In particular, when fitting IC2, take care to ensure that you identify the faint dot marking pin 1 of the package. Once the five SMDs are in place, continue by fitting the remaining parts, starting with the low-profile components (resistors, etc) and then moving on to the taller components. Crystal (X1) should be installed sitting about 2mm above the PCB, so that its metal case doesn’t short against the solder pads underneath. This can be easily achieved by pushing the crystal down onto a thick cardboard spacer which is then removed after the leads have been soldered. Note though that the PCBs supplied by SILICON CHIP should have a solder mask layer over these pads on the top of the board, so in this case the crystal can be pushed all the way down. A 28-pin DIL socket is used for microcontroller IC1. Be sure to install it with its notched end positioned as shown on Fig.6. This close-up view shows how the UP501 GPS module and the three LEDs are mounted. The LEDs must be 20mm proud of the PCB so that they protrude through the case lid. cards may also work but we haven’t tested them. However, we expect that larger cards will work if reformatted using the FAT32 file system. Typically, a track that is recorded once a second will require about 2MB of storage per 1000km travelled, although this can vary considerably depending on your driving patterns. These days, an 8GB SD card can be as cheap as $10. So, using 8GB as the benchmark, you will be able to record all three data formats at the rate of once a second for over 1,000,000km. Obviously, storage capacity is not an issue! Construction The GPS Tracker is built on a double-sided PCB coded 05112131 and measuring 137mm x 68.5mm. Fig.6 shows the parts layout. Most of the parts are through-hole devices, so the assembly is fairly straightforward. However, voltage siliconchip.com.au Fitting the SD card socket regulator IC2 and the four 10µF capacitors are surface mount devices (SMDs) and these parts must be fitted first. To mount each SMD, first apply plenty of liquid flux to its PCB pads. That done, place the component in position and hold it down with tweezers or a matchstick while you put some solder on the tip of your iron and tack-solder one pin (or end). Adjust its position by remelting the solder and nudging it slightly if necessary, then solder the remaining pin(s). Finally, return to the original pin and add more solder, to ensure it is soldered correctly. Don’t worry if you get a solder bridge between two pins when soldering IC2. The bridge can be easily removed after the device has been fitted using solder wick. Note that, for performance reasons, the components around the voltage regulator are closely packed. Check Fig.6 carefully to ensure that each Another part that needs special treatment is the SD card socket which is surface mounted. It has two small plastic posts on the underside that mate with matching holes in the PCB to ensure it is correctly positioned. In particular, make sure that you find and solder all the SD card socket’s solder tabs – there are 16 in total. Two of these are very close together on the front lefthand corner of the socket (viewed from the front) and both should be soldered to the same solder pad. Other parts As shown in Fig.6, the 4700µF capacitor is mounted side-on against the PCB. That means that you have to bend its leads down by 90° before fitting it, so that they pass down through the PCB pads. Take care to ensure it is orientated correctly and place a dob of hot-melt glue or neutral-cure silicone under the capacitor before pushing it down into place. This will ensure that it is held against the PCB and prevent it later fracturing its PCB pads due to vibration (the unit is intended for use in a vehicle after all). LEDs1-3 are mounted 20mm proud of the PCB, so that they later protrude through their respective front-panel holes. To set the correct height, cut a 20mm-wide strip of thin cardboard November 2013  31 This is the level of detail that you can see in Google Earth. The red line is the track of the vehicle and in this case you can even see what traffic lane it was travelling in. and slide it between the legs of each LED while you solder it into position. Make sure the LEDs are all correctly orientated, ie, with their cathode (K) leads towards the edge of the PCB. GPS module The UP501 GPS module plugs into a 6-pin header socket which positions the module over the SD card socket (see Fig.6 and photos). If you are using this GPS module, simply solder a 6-pin header onto the module. It’s subsequently plugged into the socket on the PCB after the initial testing. Alternatively, if you are using the EM-408 GPS module, you need to cut off one of the connectors from the supplied cable and solder the leads to a 6-pin header as shown in Fig.7. This header is then later plugged into the header socket on the PCB. As discussed earlier, if you are using the EM-408, you can leave out the super capacitor, diode D4 and the associated 47Ω resistor. However, these parts should be fitted for the UP501. A problem with the EM-408 is that BROWN WIRE 770120 (PATCH ANT) GLOBALSAT EM-408 GPS MODULE (TOP) 1 EN 2 GND 3 RxD 4 TxD 5 Vin 1 2 3 4 5 6 GPS HEADER SOCKET Fig.7: if you use the EM-408 GPS module, cut off one connector from the supplied cable and then solder the cable to a 6-pin header as shown here. This header is then plugged into the GPS header socket on the PCB. 32  Silicon Chip there’s no easy method of mounting it securely. One way around this is to sit the module (with its integrated aerial facing up) on top of a block of soft foam which in turn sits on top of the PCB. Then, when the lid is screwed down, you will have a “squashed sandwich” arrangement which will push the module against the lid of the box, thereby holding it in place. Alternatively, you may be able to secure it to the top of the SD card socket using double-sided adhesive foam. Make sure that the adhesive cannot come into contact with the SD card when it is inserted though. The assembled PCB fits neatly into the specified plastic instrument case and is secured at all four corners using short M3 or self-tapping screws. Fig.8 shows the drilling details for the lid (to accept the three LEDs), plus the location of the cut-out required in one of the end panels to accommodate the SD card. The USB connector is used only for debugging, so there’s no need to make a cut-out for it in the opposite end panel. However, you will need to drill a hole in this panel for the power lead. A vehicle is a high vibration environment so both the microcontroller and the GPS module must be secured to prevent them from vibrating loose. The best way to do this is to cut two pieces of high-density foam (the type used to package heavy appliances) and glue them to the lid, so that they press down onto these devices when the lid is later fastened into place. Testing Before plugging in microcontroller IC1 and the GPS module, you should first test the operation of the power supply. To do this, connect the PCB to a 12V supply and check that there is 3.3V (3.1-3.45V range) between pins 13 (+) and 19 (-) of the IC socket. At the same time, the red fault LED should illuminate. Next, remove the power and check that the 3.3V rail remains for a few seconds (this indicates that the 4700µF capacitor is doing its job). Wait for this rail to drop to almost 0V, then complete the PCB assembly by inserting the microcontroller and GPS module into their sockets. Using the tracker Using the GPS Tracker is as simple as applying power, inserting the SD siliconchip.com.au 15.5 A LH END PANEL A www.siliconchip.com.au A 13 ALL DIMENSIONS IN MILLIMETRES Fig.8: use these two templates to make the SD card slot cut-out in one of the end panels of the case and to drill the holes for the LEDs in the lid. card and checking the three indicator LEDs. The first of these is the power LED and it only comes on when the microcontroller has completed its self test routine, indicating that both the power supply and the microcontroller itself are OK. The second is the GPS signal LED. This will be off if the GPS module could not be detected (ie, disconnected), flashing if the module is in communication but has not got a fix on sufficient satellites, and steadily illuminated if it has a fix and a valid latitude and longitude. Note that you need to be a little patient when you first power it up, as it can take up to 15 minutes for the GPS module to get its first fix. So place the device somewhere where it has a clear view of the sky and give it some time. The third LED (red) is used to signal a fault. As explained earlier, this LED will come on if a fault is detected, including a faulty or disconnected GPS module, a faulty or unprogrammed microcontroller or a problem with the SD card. Note that a loss of the GPS satellite signal is not counted as a fault because you may be travelling through a tunnel and the GPS Tracker will resume recording when you exit and the signal is restored. If the red fault LED is illuminated, you can deduce the general location of the fault from the other LEDs. For example, if the fault LED is on and both siliconchip.com.au the green LEDs are on, this indicates that the microcontroller and GPS are OK and therefore something must be wrong with the SD card. Typical problems with the SD card include not being inserted correctly, having the write protect switch in the on position and a corrupted and/or incorrect file system on the card. Any of these will light the fault LED. When the GPS Tracker is running normally, the fault LED will be off and the green power and GPS signal LEDs will be on. Whenever the tracker saves an item of information to the SD card, + GPS Signal 16 11 35 SILICON CHIP 4 HOLES A: 3.5mm IN DIAMETER + 13.5 Power CL + 13.5 Fault TOP HALF OF 1 5 0 x 8 0 x 30mm ABS CASE (VIEWED FROM OUTSIDE) CUTOUT FOR SD CARD: 27 x 4mm Fig.9 (above): this front-panel artwork can be copied, laminated and attached to the case lid using silicone. It’s also available in PDF format on the SILICON CHIP website. the power LED will blink momentarily to give an indication that it is active and recording your position. One point to note is that when you are testing the unit on the bench, you will find that it does not record any data. That’s because it will only record trips that cover more than 100 metres. This feature was included to avoid recording trivial vehicle movements, like moving a car from the driveway to the garage. Installation Installing the GPS Tracker can be as easy as securing it to the top of the dashboard using Velcro (or similar hook & loop material) and using a cable with a cigarette lighter plug for power. For a more permanent instal- The GPS Tracker sitting on the dashboard of a vehicle. It can be held in place using hook & loop material (eg, Velcro). November 2013  33 GPS Tracker Parts List 1 PCB, code 05112131, 137mm x 68.5mm (available from the SILICON CHIP Online Shop) 1 ABS box 80 x 150 x 30mm (Altronics H0218, Jaycar HB6034) 1 front panel label, 71 x 85mm 1 UP501 or EM-408 GPS module 1 8MHz crystal (X1) 1 15µH 2.1A choke (L1) (Pana­ sonic ELC09D150F or similar) 1 28-pin narrow DIL IC socket 1 tactile pushbutton switch (S1) 1 2-way screw terminal block, 5.08mm pitch (CON1) 1 3-way polarised male header, PCB-mount, 0.1-inch pitch (CON2) 1 Type-B USB socket, PCB mount (CON3) (Jaycar PS0920, Altronics P1307) 1 SD memory card connector (CON4) (Altronics P5720) 1 6-pin male header, PCB mount, 0.1-inch pitch (CON5, optional) 1 6-pin male header, PCB mount, 0.1-inch pitch (for GPS module) 1 6-pin header socket, PCBmount, 0.1-inch pitch (CON6) 4 M3 x 5mm machine screws (or No.4 x 6mm self tappers) 2 momentary pushbutton switches (optional – see text) Semiconductors 1 PIC32MX250F128B-I/SP micro­ controller programmed with 0511213A.hex (IC1) (available from the SILICON CHIP Online Shop) 1 Microchip MCP16301T-I/CHY switching regulator (IC2) 2 3mm green LEDs (LED1,LED2) 1 3mm red LED (LED3) 1 IRF540, STP16NE06 or PT3055V Mosfet (Q1) (TO-220 Finding The Parts As usual, a high-quality PCB for the project can be purchased from the SILICON CHIP Online Shop at www.siliconchip.com.au.   A pre-programmed microcontroller (PIC32MX250F128B-I/SP) can also be purchased from the Online Shop or you can purchase a blank chip direct from Microchip (www.microchipdirect. com), element14 (Cat. 2097773/2096412) or RS Components (part 768-0836). Note that if you purchase a blank microcontroller, you will need a programmer (such as a PICkit 3) to install the firmware. The hex file is available on the SILICON CHIP website. The voltage regulator (Microchip MCP16301T-I/CHY) can be purchased on-line from Microchip Direct or RS Components (part number 770-9476P). element14 also have the 15μH choke and 10μF SMD capacitors (Cat Nos 8094799 and 1845759 respectively), as do RS Components (part numbers 540-8538 and 758-8093 respectively). Finally, the UP501 GPS module can be purchased from either RS Components (part 716-5283) or Element14 (part 2113837). If you prefer the EM-408 module, it can be purchased from Altronics (Cat. K-1131) and from many online parts shops. lation, it could be placed on the rear parcel shelf, in the glove box or under the dashboard and permanently wired to the vehicle’s ignition supply (ie, the 12V supply that’s available when the engine is running). In some locations, such as under the dashboard, it’s possible that there will be insufficient signal for the module to acquire or maintain a reliable satellite fix. To assess this, you can carry out a simple test. First, place the GPS Tracker on top of your vehicle with a clear view of the sky (no trees, tall 34  Silicon Chip buildings, etc) and leave it for half an hour or so to get a solid fix and charge the super-capacitor. That done, remove the power, swiftly place it in its intended location and reconnect the power. If the signal level is excellent, the GPS module should regain a fix (indicated by a solid green GPS LED) within 10 seconds. If the signal is marginal, it might take up to a minute or more with the LED blinking before a fix is found. Anything between these two is an indication of the signal strength. package) 1 1N4745 16V 1W zener diode (ZD1) 1 1N4004 diode (D1) 2 1N5819 Schottky diodes (D2,D4) 1 1N4148 silicon diode (D3) Capacitors 1 1F 5V super capacitor, PCB mount, 5.08mm lead pitch 1 4700µF 25V electrolytic 4 10µF 25V ceramic, SMD 1206 5 100nF monolithic ceramic 2 22pF ceramic Resistors (0.25W 1%) 1 27kΩ 3 82Ω 3 10kΩ 1 47Ω 1 8.2kΩ 1 10Ω 1W Note: a kit of parts for this project will be available from Jaycar, Cat. KC5525. If the signal level is inadequate, you could remotely mount the GPS module in a location with a better signal and connect it to the PCB using a 6-core cable up to 2m long. Note that the aerial is on the top of the GPS module and this needs to be aimed straight up at the sky for best reception (ie, the module should be horizontal). If you are using the EM-408, you can go further and purchase an external antenna with an MMCX connector and plug it into the module. These are available cheaply on eBay and other on-line sources and they will provide a strong signal, even in adverse situations. They are also waterproof and have a magnetic base, so the antenna can be mounted externally on the vehicle with a good view of the sky. If you are using the two optional inputs (POI and NEW TRACK), then you will have to add momentary pushbutton switches to short them to ground. The maximum voltage on these inputs is 3.3V so don’t connect them to the vehicle’s 12V system (note: if these switches are mounted remotely from the case. it may be necessary to connect them using shielded cable to prevent glitches). Alternatively, the NEW TRACK input can be connected to the vehicle’s ignition circuit in order to automatically create a new track each time the siliconchip.com.au ignition is switched off (only necessary if the unit’s power supply is not switched with the ignition). This involves connecting a diode between CON2 and the ignition line, with the diode’s anode going to CON2. This pulls the NEW TRACK input low each time the ignition is switched off but prevents 12V from being applied to this input (which would damage it). Fault finding If you have a problem with your GPS Tracker, the first thing to do is check the indicator LEDs. If no LEDs are illuminated it indicates a power supply problem and you should check the input supply for 12V and the regulator output for 3.3V. If the red fault LED is on but no other LEDs are illuminated, this indicates that the microcontroller has a problem. Most of the time, this will be because it has been inserted the wrong way around. If so, reverse it and pray that it survived. Another possibility is the 10µF capacitor connected to pin 20 of the microcontroller. It must be a low-ESR ceramic device; anything else could prevent the microcontroller from starting up. If the GPS signal LED does not come on at all, it indicates that the GPS module is not communicating. This could be because it is not plugged in correctly, the super-capacitor is missing, it is configured for the wrong baud rate or it is faulty (unlikely). If you suspect the module, use the USB connector to connect the GPS Tracker to a desktop computer. For Windows, you need to install the SILICON CHIP USB Serial Port Driver (available on the SILICON CHIP website) but this isn’t necessary for Mac and Linux computers which have built-in drivers. The installation instructions are included with the driver. Next, use a terminal emulator to open the virtual serial port over USB, as created by the GPS Tracker on your computer. When you do, you should see the NMEA data stream as it is produced by the GPS module. There are many free applications that you can download that can use this data to diagnose your module. If you are a 4WD off-road enthusiast you could connect the tracker to a laptop via USB and use an application like ExploreOz which will use the NMEA data stream to pinpoint your position on a map. You can also use this facility to siliconchip.com.au This view shows a week long camping trip as recorded by the GPS Tracker. If you are on a long tour, you can use Google Earth to aggregate many individual tracks over many days to provide a “high-level” view of your progress across the surface of the earth. send commands to the module but you should avoid changing its baud rate as that parameter will be stored in its internal memory and will be recalled on power up. That could make it impossible to communicate with your module, even after the power has been cycled. If the NMEA data is missing and everything else is OK (including the supply rail to the module), then the module is probably faulty. Firmware updates For firmware updates, you should check the author’s website (http:// geoffg.net/tracker.html). To load a new firmware image, hold down the BOOTLOAD button while applying power to the GPS Tracker. The power LED will then flash slowly, indicating that the unit is in bootload mode. Next, copy the new firmware file (it must be called TRACKER.HEX) to the root directory of an SD card and insert it into the SD card socket. The power LED will then flash rapidly as the image is read from the card and programmed into the microcontroller’s flash memory. The whole process only takes about 10 seconds and when it is finished, the GPS Tracker will automatically start running the new firmware. If an error occurs, the power LED will resume its slow flash and the red fault LED will come on. Possible causes include: (1) a missing or incorrectly named hex file, (2) a hex file that is corrupted in some way and (3) a marginal or noisy power supply. After you have identified and corrected the issue, you can run through the bootload process again. So, there you have it – a versatile gadget that can record a lifetime’s worth of travelling. Where are you SC going to go with it? November 2013  35