Build your own GPS tracker:
With Electronjs powered software:
|1||XC4989||16Gb SD Card|
|1||RR0552||150 Ohm Resistors|
This project works in two stages. Firstly the project is set up to record GPS information when you are out on a trip; This could be in the car or on the bike; the GPS is set to record the coordinates every 10-20 seconds and can be easily configured in the main
After-which, you can take it home and plug it into the computer. With the supplied GPS software, you will be able to plot the GPS-coords on a map. The GPS software is set up to check for new Serial devices and ask them for tracking information.
The general systems are connected as followed:
|SD Card Module||SPI pins (13,12,11), Chip Select 10|
|Status LEDs||Red 6, Orange 5, Green 4|
|GPS Receiver||Serial Receive (D0 or "RX")|
The battery discharge is just a simple switch to let us know if the GPS tracker is powered by the MB3793 power bank, or the USB connection to the computer. While it's connected to the computer, it will charge the battery (see "Preparing the Power supply" for a cool animation).
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.
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.
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).
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..
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.
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).
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.
You should have 3 components now:
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.
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.
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"
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)|
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)|
See below for a screenshot:
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:
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.
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
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.
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:
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. 😄