The jac:stack
An Addon for the Micro:bit
This is the second iteration of an idea to present GPS support to the Micro:bit, but rather than the previous version which was more of a dedicated GPS logger board, this one presents the much more flexible Jacdac interface to two ports for screw terminals, or one wire-to-board connection on the right.
Jacdac Support
Jacdac is both an electrical and protocol specification for connecting devices to sensors with as low friction as possible. This is achieved by way of a 3-pin interface (ground is duplicated to make a 4-standoff variant for bolted-on modules) that can be driven with a slightly modified UART in half-duplex mode, and a software stack able to automatically identify connected devices and present a common interface up to higher-level code. The upshot of this complexity is a kind of microcontroller USB.
Jacdac is developed by Microsoft Research, and the pages for which can be found at the project website over on github.io.
I elected to support this protocol here as it opens up a wide range of sensors already developed, and vastly increases the flexibility of the Micro:bit as a sensor platform.
Adafruit “Ultimate GPS” Support
Having had no luck whatsoever with GPS modules on the previous design, I chose to pick as close to a ‘fully integrated’ module as I could, and costs therein be damned. Consequently, this board uses the Adafruit Ultimate GPS Module; a reasonably small, but very capable module that should just workTM.
The module boasts quite the set of features (list taken from the Adafruit product page):
- -165 dBm sensitivity, 10 Hz updates, 66 channels
- Ultra low power usage: 20mA current draw while tracking
- 3.3V operation,
- RTC battery-compatible
- Built-in datalogging
- PPS output on fix
- We have received reports that it works up to ~32Km altitude (the GPS theoretically does not have a limit until 40Km)
- Internal patch antenna + connection for optional external active antenna
- Fix status output
- Ultra small size: only 16mm x 16mm x 5mm and 4 grams
But what was most interesting to me in this case was the inclusion of both UART and I2C peripheral pins; and as the Clip:bit input board exclusively uses I2C to not content with any other peripherals, perhaps I could wrangle this module into working without using any more pins on the Micro:bit, freeing them for other, more fun stuff.
Unfortunately, the default firmware seems to have no way to set the module to send data over I2C, so instead I had to fall back to using P0 for serial data. Thankfully for the work I’m doing with this module we aren’t using anything connected to P0, so this proved to not be a major issue.
NMEA Data
With the hardware completed, I also needed to write software for the Micro:bit and Makecode which would present the positional and time data to the user without having to deal with raw NMEA strings.
To this end, I produced a set of blocks for Makecode which let users simply pull in a latitude
or longitude
block to get their location.
GPS Logging
Throwing this new extension in with the Micro:bit v2 Data Logger extension provides all the tools to do some basic GPS path logging, with the device periodically sampling its location and writing that to flash (along with any relevant sensor data). Further augmenting the functionality with the addition of the Clip:bit gives a powerful survey platorm that can both log
https://github.com/JohnVidler/pxt-jac-stack
https://github.com/JohnVidler/pxt-mock-gps