Introduction: HackerBoxes 0021: Hacker Tracker

Hacker Tracker: This month, HackerBox Hackers are experimenting with data logging, satellite positioning, and location tracking. This Instructable contains information for working with HackerBoxes #0021. If you would like to receive a box like this right in your mailbox each month, now is the time to subscribe at and join the revolution!

Topics and Learning Objectives for HackerBox 0021:

  • Set up the Arduino integrated development environment
  • Configure a USB-Serial bridge for the Arduino Nano
  • Modify and upload program code to the Arduino Nano
  • Read and Write data from the Nano to a flash memory card
  • Retrieve data logged to flash memory into a computer
  • Set up a GPS satellite positioning module
  • Log GPS location data to flash memory
  • Retrieve logged GPS data and load it into a mapping system

HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are hobbyists, makers, and experimenters. And we are the dreamers of dreams.

Step 1: HackerBoxes 0021: Box Contents

  • HackerBoxes #0021 Collectable Reference Card
  • Arduino Nano V3 - 5V, 16MHz, MicroUSB
  • NEO-6M GPS Module with Integrated Antenna
  • MicroSD Card Reader Module
  • GY-273 Three-Axis Magnetometer
  • 16GB MicroSD Flash Card
  • Deluxe Surface Mount PCB Ruler
  • MicroUSB Cable
  • Tiny USB MicroSD Card Adapter
  • Solderless Breadboard
  • Jumper Wire Set (65 pieces)
  • Exclusive HackerBoxes "Hardware Hackers" Decal

Some other things that will be helpful:

  • Soldering iron, solder, and basic soldering tools
  • USB 5V Rechargeable Power Bank
  • Computer with Arduino IDE

Most importantly, you will need a sense of adventure, DIY spirit, and hacker curiosity. Hardcore DIY electronics is not a trivial pursuit. It's a real challenge and when you persist and enjoy the adventure, a great deal of satisfaction can be derived from learning new technology and hopefully getting some projects working. Just take each step slowly, mind the details, and don't hesitate to ask for help.

FREQUENTLY ASKED QUESTIONS: We would like to ask all HackerBox subscribers a really big favor. Please take a moment to review the FAQ on the website prior to contacting support. The HackerBoxes membership numbers have grown and grown, which is awesome. THANK YOU! However, we are now spending an ever-increasing amount of time answering support emails. Sometimes, several hours a day. While we obviously want to help all members as much as needed, over 80% of our support emails ask simple questions that are very clearly addressed in the FAQ. Tending to these unnecessary inquiries is quite inefficient and takes time away from the creative aspects of our educational mission. And let's be frank, we know that you already understand how tracking numbers work. If you just want to reach out and make conversation, we can certainly come up with something a little more interesting to discuss. Thank you for understanding!

Step 2: Arduino Nano

The Arduino Nano is a surface-mount, breadboard-friendly, miniaturized Arduino board with integrated USB. It is amazingly full-featured and easy to hack.


  • Microcontroller: Atmel ATmega328P
  • Voltage: 5V
  • Digital I/O Pins: 14 (6 PWM)
  • Analog Input Pins: 8
  • DC Current per I/O Pin: 40 mA
  • Flash Memory: 32 KB (2KB for bootloader)
  • SRAM: 2 KB
  • EEPROM: 1 KB
  • Clock Speed: 16 MHz
  • Dimensions: 17mm x 43mm

This particular variant of the Arduino Nano is the black Robotdyn design. The interface is by an on-board MicroUSB port that is compatible with the same MicroUSB cables used with many mobile phones and tablets.

Arduino Nanos feature a built-in USB/Serial bridge chip. On this particular variant, the bridge chip is the CH340G. Note that there are various other types of USB/Serial bridge chips used on the various types of Arduino boards. These chips allow you computer's USB port to communicate with the serial interface on the Arduino's processor chip.

A computer's operating system requires a Device Driver to communicate with the USB/Serial chip. The driver allows the IDE to communicate with the Arduino board. The specific device driver that is needed depends upon both the OS version and also the type of USB/Serial chip. For the CH340 USB/Serial chips, there are drivers available for many operating systems (UNIX, Mac OS X, or Windows). The maker of the CH340 supplies those drivers here.

