Asynchronous library for interfacing with u-blox M8 series GNSS modules over I2C
It's recommended to create a Virtual Environment before installing
pip install "git+https://github.com/Rose-Rocketry/ublox-m8-i2c"
Many Raspberry Pi's, including the Raspberry Pi zero W, don't support clock stretching on their hardware I2C bus.
You can add the following to /boot/config.txt
activate a bit-banged I2C bus on GPIO pins 23 and 24 at /dev/i2c-3
# (...default values...)
# Uncomment some or all of these to enable the optional hardware interfaces
dtoverlay=i2c-gpio,bus=3,i2c_gpio_sda=23,i2c_gpio_scl=24
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# (...default values...)
u-blox pin | Raspberry Pi pin |
---|---|
3v3 | 3v3 |
GND | GND |
SDA | GPIO23 |
SCL | GPIO24 |
You can test your connection to the module with the following command:
$ python -m ublox_m8_i2c
Compiling i2c_stream...
..$GNRMC,010129.00,V,,,,,,,101022,,,N*68
$GNVTG,,,,,,,,,N*2E
$GNGGA,010129.00,,,,,0,00,99.99,,,,,,*73
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*2E
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*2E
$GPGSV,1,1,01,08,,,19*78
See __main__.py for a complete example
from ublox_m8_i2c import open_async
reader, writer = await open_async(
bus="/dev/i2c-3",
address=0x42,
)
await writer.write(b"Hello World!\n")
line = await reader.readline()
print(line)