Hi! I’m following this guide to add an external GPS module to Blues board so that I can run cellular and gps both in continuous mode. Attached is my code.
port = I2C("/dev/i2c-1")
card = notecard.OpenI2C(port, 0, 0, debug=True)
print("Connected to Notecard...")
req = {"req": "hub.status"}
while True:
rsp = card.Transaction(req)
if rsp.get("connected"):
break
time.sleep(1)
req = {"req": "card.aux.serial"}
req["mode"] = "gps"
card.Transaction(req)
req = {"req": "card.location.mode"}
req["mode"] = "continuous"
card.Transaction(req)
req = {"req": "hub.set"}
req["product"] = productUID
req["mode"] = "continuous"
req["outbound"] = 30
req["inbound"] = 240
card.Transaction(req)
req = {"req":"hub.sync"}
card.Transaction(req)
req = {"req": "card.location"}
card.Transaction(req)
req = {
"req": "note.add",
"file": "test.qo",
"body": { "test": 1 },
"sync": True
}
card.Transaction(req)
I’m using Sparkfun GPS Dead reckoning ZED-F9R as the external GPS module. The GEO led is steady blue, and the PPS led blinks at a fixed rate, which I believe means that the GPS module is able to find a satellite. But I always receive the following response:
{"req":"card.location","crc":"0005:f0ae3444"}
{'stop': True, 'status': 'GPS waiting to start {gps-starting} {gps-active}', 'mode': 'continuous', 'lat': 40.453967499999976, 'lon': -79.93564453124998, 'dop': 20, 'time': 1743021476, 'crc': '0005:3AA0C0FE'}
Do I need to switch the GPS and Serial dip switch to on if I’m using external GPS module?
Hey @vickylry,
You can find details on what those DIP switches do here: Notecarrier Datasheet - Notecarrier Pi v2.0 - Blues Developers.
In short:
-
The ACTIVE GPS
switch controls whether the board should supply power to an active GPS antenna. Per your image it looks like you have a passive antenna, so you should leave this switch OFF
.
-
The SERIAL TXRX
switch controls whether to expose the Notecard’s AUX_RX
and AUX_TX
pins via the Pi’s GPIOs 14 and 15 (Pins 8 and 10). In order for a Notecard to work with an external GPS you need to connect to those pins, so you do need to set this switch to ON
.
One thing to note: you’ll want to make sure you’re using a UART connection between your GPS module and the Notecard with this approach. I’ve been looking over the documentation for the SparkFun GPS-RTK Dead Reckoning and it does talk about SPI as well as UART, so there might be something you have to configure on the GPS board to get the right interface in place.
If you’re still having issues you do have another option. Both the SparkFun board and the Notecarrier Pi have Qwiic ports, so you could connect the two over I2C with a simple Qwiic cable. I’d only go down this route though if you can’t get UART to work though. With an I2C connection the Notecard won’t automatically get a location and associate it with all new Notes. Instead, you’ll have to use your Pi to manually gather the location from the external GPS over I2C, and then include that location in the body of your Notes. It should work, but it’ll be more of a hassle in your firmware.
Let me know how it goes. I haven’t tried to connect an external GPS to a Pi hat myself, so if there are any oddities here I’ll want to make sure to get our documentation updated.
Thanks,
TJ
2 Likes
I ended up using usb cable to connect the gps and RPI to make it work, thanks for the help!
3 Likes