Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 17 of 17

Thread: uBlox Library

  1. #1
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    213

    uBlox Library

    For an introduction of me, you can find my recent post.

    I'd like to announce availability of a library for uBlox 7 and 8 series receivers. This library uses the UBX protocol and the UBX-NAV-PVT packet. You might ask, "Why UBX when plenty of NMEA parsers are available?". The short answer is that UBX is an efficient, binary protocol and the UBX-NAV-PVT packet provides much more data than is available via NMEA. The additional data include North, East, and Down (NED) velocities; estimates of accuracy for horizontal and vertical position and velocity; and position dilution of precision (pDOP). I hope this library is useful to others and I'd love any feedback or contributions.

    Best,
    Brian

  2. #2
    I'm interested in using a GPS receiver to provide an frequency reference at an arbitrary RF frequency in the range of 7 to 22 MHz. I know some of the uBlox products can do this, but I'm not sure if the series 7 & 8 have that capability. Do you plan on supporting this function?

    Thanks,
    Michael

  3. #3
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    213
    Hi Michael, it looks like a couple of the uBlox 7 and 8 series variants would support a pulse output. Are you looking to configure the pulse pin or to receive and parse a packet of the timing data? Right now the library is setup to only receive and parse the UBX packets with configuration done through the uBlox u-center software. I would like to add the ability to configure receivers through the library, but that is lower priority for me at the moment.

    Brian

  4. #4
    Brian,

    I'm interested in using a uBlox as the local oscillator for a very stable amateur radio transceiver. This would require configuring it to output an arbitrary and changeable frequency in the amateur bands. I already use the 1pps output for a similar function, but having a GPS chip output the target frequency directly is more desirable.

    Your library looks very useful. I hope you'll consider this frequency configuration function down the line.

    Best regards,
    Michael

  5. #5
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    213
    Hi Michael,

    Thanks for the additional information. That sounds really cool! I'll definitely keep your use case in mind when I get to adding configuration messages to the library.

    Brian

  6. #6
    Junior Member
    Join Date
    Jun 2016
    Posts
    1
    wow, good job Brian
    Thank you for share!

    Jaume

  7. #7
    Very nice!
    Created something like this myself for a Windsurf GPS project.
    For high speed logging we also use NAV-SAT and NAV-DOP

  8. #8
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    213
    Awesome! Are you coupling the pseudo ranges with an IMU (i.e. using an extended Kalman filter to get position, velocity, and orientation) or just computing location from the pseudo ranges?

    Our use case has been coupling the GPS data (position and speed at a rate of 1-10 Hz) with IMU data (linear acceleration and rotational velocity at a rate of 50 - 150 Hz) using a loosely coupled EKF to get the inertial position, velocity, and orientation. The advantage is that you get the full inertial solution at the rate that you run the EKF at, in this case 50 to 150 Hz, but its drift is limited by the lower rate GPS data. Some grad students have been working on using pseudo ranges to more tightly couple the EKF and potentially add RTK with a second GPS receiver. Can't wait to get the Teensy 3.5/3.6 to try running the EKF code on the Teensy! I tried this with the Teensy 3.2, but could only manage to compute the solutions at a rate of 20 Hz or so...

  9. #9
    I'm just computing speed and distance
    Here is my project : https://forum.pjrc.com/threads/36306...eed-GPS-logger

    I tried your code and it is really slow in my use case...
    Searched on the forum and found this : https://forum.pjrc.com/threads/31116...ghlight=double

    I prefer the double you are using instead of my single float, as i think the double offers a better accuracy when using lat/lon.
    But when driving around my hometown the 2 units I use for testing are not usable.
    It updates speed, but to slow, and distance is very erratic...

    When I use single float, the display can update 2 times a second without to much issue.

    Is the double really that slow or am I using it in the wrong way?

  10. #10
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    213
    I don't see a large computational difference in my uBlox library between double and float. The UBX-NAV-PVT packet is sent as longs for latitude, longitude, height, velocities, etc. Within the library, I take those longs and scale by 1E-7 (latitude and longitude) or 1E-3 (height and velocity). Using micros() to do some timing, I see about a 10 microsecond difference between using doubles and floats for computing latitude, longitude, height, and velocities.

    Incidentally, the difference in precision between using a float and a double in latitude / longitude would result in about a 2 foot error.

  11. #11
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    311
    Brian,

    Are there any other settings that need to changed on the NEO-7M in U-Center?
    Do all other Serial1 messages need to be turned off other than UBX-NAV-PVT?

    I am using a UBLOX NEO-7M on Teensy 3.1 Serial1 (RX=Pin 0, TX=Pin 1)

    I've turned on the UBX output and set the UART1 Baudrate to 115200.
    I have set these in the EEPROM so it powers on correctly.

    If I use my Teensy 3.1 as a serial pass through SERIAL1 <-> USB_Serial, I am able to see the UBX-NAV-PVT messages update from within U-Command.
    However, when I run the uBlox library (set to SERIAL1@115200) I do not get any output from the uBloxData routine.

    Here is my SERIAL1 <-> USB_SERIAL Passthrough code:
    Code:
    int BAUD = 115200;
    
    void setup() {
     
        Serial.begin(BAUD); 
        Serial1.begin(BAUD);
        delay(1000);
        Serial.print("Serial <=> Serial1 Passthru Ready at ");
        Serial.print(BAUD);
        Serial.println(" BAUD");
    }
    
    void loop() {
    
        // Send bytes from UBLOX -> Teensy to Computer
        if ( Serial1.available() ) {
             Serial.write( Serial1.read() );       
        }
    
        // Send bytes from Computer -> Teensy back to UBLOX
        if ( Serial.available() ) {
            Serial1.write( Serial.read() ); 
        }
    }
    Here is a screencapture of the UBX-NAV-PVT messages window from U-Center
    Click image for larger version. 

