This project has sample code for the Complex Arts Sensor Board written in Python.
You might also want to take a look at our Arduino demos for the Sensor Board.
You will need to download our custom binary version of the excellent micropython firmware that supports the BNO085 on the Sensor Board.
You will find the latest firmware binary in the latest
releases.
The firmware binary is the file firmware.bin
.
Installation is done with the esptool.py
as described in
here.
First erase the ESP32 flash
esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash
Then program the firmware starting at address 0x1000:
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 firmware.bin
Replace /dev/ttyUSB0
by whatever serial port your board is connected to.
This can vary depending on the operating system you're using.
Two demos are provided:
-
accelerometer.py
Initializes the BNO085 and prints accelerometer readings over serial while blinking one of the user LEDs. -
orientation.py
Initializes the BNO085 and prints orientation readings over serial while blinking one of the user LEDs.
The easiest way to install these programs on a board running the micropython firmware is by using a tool such as adafruit's ampy.
For example:
ampy -p /dev/ttyUSB0 put accelerometer.py
will copy the file accelerometer.py
to the board.
You can run the program by connecting to the board using a serial
monitor program such as picocom
or minicom
and simply importing
import accelerometer
after the REPL prompt. You might need to reset the board after using
ampy
.
Detailed documentation for the module bno085
, including a discussion
of the above demos, is available
here.