Progress Bar

Skip to main content

Jaycar
...

GPS-Tracker

GPS-Tracker

Difficulty
Security & Surveillance

Summary

Materials Required

116GB Class 10 microSDHC CardXC4989
1Duinotech Leonardo r3 Main BoardXC4430
1
1Arduino Compatible GPS Receiver ModuleXC3710
1Red 5mm LED 8mcd Round DiffusedZD0150
1Orange 5mm LED 80mcd Round DiffusedZD0169
1Green 5mm LED 80mcd Round DiffusedZD0170
1150 Ohm 0.5 Watt Metal Film Resistors - Pack of 8RR0552
12600mAh Metallic Power Bank Space GreyMB3793
13PDT Mini Toggle SwitchST0505

Removing female headers (optional)

Firstly, a completely optional step: if you want to remove the female header pins on the top of the datalogging shield, you can do so by mounting the shield in the leonardo, then bending back and forth the header row:

Once it breaks off, you can clean up the joints by using a small blob of solder over the broken metal; This neatens the join but also makes it stronger, but be careful not to melt the header pins on the leonardo by leaving the heat on for too long.

Connecting up LEDs

Next up, for connecting the LEDs, we are going to use our 150 ohm resistors connected into pins 3, 5, and 6. Use a pair of pliers to bend the leads of the resistos first, before you put them in.

We've also marked where the LEDs go, you must make sure that the positive side (the leg of the LED which is longer) must go closer to the resistors, as marked by the '+' sign.

From here, the Red Positive leg attaches to the resistor on pin 6, Orange positive to resistor on pin 5, and Green positive to resistor on pin 3. Our soldering is shown below:

We've also attached all of the negatives to go up the board, with the final RED negative lead bent at 90 degrees to be used later.

Use some WH3032 solid core wire to attach into the RX pin, we'll need this to receive serial data from the GPS later.

Placing GPS Module

First, either bend or re-solder the header pins on the XC3710 GPS module so that they are straight.

Then place the GPS module into the datalogging shield, in the last row, close to the analogue pins. You should find that it will fit just besides the LEDs that you have placed; In our photo below, we don't have the LEDs yet connected:

You can see that the bottom 3 pins are all we need in order to use the GPS module: VCC, GND, and TX (for Serial Transmission)

Solder in the GPS module at one or two spots to keep it in place, then follow the schematic below (looking at the underside of the shield).

  • VCC is connected to the 3V pin on the shield, which is a suitable voltage to use on the GPS.

  • GND is connected to both the LED negative legs from before, and to the 5V on the edge of the shield. Use some left over resistor legs to make the connection and keep it neat.

  • TX is connected to the RX from before; we have removed the shielding and soldered it at some points to keep it close to the board, but it is probably best to keep the marked section covered, so that it doesn't short through to the case of the GPS (and thus ground).

Once the 3 LEDs and the GPS module are connected, the shield is complete; we just need a slight modification on the leonardo to get it working as expected..

Preparing the LEONARDO

Unfortunately, the designers of the Leonardo board did not route SPI pins through to standard 13,12,11 pins; so we need to do some slight modification to our board to get it to read from SD card.