When you first plug the Arduino Nano into a USB port of your computer, the green power light should come on and shortly after the blue LED should start to blink slowly. This happens because the Nano is pre-loaded with the BLINK program, which is running on the brand new Arduino Nano.

Step 3: Arduino Integrated Development Environment (IDE)

If you do not yet have the Arduino IDE installed, you can download it from

If you would like additional introductory information for working in the Arduino ecosystem, we suggest checking out the instructions for the HackerBoxes Starter Workshop.

Plug the Nano into the MicroUSB cable and the other end of the cable into a USB port on the computer, launch the Arduino IDE software, select the appropriate USB port in the IDE under tools>port (likely a name with "wchusb" in it). Also select "Arduino Nano" in the IDE under tools>board.

Finally, load up a piece of example code:


This is actually the code that was preloaded onto the Nano and should be running right now to slowly blink the blue LED. Accordingly, if we load this example code, nothing will change. Instead, let's modify the code a little bit.

Looking closely, you can see that the program turns the LED on, waits 1000 milliseconds (one second), turns the LED off, waits another second, and then does it all again - forever.

Modify the code by changing both of the "delay(1000)" statements to "delay(100)". This modification will cause the LED to blink ten times faster, right?

Let's load the modified code into the Nano by clicking the UPLOAD button (the arrow icon) just above your modified code. Watch below the code for the status info: "compiling" and then "uploading". Eventually, the IDE should indicate "Uploading Complete" and your LED should be blinking faster.

If so, congratulations! You have just hacked your first piece of embedded code.

Once your fast-flash version of blink is loaded and running, why not see if you can you change the code again to cause the LED to blink fast twice and then wait a couple of seconds before repeating? Give it a try! How about some other patterns? Once you succeed at visualizing a desired outcome, coding it, and observing it to work as planned, you have taken an enormous step toward becoming a competent hardware hacker.

Step 4: Battery Power

While working with the code on the Nano, we use the MicroUSB cable connected to a PC. This cable also supplies power to the Nano.

The easiest way to switch over to mobile (that is, battery powered) operation is to simply plug the USB cable into a USB 5V Power Bank, like this one.

A slightly more integrated option is to use the Nano's on-board voltage regulator connected to the VIN pin. Supplying a 6-9V unregulated power source (such as a battery) to the VIN pin can power the Nano. This is slightly more complicated because you need to consider how the battery is housed, how it is connected to the board, how to provide discharge protection for the battery (particularly if it is a LiPo), and also possibly how to charge the battery. Using a power bank, at least initially, abstracts these issues away in a single solution.

Step 5: Read and Write on MicroSD Flash Card

Adding a flash memory card to an embedded circuit is a great way to log data that can be accessed later. For example, the data may be stored on the card and then loaded, at a later time, into a computer for analysis.

This example shows how to read and write data to and from a MicroSD card.

We will use the code from the official Arduino tutorial.

To keep things simple, we will use the default SPI pin assignments from the tutorial.

VCC       - 5V
GND       - GND
MOSI      - pin 11
MISO      - pin 12
SCK       - pin 13
CS        - pin 4

Once the connections are made and the code is loaded, the results can be observed on the serial monitor (set to 9600 baud).

Hit the reset button on the Nano and each time you do, you will notice that there is another "testing 1, 2, 3." line added. This is because the file on the MicroSD card is being appended with the message each time.

Step 6: Reading the MicroSD Data Into a Comupter

The tiny USB adapter for MicroSD cards can be used to connect the MicroSD card to a computer system.

Insert the card into the adapter with the contacts down and plug the adapter into a USB port on any computer. No drivers are required on the computer. The card should show up as a standard USB storage device.

A blue LED will illuminate on the card adapter once everything is properly inserted.

Notice that the card has a file called "test.txt" containing all of the "testing 1, 2, 3." lines appended in the previous step.

Step 7: Satellite Navigation Systems

Satellite navigation (SatNav) uses a system of satellites to determine positioning information. A SatNav system with global coverage is referred to as a global navigation satellite system (GNSS). The United States operates the NAVSTAR Global Positioning System (GPS) and Russia operates GLONASS. China is in the process of expanding its regional BeiDou Navigation Satellite System into the Compass GNSS. The European Union operates the Galileo GNSS scheduled to be fully operational by 2020.

