I2C struggle when transmitting data using Notecarrier F 1.3 with wifi+cell notecard

Hello,

I am reaching out because I have built a system using a Notecarrier F and it is not performing as expected. I have connected several sensors to the Notecarrier using its QWIIC connection port. The sensors are plugged into an I2C bus which is plugged into the Notecarriers QWIIC port. In my.The Notecarrier + ESP32 Feather poll the sensors and then transmit the data using the notecard.

This has worked until recently, I added a new I2C GNSS module (SparkFun GNSS Receiver Breakout - MAX-M10S). The system can polls all of the sensors at about 1Hz until I start transmitting data from the Notecarrier. Specifically, the GNSS module struggles to update its coordinates while I am transmitting data with the Notecarrier. It repeats the same coordinates until the data transmission to the Blues IoT Cloud from the Notecarrier stops.

I originally setup the notecard with:

’ {

J \*req = notecard.newRequest("hub.set");

if (req != NULL) {

JAddStringToObject(req, “product”, productUID);

JAddStringToObject(req, “mode”, “continuous”);

NoteRequest(req);

}

}’

I transmit data in my main loop with:

’ J *req = notecard.newRequest(“note.add”);

if (req == NULL) {

error += "Failed to create note.add; ";

return;

}

JAddBoolToObject(req, “sync”, true);

J *body = JCreateObject();

if (body) {

JAddNumberToObject(body, “temperature”, temperature);

JAddNumberToObject(body, “conductivity”, conductivity);

JAddNumberToObject(body, “salinity”, salinity);

JAddNumberToObject(body, “pressure”, pressure);

JAddNumberToObject(body, “altitude”, altitude);

JAddNumberToObject(body, “longitude”, lon);

JAddNumberToObject(body, “latitude”, lat);

JAddNumberToObject(body, “tempPress”, tempPress);

JAddNumberToObject(body, “depth”, depthMeters);

JAddNumberToObject(body, “depthConfidence”, pingConfidence);

JAddStringToObject(body, “Timestamp”, timestamp.c_str());

JAddStringToObject(body, “deviceType”, deviceType);

JAddStringToObject(body, “waterState”, deviceType);

JAddStringToObject(body, “error”, error.c_str());

JAddItemToObject(req, “body”, body);

}

NoteRequest(req);

}’

Would someone be able to help me troubleshoot this problem? Thank you for all of your help!

Hi @antiexpert,

Using an external GPS with a Notecard is only supported via AUX UART. So unplug it from the Notecarrier’s QWIIC port and wire it instead to TX/RX according to our instructions in this blog post: Using an External GPS/GNSS Module with the Notecard.

Thanks,
Rob

Hi Rob,

I appreciate the quick response. The main reason why I am choosing to use an external GPS module rather than the native GPS support on the notecard is because I found the Notecard GPS update rate to be somewhere around 1 update a minute and I had this rate confirmed with the Blues support team. My external module on the other hand is capable of providing a fresh GPS point once every second

To your knowledge, should connecting to the the Notecarrier have any effect on the GPS update rate? Also, the AUX UART is a separate connection than the if I were to use the F_TX and F_RX pints right? Is there any additional setup needed to use the AUX UART pins (i.e. one of the switches on the back of the notecarrier)?

I will try to answer these questions myself in the time being but if you can still provide your knowledge it would be super helpful!

Thanks,
Will

I would also be curious to know why a GPS module does not work over I2C? I thought it would appear like a blackbox simply providing values over the I2C line but for what reason do GPS modules specifically not work with the notecarrier over I2C?

Apologies for the spam, but just to add onto my question regarding the GPS update rate: I found this in the guide you shared in the list of commands for using and external GPS

This this “seconds” parameter what defines the rate of GPS update? If so, is it possible to have this as often as 1 second (so “seconds”: 1)

Update: I am am attemping to use the external GPS connected over the AUX UART pins. The AUX switch underneath the notecarrier is switched to normal to allow the AUX pins to be used. This is my code:

#include <Arduino.h>

#include <Wire.h>

#include <Notecard.h>

Notecard notecard;

void sendSetupRequests()

{

// {“req”:“hub.set”,“mode”:“continuous”,“outbound”:1,“inbound”:240}

J *req = NoteNewRequest(“hub.set”);

if (req != nullptr) {

JAddStringToObject(req, “mode”, “continuous”);

JAddNumberToObject(req, “outbound”, 1);

JAddNumberToObject(req, “inbound”, 240);

if (!NoteRequest(req)) {

Serial.println(“hub.set failed”);

}

}

// {“req”:“card.aux.serial”,“mode”:“gps”}

req = NoteNewRequest(“card.aux.serial”);

if (req != nullptr) {

JAddStringToObject(req, “mode”, “gps”);

if (!NoteRequest(req)) {

Serial.println(“card.aux.serial failed”);

}

}

// {“req”:“card.location.mode”,“mode”:“periodic”,“seconds”:1}

req = NoteNewRequest(“card.location.mode”);

if (req != nullptr) {

JAddStringToObject(req, “mode”, “periodic”);

JAddNumberToObject(req, “seconds”, 1);

if (!NoteRequest(req)) {

Serial.println(“card.location.mode failed”);

}

}

// {“req”:“card.location.track”,“start”:true}

req = NoteNewRequest(“card.location.track”);

if (req != nullptr) {

JAddBoolToObject(req, “start”, true);

if (!NoteRequest(req)) {

Serial.println(“card.location.track failed”);

}

}

}

