Change sampling frequency of GPS

Hello Marco!

Ublox receiver has a lot of different settings, message rate included.
If you want to change something about the receiver using Python, all you need to do is send the correct configuration message. For example:

def enable_posllh(self):
      msg = [0xb5, 0x62, 0x06, 0x01, 0x03, 0x00, 0x01, 0x02, 0x01, 0x0e, 0x47]
      self.bus.xfer2(msg)

This function makes the receiver send the NAV_POSLLH message. As you can see the function only does two things: prepares a message in hex and then sends it using SPI.

Same is with the output rate, only this time you need a different configuration message. The best way to get this messages in hex is to use u-center. If you look through a message view, UBX->CFG->RATE will be what you are looking for:

Here you can change the measurement period(I changed from 1000ms to 100ms) and then copy the configuration message down below, starting from B5.

Here’s another python function, based on this message, that changes the rate to 10 Hz.

def ubx_change_rate(self):
      msg = [0xb5, 0x62, 0x06, 0x08, 0x06, 0x00, 0x64, 0x00, 0x01, 0x00, 0x01, 0x00, 0x7A, 0x12]
      self.bus.xfer2(msg)

You can add this method to the U_blox class if you want to try it out(don’t forget to call it in the main though).

Just like this you can configure most of the u-blox settings. Feel free to ask any questions.

1 Like