Adafruit's New Breakout Board Has Its Own Brain
Adafruit's latest STEMMA QT/Qwiic I2C breakout board is a little smarter than the average. While we are used to having everything from buttons and dials right up to screens and LED panels working over I2C, the ATtiny1616 Breakout with seesaw features... well an ATtiny1616. I guess the clue is kinda in the name.
So, why would you need a separate MCU as an I2C peripheral? Well, since it's a standalone processor, it can take care of timing sensitive tasks for you, add GPIO, act as an I2C bridge, even an external EEPROM. Addressible LEDs like Neopixels or any other WS2812B strips can be a pain to get working right, and straight out of the gate, this breakout is perfect for that. It even has a dedicated Neopixel output capable of driving up to 250 LEDs.
We chatted about the board and the accompanying Seesaw library in this week's Electromaker Show:
So, having an I2C copilot on your projects is cool, but it does sound somewhat complicated to get working, right? Well, it turns out that Adafruit has thought of that, and created a custom software library to take away any and all headaches associated with getting MCUs to play nice.
In a nutshell, Seesaw is both custom firmware for the ATTiny1616, and a software library for both Python and Arduino programming. Each breakout board comes pre-flashed with Seesaw, turning it into an I2C-to-anything-you-like board. The code for it is pretty simple too. Here's some example code for setting up PWM via Seesaw on an ATTiny breakout board:
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# Simple seesaw test for writing PWM outputs
# On the SAMD09 breakout these are pins 5, 6, and 7
# On the ATtiny8x7 breakout these are pins 0, 1, 9, 12, 13
#
# See the seesaw Learn Guide for wiring details.
# For SAMD09:
# https://learn.adafruit.com/adafruit-seesaw-atsamd09-breakout?view=all#circuitpython-wiring-and-test
# For ATtiny8x7:
# https://learn.adafruit.com/adafruit-attiny817-seesaw/pwmout
import time
import board
from adafruit_seesaw import seesaw, pwmout
i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
ss = seesaw.Seesaw(i2c)
PWM_PIN = 12 # If desired, change to any valid PWM output!
led = pwmout.PWMOut(ss, PWM_PIN)
delay = 0.01
while True:
# The API PWM range is 0 to 65535, but we increment by 256 since our
# resolution is often only 8 bits underneath
for cycle in range(0, 65535, 256): #
led.duty_cycle = cycle
time.sleep(delay)
for cycle in range(65534, 0, -256):
led.duty_cycle = cycle
time.sleep(delay)
Example code exists for several other use cases too on the Adafruit Learn page for Seesaw and the ATTinyxx breakouts, including Neopixel code, and how to use the breakout's onboard EEPROM.
The Adafruit ATtiny1616 Breakout with seesaw - STEMMA QT / Qwiic is available directly from Adafruit.
Leave your feedback...