Using the BerryIMUv3 on a Raspberry Pi Pico with MicroPython

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)

 

Raspberry Pi Pico and BerryIMU
Raspberry Pi Pico and BerryIMv3 via SPI

 

Raspberry Pi Pico and BerryIMU
Raspberry Pi Pico and BerryIMv3 via I2C

Thonny and the MicroPython code

The MicroPython code can be downloaded from our GitHub repository. The code for this example can be found under the PicoMicroPython directory.

We will be using Thonny to program the Raspberry Pi Pico.

If you are new to the Raspberry Pi Pico and Thonny, we suggest viewing these excellent tutorials from our friends at Core Electronics;
1. Getting started with Raspberry Pi Pico
2. Pico and Thonny

 

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

 

BerryIMU Pico Thonny
BerryIMU Pico Thonny

 

2 thoughts on “Using the BerryIMUv3 on a Raspberry Pi Pico with MicroPython”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.