Example Code for Raspberry Pi-I2C Tutorial

Read GNSS data from the GNSS-RTK kit using the I2C protocol with Raspberry Pi.

Hardware Preparation

Software Preparation

Wiring Diagram

Other Preparation Work

  • Configure I²C speed as 400kbps in Raspberry Pi settings.
    Configure I²C Speed
  • 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?

TOP