/pico-bno055-rs

Code for connecting an RP2040 (via Raspberry Pi Pico) to a Bosch BNO055 IMU (via an Adafruit breakout board) and having the realtime orientation data be sent to the host machine via serial USB.

Primary LanguageRust

pico-bno055-rs

Have a Raspberry Pi Pico get its realtime orientation data from a Bosch BNO055 Inertial Measurement Unit and write the to the host computer via serial USB connection.

Get Started

  1. Install the latest version of Rust. This is the language in which this program is written.

  2. Install the thumbv6m-none-eabi target. This lets us compile our Rust program into a language understood by the Pico

rustup self update
rustup update stable
rustup target add thumbv6m-none-eabi
  1. Install the Rust port of ELF2UF2. This is used for flashing the program to the board
cargo install elf2uf2-rs
  1. Install Clippy. This is used to help lint the Rust code
rustup component add clippy
  1. Install just. This is used for running certain tasks, (just build will build the program, for example)
cargo install just
  1. Build the project to make sure everything's setup correctly
just build

And you're good to go! If you want to do some debugging as well, do the following optional steps.

  1. Install Python

  2. Install the pySerial library

Flashing the program to the Pico

To flash the program to the Pico:

  1. Plug in the Pico to your host machine in bootloader mode (with the on-board button held down)
  2. Run just flash

View Quaternion Data Live

  1. With the program flashed to the Pico, plug in the Pico via USB to the host computer
  2. Locate the serial port on the host computer (COM... on Windows, /dev/tty... on POSIX)
  3. Edit debug-quaternion.py to use the serial port to which the Pico is connected
  4. Run python scripts/debug-quaternion.py

Additional Resources