SatNav systems allow small electronic receivers to determine their location (longitude, latitude, and altitude/elevation) to high precision (within a few meters) using time signals transmitted along a line of sight by radio from satellites. The signals also allow the electronic receiver to calculate the current local time to high precision. GPS satellites continuously transmit their current time and position.

A GPS receiver monitors multiple satellites and solves equations to determine the precise position of the receiver and its deviation from true time. At a minimum, four satellites must be in view of the receiver for it to compute four unknown quantities (three position coordinates and clock deviation from satellite time).

Step 8: NEO-6M Satellite Navigation Module

The NEO-6M GPS receiver features high sensitivity, low power consumption, and advanced miniaturization. Its extremely high tracking sensitivity greatly enlarges the coverage of its positioning. It can operate where ordinary GPS receiver modules cannot, such as in narrow urban corridors or dense jungle environment.

The module can be plugged directly to a computer using a MicroUSB cable. This can be done without any wiring to the module, just a USB cable. When power is first applied to the module, the LED will glow steady. Once the satellite signals are acquired and positioning is locked, the LED will start to blink.

Using the Arduino IDE, the GPS module's USB port may be selected. The serial monitor may then be opened and set to 9600 baud rate. GPS data will appear in the NMEA format as specified by the National Marine Electronics Association (NMEA). This data will include the time which you should be able to recognize even though it is in UTC and thus likely shifted from your timezone by an integer number of hours.

Highlight and copy some of this NMEA data from the serial monitor and paste it into a text file.

Browse to the website for GPS Visualizer, select the text file with the NMEA data, and then view the geolocation results on a satellite map.

If you have a Windows computer, you may want to try out the ublox u-center software to read directly from the GPS module.

Step 9: Wire GPS Logger

A GPS position tracking logger can be implemented by combining the NEO-6M GPS module and the MicroSD card module. The measured GPS data can be logged to the MicroSD flash storage.

To use the GPS logger code shown here, the GPS module is wired up to the Nano A1 and A0 pins like so:

VCC - 5V
TXD - A1
RXD - A0

The MicroSD card module is wired up as before with its chip select wired to pin 4 of the Nano.

Step 10: Mapping Logged GPS Data From a Computer

GPS data points are read from the NEO-6M and written to the MicroSD flash memory in a file called "gps.txt".

After data collection, the card can be connected to a computer using the USB adapter, and the "gps.txt" file can be selected for upload into GPS Visualizer for mapping.

In the illustrated example, we tracked GPS location points while driving a car from one side of a waterway near the HackerBoxes Headquarters to the other side of the watreway. It is easy to see that some routes are better suited to using a boat.

Step 11: Three-Axis Digital Compass

The GY-273 sensor module is based on the Honeywell HMC5883L (datasheet) 3-axis magnetometer. When it cooperates, the module can be used to implement an electronic compass. This can support adding direction, or orientation, readings to your embedded projects.

The GY-273 can communicate with the Arduino over I2C. This tutorial from Henry's Bench has some useful information on wiring up the module and using the appropriate libraries. This sparkfun guide also had some interesting information.

We have to warn however, that we have had a lot of problems with these HMC5883L modules. They are tricky to get working correctly and the MEMS sensors are prone to damage.

Step 12: Trust Your Technolust

Thank you for joining our adventures into the world of data logging, satellite positioning, and location tracking. If you have enjoyed this Instrucable and would like to have a box of electronics and computer tech projects like this delivered right to your mailbox each month, please join us by SUBSCRIBING HERE.

Reach out and share your success in the comments below and/or on the HackerBoxes Facebook page. Certainly let us know if you have any questions or need some help with anything. Thank you for being part of HackerBoxes. Please keep your suggestions and feedback coming. HackerBoxes are YOUR boxes. Let's make something great!


LeanderM1 (author)2017-08-17

I updated the ino file so it uses strings - that way if you want to discriminate between various "sentences" received by your GPS receiver you now can. Thanks for great references and the tutorial to put together this neat little device!

Check it out here:

JustxFish (author)2017-08-13