With some short lengths of solid core wire (solid-core is highly recommended as the wires can't splay everywhere and cause a short circuit) - Connect Pins 13,12, and 11 to the ISCP header as shown below.

To make it easier, you can first remove the ISCP pins from the board by heating up the solder and pulling them out, then cleaning residual solder with some solder wick such as NS3027.

Doing this makes the leonardo board act like the uno in regard to SPI, but you will have to replace the header pins if you need to use the ISCP in the future.

Formatting the card

Depending on the size of the SD card, you might have it already set as NTFS filesystem. We need it to be FAT32 to work with this code, so insert it into your computer and find the device in your Explorer.

Once you've found it, right click and press "Format". Make sure the file system is set as FAT32 and press "Start".

If you are using larger cards you might not get the option to use FAT32 in the windows software, but you will be able to use FAT32 if you use different software. Search for "Format FAT32 64GB card" or similar and you should find some software that will be able to format larger cards, but keep in mind that this system will probably need only 200Kb per day of tracking, ( which for 8Gb, is about 40 thousand days).

Preparing the Power supply

For the power supply, we are going to use the ST0505 switch to switch between the OUTPUT and INPUT of the battery charge bank. We use the 3rd pin to signal to the Arduino whether we are using the battery bank or not, just so we can set which "mode" we want to be in; to either log data to, or read data from, the SD card.

You will need to cut the supplied USB cable that came with the MB3793 and strip the two wires inside on both ends of the lead, so that it looks something like this:

We will be connecting both ends of the USB lead to the switch, and plugging both ends into the MB3793 battery bank.

The schematic for the switch is like such:

Basically, you should see 3 lots of 3 on the bottom of your switch; these are configured like 3 separate SPDT switches; two of which we use as power, and the final one we either ground or leave floating. In software, we use pinMode(A0,INPUT_PULLUP); so that the switch is left "HIGH" when not connected (floating) - or GROUND when the switch is turned on.

The benefit of this system is that arduino will know where it's getting it's power from, and if the unit is turned "OFF" while connected to the computer, it will also charge the battery bank.

In terms of wiring this up on the switch, it is pretty easy. The middle row accounts for the pin "2" in the schematic, and the top and bottom are 1 and 3.

The switch pins are rectangular and flat, and are laid out horizontally; It was a little difficult to get the photos of the switch, so take this visual representation instead:

This is what the bottom of the switch should look like; the 3 leads going to the shield can be bundled together if needed; in our photo at the top of the page we used some clear heatshrink to keep it together. Notice that the bottom right pin is unused, which matches the schematic as one of the pins is left floating, and there is a bridge between the top middle and right pins.

Connecting it all together.

You should have 3 components now:

  1. The Leonardo, with the ICSP modification to pins 11,12,13.

  2. The Shield, with 3 LEDs and GPS connected.

  3. The power bank, with both USB connectors plugged in, connected to the switch, and 3 leads coming off it (VCC,GND,A0)

Simply solder the 3 leads from the switch to the shield in the 5V, GND, and A0 pins. You can use some heatshrink to keep the switch leads together.

Installing the GPS Software

We have put a windows binary for the GPS software on Github under "releases" tab; which you can click here

Download the software and run it. It should open up with no problems; You won't have much data to view though until you use the GPS tracker, which is shown next.

Use and Troubleshooting

When the switch is set OFF you should find that the unit has no power; Connect it up to the computer and program the Leonardo as normal, by opening the project in the arduino IDE, set the board type to Leonardo, and select the correct port.

Once the Leonardo has rebooted and programmed successfully; you should find all LEDs turn on, which mean that it is "Computer Mode"

Computer Mode

You can open up the serial monitor and type in some commands, but without tracking information it won't have much of a response.

If you send

It should reply (with no data)

LIST

LIST

READ

DATA

If you find it replies "failed to init SD card" and you are sure the SD card is in the unit and formatted correctly, then submit an issue on github, as SD cards can sometimes have a bit of trouble.

We have provided a TEST file in the folder of the repo, which you can copy onto the SD card and use the serial monitor to test. Once it is placed on the SD card, insert the SD card into the unit, and connect it up (in command mode) so you can use the serial monitor:

If you send

It should reply (with TEST data)

LIST

LIST TEST|

READ TEST

DATA 210103.00 3349.41957,15101.13422|...

See below for a screenshot:

Tracking Mode

Disconnect the tracker from the Computer and turn the switch ON, you should find that the Power LED is turned on, and the other LEDs will blink at certain times.

Generally speaking, the LEDs will flash once on success and multiple times on failure:

  • Orange LED is related to the SD Card

  • Green LED is related to the GPS.

You might get a few GPS failures until you take the unit out into the open air and leave it for a minute or so, just so it can get a good lock on satellite information. If it takes more than 5 minutes to get a lock, submit an issue and we can help you debug;

While in tracking mode, you should still be able to see some information on the serial monitor, which can help you see what's happening with the unit.

Complete example use

Once it seems to be tracking successfully, take it for a walk around the block or put it in the dash of your car.

After a short trip, bring it back home, turn it OFF and connect it to the computer. then open up the GPS software and select the serial port.

You should find that it will return a list of tracking information. These are currently set to UTC time but we are working to make it local time as well.

If you find "Access Denied" that is most likely due to the serial port being blocked by Arduino, so make sure you close that, then you can close and re-open the software.

Once you select some tracking information, it will show up on the map and zoom to it, so you can see that complete track:

We really love this project and we hope you do too. If you want to contribute, one of the best ways is to submit suggestions on how to improve the project via the "Issues" tab on Github. This could be anything from suggesting a rainbow-track, loading multiple tracks at once, or showing a little car animation along the track. Be sure to include as much information as what you want, and we can outline how to make the changes so that either you can have a go of hacking it yourself, or someone else might come along and contribute so they can put it on their resume.

To extend the GPS Tracker software, you have to install a few things to set up your computer. Firstly, head over to https://nodejs.org to install node on your computer. If you are using linux or mac, you can simply use your package manager to install node.

Then in a command prompt window (or terminal), type in:

cd gps-view
npm install

Which should set up the dependencies required to build the software. You can read the README.md file in the gps-view folder to see more information about how to edit, build, and compile the example, there's a lot going on.

Recommended developing setup

For developing the gps-view tracker software, we generally recommend using Microsoft VSCode from https://code.visualstudio.com as well as the following extensions for syntax highlighting:

  • Prettier Code Formatting

  • Vetur

  • Vuetify-vscode

If you want to develop the Arduino application further, you could also install the Arduino extension and have a great editor for Arduino as well, which is what we use here at Jaycar. 😄

Similar projects you may be interested in

Arduino RFID Keypad
Security & Surveillance
Arduino RFID Keypad
Difficulty

IOT Button Notifier
Security & Surveillance
IoT Button Notifier
Difficulty

Security & Surveillance
Intruder Alert
Difficulty

Fingerprint Login
Security & Surveillance
Fingerprint Login
Difficulty