Problem during compilation with LoRa One GPS

Dear,

I just received my LoRa One beta card.

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”.

So I’m trying this code (founded at this URL : http://support.sodaq.com/loraone-gps/) :

#include “Sodaq_GPS.h”
Sodaq_gps gps;

void setup()
{
//Turn the GPS on
pinMode(GPS_ENABLE, OUTPUT);
digitalWrite(GPS_ENABLE, HIGH);

delay(500);

//Start the Serial and GPS
SerialUSB.begin(9600);
gps.begin();
}

void loop()
{
//Scan for satellites
gps.scan();

//Print latitude and longitude
SerialUSB.print(gps.lat(),6);
SerialUSB.print(",");
SerialUSB.println(gps.lng(),6);
SerialUSB.println();
}

And I receive this error message :

/Applications/Arduino-4.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware “/Applications/Arduino-4.app/Contents/Java/hardware” -hardware “/Users/Bernard/Library/Arduino15/packages” -tools “/Applications/Arduino-4.app/Contents/Java/tools-builder” -tools “/Applications/Arduino-4.app/Contents/Java/hardware/tools/avr” -tools “/Users/Bernard/Library/Arduino15/packages” -built-in-libraries “/Applications/Arduino-4.app/Contents/Java/libraries” -libraries “/Users/Bernard/Documents/Arduino/libraries” -fqbn=SODAQ:samd:sodaq_loraone_beta -vid-pid=0X2341_0X804D -ide-version=10609 -build-path “/var/folders/33/bww13rf526g81qbh47bx6x140000gn/T/build54f93fce29dcfa6dbd50a7a78c558ccb.tmp” -warnings=none -prefs=build.warn_data_percentage=75 -verbose “/Users/Bernard/Documents/Arduino/sketch_LoRa_Test2/sketch_LoRa_Test2.ino”
/Applications/Arduino-4.app/Contents/Java/arduino-builder -compile -logger=machine -hardware “/Applications/Arduino-4.app/Contents/Java/hardware” -hardware “/Users/Bernard/Library/Arduino15/packages” -tools “/Applications/Arduino-4.app/Contents/Java/tools-builder” -tools “/Applications/Arduino-4.app/Contents/Java/hardware/tools/avr” -tools “/Users/Bernard/Library/Arduino15/packages” -built-in-libraries “/Applications/Arduino-4.app/Contents/Java/libraries” -libraries “/Users/Bernard/Documents/Arduino/libraries” -fqbn=SODAQ:samd:sodaq_loraone_beta -vid-pid=0X2341_0X804D -ide-version=10609 -build-path “/var/folders/33/bww13rf526g81qbh47bx6x140000gn/T/build54f93fce29dcfa6dbd50a7a78c558ccb.tmp” -warnings=none -prefs=build.warn_data_percentage=75 -verbose “/Users/Bernard/Documents/Arduino/sketch_LoRa_Test2/sketch_LoRa_Test2.ino”
Warning: platform.txt from core ‘SODAQ SAMD (32-bits ARM Cortex-M0+) Boards’ contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} “{build.path}/{archive_file}” “{object_file}”, automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} “{archive_file_path}” “{object_file}”. Consider upgrading this core.
“/Users/Bernard/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++” -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10609 -DARDUINO_SODAQ_LORAONE -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON ‘-DUSB_MANUFACTURER=“SODAQ”’ ‘-DUSB_PRODUCT=“SODAQ LoRaONE”’ “-I/Users/Bernard/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/” “-I/Users/Bernard/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/” “-I/Users/Bernard/Library/Arduino15/packages/SODAQ/hardware/samd/1.6.8/cores/arduino” “-I/Users/Bernard/Library/Arduino15/packages/SODAQ/hardware/samd/1.6.8/variants/sodaq_loraone_beta” “/var/folders/33/bww13rf526g81qbh47bx6x140000gn/T/build54f93fce29dcfa6dbd50a7a78c558ccb.tmp/sketch/sketch_LoRa_Test2.ino.cpp” -o “/dev/null”
“/Users/Bernard/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++” -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10609 -DARDUINO_SODAQ_LORAONE -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON ‘-DUSB_MANUFACTURER=“SODAQ”’ ‘-DUSB_PRODUCT=“SODAQ LoRaONE”’ “-I/Users/Bernard/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/” “-I/Users/Bernard/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/” “-I/Users/Bernard/Library/Arduino15/packages/SODAQ/hardware/samd/1.6.8/cores/arduino” “-I/Users/Bernard/Library/Arduino15/packages/SODAQ/hardware/samd/1.6.8/variants/sodaq_loraone_beta” “-I/Users/Bernard/Documents/Arduino/libraries/Sodaq_RN2483/src” “/var/folders/33/bww13rf526g81qbh47bx6x140000gn/T/build54f93fce29dcfa6dbd50a7a78c558ccb.tmp/sketch/sketch_LoRa_Test2.ino.cpp” -o “/dev/null”
“/Users/Bernard/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++” -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10609 -DARDUINO_SODAQ_LORAONE -DARDUINO_ARCH_SAMD -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x804d -DUSBCON ‘-DUSB_MANUFACTURER=“SODAQ”’ ‘-DUSB_PRODUCT=“SODAQ LoRaONE”’ “-I/Users/Bernard/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/CMSIS/Include/” “-I/Users/Bernard/Library/Arduino15/packages/arduino/tools/CMSIS/4.0.0-atmel/Device/ATMEL/” “-I/Users/Bernard/Library/Arduino15/packages/SODAQ/hardware/samd/1.6.8/cores/arduino” “-I/Users/Bernard/Library/Arduino15/packages/SODAQ/hardware/samd/1.6.8/variants/sodaq_loraone_beta” “-I/Users/Bernard/Documents/Arduino/libraries/Sodaq_RN2483/src” “/var/folders/33/bww13rf526g81qbh47bx6x140000gn/T/build54f93fce29dcfa6dbd50a7a78c558ccb.tmp/sketch/sketch_LoRa_Test2.ino.cpp” -o “/var/folders/33/bww13rf526g81qbh47bx6x140000gn/T/build54f93fce29dcfa6dbd50a7a78c558ccb.tmp/preproc/ctags_target_for_gcc_minus_e.cpp”
/Users/Bernard/Documents/Arduino/sketch_LoRa_Test2/sketch_LoRa_Test2.ino:6:23: fatal error: Sodaq_GPS.h: No such file or directory
** #include “Sodaq_GPS.h”**
compilation terminated.

