Example Code for Raspberry Pi-I2C Tutorial
Read GNSS data from the GNSS-RTK kit using the I2C protocol with Raspberry Pi.
Hardware Preparation
- Raspberry Pi 4B × 1
- DFR0566 Raspberry Pi 4B/3B+ IO Expansion Board × 1
- GNSS-RTK High-Precision Positioning Kit × 1
Software Preparation
Wiring Diagram

Other Preparation Work
- Configure I²C speed as 400kbps in Raspberry Pi settings.

- Download the library file and run it, the default is I2C mode.
- Dial the hardware DIP switch to I2C mode (power off and restart after switching).
Sample Code
cd ~
cd Desktop
mkdir df
cd df
git clone https://github.com/DFRobot/DFRobot_RTK_LoRa
cd DFRobot_RTK_LoRa/python/raspberrypi/examples
sudo python3 get_gnss.py
Result
The script outputs GNSS data (latitude, longitude, altitude, etc.) to the terminal.
Was this article helpful?
