The seesaw firmware that ships with the ATtinyxxx breakouts include the ability to power up to 60 NeoPixels on one pin. This example displays a rainbow across a NeoPixel ring.

Follow the instructions on the Python & CircuitPython page to get set up.

NeoPixel Pins

Only one pin can be used at a time for powering NeoPixels on the ATtinyxxx breakouts!

There are 15 pins on the ATtiny817 breakout that can be used for powering NeoPixels:

  • 0-3, 5-9, 12-14, 18-20

There are 12 pins on the ATtinyx16 breakouts that can be used for powering NeoPixels:

  • 0-6, 8, 11, 14-16

Wiring

As stated above, you can use many different pins for powering NeoPixels, but this example uses pin 19. Connect a NeoPixel ring (or strip) to the breakout as follows.

  • Use a STEMMA QT cable to connect the STEMMA QT connector on the Feather to the STEMMA QT connector on the breakout.
  • Connect NeoPixel ring GND to breakout GND
  • Connect NeoPixel ring IN (data in) to breakout pin 19
  • Connect NeoPIxel ring power to breakout VIN
If you are using an ATtinyx16, there is no pin 19. Connect the NeoPixel IN pin to one of the 12 NeoPixel capable pins listed above.

Example Code

Update your code.py to the following. If you are using an ATtinyx16, update NEOPIXEL_PIN to be one of the NeoPixel capable pins listed above to match your wiring.

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

# Simple seesaw test writing NeoPixels
# Can use any valid GPIO pin, up to 60 pixels!
#
# 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/neopixel

import time
import board
from rainbowio import colorwheel
from adafruit_seesaw import seesaw, neopixel

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)

NEOPIXEL_PIN = 19  # Can be any pin
NEOPIXEL_NUM = 12  # No more than 60 pixels!

pixels = neopixel.NeoPixel(ss, NEOPIXEL_PIN, NEOPIXEL_NUM)
pixels.brightness = 0.3  # Not so bright!

color_offset = 0  # Start at red

# Cycle through all colors along the ring
while True:
    for i in range(NEOPIXEL_NUM):
        rc_index = (i * 256 // NEOPIXEL_NUM) + color_offset
        pixels[i] = colorwheel(rc_index & 255)
    color_offset += 1
    time.sleep(0.01)

The NeoPixel ring lights up in a rainbow!

First you import all the necessary modules and libraries. Then you instantiate the seesaw on I2C.

Next, you set the NeoPixel pin, and the number of pixels to match your wiring and pixel number. This example uses pin 19 and a 12-pixel ring.

Then, you create the pixels object with the pin and number you set above.

Before the loop, you set pixel brightness to 30% and create a color_offset variable and set it to 0 to start the colorwheel at red.

Inside the loop, you display the rainbow with a slight delay. Increase this to slow down the rainbow if desired.

That's all there is to using CircuitPython seesaw NeoPixel with the ATtinyxxx breakouts!

This guide was first published on Oct 20, 2021. It was last updated on May 30, 2024.

This page (NeoPixel) was last updated on May 30, 2024.

Text editor powered by tinymce.