Successfully tested SWI2C with MPU6050 on Arduino UNO Q (Software I²C on arbitrary GPIO pins)

Hi everyone,

I wanted to share the results of some testing I recently carried out with the new Arduino UNO Q.

Background

I am currently developing a wearable project that requires using an MPU6050 over software I²C so that I can place the bus on arbitrary GPIO pins instead of the hardware I²C pins.

While looking for a suitable library, I first tried SoftwareWire. Unfortunately it did not compile on the UNO Q because it relies on AVR-specific register implementations such as digitalPinToPort() and portModeRegister(), which are not available on the UNO Q's Zephyr-based Arduino core.

After some searching, I came across Andy4495's SWI2C library:

One thing I immediately liked was that the implementation is platform independent and uses only the standard Arduino API (pinMode(), digitalWrite(), and digitalRead()), so I decided to test it on the UNO Q.


Test Environment

Board

  • Arduino UNO Q

Microcontroller

  • STM32U585 (Arm Cortex-M33)

Arduino Core

  • Arduino Zephyr Core v0.56.0

Operating System

  • Ubuntu 24.04 LTS

Peripheral

  • MPU6050

Software I²C Pins

  • SDA → D2
  • SCL → D3

Test Procedure

The following functionality was tested:

  • Library compiled without modification.
  • Software I²C initialized successfully.
  • MPU6050 was initialized successfully.
  • Continuous 14-byte reads starting from register 0x3B.
  • Accelerometer data.
  • Gyroscope data.
  • Temperature data.
  • Continuous real-time streaming while moving the sensor.

Results

Everything worked successfully.

The library required no modifications to compile on the UNO Q.

I was able to continuously stream accelerometer, gyroscope and temperature data using arbitrary GPIO pins through software I²C.

The communication remained stable throughout testing.


Screenshots

Serial Output

Upload / Build Environment


Why I'm posting this

The UNO Q is still a relatively new board and there isn't much information available regarding software I²C compatibility.

Hopefully this saves someone else some debugging time if they're trying to use software I²C on the UNO Q.

I have also opened a compatibility report on the SWI2C GitHub repository so the maintainer is aware that the library has now been successfully tested on this platform.

If anyone has tried other software I²C libraries on the UNO Q, I'd be interested to hear your experience as well.

Great result and summary, thanks for sharing!

Nice find - and even better than it works. Will have to give it a test.

Please, post the sketch.