This step by step guide will show you how to make a GPS tracking and data logging device using the BBC micro:bit and the Seluxit wappsto:bit. It’s a great device that can track locations and log coordinates of the places you’ve been to.
This device is perfect as a family GPS tracker to monitor the location of your children to ensure their safety, a pet tracker or just for tracking your running or walking routes for fun, to collect all the beautiful places you’ve visited.
Springtime is “equal” to spending time outside – and that’s great! But couldn’t it be funny to see how far you have been around? Let’s try this project to create a GPS tracking data logging device, step by step. But, most of all, have fun!
To ensure that the project you’re planning will turn out successful, it’s always wise to make a “master plan”.
The “Master plan” for this project needs to cover our main requirements for the project, and specifically, we want it to:
If you work on a bigger project, then do a Flow Chart to create a plan before you start to code anything.
So, to get started, you first need to create:
This project is based on two main components, the BBC micro:bit V2.2 board and the Seluxit Wappsto:bit NB IoT+. Some additional parts required for the project are listed at the top of this project page.
First, attach the micro:bit to the wappsto:bit.
It’s important to note that the micro:bit does not power the wappsto:bit. When programming and using the stored data, you need to have a USB cable connected to the micro:bit (green arrow). When running the code and using the functionality of wappsto:bit, you need to power both through the wappsto:bit (orange arrow).
Before we put the whole program together, let’s first see if the plan holds tight. We can do this by a simple “proof of concept” program.
First, create a new project. Let’s call it “GPSDatalogger”.
Personally, I like to use functions, so let’s create those needed:
I always add an icon or similar to the on start block – that way I am sure that the micro:bit is working (remember to use the Green arrow USB). To add a simple icon to the “on start” block:
Then, we need to add the extension (library) for the wappsto:bit. Click on extensions; in the new window, write “Wappsto” and click search:
Click on the extension shown – it’s now added to the environment.
To configure the wappsto:bit, we first need to set it up; we do this in the setup function:
In the “on start” block, we will add the just created setup function and some basic things (just to have some visual of the things happening):
Add “call setup” from the Functions library.
Now let’s add some more functionality.
Add a button to display some positions:
Add the following to the “no button “B” pressed block:
Now try downloading the program to the micro:bit. You will see that the micro:bit is “stock” at the heart icon; this is because the micro:bit is not supplying power to the wappsto:bit. So, try moving the USB cable (remember the green/Orange arrows) to the wappsto, and you should now see the “Check sign” appear.
If you click the button “B” and it shows “NaN NaN”, it means the GPS module does not yet have a fix. If you are indoors, try putting the board close to a window and wait for a little before trying again.
First, we need a “count” variable. So, from the Variables library, click on “Make a Variable” and name it “count”.
Next, we need to add the datalogger extension similar to when we added the wappsto:bit extension. We also need to set it up – we will do this in the setup function, so add:
“set columns array of “a” “b” “c” ” change “a” to “count”, “b” to “GPS latitude” and “C” to “GPS longitude”.
In the setup function, we also define the count variable:
From the Variables library, drag “set count to ‘0’” and change “0” to “1”.
Now create the Variable called “logInterval”.
Add “set logInterval to ‘0’” from Variables library to block “function “userVariables” and change the “0” to “10000”.
Now for the logger loop:
Let’s add functionality to clear the log. Here we use the “on log full” event to set a flag:
From the Data Logger library, drag the “on log full” block out.
Now create a variable named “logFul”, add “set logFul to 0” to the above block and change “0” to the logic component “true”.
Create the function “clearLog” and populate it, so it’s like this:
Call the function from a button (here A+B):
Now, I would like to add a way to see how much we have logged:
Now everything works fine! But, let’s add extra functionality so that we only log data when the log is not full and we have a fix/position.
So, we can add some logic to the “every “logInterval” ms” block by adding this:
Your program should now look like this:
And here is a link to the finished code.
Now that we have logged data, how to get it?
When you plug the USB cable between the micro:bit and your computer, you will get the log a window looking like this:
Try clicking on the “micro_bit data log”; it will look similar to this:
If you then mark one log entry with data (here the last one) – just the GPS latitude and GPS longitude and copy & paste it to the Google search console, you’ll be able to see where you’ve been:
This project is easy, fun, and highly customizable to best suit your intended use for this GPS tracking device. It can be adapted for multiple applications where location tracking is required.
Using the BBC micro:bit, the Seluxit wappsto:bit boards and a bit of programming, you can now keep records of all the fantastic locations you, our family or friends have been to. Whether you’re walking, running or hiking, imagine how cool it would be to view the path you’ve made on a map!
Visit our BBC micro:bit shop for more exciting products for your next projects!
Visit our Projects Hub for more inspiring projects to try out next!
Link to the code as shown in step 6.
logInterval – Number, used to set the interval between Data Logger entries.
Count – number, used to count nr of data entries.
logInterval – number, used to set the time between log entries.
clearLog – empty the data storage.
userVariables – keeps the settings that the user can play with.
setup – keeps the things that need to be set up before running the program.
From a quick tap to smashing that love button and show how much you enjoyed this project.
Please select an option to see content specific to your location and shop online.