BMA400 3 Axis Accelerometer on Raspberry Pi Pico 2

Introduction

In the previous post I looked at interfacing the ICM20948 9DOF IMU with the Raspberry Pi Pico 2 (Ref.1). In this post I examine interfacing the Bosch BMA400 3 axis accelerometer with the Pico 2. The BMA400 breakout pcb is extremely small and lends itself to small portable instruments (Ref.2).

Raspberry Pi Pico 2 to BMA400 Connection

Fig.1 Pico 2 Pinout
Fig.2 Pico 2 to BMA400 Connection on Parallax BOE Dev Board
Fig.3 BMA400 Breakout with QWIIC Connector/Male Pin Adapter Cable to PICO 2 on BOE

Figure 1 shows the pinouts for the Pico 2 as well as the pin assignments. Figure 2 shows the Pico 2 connections to the SparkFun BMA400 breakout (Ref.2). The Pico 2 is mounted on the protoboard of a Parallax BOE dev board. The top layout is shown as well as a KiCad view of the pcb wiring to determine the pinout of the QWIIC connector. Figure 3 shows the connections and the QWIIC adapter cable.

MicroPython & Thonny Python IDE

Fig.4 Thonny IDE Loading Python Code via zip File
Fig.5 Thonny IDE Running MicroPython Code & Sensor Opt in Shell
Fig.6 BMA400 Sensor Orientation Flat Ref.5 p.112|121
Fig.7 BMA400 Sensor Orientation Vertical Ref.5 p.112|121
Fig.8 I2C Bus Monitoring with PicoScope3205D

First step is to download and install MicroPython on the Pico 2. This was covered in the previous post (Ref.1). The BMA400 dev board comes with an Arduino library but not a MicroPython one. The manufacturer Bosch has a C API driver. Searching on the Internet I found a MicroPython libary at pypi.org “micropython-bma400 0.1.2” (Ref.3). Download the zip file and install in Thonny as in Figure 4 using “Install from local file”.

Figure 5 shows the “bma400_simpletest.py” example running with the output displayed below in the shell area. In the example, the sensor is vertical, so ax = -0.1Gs, ay = -0.01Gs, az = -0.01Gs. I presume Gs = 10xg where g = 9.81m/sec^2. Note on the pcb in Figure 2, the dot next to pin 1 on the sensor is on LHS of the bottom edge. Figures 6/7 show the orientation. Figure 8 shows the I2C communication SDA/SCL on pin4/5.

Fig.9 YouTube Video BMA400 3 Axis Accelerometer on Raspberry Pi Pico 2
Electronics Blog Topics

Please send your comments, questions and suggestions to:
contact:

YouTube Channel
YouTube Channel

References

#1. – “ICM20948 9DOF IMU on Raspberry Pi Pico 2”
https://jeremyclark.ca/wp/nav/icm20948-9dof-imu-on-raspberry-pi-pico-2/

#2. – “SparkFun Micro Triple Axis Accelerometer Breakout – BMA400 (Qwiic)”
https://www.sparkfun.com/sparkfun-micro-triple-axis-accelerometer-breakout-bma400-qwiic.html

#3. – “MicroPython Library for BMA400”
https://pypi.org/project/micropython-bma400/

#4. – “Bosch Data Sheet BMA400”
https://www.bosch-sensortec.com/en/products/motion-sensors/accelerometers/bma400

By Jeremy Clark

Jeremy Clark is a Senior Telecommunications Engineer and Advanced Amateur Radio Operator VE3PKC. He is the author of E-Books on Telecommunications, Navigation & Electronics.