How to use mpu6050 accelerometer with i2c-4

pip install adafruit-circuitpython-mpu6050
pip install adafruit-blinka

Simple example

import time
import busio
import board
from adafruit_mpu6050 import MPU6050

Utiliza los pines específicos para el bus I2C-4

i2c_bus = busio.I2C(board.D4_B3, board.D4_B2)

Inicializa el sensor MPU6050

mpu = MPU6050(i2c_bus)

while True:
# Lee los datos del acelerómetro
accel_x, accel_y, accel_z = mpu.acceleration
# Lee los datos del giroscopio
gyro_x, gyro_y, gyro_z = mpu.gyro

# Imprime los datos del acelerómetro y giroscopio
print(f"Acelerómetro: X={accel_x:.2f}, Y={accel_y:.2f}, Z={accel_z:.2f} m/s^2")
print(f"Giroscopio: X={gyro_x:.2f}, Y={gyro_y:.2f}, Z={gyro_z:.2f} rad/s")
print("")

# Espera un segundo antes de la siguiente lectura
time.sleep(1)

Here is a demo for raspberry pi which uses python lib smbus, perhaps you can refer to it.

No, no, its on radxa zero 3w

I mean you can see how this demo is implemented, since the smbus library is generic.

This demo works fine on 3W.

@Nasca I have some previous HV, and i use bus 3, pin 3, and pin 5 on this board, however, i noticed the new revision: https://docs.radxa.com/en/zero/zero3/hardware-design/hardware-interface i2c3 is not available, is it correct?

Can you provide which HW version is the latest one and clarify this for the latest board version:

“Pin 3, Pin 5, Pin 27, and Pin 28 add extra pull-up resistors for I2C device power supply, so they work abnormally when used as GPIOs.”

I2C3 is occupied by kernel default.


Yep, i disabled it. I thought it fusb was necessary to be enabled for the wifi, but board works without it.
I haven’t tested USB3 yet. Can you clarify what the fusb302 at 3W is for?

usbc0 node is used for usb 3.0 port.

1 Like