void printLocation()

{

J *req = NoteNewRequest(“card.location”);

if (req == nullptr) {

Serial.println(“Failed to create card.location request”);

return;

}

J *rsp = NoteRequestResponse(req);

if (rsp == nullptr) {

Serial.println(“card.location request failed”);

return;

}

double latitude = JGetNumber(rsp, “lat”);

double longitude = JGetNumber(rsp, “lon”);

int locationTime = JGetInt(rsp, “time”);

const char *status = JGetString(rsp, “status”);

Serial.print("Latitude: ");

Serial.println(latitude, 7);

Serial.print("Longitude: ");

Serial.println(longitude, 7);

Serial.print("Time: ");

Serial.println(locationTime);

Serial.print("Status: ");

Serial.println(

status != nullptr && strlen(status) > 0

  ? status

  : "(no status)"

);

Serial.println();

NoteDeleteResponse(rsp);

}

void setup()

{

Serial.begin(115200);

delay(2000);

Serial.println(“Starting Notecard external GPS test”);

Wire.begin();

Wire.setClock(100000);

notecard.begin();

// Uncomment to display raw Notecard requests and responses.

// notecard.setDebugOutputStream(Serial);

sendSetupRequests();

Serial.println(“Setup complete”);

Serial.println();

}

void loop()

{

printLocation();

delay(1000);

}

I get the following result repeatedly:

Latitude: 49.2616725

Longitude: -123.2471680

Time: 1780075552

Status: GPS waiting to start {gps-starting} {gps-active}

The GPS has not updated but the module is connected to a working antenna and is blinking. I am assuming this GPS coordinate it gives me was just the last GPS coordinate the system had and was not actually data from the GPS module. Everything is wired correctly. Any ideas why I would not be getting any update?

Hey @antiexpert,

To answer a few of your questions.

This this “seconds” parameter what defines the rate of GPS update? If so, is it possible to have this as often as 1 second (so “seconds”: 1)

In periodic mode, seconds does determine the interval Notecard uses to retrieve a new location.

However, for your situation though I would instead use {"req":"card.location.mode","mode":"continuous"}, which tells the Notecard to keep the GPS/GNSS module powered on and sampling constantly, rather than turning it on only at intervals.

I would also be curious to know why a GPS module does not work over I2C? I thought it would appear like a blackbox simply providing values over the I2C line but for what reason do GPS modules specifically not work with the notecarrier over I2C?

That’s just how the Notecard firmware works. It ingests external GPS data by reading NMEA sentences over its AUX serial (UART) pins.

And when I ran your problem by AI it had a suggestion for why you might not be seeing location data.

In AUX GPS mode the Notecard reads NMEA at 9600 baud by default. However, looking at the docs for the SparkFun board it looks like it’s set to use 38400 baud. You could try including a rate on your card.aux.serial request to see if the mismatched baud rate is the problem: {"req":"card.aux.serial","mode":"gps","rate":38400}.

I’d also recommend testing this outdoors, if possible, just to make sure your module has a clear view of the sky.

Give that a shot and let us know if you’re still not seeing location data.

TJ

Hi TJ,

Thank you for getting back to me. I should have mentioned I switched to a different GPS module now that uses UART which had a baud rate of 9600. I was testing outdoors and the GPS worked when simply connected to the ESP32.

Since the GPS is connected to ground and power as indicated by the blinking LED, it seems most likely that when doing

J *req = NoteNewRequest(“card.location”);
NoteRequest(req);"

Nothing is happening on AUX_TX or AUX_RX. I would love to know if you can provide any more knowledge on the specs of using an external GPS. Can the notecarrier handle 1s updates or perhaps that was too fast for it hence it not updating. The instructions are unclear as well as to if the AUX switch which controls the AUX pins on the board should be in DFU (default) position or Normal. From the documentation I have been able to find it seems like Normal is more appropriate but if you could clarify that would be appreciated.

Thank you for all of your help! Any other ideas are welcome.

Best,

Will

Hi Will,

Ok good to know that you have this working on an MCU.

I would love to know if you can provide any more knowledge on the specs of using an external GPS. Can the notecarrier handle 1s updates or perhaps that was too fast for it hence it not updating.

In continuous GPS mode Notecard updates its location from the external GPS every ~5 seconds. We throttle updates to every 5 seconds because we write the retrieved location to flash, and we don’t want to hammer that.

The instructions are unclear as well as to if the AUX switch which controls the AUX pins on the board should be in DFU (default) position or Normal. From the documentation I have been able to find it seems like Normal is more appropriate but if you could clarify that would be appreciated.

Normal is what you want. The DFU position is for using the AUX pins for Notecard Outboard Firmware Update.

I just connected a Notecard Cell+WiFi, Notecarrier F, and an Adafruit external GPS to test this to make sure everything worked with the latest firmware. I first ran these commands in the In-Browser Terminal:

{"req":"card.aux.serial","mode":"gps"}
{"req":"card.location.mode","mode":"continuous"}
trace +gps

And then I started spamming card.location until I started seeing updates.

{"req":"card.location"}

I would try running these in the Terminal and see if you see a location, or any helpful log/debug messages, and we can go from there.

TJ