GNSS module: Lat/lon readings always 0.0

Dear all,
I looked at the forum, found an old thread that never was answered, so I start this new one.

I have managed to get sensor readings from the other sensors, but not the GNSS module. I do not know whether the problem is the script (see below) or the module itself. I have put the module under open sky for half an hour. My cheap smartphone had a fix in seconds, because there were plenty of satellites from all systems with good signal strength (using GPS Test app to check).
Does the script look okay, and is thus perhaps the GNSS module not working?
Is there a way (method call) to check how many satellites the module is “seeing”?

I searched the net using the module’s specific name but couldn’t find anything. Thanks a lot!
Frank.
PS: I am a German native speaker, so you can answer in German if you prefer.
PPS: The short script:

#include “SenseBoxMCU.h”
HDC1080 hdc;
float temp;
GPS gps;
float lat; // Geografische Breite
float lon; // Geografische Länge

void setup() {
// put your setup code here, to run once:
hdc.begin();
gps.begin();
}

void loop() {
// put your main code here, to run repeatedly:
lat = gps.getLatitude();
lon = gps.getLongitude();
temp = hdc.getTemperature();
Serial.println(temp);
Serial.println(lon);
Serial.println(lat);
delay(1000);
}

Hi @Frank,

I don’t have a testing module here right now but the problem could be the delay(1000) at the end of your code. The delay blocks the execution of further code. Therefore, the GPS library can’t encode new GPS readings at this time. You could try to use the Measuring interval Block in Blockly or just omit the delay for now. Let me know if something like this worked for you!

1 Like

Hi @Felix,

it works, thanks a lot! I now get sensible coordinate readings. I added the delay(1000) statement only for improving the output on the serial monitor. I thought that the GNSS module would calculate the position independently of the MCU.

Follow-up question (always!): I have fully functioning sketches (generated by OSeM) for both LoRa and Wifi. Where should I look for documentation on how to add the coordinates to the transmission?

I have not been able to find a good example that I could modify with my settings, or detailed instructions on how to add coordinates to measurements sent to OSeM. The module’s documentation on https://sensebox.github.io/books-v2/home/de/komponenten/zubehoer/gps.html mentions the uploadMobileMeasurement method from the SenseBoxMCU-Lib, but both sketches use other libraries and methods.

Cheers,

Frank

The function uploadMobileMeasurement from Blockly is not used in the generated sketches, as this function can only upload a single measurement at a time. The generated sketches collect sensor readings and uploads them all at one time.
Regarding LoRa you may want to take a look at this project: https://github.com/sensebox/mobile-sensebox/tree/master/lora-gps. You can add coordinates to a measurement like here.
Regarding WiFi take a look here: https://github.com/sensebox/mobile-sensebox/tree/master/wifi-gps. The code should work but you will need to change it according to your setup.

Let me know if there are any occuring problems