I was unable to get the Digital Compass to work with the examples provided as it would just return 0 for all 3 axes. I found this post, and when using the code linked towards the bottom of the post it appears that the compass is now working. I haven't validated the accuracy yet but thought I'd share my findings.

moldavia (author)JustxFish2017-08-13

It looks like you are on the right track. This is made by a different manufacturer than the Honeywell sensor, and has different registers.

A bit of searching, and I found others with similar issues, and someone wrote a library for the IC marked with DA 5883.

I have not tried this yet.

moldavia made it! (author)moldavia2017-08-13

This does appear to be working.

Digital compass.png
moldavia (author)moldavia2017-08-14

Link to the forum posts with more info, and a link to the correct datasheet for the DA 5883.

moldavia (author)2017-08-12

It looks like the digital compass uses 3.3V logic, and the Arduino Nano uses 5V. Could be why it isn't working very well.

MartinW114 (author)2017-08-07

I am having trouble wiring the gps logger. I need a wiring schematic. The picture is hard to tell which wire goes to which pin.

HackerBoxes (author)MartinW1142017-08-07

Check out Step 5 and Step 9 for two "net lists" of which pins to connect together. That should do the trick!

ElijahH15 made it! (author)2017-08-06

I feature my HackerBoxes on my local computer services site. I built this project and uploaded a blog post about my experience at

Earthwormchris (author)2017-07-26

I made a clunky little 3D printable case for the project.

JonW27 made it! (author)Earthwormchris2017-08-05

Thanks again, here it is all sealed up and ready to roll. Appreciate your effort ewc!

JonW27 (author)Earthwormchris2017-08-05

Thank you! I made one and it looks great. Also went out to test it, worked just fine too. Really appreciate you sharing this project box.

TimGTech (author)Earthwormchris2017-07-31

Nice! Thanks!

erazmus (author)2017-08-04

I don't know if anyone else noticed, but the 'Kingston' micro SD card included this month is almost definitely a counterfeit. Check out this interesting article from a few years ago:

The hologram on the back of the package is fake. While I appreciate Hackerboxes sourcing us inexpensive hardware every month, I think they need to be careful about including hardware that's obviously counterfeit. There are laws about this that could get Hackerboxes or their customers in trouble for importing known counterfeit goods - especially now that they are making me do the dirty work to use a freight forwarded to get the package into Canada. Perhaps next time just include a 'generic' SD card instead of a fake branded one. (cross posting to the Facebook page also)

HackerBoxes (author)erazmus2017-08-05

Those flash cards were extremely expensive and they work great. In fact, we paid more for them than they cost at Costco. Unfortunately, you cannot go into Costco and buy 3,000 flash cards. Also, please stop the whining about shipping. No one is "making" you do anything. If you don't like it, then don't buy it. Thank you!

JSWheeler (author)2017-08-05

