Programatically configure ZED F9R Pi Hat

Hello everyone.

I’m using ZED F9R Raspberry pi hat in my RTK setup. Using Raspberry Pi 5. Everything works fine in terms of base/rover system, but i’m having a hard time configuring the ZED-F9R board programatically. When i do it from U-Center it works great, but for some reason I’m unable to find good information on how to configure it programatically. What i want to change are baud rate and CFG-RATE-MEAS settings. I want to change rate to 5 Hz and increase baud rate to support a lot of data which 5 Hz rate will produce, but I’m not able to do so.

Can someone point me toward some good resource or example of how to do this?

We have a python library for it here and example5 looks like what you’re after Qwiic_Ublox_Gps_Py/examples at master · sparkfun/Qwiic_Ublox_Gps_Py · GitHub

1 Like

Thank you TS-Russell, I will give it a try. I appreciate your help.

1 Like

Just a quick note about the example on GitHub. It seems to use a wrong method in there, and it threw me off at first, but I was able to find the proper method that can help set CFG-RATE on ZED F9R. Here is my simple code that can set CFG-RATE to 200 ms to all layers:

import serial
from ublox_gps import UbloxGps
from time import sleep

port = serial.Serial('/dev/ttyAMA0', 230400, timeout=1)
gps = UbloxGps(port)

def run():
    try:
        print("Setting UBX Rate to 200 ms (5 Hz)")
        rate_bytes = (200).to_bytes(2, byteorder='little')  # 2-byte little endian
        gps.ubx_set_val(0x30210001, rate_bytes, layer=0)
        sleep(0.5)  # Allow some time for the setting to take effect
        gps.ubx_set_val(0x30210001, rate_bytes, layer=1)
        sleep(0.5)  # Allow some time for the setting to take effect
        gps.ubx_set_val(0x30210001, rate_bytes, layer=2)

        # Optional: confirm it's set
        #rate = gps.ubx_get_val(0x30210001, layer=0, wait_time=5000)
        # print(f"Rate is now set to: ms")

    finally:
        port.close()

if __name__ == '__main__':
    run()
1 Like

Good job! Thanks for posting the updated method too

1 Like