In this guide we will show how to get the a BerryIMUv3 working with a Raspberry Pi Pico, using MicroPython. This code example supports I2C and SPI.
Hook up Guide
The two images below show how to hook up the BerryIMUv3 via I2C or SPI. (If using SPI, you will need to place a solder “blob” on JP7 on the BerryIMUv3 to complete the SPI connection, as shown here)
Thonny and the MicroPython code
We will be using Thonny to program the Raspberry Pi Pico.
The sample code supports both I2C and SPI communications. Comment out the protocol which will not be used as shown below. Below we have commented out I2C as we will be using SPI
import utime import math from LSM6DSL import * import machine #Comment out one of the below lines import IMU_SPI as IMU #import IMU_I2C as IMU