Got the GPS working without any issues! The magnetometer is also giving me issues (reports 0's) and is not working for either examples given.

EdW74 (author)2017-08-04

Any one have any success getting the gps to work with an ESP32? I am trying to become more familiar with the esp32, seems like the softwareserial (for esp32) i am able to find on the net doesn't seem to work.

BrianG282 (author)2017-08-03

Well... An update to those interested. I was able to get the Magnetometer up and running for about 10 minutes. Then without warning. It just stopped. All outputs on the serial monitor have reverted to 0. I decided to wipe clean and redo all the code. Even just using the Adafruit examples and some simple equations for the axis, it's like it's dead in the water.

droneb (author)2017-08-02

Throw in an RTC module and this could be even better.

BrianG282 made it! (author)2017-08-01

Took a quick walk around our office parking lot to get a signal fix. Made this on my lunchbreak! So my C++ skills have now been sharpened from "nonexistent" to "dull butter knife"

I noticed some of you mentioned you had issues with the GPS drivers. I was actually able to do the whole setup just through the Nano and everything worked fine. I wasn't able to get the magnetometer working, but I also only had an hour.

Will tackle next.

This is my 2nd hackerbox, I'm glad I signed up!

Capture.PNGSerial monitor.PNGIMG_20170801_150630.jpg
TimGTech (author)2017-07-25

I plugged in the GPS module and Windows 10 has a USB driver for it so it did not show up as a COM port. So I installed the Ublox U-Center and selected the Ublox driver instead of the Windows driver and now have it showing up with a COM port. So now it reads in the Arduino monitor. Works fine in U-Center too. Just can do both at once. Just sharing in case anyone else runs into this.

Racer1TN (author)TimGTech2017-07-26

I have the same issue with the U-blox. Working thru your suggestion. I also don't get any GPS data to write to the sdcard. If I reset the NANO, the data shows on the comm port screen, but nothing writes to the sd card. Does not matter if i create the gpadata text file or not. Tried copying the text from the gps data output to the GPS visualization website and it indicated a header was missing. Their header example is less than the output from the chip.

Racer1TN (author)Racer1TN2017-08-01

I got it, cool! had output of GPS connected to rx and tx..not AØ and A1. duh...Sleep helps troubleshooting....:D

TimothyD14 (author)TimGTech2017-07-29

How did you change the driver to the Ublox driver? I downloaded the drivers, and it looks like it's using the Ublox driver, but I'm still not getting a COM port.

TimGTech (author)TimothyD142017-07-30

Maybe try using jumper wired or a stacking header if you have one to connect the SD module to the breadboard. I was having issues and that was the fix. See my previous post about it with a few pics.

TimGTech (author)TimothyD142017-07-30

After installing I unplugged from the USB and rebooted. Plugged back in USB and the com port appeared.

bitanalyst (author)TimGTech2017-07-29

Thanks, had the exact same issue and this did the trick!

Juxpitos (author)2017-07-30

so how do you test this to make sure the SD card wr is working? as I've taken mine out twice now and made sure the GPS unit was powered and flashing before i went on a walk, and never got any data on the sd card... so can we get a clear picture of how to wire this up and some better instructions?

mainegeek (author)Juxpitos2017-07-31

Did you check the output of serial monitor? If the GPS is working you should see AT type commands. If the SD card is not working you should also see "error opening gps.txt". I ran into this; the problem with breadboards is sometimes things move and lose contact.

mainegeek made it! (author)2017-07-31

I'm done the GPS part. I haven't gotten anywhere with the magnetometer compass. I just get 0 for x, y, and x with the first example. I haven't tried the Adafruit example yet though.

bitanalyst made it! (author)2017-07-30

Great box! I Just finished taking my tracker for a drive in my car and it worked great. I had no idea it could be so easy to connect flash storage to an Arduino.

For indoor testing I connected an active external GPS antenna directly to the module using an SMA to IPX adapter. With the antenna placed near a window it was able to lock on pretty fast.

I'm going to attempt to make a GPS clock that utilizes the 1PPS output on this module next.

FullSizeRender 7.jpgIMG_5512.JPGGPS Test.jpg
Juxpitos (author)2017-07-30

anyone else having issues with the arduino sample code? when i try to verify mine it tells me this:

Arduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Documents\Arduino\sketch_jul30a\sketch_jul30a.ino: In function 'void setup()':

sketch_jul30a:11: error: 'SD' was not declared in this scope

if (!SD.begin(4)) {


sketch_jul30a:19: error: 'myFile' was not declared in this scope

myFile ="test.txt", FILE_WRITE);


sketch_jul30a:19: error: 'SD' was not declared in this scope

myFile ="test.txt", FILE_WRITE);


sketch_jul30a:19: error: 'FILE_WRITE' was not declared in this scope

myFile ="test.txt", FILE_WRITE);


exit status 1
'SD' was not declared in this scope

Any help would be greatly appreciated, thanks

Juxpitos (author)Juxpitos2017-07-30

Nevermind, wasn't copying the entire code, now that i have the first two lines it worked fine... Pebkac error, lol

Juxpitos (author)Juxpitos2017-07-30

even with it set on the nano board i get the same errors

JonW27 (author)2017-07-30

Had some issues getting the included Arduino Nano to recognize my COM port, used the driver on this page to get it installed and recognized:

TimGTech made it! (author)2017-07-30

If you have issues with your SD card module try using male/female jumper wires to connect it or a stacking header if you happen to have one. I was having issues with mine and discovered that it wasn't making a good connection on the breadboard. So functionality was hit and miss. After using a stacking header to connect it, it works like a charm every time. The hearder pins on the SD module are a tad short for plugging into a breadboard directly.

