Table of Contents:
The SN01 xChip is a GPS sensor that is packed with features:
- It reports on latitude and longitude.
- It reports real time and today's date.
- It reports altitude
- It estimates the speed at which it is travelling.
- It even provides a measure of its own accuracy - the HDOP (Horizontal Dilution Of Precision) gives an indication of the margin of error of the GPS coordinates that it reports on.
- The SN01 receives data from GPS satellites.
- These satellites constantly send out signals which includes data on their position and the current time.
- The SN01 uses this data to build an 'almanac', which is a table of data about the positions of the satellites that it can receive data from.
- The time it takes for the SN01 (or any GPS device) to build this almanac and start reporting GPS coordinates is called the TTFF.
- The TTFF (Time To First Fix) can be as much as 12.5 minutes. In testing it is common to get a TTFF of less than 2 minutes.
Ensure that you use the SN01 outside and away from overhead obstructions.
- It is essential that the SN01 has 'line of sight' to at least 3 satellites to ensure that it can fix your position.
To write code that uses the SN01 in MakeCode you will need to load the SN01 extension:
- Open MakeCode and start a new project
- Click on Advanced / Extensions
- Type in XinaBox/pxt-SN01
- Click on search
- Select the SN01 tile
After a few moments the extension should load and you will see a new tab in the left hand menu titled SN01.
Given that the SN01 is so versatile we ideally need to write lots of different Hello World! programs to showcase all the functionality.
The code below shows you how to use the get time function:
- The code above is a complete program. Load it onto your micro:bit and after a little while the time will begin to scroll on your micro:bit LEDs.
- It will take a little while for the SN01 to begin to receive data from any satellites that are in range. It may take a couple of minutes for the correct time to begin to scroll.
- Connecting it up
- Getting to know GPS on the micro:bit
- Loading the extension and Hello World!
- Overview of functionality
- SN01 functionality / MakeCode blocks (3 pages)
- Sample code (logging GPS data to csv file)
- [click here to download all how-to guides in a single PDF]
Use the SN01 in conjunction with the IM01 to build a simple data logger that will store real time, latitude and longitude on a microSD card in csv format.
- Find a microSD card and format it as FAT32
- Insert the microSD card into the slot on the IM01
- Ensure that the IM01 extension is loaded into MakeCode
- Enter the code below:
Flash a micro:bit with this code then take it with you on a walk or a jog. As long as the SN01 can 'see' enough satellites it will record your route.
The data file that is stored on the microSD card will look like this:
Click here to open the project in the MakeCode preview window.