The Adafruit CircuitPython seesaw library makes it easy to do all kinds of things with your ATtiny817 Breakout. This section includes a quick way to verify your breakout is hooked up properly and functioning.

You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library.

CircuitPython Microcontroller Wiring

First wire up a ATtiny817 breakout to your microcontroller board exactly as shown below. Here's an example of wiring a Feather RP2040 to the breakout using I2C via the STEMMA QT connector.

  • Use a STEMMA QT cable to connect the STEMMA QT connector on the Feather to the STEMMA QT connector on the breakout.

Here's an example connecting the breakout STEMMA QT connector to a solderless breadboard.

  • Plug a STEMMA QT to male jumper wire cable into the STEMMA QT connector on the breakout.
  • Feather 3V to breakout VIN (red wire)
  • Feather GND to breakout GND (black wire)
  • Feather SCL to breakout SCL (yellow wire)
  • Feather SDA to breakout SDA (blue wire)

Python Computer Wiring

Since there's dozens of Linux computers/boards you can use we will show wiring for Raspberry Pi. For other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is supported

Here's the Raspberry Pi wired with I2C.

  • Plug a STEMMA QT to male jumper wire cable into the STEMMA QT connector on the breakout.
  • Pi 3V3 to breakout VIN (red wire)
  • Pi GND to breakout GND (black wire)
  • Pi SCL to breakout SCL (yellow wire)
  • Pi SDA to breakout SDA (blue wire)

Python Installation of seesaw Library

You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready!

Once that's done, from your command line run the following command:

  • pip3 install adafruit-circuitpython-seesaw

If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

CircuitPython Usage

To use with CircuitPython, you need to first install the seesaw library into the lib folder on your CIRCUITPY drive. Then you need to update with the example script.

Thankfully, you can do this in one go. In the example below, click the Download Project Bundle button below to download the necessary libraries and the file in a zip file. Extract the contents of the zip file, and copy the entire lib folder and the file to your CIRCUITPY drive.

Your CIRCUITPY/lib folder should contain the following folders:

  • adafruit_bus_device/
  • adafruit_seesaw/

Python Usage

Once you have the library pip3 installed on your computer, copy or download the following example to your computer, and run the following, replacing with whatever you named the file: python3

Example Code:

# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
Simple seesaw test for ATtiny8x7 breakout using built-in LED on pin 5.
import time
import board
from adafruit_seesaw.seesaw import Seesaw

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(i2c)

ss.pin_mode(5, ss.OUTPUT)

while True:
    ss.digital_write(5, False)  # Turn the LED on (the built-in LED is active low!)
    time.sleep(1)  # Wait for one second
    ss.digital_write(5, True)  # Turn the LED off
    time.sleep(1)  # Wait for one second

If running CircuitPython: Once everything is saved to the CIRCUITPY drive, the built-in LED will begin blinking!

If running Python: Once you run the example, the built-in LED will begin blinking!

In this example, you first import the required modules and library. Then you initialise the seesaw and provide it the I2C board object.

Next, you setup pin 5 as an output.

Inside the loop, you first set the LED to False to turn it on. False is the voltage level. You set it to False to turn it on because the LED is tied active low. Then, you wait for one second. Next, you turn off the LED by setting it to True, and then wait one more second before beginning the loop again.

That's all there is to blinking the built-in LED on the ATtiny817 breakout using CircuitPython and the seesaw library!

This guide was first published on Oct 20, 2021. It was last updated on Dec 10, 2023.

This page (Python & CircuitPython) was last updated on Dec 08, 2023.

Text editor powered by tinymce.