STEMMA Friend Is an I2C Multi-Tool, Here to Help You Get Hooked Up Hassle-Free!

Adafruit is showing us how to get friendly with I2C debugging!

Tom Fleet
4 years agoHW101 / Sensors / Debugging

In the time I've known and worked with the Arduino environment, here's one sketch above all other that — in one format or another — has been in every Arduino Sketchbook I've worked with.

It's pretty much the first sketch I end up googling on a fresh installation, and if you've ever worked with I2C devices in the context of Arduino, you'll likely recognize what's going on in the listing above.

It's a script designed to restore your sanity when working with I2C devices — and will dutifully report back over the Serial terminal the addresses of any devices that respond on a given I2C (Wire) bus.

As shown above, it's verifying that I've correctly assembled a development board, with the expected responses from the two I2C devices that are populated on it.

Suffice to say that the I2C world, as simple as intended, can get a bit hairy.

Multiple devices with the same address will lead to bus conflicts. There can be missing (or multiple!) sets of pull-up resistors to contend with on occasion, and don't even get me started on the wonderfully loosely defined part of the specification that deals with clock stretching — even the Raspberry Pi has had issues with that — requiring either a cripplingly slow I2C hardware clock, or software I2C implementation to fix the issue.

When you are cranking out as many I2C prototyping modules as the gang over at Adafruit do, you don't want to be spending what adds up to a significant amount of time, hooking up a logic probe every time you don't get an ACK on the bus.

To this end, they have put together a really handy looking gadget, named the STEMMA Friend, aimed at easing the pain that can be experienced when bringing up a board with a I2C device loadout!

Barely larger than the 240 x 240 pixel IPS IFT display that dominates the front face of the board, the STEMMA Friend is based around the Microchip SAM D21E MCU, along with a small loadout of other support components to get the show on the road!

This tiny, 32-pin QFN packs a punch, and with its native USB port, the STEMMA Friend is able to not only display the results of the I2C bus scan on its integrated display, but also pass the data up to the USB CDC serial port — potentially making it useful as an ATE element, perhaps?

Speaking of USB, this gadget is more useful than just a "bench tool" — the STEMMA Friend also has the standard JST battery connector we all know and love, meaning that this debug tool is happy to assist, whether sat on the bench, or on the go!

While we know little more than what is shown in the teaser video embedded at the end of the article, we can see that there are multiple I2C buses — with both STEMMA connectors sitting on I2C bus 0, and the Grove compatible connector sitting on I2C bus #1.

If we look at bit closer at the display, we can see that address 0x3C is highlighted in yellow — and looking at the Grove connector, we can see a small OLED module hooked up. If we search the very useful i2cdevices.org for that hexadecimal value, we are presented with a list of five known devices that answer to that address.

0x3C is a common address for the SSD1305/1306 display controllers, so this matches with what we're seeing in the video.

Additionally, 0x40 is a known address for the Si7021 humidity and temperature sensor, which we are shown plugged into I2C bus #0, using the STEMMA QT connectors.

The ability to poll two separate buses could come in very handy for trying to debug potential address conflicts, especially in the case of user-defined / programmable devices that can be strapped to a range of addresses!

What's more is that, while this STEMMA Friend is currently shown debugging an I2C hardware connection, the Grove connector, mapped to that second I2C bus is capable of being instantiated as a UART, opening up the door for a handy little serial output that can sit in your pocket.

Speaking Adafruit for a bit more detail, Phil Torrone tells us that there is scope for future firmware developments, in order to give the STEMMA Friend some extra legs — the ability to auto-detect known I2C device types, and potentially perform simple read sequences to verify their operation!

That would be really very useful indeed!

Tom Fleet
Hi, I'm Tom! I create content for Hackster News, allowing us to showcase your latest and greatest projects for the world to see!
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles