# Adafruit seesaw

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/047/811/medium800/sensors_seesaw.jpg?1509569580)

Adafruit seesaw is a near-universal converter framework which allows you to add and extend hardware support to any I2C-capable microcontroller or microcomputer. Instead of getting separate I2C GPIO expanders, ADCs, PWM drivers, etc, seesaw can be configured to give a wide range of capabilities.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/808/medium800/sensors_3657_quarter_ORIG.jpg?1509569184)

For example, our ATSAMD09 breakout with seesaw gives you

- 3 x 12-bit ADC inputs
- 3 x 8-bit PWM outputs
- 7 x GPIO with selectable pullup or pulldown
- 1 x NeoPixel output (up to 170 pixels)
- 1 x EEPROM with 64 byte of NVM memory (handy for storing small access tokens or MAC addresses)
- 1 x Interrupt output that can be triggered by any of the accessories
- 2 x I2C address selection pins
- 1 x Activity LED

But you can reprogram and reconfigure the chip to have more or less of each peripheral - as long as it fits into the ATSAMD09D14's firmware! For example, there's also a UART converter but it isn't included in the default firmware.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/810/medium800/sensors_3657_iso_ORIG.jpg?1509569221)

The ATSAMD09 breakout is great for development of seesaw capabilities (we use it in-house for our design work) or you can use it as-is to give your Raspberry Pi or ESP8266 more hardware support! Each breakout comes with the assembled and tested board, as well as some header strips.