Please could you help me and give me the solution to find this library ?

Thanks to everybody.

I’m not sure where the original library was located, possibly it was renamed.

I believe this is the most up to date library:

There is an example included.

Hi,

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 ?

Thanks a lot.

Regards,

Bernard

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.

Thanks for your feedback.

But I already modify the library (Sodaq_UBlox_GPS…cpp) based on the information finded in it.

Here is a copy of this information :

/*!

  • Read the coordinates using $GPGGA
  • See also section 24.3 of u-blox 7, Receiver Description. Document number: GPS.G7-SW-12001-B
  • See section “Decode of selected position sentences” at
  • http://www.gpsinformation.org/dale/nmea.htm
  • The most important NMEA sentences include the GGA which provides the
  • current Fix data, the RMC which provides the minimum gps sentences
  • information, and the GSA which provides the Satellite status data.
  • 0 $GPGGA
  • 1 time hhmmss.ss UTC time
  • 2 lat ddmm.mmmmm Latitude (degrees & minutes)
  • 3 NS char North/South indicator
  • 4 long dddmm.mmmmm Longitude (degrees & minutes)
  • 5 EW char East/West indicator
  • 6 quality digit Quality indicator for position fix: 0 No Fix, 6 Estimated, 1 Auto GNSS, 2 Diff GNSS
  • 7 numSV num Number of satellites used
  • 8 HDOP num Horizontal Dilution of Precision
  • 9 alt num Altitude above mean sea level
  • 10 uAlt char Altitude units: meters
  • 11 sep num Geoid separation: difference between geoid and mean sea level
  • 12 uSep char Separation units: meters
  • 13 diffAge num Age of differential corrections
  • 14 diffStation num ID of station providing differential corrections
  • 15 checksum 2 hex digits
    */

So I just add this Line (into Sodaq_UBlox_GPS…cpp) to get ‘alt’ information :

    _alt = getField(line, 9).toFloat();

I also update the Sodaq_UBlox_GPS.h file with those lines :

double      _alt;
double getAlt() { return _alt; }

But the result of this function is always 0.00000

Any idea ? Perhaps the wrong field number (9) ?

Bernard

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().

Hi,

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.

Thanks again for your feedback.

Bernard

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.

sodaq_gps.setDiag(SerialUSB);

hi Bernard
could you publish your corrected code here?
that would help debugging the bad fix time caused by the tiny little antenna.
thanks, urs

Hi,

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());

The Sodaq card stay at the same place.

I hope it will help you.

Thanks for your help !

it would be helpfull for the full code. thanks :smiley:

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.

Hi Rrsm,

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 ?

Thanks.

Hi Guys,

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

 git clone https://github.com/SodaqMoja/Sodaq_UBlox_GPS

Then on compile,

sodaq_gps.init();
"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

#if defined (GPS_ENABLE)
void init(int8_t enable_pin = GPS_ENABLE);
#else
void init(int8_t enable_pin = -1); 
// Or void init(int8_t enable_pin = NOT_A_PIN); 
#endif

like this
sodaq_gps.init(); with no parameter will always compile (not saying works)