Sony’s Spresense board sports many powerful features; one of them is GNSS connectivity, which provides precise satellite-fed data on the current position on the board, along with other useful information (for example, the current time).

Zerynth offers an example that can get you started with Spresense’s GNSS functionality in seconds in a few lines of Python code.

If you haven’t done that already, make sure to connect, register and virtualize your board with Zerynth Studio. You can find more info on how to get started with Spresense and Zerynth in this tutorial.

Then just clone the “GNSSData” example from Zerynth’s Example Library, connect the board to your computer, and uplink the program to the board. You can find more info about the library of this driver in the official documentation.

After opening the Serial Monitor in Zerynth Studio, you should see the value acquired from the satellites:

Here is the example’s code:

Copy to Clipboard

Of course, this is just the start: you can use the data collected by the board to power an application that performs live tracking on a map!

Let’s do that with Jupyter.

First of all, we need to install Jupyter, along with gmaps and PySerial:

Copy to Clipboard

Once that’s done, we can uplink the following firmware to the Sony Spresense board:

Copy to Clipboard
And then, by running the following Jupyter notebook, we can see the position of the Spresense on a map in real-time:
Copy to Clipboard

To generate a Google Cloud API key follow this tutorial.

You can change the values of the center and the zoom level to customize the display of the map:

Copy to Clipboard

For this second script you will need to ensure that the path to the serial device is the right one; in our case, it’s /dev/tty.SLAB_USBtoUART.

Copy to Clipboard

This is what that looks like:

Note that you might have to wait a bit for the Spresense to acquire enough satellite signals for it to be able to display the right position.

Here are some general things to be aware of when testing your GNSS application:

  • The receiver needs to find at least four satellites to be able to determine its position.
  • Make sure you have a clear sky. The receiver will have a hard time finding a satellite if there is something blocking the way, such as a roof.
  • Try to avoid obstructions around you. Satellites may be positioned low towards the horizon and e.g. buildings with lots of concrete, metal girders etc could block them from the receiver.
  • Depending on the conditions and the state of the device it might take minutes to get a fix, so please be patient.

If you want to add more sensors to the mix, you can add the data you want to show to the Python dictionary that the Sony Spresense board sends over the serial connection, and then visualize it with Jupyter.

Share This Story, Choose Your Platform!

About the Author: Lana Vukovic

Lana Vukovic
Lana is a Classics graduate who got bored of ancient Greek and Roman texts and got into new technology instead.

Follow Zerynth on

Latest Posts