Skip to content

Simple program for communicating with u-blox M8 series GNSS modules over I2C

License

Notifications You must be signed in to change notification settings

Rose-Rocketry/ublox-m8-i2c-standalone

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

ublox-M8-I2C-standalone

Simple program for communicating with u-blox M8 series GNSS modules over I2C

Installation

Build i2c_stream

Run this code on the target:

gcc i2c_stream.c -o i2c_stream

Setup software 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

[all]
dtoverlay=i2c-gpio,bus=3,i2c_gpio_sda=23,i2c_gpio_scl=24

Wiring

u-blox pin Raspberry Pi pin
3v3 3v3
GND GND
SDA GPIO23
SCL GPIO24

Image of Sparkfun u-blox SAM-M8Q connected to a Raspberry Pi zero W

Testing

You can test your connection to the module with the following command:

$ ./i2c_stream
Usage: ./i2c_stream <bus> <addr> <poll_sleep_ms> <poll_error_sleep_ms>

$ ./i2c_stream /dev/i2c-3 42 100 1000

Usage Example

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)

About

Simple program for communicating with u-blox M8 series GNSS modules over I2C

Resources

License

Stars

Watchers

Forks

Languages

  • C 100.0%