Name:	UBX_Messages.png 
Views:	69 
Size:	53.1 KB 
ID:	8012

    I wonder what I am doing wrong?
    Thanks -- Wozzy
    Last edited by Wozzy; 09-03-2016 at 11:37 PM.

  12. #12
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    311
    Here's a little more information:
    This is a chunk of output of the U-Control packet console:
    Code:
    21:56:23  R -> UBX 03-09,  Size 128,  'Unknown'
    21:56:23  R -> UBX 03-0A,  Size 1304,  'Unknown'
    21:56:25  R -> UBX NAV-SOL,  Size  60,  'Navigation Solution'
    21:56:24  R -> UBX NAV-PVT,  Size  92,  'Navigation PVT Solution'
    21:56:24  R -> UBX NAV-SVINFO,  Size 244,  'Satellite Status and Information'
    21:56:24  R -> UBX NAV-CLOCK,  Size  28,  'Clock Status'
    21:56:24  R -> UBX NAV-AOPSTATUS,  Size  28,  'AOP Status'
    21:56:24  R -> UBX 0C-31,  Size 640,  'Unknown'
    21:56:24  R -> UBX 0C-10,  Size 652,  'Unknown'
    21:56:24  R -> UBX MON,  Size 395,  'Monitor'
    21:56:24  R -> UBX MON-MSGPP,  Size 128,  'MSGPP Message Parse & Process'
    21:56:24  R -> UBX MON-IO,  Size 128,  'IO System'
    21:56:24  R -> UBX MON,  Size 336,  'Monitor'
    21:56:24  R -> UBX 03-09,  Size 128,  'Unknown'
    21:56:24  R -> UBX 03-0A,  Size 1304,  'Unknown'
    21:56:26  R -> UBX NAV-SOL,  Size  60,  'Navigation Solution'
    21:56:25  R -> UBX NAV-PVT,  Size  92,  'Navigation PVT Solution'
    21:56:25  R -> UBX NAV-SVINFO,  Size 244,  'Satellite Status and Information'
    21:56:25  R -> UBX NAV-CLOCK,  Size  28,  'Clock Status'
    21:56:25  R -> UBX NAV-AOPSTATUS,  Size  28,  'AOP Status'
    21:56:25  R -> UBX 0C-31,  Size 640,  'Unknown'
    21:56:25  R -> UBX 0C-10,  Size 652,  'Unknown'
    21:56:25  R -> UBX 03-0F,  Size  61,  'Unknown'
    21:56:25  R -> UBX 03-0F,  Size  61,  'Unknown'
    And here is what I believe is the UBX-NAV-PVT Block from the Binary Console:
    Code:
              04A0  00 00 00 00 00 00 00 C0 67 FF 00 00 00 00 00 00  .......g......
              04B0  00 00 00 00 00 00 00 00 00 11 11 00 00 00 00 02  ................
              04C0  00 00 00 00 FF FF 00 00 00 00 00 00 20 00 05 04  .......... ...
              04D0  00 03 01 00 00 00 BF 70                          ......p.
              
    22:00:05  0000  B5 62 01 06 34 00 08 F9 9E 23 07 67 04 00 78 07  b..4...#.g..x.
              0010  03 DD C7 12 5F 07 A0 CB BE E3 50 29 43 18 17 08  .._.*˾P)C...
              0020  00 00 02 00 00 00 F5 FF FF FF 04 00 00 00 1D 00  ............
              0030  00 00 23 02 03 06 84 D3 01 00 A7 18              ..#........
              
    22:00:04  0000  B5 62 01 07 54 00 08 F9 9E 23 E0 07 09 03 16 00  b..T...#.....
              0010  04 07 2D 00 00 00 05 67 04 00 03 01 0B 06 77 3A  ..-....g......w:
              0020  12 D3 A2 1B CA 17 21 F2 00 00 FB 78 01 00 6D 16  .Ӣ..!..x..m.
              0030  00 00 B9 4D 00 00 D7 FF FF FF F7 FF FF FF 97 FF  ..M...
              0040  FF FF 2A 00 00 00 5F 1E 44 01 20 01 00 00 D5 86  *..._.D. ....
              0050  54 00 23 02 43 18 84 D3 11 00 28 A7              T.#.C....(.
              
    22:00:04  0000  B5 62 01 30 E0 00 08 F9 9E 23 12 03 00 00 05 02  b.0...#......
              0010  0D 04 1D 24 72 00 C9 FE FF FF 00 05 0D 07 21 3B  ...$r.....!;
              0020  2C 00 91 FF FF FF 0E 07 04 04 0F 06 2A 00 00 00  ,........*...
              0030  00 00 02 0D 0D 07 24 3C 8C 00 CC FF FF FF 06 0F  ......$<....
              0040  0D 07 24 2A C1 00 4C FF FF FF 0F 12 04 01 00 06  ..$*.L......
              0050  00 01 00 00 00 00 03 14 0D 07 22 36 15 01 A9 00  .........."6...
              0060  00 00 0A 15 04 04 12 15 30 01 00 00 00 00 08 19  ........0.......
              0070  0C 01 00 01 EC 00 00 00 00 00 0D 1A 04 01 00 01  ...............
              0080  3D 01 00 00 00 00 01 1D 0D 07 1F 3B 06 01 06 01  =..........;....
              0090  00 00 0C 1E 04 04 15 0A 43 00 00 00 00 00 04 85  ........C.......
              00A0  14 01 00 24 D4 00 00 00 00 00 0B 87 14 01 00 10  ...$...........
              00B0  F8 00 00 00 00 00 07 8A 14 01 00 21 E0 00 00 00  ..........!...
              00C0  00 00 10 C1 10 01 00 A5 00 00 00 00 00 00 11 C4  .............
              00D0  10 01 00 A5 00 00 00 00 00 00 09 C5 10 01 00 A5  .............
              00E0  00 00 00 00 00 00 80 E2                          ........
              
    22:00:04  0000  B5 62 01 22 14 00 08 F9 9E 23 FA 4E 0E 00 D2 07  b."....#N...
              0010  00 00 2D 00 00 00 84 03 00 00 DC 04              ..-.........
              
    22:00:04  0000  B5 62 01 60 14 00 08 F9 9E 23 00 00 00 00 00 00  b.`....#......
              0010  00 00 00 00 00 00 00 00 00 00 37 FA              ..........7.
              
    22:00:04  0000  B5 62 0C 31 78 02 00 03 98 02 0A 58 04 00 0A 08  b.1x......X....
              0010  05 00 10 38 04 00 98 90 8A 0A 58 90 CA 05 98 91  ...8......X....
              0020  8A 14 D8 90 0A 02 F8 90 8A 19 48 91 0A 10 10 00  ........H.....
              0030  00 00 10 00 00 00 18 11 CA 13 10 00 00 00 38 91  .............8.
              0040  CA 12 68 90 4A 10 C8 90 4A 14 28 90 CA 05 D8 91  .h.J..J.(...

  13. #13
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    311
    I pulled a UBLOX NEO 8M out of another project and hooked it to my Teensy 3.6
    It is working with the uBlox Library.

    I discovered that the UBX NAV-PVT Packet Size = 100 bytes on the UBLOX NEO 8M,
    and is equal to 92 bytes on the UBLOX NEO 7M

  14. #14
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    213
    Hi Wozzy!

    Thanks so much for digging into this and sorry for the delay (some time in a cabin away from internet and work deadlines, somehow September flew by...). I'll try to see about making this more robust as I have time, probably using the message size field.

    Brian

  15. #15
    Member
    Join Date
    Oct 2017
    Location
    Houston
    Posts
    55
    Brian, I'm currently running an Adafruit GPS using the neoGPS library, but am thinking of getting a uBlox so I can try out your library and the UBX parsing and velocity measurement capability. I'm guessing I should get a UBLOX NEO 8M, but is there a particular variant you'd recommend? My ultimate goal is to (loosely or tightly) integrate it with an IMU and the Teensy 3.6. I'm testing out your 7-State uNavAHRS right now as well. Thanks! Don

  16. #16
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    213
    Quote Originally Posted by Don Kelly View Post
    Brian, I'm currently running an Adafruit GPS using the neoGPS library, but am thinking of getting a uBlox so I can try out your library and the UBX parsing and velocity measurement capability. I'm guessing I should get a UBLOX NEO 8M, but is there a particular variant you'd recommend? My ultimate goal is to (loosely or tightly) integrate it with an IMU and the Teensy 3.6. I'm testing out your 7-State uNavAHRS right now as well. Thanks! Don
    Hi Don,

    I'm currently using this one:
    https://hobbyking.com/en_us/ublox-mi...odule-1pc.html

    But I would recommend buying this:
    https://store.mrobotics.io/mRo-GPS-u...-gps003-mr.htm

    It includes a micro USB, which makes setting up the thing in uCenter much easier, plus it uses JST-GH connectors. The boards that I'm developing also use these connectors and they're quickly becoming standard in the drone and robotics space.

    Brian

  17. #17
    Member
    Join Date
    Oct 2017
    Location
    Houston
    Posts
    55
    Thx Brian!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •