I’m trying to compile your code but I receive an error message about “Sodaq_GPS.h” (not found)
I already follow all instructions in this page (http://support.sodaq.com/loraone-basic-sketches/)
I use the last version of your library (1.6.8)
The selected card (in Arduino software) is “SODAQ LoRaONE Beta”.
Thanks a lot for your help. It works with this library.
I just have a problem with the altitude.
I just add code to get it (based on information founded in the cpp file -> field 9 for altitude) but the result is always 0.00000
Any idea ?
It doesn’t seem like the altitude field of the $GPGGA sentence is being parsed at the moment. So at the moment it is not possible to read that value using the current library.
If you are getting valid values for the other fields (lat, long and time) then I believe the issue is caused by an early exit.
The $GPRMC sentence also contains the lat, long and time values. If the scan() method sees that sentence first, then based on the default settings, it will exit at that point.
Try increasing the minimum number of valid lines it has to receive before exiting. This can be done with setMinNumOfLines().
Thanks for your idea ! It seems correct now.
I will continue investigation to have better stability. I receive an altitude with a difference of around 30 meters between 2 scans. So it’s strange. I will continue my investigations to be sure the received value is the altitude.
You could try increasing the number of minimum lines to a high number and the enabling the debug output to see the raw sentences. This should help you see if the altitude value is stable.
Here is my result :
SODAQ LoRaONE test_gps is starting …
delay … 0ms
waiting for fix …, timeout=900000ms
time to find fix: 6708ms
datetime = 20160621071821
lat = 50.6087728
lon = 5.1757167 alt = 124.60
num sats = 5
delay … 1000ms
waiting for fix …, timeout=900000ms
time to find fix: 7998ms
datetime = 20160621071829
lat = 50.6088053
lon = 5.1757050 alt = 140.70
num sats = 5
delay … 1000ms
waiting for fix …, timeout=900000ms
time to find fix: 8596ms
datetime = 20160621071838
lat = 50.6090007
lon = 5.1750036 alt = 66.20
num sats = 5
delay … 1000ms
waiting for fix …, timeout=900000ms
time to find fix: 5595ms
datetime = 20160621071844
lat = 50.6088623
lon = 5.1754166 alt = 101.90
num sats = 5
delay … 1000ms
waiting for fix …, timeout=900000ms
time to find fix: 5593ms
datetime = 20160621071850
lat = 50.6088135
lon = 5.1754450 alt = 100.00
num sats = 5
delay … 1000ms
waiting for fix …, timeout=900000ms
Here are the added lines :
Into parseGPGGA function (into Sodaq_UBlox_GPS.cpp file) Adding :
_alt = getField(line, 9).toFloat();
Into Sodaq_UBlox_GPS function (into Sodaq_UBlox_GPS.cpp file) Update of the value :
_minNumOfLines = 3; // Instead of _minNumOfLines = 0;
Into public section of the Sodaq_UBlox_GPS.h file Adding :
String getAlt() { return _alt; }
Into private section of the Sodaq_UBlox_GPS.h file Adding :
String _alt;
Into the loop function of the Arduino code :
MySerial.println(String(" alt = ") + sodaq_gps.getAlt());
Could you try increasing the number of lines seen which are required before it returns a location fix. I’m curious to see if the reading settles down.
Every GPS lock will have a certain about of precision. The figure given is known as the Dilution Of Precision, details of which can be found in the $GPGSA sentence. This is not exactly an error figure, but it describes a probability distribution not too dissimilar to the standard deviation.
I’ve tried to send you the code (response to your email) but not possible. I receive an error message.
Please could you provide me another email address ?
I’m sorry but example in this lib does not compile on my side, I’ve got Arduino 1.6.11 with sodaq board installed of course, then I did (from my libraries folder) go get the library
"C:\Users\Charles\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=48000000L -DARDUINO=10611 -DARDUINO_SODAQ_ONE -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON '-DUSB_MANUFACTURER="SODAQ"' '-DUSB_PRODUCT="SODAQ ONE"' "-IC:\Users\Charles\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel/CMSIS/Include/" "-IC:\Users\Charles\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.0.0-atmel/Device/ATMEL/" "-IS:\Skydrive\devt\Arduino\hardware\Sodaq\samd\cores\arduino" "-IS:\Skydrive\devt\Arduino\hardware\Sodaq\samd\variants\sodaq_one" "-IS:\Skydrive\devt\Arduino\libraries\Sodaq_UBlox_GPS\src" "-IS:\Skydrive\devt\Arduino\hardware\Sodaq\samd\libraries\Wire" "C:\Users\Charles\AppData\Local\Temp\build2a656f79219c460f11619f525a39cc02.tmp\sketch\test_ublox_gps.ino.cpp" -o "C:\Users\Charles\AppData\Local\Temp\build2a656f79219c460f11619f525a39cc02.tmp\sketch\test_ublox_gps.ino.cpp.o"
S:\Skydrive\devt\Arduino\libraries\Sodaq_UBlox_GPS\examples\test_ublox_gps\test_ublox_gps.ino: In function 'void setup()':
test_ublox_gps:62: error: no matching function for call to 'Sodaq_UBlox_GPS::init()'
sodaq_gps.init();
^
S:\Skydrive\devt\Arduino\libraries\Sodaq_UBlox_GPS\examples\test_ublox_gps\test_ublox_gps.ino:62:20: note: candidate is:
In file included from S:\Skydrive\devt\Arduino\libraries\Sodaq_UBlox_GPS\examples\test_ublox_gps\test_ublox_gps.ino:2:0:
S:\Skydrive\devt\Arduino\libraries\Sodaq_UBlox_GPS\src/Sodaq_UBlox_GPS.h:31:10: note: void Sodaq_UBlox_GPS::init(int8_t)
void init(int8_t enable_pin);
^
S:\Skydrive\devt\Arduino\libraries\Sodaq_UBlox_GPS\src/Sodaq_UBlox_GPS.h:31:10: note: candidate expects 1 argument, 0 provided
Using library Sodaq_UBlox_GPS at version 0.9.1 in folder: S:\Skydrive\devt\Arduino\libraries\Sodaq_UBlox_GPS
Using library Wire at version 1.0 in folder: S:\Skydrive\devt\Arduino\hardware\Sodaq\samd\libraries\Wire
exit status 1
no matching function for call to 'Sodaq_UBlox_GPS::init()'
```
The error is coming from init() method that MUST have the GPS enable pin in parameter so I needed to replace by
```
sodaq_gps.init(GPS_ENABLE);
```
to be able to compile, so a fix could be changing in `Sodaq_UBlox_GPS;h`
```
void init(int8_t enable_pin);
```
by
```
void init(int8_t enable_pin = GPS_ENABLE);
```
The GPS_ENABLE definition is specific to the SodaqONE, the library is not tied to a specific board.
You can pass -1 if the switching mechanism is not required. However, it is required that you pass GPS_ENABLE when using the library with the SodaqONE.
I believe a better fix would be to update the example to pass GPS_ENABLE. However, the example would then only compile for the SodaqONE board. Perhaps the example could include a conditional block around the intialisation call, which detects if the code is being compiled for the SodaqONE.
Good catch, but in all ways init() need a parameter and example won’t compile with any board, may be -1 is correct and in this case the library code could be