iandouglas (author)2017-07-27

My GPS unit only has the red power LED, I never see the blue led indicating it's trying to get a lock or indicate that it does have a lock. Could I have gotten a bad GPS unit?

bitanalyst (author)iandouglas2017-07-29

The LED on the GPS unit is solid red until it locks on to a signal. Once the unit has a fix it will be flashing red. If you are using the unit indoors it may have trouble getting a good signal. Check the serial monitor to see if you are getting any output from the module and try moving it near a window or outdoors. Connecting an external antenna helps quite a bit too.

g2em3 made it! (author)2017-07-29

So was anyone able to combine the digital compass and the GPS logger into one unit?

Kind of wish I could figure how to do that with the screen from last months kit and display some of the live data onto a screen. Compass, Altitude, Position, speed like an OSD On Screen Display.

Fun kit this month, I have been marking trails all over our neighborhood that are not on any known maps. Also the GPS does work well under heavy tree cover.

djcc2012 made it! (author)2017-07-28

Took it for a ride yesterday. It worked very well, with just one little hitch. For some reason partway through my trip it appears that I took a very quick detour to India! I think the GPS may have dropped a bit or two. My Long went from -441 to -278, then zipped right back to the correct -441. :-) Actually, my Long should be -81, but for some reason I continually get -360 + -81, so -441. GPS Visualizer seems OK with the -441.

WesG11 (author)2017-07-27

Maybe everyone has figured this out already but how do you get the txt file to show up in the map format. I've tried GPS Visualizer and i get the header was missing message and with U-Center, Im not sure how to enter the data in or do I open the file on the sd card from the file/open tab? Everything else seems to be working fine. I got the data but I'm just not sure how to view it.

Racer1TN (author)WesG112017-07-27

i got the same error trying to upload the captured text and one other question, how did you get the program to write the file to gps.txt? I have compared the exact same code from another instructables project and cannot find the error. I get no error that it cannot write nor any data written. I only see the text from the gps if i reset the nano.

RichW36 made it! (author)2017-07-25

I made it and it works. But my mini card reader was doa. :(

Racer1TN (author)RichW362017-07-25

My mini card reader worked once and then will not work since then. It does not recognize when plugged in and the blue led does not light.

RichW36 (author)Racer1TN2017-07-26

Mine did the exact same thing. It sounded like it was going to connect twice and then nothing. And the light never came on.

TimGTech (author)2017-07-25

On a side note - The ruler was worth the cost of the box alone! It's bad to the bone! :)

Earthwormchris (author)2017-07-25

I'm currently printing up a case I've made, if everything fits inside and works, I'll share it on thingiverse.

Hackerdaddy (author)2017-07-25

I wish I had started 20 boxes ago as this was a fun build. This project will transform into vessel tracking and analysis during maiden sea trials. Keep on making it happen and I can't wait to see my next project!

seaprimate made it! (author)2017-07-25

So decided to wire the modules on a perfboard. I know it doesn't look pretty and clean like soldering traces, but it's better than the breadboard and it still works. I had an issue originally with GPS not loading, both on the breadboard and this, but I simply deleted the first txt file and let it make another one and it worked perfectly. So if you get the whole "No valid GPS data detected" error when you test the first time, just delete the file and retry

grtyvr (author)2017-07-25

Makes me wonder how small a gps antenna can get.....

"The Pulse W3011 is only 3.2 (w) x 1.6 (l) x 1.1 (h) millimeters
(mm), and it weighs just 0.033 grams, yet has an efficiency of 80% with
an operating temperature of -40 to +85 degrees Celsius. Ground clearance
area is 4 x 4.25mm"

OK. Very small. So the limiting size on
your tracking device is the battery (unless you use a supercap) and the
SD card (unless you use the SD chip directly on a board and use
pogo-pins to get the data off) in which case we are talking about on the
order of 5x10x3.=Trust nothing! It is all tracking you!

About This Instructable




More by HackerBoxes:HackerBoxes 0021: Hacker TrackerHackerBoxes 0020: Summer CampHackerBoxes 0019: Raspberry WiFi
Add instructable to: