Need An USB-I2C Adapter? Use Your Pico!

A Pi Pico plugged into a breadboard, with an I2C OLED display connected to it

Given its abundance and simplicity, the RP2040 has no doubt become a favourite for USB peripheral building – in particular, USB-connected tools for electronics experiments. Today, we see one more addition to our Pico-based tool arsenal – a USB-I2C adapter firmware for RP2040 by [Renze Nicolai]. This is a reimplementation of the ATTiny-based I2C-Tiny-USB project and complies to the same protocol – thus, it’s compatible with the i2c-tiny-usb driver that’s been in the Linux kernel for ages. Just drag&drop the .uf2, run a script on your Linux system, and you will get a /dev/i2c-X device you can work with from userspace code, or attach other kernel drivers to.

The software will work with any RP2040 devboard – just connect your I2C devices to the defined pins and you’ll have them show up in i2cdetect output on your Linux workstation. As a demo, [Renze] has written a userspace Python driver for one of these SSD1306 128×64 OLEDs, and gives us a commandline that has the driver accept output of an ffmpeg command capturing your main display’s contents, duplicating your screen on the OLED – in a similar fashion that we’ve seen with the “HDMI” I2C-driven display a few months back. Everything you might need is available on the GitHub page, including usage instructions and examples, and the few scripts you can use if you want to add an udev rule or change the I2C clock frequency.

Just to name a few purposes, you can use a Pi Pico as a tool for SWD, JTAG, CAN, a logic analyser with both digital and analog channels, or even as a small EMP-driven chip glitching tool. The now-omnipresent $3 Pi Pico boards, it seems, are a serious contender to fondly remembered hacker tools of the past, such as the legendary BusPirate.

12 thoughts on “Need An USB-I2C Adapter? Use Your Pico!

    1. It depends on what you want. Three analogue inputs isn’t always enough (the stm has around 8, and they’re nicely usable as capacitive inputs with no extra hardware), and I don’t think the Pico has an rtc you can power with a coin cell (but on many of my stm32 clones the externally powered clock doesn’t work anyway). But most of my projects don’t need these extras.
      I should consider porting my stm32f1 USB library to the Pico, and then it’ll work for most of my use cases.

  1. now if only the author would’ve checked their github in ever, and noticed they got a) the protocol all wrong and b) it already fixed by someone else, they could’ve just clicked a single button and it would actually work as advertised.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.