**Please note:** The boards do not come with a bootloader. If you want to do development using seesaw [you'll need to pick up a J-Link](https://www.adafruit.com/?q=j-link)and we recommend a [SWD adapter breakout](https://www.adafruit.com/product/2743) - at this time our project is for Atmel Studio but you could probably get it working with arm gcc and a Makefile. We don't provide any support for custom builds of seesaw - we think this is cool and useful for the Maker community!

![](https://cdn-learn.adafruit.com/assets/assets/000/047/809/medium800/sensors_3657_kit_ORIG.jpg?1509569189)

# Adafruit seesaw

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/047/812/medium800/sensors_front.jpg?1509569723)

![](https://cdn-learn.adafruit.com/assets/assets/000/047/813/medium800/sensors_back.jpg?1509569727)

## Power Pins:

- **Vin** &nbsp;- this is the power pin. Since the ATSAMD09 uses 3.3V, we have included an on-board voltage regulator that will take 3-5VDC and safely convert it down. You can power from 3.3V to 5V
- **3Vo** &nbsp;- this is the 3.3V output from the voltage regulator,&nbsp;you can grab up to 100mA from this if you like
- **GND** &nbsp;- common ground for power and logic

## Logic Pins:

- **23 / SCL&nbsp;** - this is the I2C clock pin, connect to your microcontrollers I2C clock line. There is a 10K pullup on this pin to 3.3V. I2C is 'open drain' which means as long as you don't add an extra pullup you can use with 5V logic devices.
- **22 / SDA&nbsp;** - this is&nbsp;the I2C data pin, connect to your microcontrollers I2C data line. There is a 10K pullup on this pin to 3.3V. I2C is 'open drain' which means as long as you don't add an extra pullup you can use with 5V logic devices.
- **RST** - this is the reset pin. Pulling this pin to ground resets the device.

## GPIO Pins:

- Pins **9, 10, 11, 14, 15, 24, and 25** can be used as GPIO.

## Neopixel Pins:

- Pins **9, 10, 11, 14, 15, 24, and 25** &nbsp;can be used as the NeoPixel output.

## Address Pins:

- **16 / AD0** - this is the ADDR0 pin. Connect this to ground to increment the devices I2C address by 1.
- **17 / AD1&nbsp;** - this is the ADDR1 pin. Connect this to ground to increment the devices I2C addres by 2.

## ADC Pins:

- **2** - this pin can be configured as an ADC input.
- **3** - this pin can be configured as an ADC input.
- **4** - this pin can be configured as an ADC input.

## PWM Pins:

- **5** - this pin can be configured as a PWM output.
- **6** - this pin can be configured as a PWM output.
- **7** - this pin can be configured as a PWM output.

## Interrupt Pins:

- **8 / IRQ** - this pin gets pulled low by the seesaw to signal to your host microcontroller that an interrupt has occurred.

## Programming Pins:

- **SWD** - this pin connects to SWDIO of an SWD compatible programmer to program the device over SWD.
- **SWC** - this pin connects to SWCLK of an SWD compatible programmer to program the device over SWD.
- **RST&nbsp;** - this pin connects to RESET of an SWD compatible programmer to program the device over SWD.

# Adafruit seesaw

## Arduino Wiring & Test

# Arduino Wiring & Test

You can easily wire this breakout to any microcontroller, we'll be using an Adafruit Metro M0 Express (Arduino compatible) with the Arduino IDE. But, you can use any other kind of microcontroller as well as long as it has I2C clock and I2C data lines.

# I2C Wiring

- Connect&nbsp; **Vin** &nbsp;to the power supply, 3-5V is fine.
- Connect&nbsp; **GND&nbsp;** to common power/data ground
- Connect the&nbsp; **SCL** &nbsp;pin ( **23** )&nbsp;to the I2C clock&nbsp; **SCL** &nbsp;pin on your Microcontroller.
- Connect the&nbsp; **SDA** &nbsp;pin&nbsp;( **22** ) to the I2C data&nbsp; **SDA&nbsp;** pin on your Microcontroller.
- Connect the positive (long lead) of an LED to pin&nbsp; **15** on the seesaw breakout and the other lead to&nbsp; **GND** through a&nbsp; **1k ohm resistor.**

This seesaw uses I2C address&nbsp; **0x49** by default. You can change this by grounding the **AD0/16** and/or **AD1/17** pins, but we recommend not doing that until you have it working

![](https://cdn-learn.adafruit.com/assets/assets/000/047/800/medium800/sensors_SAMD09_bb.png?1509563844)

# Download Adafruit\_Seesaw library

To begin reading sensor data, you will need to download Adafruit\_Seesaw from the Arduino library manager.

Open up the Arduino library manager:

![](https://cdn-learn.adafruit.com/assets/assets/000/084/495/medium800/sensors_1library_manager_menu.png?1574051776)

Search for the&nbsp; **Adafruit Seesaw&nbsp;** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/084/496/medium800/sensors_seesaw.png?1574051851)

We also have a great tutorial on Arduino library installation at:  
[http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use)

# Load Test Example

Open up&nbsp; **File-\>Examples-\>Adafruit\_Seesaw-\>digital-\>blink** and upload to your Arduino wired up to the seesaw breakout. If everything is wired up correctly, the led should blink on and off repeatedly.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/816/medium800/sensors_demo.png?1509570960)

![](https://cdn-learn.adafruit.com/assets/assets/000/047/938/medium800thumb/sensors_3657_gif_1.jpg?1509727136)

# Documentation

see&nbsp;[here](https://adafruit.github.io/Adafruit_Python_seesaw/classAdafruit__Seesaw_1_1seesaw_1_1Seesaw.html)&nbsp;for documentation of the seesaw python API.

# Adafruit seesaw

## CircuitPython Wiring & Test

# CircuitPython Wiring & Test

You can easily wire this breakout to a microcontroller running CircuitPython. We will be using a Metro M0 Express.

# I2C Wiring

- Connect&nbsp; **Vin** &nbsp;to the power supply, 3-5V is fine.
- Connect&nbsp; **GND&nbsp;** to common power/data ground
- Connect the&nbsp; **SCL** &nbsp;pin ( **23** ) to the I2C clock&nbsp; **SCL** pin on your CircuitPython board, usually marked SCL. On&nbsp;a Gemma M0 this would be&nbsp; **Pad #2/ A1**
- Connect the&nbsp; **SDA** &nbsp;pin ( **22** ) to the I2C data&nbsp; **SDA&nbsp;** pin on your CircuitPython board, usually marked SDA. On an&nbsp;Gemma M0 this would be&nbsp; **Pad #0/A2**
- Connect the positive (long lead) of an LED to pin&nbsp; **15** &nbsp;on the samd09 breakout and the other lead to&nbsp; **GND** &nbsp;through a&nbsp; **1k ohm resistor.**

The seesaw uses I2C address&nbsp; **0x49** by default. You can change this by grounding the **AD0/16** and/or **AD1/15** pins, but we recommend not doing that until you have it working

![](https://cdn-learn.adafruit.com/assets/assets/000/047/801/medium800/sensors_SAMD09_bb.png?1509566199)

# Download Adafruit\_CircuitPython\_Seesaw library

To begin using the seesaw, you will need to download Adafruit\_CircuitPython\_Seesaw from our github repository.&nbsp;You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip

[Adafruit CircuitPython Seesaw Library](https://github.com/adafruit/Adafruit_CircuitPython_seesaw/archive/main.zip)
Extract the zipped folder and rename the **folder it contains** to&nbsp; **Adafruit\_seesaw**.&nbsp;drag the&nbsp; **Adafruit\_seesaw** folder to the&nbsp; **lib** folder that appears on the&nbsp; **CIRCUITPY&nbsp;** drive. You'll also need the **adafruit\_busdevice** driver.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/802/medium800/sensors_Screenshot_%2854%29.png?1509566772)

Warning: 

Open the&nbsp; **code.py** &nbsp;file on the&nbsp; **CIRCUITPY** &nbsp;drive and copy and paste the following code:

```
from board import *
import busio
from adafruit_seesaw.seesaw import Seesaw
import time

myI2C = busio.I2C(SCL, SDA)

ss = Seesaw(myI2C)

ss.pin_mode(15, ss.OUTPUT);


while True:
	ss.digital_write(15, True)   # turn the LED on (True is the voltage level)
	time.sleep(1)                # wait for a second
	ss.digital_write(15, False)  # turn the LED off by making the voltage LOW
	time.sleep(1)
```

The LED attached to pin 15 should blink on and off repeatedly.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/937/medium800thumb/sensors_3657_gif_1.jpg?1509727113)

# Adafruit seesaw

## Python Docs

# Adafruit seesaw

## Raspberry Pi Wiring & Test

The Raspberry Pi also has an I2C interface that can be used to communicate with this seesaw. You can use this breakout with the CircuitPython library and Python [thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

# Install Python Software
You'll need to install the Adafruit\_Blinka library that provides the CircuitPython library support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3.

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

- `sudo 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!

# Enable I2C

We need to enable the I2C bus so we can communicate with the&nbsp;seesaw.

```
sudo raspi-config
```

select Advanced options, enable I2C, and then finish.

![sensors_Screenshot_(21).png](https://cdn-learn.adafruit.com/assets/assets/000/047/803/medium640/sensors_Screenshot_%2821%29.png?1509568345)

![sensors_Screenshot_(22).png](https://cdn-learn.adafruit.com/assets/assets/000/047/804/medium640/sensors_Screenshot_%2822%29.png?1509568357)

![sensors_Screenshot_(23).png](https://cdn-learn.adafruit.com/assets/assets/000/047/806/medium640/sensors_Screenshot_%2823%29.png?1509568411)

![sensors_Screenshot_(24).png](https://cdn-learn.adafruit.com/assets/assets/000/047/807/medium640/sensors_Screenshot_%2824%29.png?1509568423)

With the Pi powered off, we can wire up the sensor to the Pi Cobbler like this:

- Connect&nbsp; **Vin** &nbsp;to the 3V or 5V power supply (either is fine)
- Connect&nbsp; **GND&nbsp;** to&nbsp;the ground pin on the Cobbler
- Connect&nbsp; **SDA** &nbsp;( **22** ) **&nbsp;** &nbsp;to&nbsp; **SDA&nbsp;** on the Cobbler
- Connect&nbsp; **SCL** ( **23** )&nbsp;to&nbsp; **SCL** &nbsp;on the Cobbler
- Connect the positive (long lead) of an LED to pin&nbsp; **15** &nbsp;on the samd09 breakout and the other lead to&nbsp; **GND** &nbsp;through a&nbsp; **1k ohm resistor.**

You can also use direct wires, we happen to have a Cobbler ready. remember you can plug the cobbler into the bottom of the PiTFT to get access to all the pins!

![](https://cdn-learn.adafruit.com/assets/assets/000/047/814/medium800/sensors_SAMD09_pi_bb.png?1509569886)

Now you should be able to verify that the sensor is wired up correctly by asking the Pi to detect what addresses it can see on the I2C bus:

```
sudo i2cdetect -y 1
```

It should show up under it's default address ( **0x49** ). If you don't see 49, check your wiring, did you install I2C support, etc?

![](https://cdn-learn.adafruit.com/assets/assets/000/047/817/medium800/sensors_Screenshot_%2855%29.png?1509571916)

# Run example code

At long last, we are finally ready to run our example code. Open the Python REPL to begin.

First we'll import the necessary libraries, initialise the I2C bus and setup the LED pin for use:

```
import time
import board
import busio
from adafruit_seesaw.seesaw import Seesaw

i2c_bus = busio.I2C(board.SCL, board.SDA)
ss = Seesaw(i2c_bus)

ss.pin_mode(15, ss.OUTPUT)
```

Now you're ready to blink the LED using `digital_write`:

```
while True:
    ss.digital_write(15, True)
    time.sleep(1)
    ss.digital_write(15, False)
    time.sleep(1)
```

If everything is set up correctly, the LED attached to pin 15 on the SAMD09 breakout should blink on and off repeatedly. Press CTRL + C to stop the program running once you are satisfied with the blinking.

![](https://cdn-learn.adafruit.com/assets/assets/000/047/936/medium800thumb/sensors_3657_gif_3.jpg?1509727079)

# Documentation

See&nbsp;[here](https://circuitpython.readthedocs.io/projects/seesaw/en/latest/)&nbsp;for documentation of the seesaw CircuitPython API.

# Full Example Code
https://github.com/adafruit/Adafruit_CircuitPython_seesaw/blob/main/examples/seesaw_simpletest.py

# Adafruit seesaw

## Using the Seesaw Platform

![](https://cdn-learn.adafruit.com/assets/assets/000/047/815/medium800/sensors_seesawlogo.gif?1509570247)

The sections under this heading contain more detailed information about how the Seesaw platform works.&nbsp; **If you are using our Arduino, CircuitPython, or Python API you can skip these sections.** These sections are intended for people who either want to understand and modify seesaw, or who want to make their own API for a platform that is not officially supported by Adafruit such as C/C++ on Raspberry Pi.

## Repo Summary

There are numerous code repositories with "seesaw" in the name.&nbsp; The firmware repositories contain the code running on the seesaw device itself. The support libraries are used to interact with \*any\* seesaw device.

If you are an end user of a seesaw device, then it is the support libraries you want.

There is no support for custom firmware development.

Firmware

- [seesaw](https://github.com/adafruit/seesaw) - for SAMD based boards
- [Adafruit\_seesawPeripheral](https://github.com/adafruit/Adafruit_seesawPeripheral) - for ATtiny 1-series based boards

Support Libraries

- [Adafruit\_CircuitPython\_seesaw](https://github.com/adafruit/Adafruit_CircuitPython_seesaw) - for use with CircuitPython or Blinka
- [Adafruit\_Seesaw](https://github.com/adafruit/Adafruit_Seesaw) - for use with Arduino

# Adafruit seesaw

## Reading and Writing Data

The SeeSaw operates as an I2C secondary device using standard I2C protocol. It uses the **SDA&nbsp;** and&nbsp; **SCL&nbsp;** pins to communicate with the host system.

The I2C bus on the SAMD09 is 3.3V logic level, but all boards&nbsp;_other_ than the SAMD09 breakout have level shifting so you can use 3 or 5V logic. Boards with Attiny chips are 3 or 5V safe so you can use either for power and logic

Only 7-bit addressing is supported.

I2C pullup resistors are included in our SeeSaw boards but if you are DIY'ing, be sure to add your own! 2.2K - 10K is a good range.

# Setting the Device Address

Standard 7-bit addressing is used. The seesaw's default I2C address is initially configured in the compiled firmware (e.g for theSeeSaw breakouts we use **0x49** ) but other boards will have a different base address. Check the board documentation for the default base I2C address, [or you can plug it in and scan the I2C bus to find it](https://learn.adafruit.com/scanning-i2c-addresses).

This address can be modified using the address select pins, there can be multiple address pins. If address select pin 0 ( **A0** ) is tied to ground on boot, the I2C address is incremented by 1. If address select pin 1 ( **A1** ) is pulled low, the I2C address is incremented by 2. If both address select pins are pulled low, the I2C address is incremented by 3. Thus you can, with the same hardware, have up to 4 devices

On both the SAMD09 and Attiny817 breakouts, the default A0 pin is **16** , default A1 pin is **17**. On boards where the chips are embedded, there may be as many as 4 address pins, they'll be labeled with jumpers

The base I2C address can also be modified by writing a new address to EEPROM. See the EEPROM section for more information.

# I2C Transactions

We recommend using 100KHz I2C, but speeds of up to 400KHz are supported. You may want to decrease the SDA/SCL pullups to 2.2K from 10K in that case.

## Writing Data

A seesaw write command consists of the standard I2C write header&nbsp;(with the R/W bit set to 0), followed by 2 **register&nbsp;bytes** followed by zero or more **data bytes**.

The first register byte is the&nbsp; **module&nbsp;**** base register address**. Each&nbsp;module&nbsp;(GPIO, ADC, DAC, etc.) has it's own unique 8 bit base identifier.

The second register byte is the **module function&nbsp;**** register address**. This byte specifies the desired register within the module to be written.

Thus we have up to 254 modules available (0x00 is reserved) and 255 functions per module - plenty to allow all sorts of different capabilities!

In code, this may look like this (using the Arduino wire I2C object):

```
void Adafruit_seesaw::write(uint8_t moduleBase, uint8_t moduleFunction, uint8_t *buf, uint8_t num)
{ 
	Wire.beginTransmission((uint8_t)_i2caddr);
	Wire.write((uint8_t)moduleBase); //module base register address
	Wire.write((uint8_t)moduleFunction); //module function register address
	Wire.write((uint8_t *)buf, num); //data bytes
	Wire.endTransmission();
}
```

Warning: 

## Base Register Summary

The following table summarizes the **module base registers addresses**. Further details about the function registers associated for each base register are covered in later sections.

Info: 

## Reading Data

A register read is accomplished by first&nbsp;sending the standard I2C write header, followed by the two **register bytes** corresponding to the data to be read. Allow a short delay, and then send a standard I2C read header (with the R/W bit set to 1) to read the data.

The length of the required delay depends on the data that is to be read. These delays are discussed in the sections specific to each module.

In code, this may look like this &nbsp;(using the Arduino wire I2C object):

```
void Adafruit_seesaw::read(uint8_t moduleBase, uint8_t moduleFunction, uint8_t *buf, uint8_t num, uint16_t delay)
{
  Wire.beginTransmission((uint8_t)_i2caddr);
  Wire.write((uint8_t)moduleBase); //module base register address
  Wire.write((uint8_t)moduleFunction); //module function register address
  Wire.endTransmission();

  delayMicroseconds(delay);

  Wire.requestFrom((uint8_t)_i2caddr, num);

  for(int i=0; i&lt;num; i++){
    buf[i] = Wire.read();
  }
}
```

# Adafruit seesaw

## Status

This module provides hardware specific information, status, and soft reset.

# Function Register Summary
# Function Register Description
## 0x01 - HW\_ID
A single byte value that provides the hardware specific **Hardware ID Code**.

## 0x02 - VERSION
The **Product Code** is a unique 16 bit number assigned to each product.

The **Date Code** is a 16 bit value that indicates the year, month, and day of the firmware build:

- Top 5 bits are **day** of the month (1-31)
- Middle 4 bits are **month** (1-12)
- Bottom 7 bits are 20xx **year** (00-99)

Here's a Python function for decoding a **Date Code** into year, month, and day:

```python
def datecode_decode(code):
    year = code &amp; 0x7F           // bottom 7 bits are 20xx year (00-99)
    month = (code &gt;&gt; 7) &amp; 0x0F   // middle 4 bits are month (1-12)
    day = (code &gt;&gt; 11) &amp; 0x1F    // top 5 bits are day of month (1-31)
    return year, month, day
```

## 0x03 - OPTIONS
 **Options** is a 32 bit field register indicating if a specific option (ADC, PWM, etc.) has been enabled or not within the firmware. If enabled, the bit reads a 1, otherwise 0.

Bit locations for options are defined below:

```cpp
#define SEESAW_STATUS_BASE 0x00
#define SEESAW_GPIO_BASE 0x01
#define SEESAW_SERCOM0_BASE 0x02
#define SEESAW_SERCOM1_BASE 0x03
#define SEESAW_SERCOM2_BASE 0x04
#define SEESAW_SERCOM3_BASE 0x05
#define SEESAW_SERCOM4_BASE 0x06
#define SEESAW_SERCOM5_BASE 0x07
#define SEESAW_TIMER_BASE 0x08
#define SEESAW_ADC_BASE 0x09
#define SEESAW_DAC_BASE 0x0A
#define SEESAW_INTERRUPT_BASE 0x0B
#define SEESAW_DAP_BASE 0x0C
#define SEESAW_EEPROM_BASE 0x0D
#define SEESAW_NEOPIXEL_BASE 0x0E
#define SEESAW_TOUCH_BASE 0x0F
#define SEESAW_KEYPAD_BASE 0x10
#define SEESAW_ENCODER_BASE 0x11
```

## 0x04 - TEMP
The on board **Temperature** of the device, as a signed 32 bit integer.

## 0x7F - SWRST
Writing to the register address will initiate a software reset.

# Adafruit seesaw

## GPIO

The GPIO module provides every day input and outputs. You'll get logic GPIO pins that can act as outputs or inputs. With pullups or pulldowns. When inputs, you can also create pin-change interrupts that are routed the the IRQ pin.

On SAMD09-based boards the GPIO is 3V only. On ATtiny-based boards, the GPIO logic is whatever the power pin is, 3V or 5V.

The module base register address for the GPIO module is&nbsp; **0x01**.&nbsp;

# &nbsp;Function Registers
Writes of GPIO function registers should contain **4 data bytes** (32 bits)&nbsp;following the initial register data bytes. Each bit in these registers represents a GPIO pin on **PORTA** of the seesaw device.

If the corresponding pin does not exist on the SeeSaw device, then reading or writing the bit has no effect.

We decided to go with this method to make GPIO toggling fast (rather than having one i2c transaction per individual pin control) but the host processor will need to do a little work to keep the pins identified.

## GPIO register setup on SAMD09:
## GPIO register setup on ATTiny8x7:

([this is the same as the megaTinyCore pin mapping](https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/ATtiny_x17.md))

- Bit 0: PA4
- Bit 1: PA5
- Bit 2: PA6
- Bit 3: PA7
- Bit 4: PB7
- Bit 5: PB6
- Bit 6: PB5
- Bit 7: PB4
- Bit 8: PB3
- Bit 9: PB2
- Bit 10: PB1
- Bit 11: PB0
- Bit 12: PC0
- Bit 13: PC1
- Bit 14: PC2
- Bit 15: PC3
- Bit 16: PC4
- Bit 17: PC5
- Bit 18: PA1
- Bit 19: PA2
- Bit 20: PA3

# DIRSET (0x02, 32 bits, Write Only)

Writing a 1 to any bit in this register sets the direction of the corresponding pin to OUTPUT.

Writing zeros to this register has no effect.

# DIRCLR (0x03, 32 bits, Write Only)

Writing a 1 to any bit in this register sets the direction of the corresponding pin to INPUT.

Writing zeros to this register has no effect.

# GPIO (0x04, 32 bits, Read/Write)

When this register is written, all bits that are set to 0 will have their corresponding pins set LOW.

All bits that are set to 1 will have their corresponding pins set HIGH.

Reading this register reads all pins on of the seesaw device. On the Attiny series please wait at least 250uS between command write and data read to allow the data to be read and formatted for retrieval. **Reading this register will also reset the IRQ pin if it was configured.**

# SET (0x05, 32 bits, Write Only)

Writing a 1 to any bit in this register writes the corresponding pin HIGH.

Writing zeros to this register has no effect.

# CLR (0x06, 32 bits, Write Only)

Writing a 1 to any bit in this register writes the corresponding pin LOW.

Writing zeros to this register has no effect.

# TOGGLE (0x07, 32 bits, Write Only)

Writing a 1 to any bit in this register&nbsp;toggles the corresponding pin.

Writing zeros to this register has no effect.

# INTENSET (0x08, 32 bits, Write Only)

Writing a 1 to any bit in this register enables the interrupt on the corresponding pin. When the value on this pin changes, the corresponding bit will be set in the **INTFLAG** register.

Writing zeros to this register has no effect.

# INTENCLR (0x09, 32 bits, Write Only)

Writing a 1 to any bit in this register disables the interrupt on the corresponding pin.

Writing zeros to this register has no effect.

# INTFLAG (0x0A, 32 bits, Read Only)

This register hold the status of all GPIO interrupts. When an interrupt fires, the corresponding bit in this register gets set. Reading this register clears all interrupts. **This will also reset the IRQ pin if it was configured.**

Writing to this register has no effect.

# PULLENSET&nbsp;(0x0B, 32 bits, Write Only)

Writing a 1 to any bit in this register&nbsp;enables the internal pullup or pulldown on the corresponding pin. The pull direction (up/down) is determined by the **GPIO** (output) value - if the corresponding GPIO register bit is low,&nbsp; its a pulldown. High, its a pullup.

Writing zeros to this register has no effect.

# PULLENCLR (0x0C, 32 bits, Write Only)

Writing a 1 to any bit in this register disables the&nbsp;pull up/down on the corresponding pin.

Writing zeros to this register has no effect.

# Adafruit seesaw

## UART

Warning: 

When the UART module is configured, the seesaw can act as an I2C UART bridge.

UART Pins are:

**RX: PA11**

**TX: PA10**

The module base register address for the UART is&nbsp; **0x02**.

Info: 

# Function Registers
# Status (0x00, 8bits, Read Only)

&nbsp;

The ERROR bit is set when the UART encounters an error.

The DATA\_RDY bit is set when there is data available in the RX buffer. This bit gets cleared when the data is read.

# INTEN (0x2, 8bits, Read/Write)

&nbsp;

If the DATA\_RDY bit is set, the interrupt will fire when there is data in the RX buffer.

Writing zeros to this register has no effect.

# INTENCLR (0x03, 8bits, Write Only)

same bits as INTEN. Writing 1 to any bit in this register disabled the corresponding interrupt.

Writing zeros to this register has no effect.

# BAUD (0x04, 32bits, Read/Write)

Writing to this register sets the BAUD rate.

**Default 9600**

# DATA (0x05, 32bytes, Read/Write )

Writing to the DATA register puts the data into the TX buffer to be output on the TX pin.

Reading from the DATA register reads the data from the RX buffer.

When this register is read, the DATA\_RDY bit is cleared.

# Adafruit seesaw

## PWM

This module provides support for Pulse Width Modulation (PWM) output.

# Nomenclature

The seesaw PWM Function Registers are defined using a generic nomenclature as follows:

- **PWM Number** - Specifies a specific PWM output (pin).
- **PWM Value** - Specifies the PWM **duty cycle**.
- **PWM Frequency** - Specifies the PWM **frequency**.

See the Port Specific Details section below for further information.

# Function Register Summary
# Function Register Description
## 0x01 - PWM\_VAL
Sets the **PWM Value** for a specified **PWM Number**. The first byte written is the **PWM Number**. The next two bytes are the 16 bit **PWM Value** , most significant byte (MSB) followed by least significant byte (LSB).

## 0x02 - PWM\_FREQ
Sets the **PWM Frequency** for a specified **PWM Number**. The first byte written is the **PWM Number**. The next two bytes are the 16 bit **PWM Frequency** , most significant byte (MSB) followed by least significant byte (LSB).

# Port Specific Details
## SAMD

PWM outputs are available on pins PA04, PA05, PA06, and PA07. The **PWM Number** for each is shown in the table below.

The full 16 bit **PWM Value** is used. This value should be an unsigned integer ranging from 0 for full off to 65535 for full on.

The **PWM Frequency** is a 16 bit unsigned integer value which specifies the frequency in hertz (Hz).

## ATtiny

The **PWM Number** is the Arduino GPIO pin number.

Currently, only the MSB of the 16 bit **PWM Value** is used. This is due to the 8 bit limit of analogWrite() used internally. However, a full 16 bit value should be sent from 0 for full off to 65535 for full on.

The **PWM Frequency** is a 16 bit unsigned integer value which specifies the frequency in hertz (Hz). ( **NOTE** : uses tone() internally)

# Adafruit seesaw

## Analog to Digital Converter

The ADC provides the ability to measure analog voltages at 10-bit resolution. The SAMD09 seesaw has 4 ADC inputs, the Attiny8x7 has 11 ADC inputs.

The module base register address for the ADC is&nbsp; **0x09**

Conversions can be read by reading the corresponding CHANNEL register.

When reading ADC data, there should be at least a 500 uS delay between writing the register number you would like to read from and attempting to read the data.

Allow a delay of at least 1ms in between sequential ADC reads on different channels.

## SAMD09 ADC channels are:
## ATtiny8x7 ADC channels are:

- Channel 0: PA4
- Channel 1: PA5
- Channel 2: PA6
- Channel 3: PA7
- Channel 6: PB5
- Channel 7: PB4
- Channel 10: PB1
- Channel 11: PB0
- Channel 18: PA1
- Channel 19: PA2
- Channel 20: PA3

([These are the same as the Arduino GPIO pin names for the ADCs in megaTinyCore](https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/ATtiny_x17.md))

# Function Registers
Info: 

# STATUS (0x00, 8bits, Read Only)

This register contains status information on the ADC

# &nbsp;

# INTENSET (0x02, 8bits, Write Only)

Writing a 1 to any bit in this register enables the corresponding interrupt.

Writing zeros to this register has no effect.

# INTENCLR (0x03, 8bits, Write Only)

Writing a 1 to any bit in this register enables the corresponding interrupt.

Writing zeros to this register has no effect.

# WINMODE (0x04, 8bits, Write Only)

Writing 1 to this register&nbsp;sets window control.

# WINTHRESH (0x05, 32bits, Write Only)

This register sets the threshold values for window mode.

# CHANNEL\_0 (0x07, 16bits, Read Only)

ADC value for channel 0

# CHANNEL\_1 (0x08, 16bits, Read Only)

ADC value for channel 1

# CHANNEL\_2 (0x09, 16bits, Read Only)

ADC value for channel 2

# CHANNEL\_3 (0x0A, 16bits, Read Only)

ADC value for channel 3

...

# CHANNEL\_20 (0x1B, 16bits, Read Only)

ADC value for channel 20

# Adafruit seesaw

## Interrupts

The seesaw has a configurable interrupt pin that can be triggered through various channels.

Once the interrupt is triggered, it can be only be cleared when the conditions&nbsp;of it's source module(s) have been met (e.g. data has been read, an interrupt has been cleared by reading an INTFLAG register).

See individual module sections for details on their available interrupt configurations.

The hardware interrupt pin is available on **PA08** ( **#8** )

# Adafruit seesaw

## EEPROM

The EEPROM module provides persistent storage of data across reboots.

On the SAMD09, there are **64 bytes** of _emulated_ EEPROM available for use. Byte 63 ( **0x3F** ) can be written to change the devices default I2C address.

On the ATtiny817, there are 128 bytes of actual EEPROM available for use. Byte 127 ( **0x7F** ) can be written to change the device's default I2C address.

The module base register address for the EEPROM module is&nbsp; **0x0D** &nbsp;

Info: 

# Function Registers
## SAMD09
## ATtiny817
# Adafruit seesaw

## NeoPixel

The seesaw has built in NeoPixel support for up to 170 RGB or 127 RGBW pixels. The output pin as well as the communication protocol frequency are configurable. _Note: older firmware is limited to 63 pixels max._

The module base register address for the NeoPixel module is&nbsp; **0x0E**.

# Function Registers
# PIN (0x01, 8bits, Write Only)

This register sets the pin number (PORTA) that is used for the NeoPixel output.

# SPEED (0x02, 8bits, Write Only)

The protocol speed.

**0x00 = 400khz**

**0x01 = 800khz (default)**

# BUF\_LENGTH (0x03, 16bits LE, Write Only)

the number of bytes currently used for the pixel array. This is dependent on when the pixels you are using are RGB or RGBW. 2 Bytes, little endian order

# BUF (0x04, 32 bytes, Write Only)

The data buffer. The first 2 bytes are the start address, and the data to write follows. Data should be written in blocks of maximum size 30 bytes at a time.

# SHOW (0x05, no args, Write Only)

Sending the SHOW command will cause the output to update. There's no arguments/data after the command

# Adafruit seesaw

## Encoder

This module provides incremental encoder support.

# Function Register Summary
More than one encoder can be supported. The upper 4 bits of the function register address specifies the function (summarized in table above) while the lower 4 bits indicates the encoder number, starting with 0 for the 1st encoder. For example, to read the position (0x30) of the 2nd encoder (0x01), the resulting function register address would be 0x31 (0x30 | 0x01).

# Function Register Description
## 0x00 - Status
Currently unused.

## 0x10 - Interrupt Set

Writing a 1 to any bit in this register will enable the interrupt for the specified encoder. The interrupt will fire when the encoder changes position.

## 0x20 - Interrupt Clear

Writing a 1 to any bit in this register will disable the interrupt for the specified encoder.

## 0x30 - Position
Reading this register returns the current encoder position. Writing to this register sets the current position to the specified value. The position value is a signed 32 bit integer.

## 0x40 - Delta
Reading this register returns the change (delta) in position, as a signed 32 bit integer value, since the last read. The delta will also be reset to zero.

# Adafruit seesaw

## Downloads

# Documents

- [Seesaw Arduino Driver](https://github.com/adafruit/Adafruit_Seesaw)
- [Seesaw CircuitPython Driver](https://github.com/adafruit/Adafruit_CircuitPython_seesaw)
- [Fritzing object in the Adafruit Fritzing library](https://github.com/adafruit/Fritzing-Library)
- [SAMD09 breakout PCB files (EAGLE format)](https://github.com/adafruit/Adafruit-SAMD09-Breakout-PCB/tree/master)
- [SAMD09 datasheet](https://cdn-learn.adafruit.com/assets/assets/000/047/797/original/Atmel-42414-SAM-D09_Datasheet.pdf?1509562415)

# Schematic

click to enlarge

![](https://cdn-learn.adafruit.com/assets/assets/000/047/799/medium800/sensors_schematic.png?1509562518)

# Dimensions

in inches. Click to enlarge

![](https://cdn-learn.adafruit.com/assets/assets/000/047/798/medium800/sensors_dimensions.png?1509562504)

# Adafruit seesaw

## Documentation

- [Python API Documentation](https://adafruit.github.io/Adafruit_Python_seesaw/classAdafruit__Seesaw_1_1seesaw_1_1Seesaw.html)
- [Arduino API Documentation](https://adafruit.github.io/Adafruit_Seesaw/html/annotated.html)


## Featured Products

### Adafruit Joy FeatherWing for all Feathers

[Adafruit Joy FeatherWing for all Feathers](https://www.adafruit.com/product/3632)
Make a game or robotic controller with this **Joy-** ful **FeatherWing**. This FeatherWing has a 2-axis joystick and 5 momentary buttons (4 large and 1 small) so you can turn your feather board into a tiny game controller. This wing communicates with your host...

In Stock
[Buy Now](https://www.adafruit.com/product/3632)
[Related Guides to the Product](https://learn.adafruit.com/products/3632/guides)
### Adafruit ATSAMD09 Breakout with seesaw

[Adafruit ATSAMD09 Breakout with seesaw](https://www.adafruit.com/product/3657)
Adafruit seesaw is a near-universal converter framework which allows you to add&nbsp;and extend hardware support to any I2C-capable microcontroller or microcomputer. Instead of getting separate I2C GPIO expanders, ADCs, PWM drivers, etc, seesaw can be configured to give a wide range of...

In Stock
[Buy Now](https://www.adafruit.com/product/3657)
[Related Guides to the Product](https://learn.adafruit.com/products/3657/guides)
### SEGGER J-Link EDU - JTAG/SWD Debugger

[SEGGER J-Link EDU - JTAG/SWD Debugger](https://www.adafruit.com/product/1369)
[Discontinued - **you can grab&nbsp;** SEGGER J-Link EDU Mini - JTAG/SWD Debugger **instead!**](https://www.adafruit.com/product/3571)

The SEGGER J-Link EDU is identical to the more expensive [J-Link BASE](https://www.adafruit.com/products/2209) model except...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1369)
[Related Guides to the Product](https://learn.adafruit.com/products/1369/guides)
### SEGGER J-Link EDU Mini - JTAG/SWD Debugger

[SEGGER J-Link EDU Mini - JTAG/SWD Debugger](https://www.adafruit.com/product/3571)
Doing some serious development on any ARM-based platform, and tired of 'printf' plus an LED to debug? A proper JTAG/SWD HW debugger can make debugging more of a pleasure and less of a pain. It allows you to program your devices at the click of a button, read or write memory addresses...

In Stock
[Buy Now](https://www.adafruit.com/product/3571)
[Related Guides to the Product](https://learn.adafruit.com/products/3571/guides)
### SEGGER J-Link BASE - JTAG/SWD Debugger

[SEGGER J-Link BASE - JTAG/SWD Debugger](https://www.adafruit.com/product/2209)
The SEGGER J-Link BASE is identical to the cheaper&nbsp;[J-Link EDU](https://www.adafruit.com/products/1369)&nbsp;model except for the **terms of use**.

If you're going to use your debugger strictly for personal, non-commercial projects, such as publishing...

In Stock
[Buy Now](https://www.adafruit.com/product/2209)
[Related Guides to the Product](https://learn.adafruit.com/products/2209/guides)
### 10-pin 2x5 Socket-Socket 1.27mm IDC (SWD) Cable - 150mm long

[10-pin 2x5 Socket-Socket 1.27mm IDC (SWD) Cable - 150mm long](https://www.adafruit.com/product/1675)
These little cables are handy when programming or debugging a tiny board that uses 10-pin 1.27mm (0.05") pitch SWD programming connectors. We see these connectors often on ARM Cortex dev kits, and have a few handy in our ARM-dev box. We thought you may want a backup cable as well, so now...

In Stock
[Buy Now](https://www.adafruit.com/product/1675)
[Related Guides to the Product](https://learn.adafruit.com/products/1675/guides)
### JTAG (2x10 2.54mm) to SWD (2x5 1.27mm) Cable Adapter Board

[JTAG (2x10 2.54mm) to SWD (2x5 1.27mm) Cable Adapter Board](https://www.adafruit.com/product/2094)
This adapter board is designed for adapting a 'classic' 2x10 (0.1"/2.54mm pitch) JTAG cable to a slimmer 2x5 (0.05"/1.27mm pitch) SWD Cable. &nbsp;It's helpful for using products like the [JTAGulator](https://www.adafruit.com/products/1550) or <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/2094)
[Related Guides to the Product](https://learn.adafruit.com/products/2094/guides)
### SWD (2x5 1.27mm) Cable Breakout Board

[SWD (2x5 1.27mm) Cable Breakout Board](https://www.adafruit.com/product/2743)
This adapter board is designed to make it easier to use ARM dev boards that use slimmer 2x5 (0.05"/1.27mm pitch) SWD cables for programming. &nbsp;It's helpful for using products like the [JTAGulator](https://www.adafruit.com/products/1550), <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/2743)
[Related Guides to the Product](https://learn.adafruit.com/products/2743/guides)

## Related Guides

- [Proper Debugging of ATSAMD21 Processors](https://learn.adafruit.com/proper-step-debugging-atsamd21-arduino-zero-m0.md)
- [How to Program SAMD Bootloaders](https://learn.adafruit.com/how-to-program-samd-bootloaders.md)
- [Bootloading Basics](https://learn.adafruit.com/bootloader-basics.md)
- [Adafruit nRF52 Pro Feather with Mynewt](https://learn.adafruit.com/adafruit-nrf52-pro-feather.md)
- [Programming an M0 using an Arduino](https://learn.adafruit.com/programming-an-m0-using-an-arduino.md)
- [Pip-Boy 2040 Wrist-Mounted Prop](https://learn.adafruit.com/pip-boy-2040.md)
- [Dotstar Featherwing in CircuitPython](https://learn.adafruit.com/dotstar-featherwing-in-circuitpython.md)
- [Debugging CircuitPython On SAMD w/Atmel Studio 7](https://learn.adafruit.com/circuitpython-samd-debugging-w-atmel-studio-7.md)
- [Introducing Adafruit ItsyBitsy M4](https://learn.adafruit.com/introducing-adafruit-itsybitsy-m4.md)
- [Programming Microcontrollers using OpenOCD on a Raspberry Pi](https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi.md)
- [Blinking an LED with the Zephyr RTOS](https://learn.adafruit.com/blinking-led-with-zephyr-rtos.md)
- [Debug Header for the Feather [M0]](https://learn.adafruit.com/make-a-simple-debugging-featherwing-for-the-m0.md)
- [Introducing the Adafruit nRF52840 Feather](https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather.md)
- [Getting Started with Microsoft Azure and CircuitPython](https://learn.adafruit.com/getting-started-with-microsoft-azure-and-circuitpython.md)
- [CLUE Altimeter](https://learn.adafruit.com/clue-altimeter.md)
