SX1509 I/O Expander Breakout Hookup Guide
Is your Arduino running low on GPIO? Looking to control the brightness of 16 LEDs individually? Maybe blink or breathe a few autonomously? Want to delegate scanning an 8x8 matrix of 64 buttons to another controller? These are all tasks the for which the SX1509 16-IO Expander was made!
The SX1509 is a 16-channel GPIO expander with an I2C interface -- that means with just two wires, your microcontroller can interface with 16 fully configurable digital input/output pins.
But, the SX1509 can do so much more than just simple digital pin control. It can produce PWM signals, so you can dim LEDs. It can be set to blink or even breathe pins at varying rates. And, with a built-in keypad engine, it can interface with up to 64 buttons set up in an 8x8 matrix.
It's a really cool chip and a great tool for expanding the capability of your Arduino or any other I2C-capable microcontroller.
Covered In this Tutorial
This tutorial will serve to familiarize you with all things SX1509 and the SparkFun Breakout. Then we'll demonstrate how take advantage of all of the I/O expander's features using an Arduino-compatible microcontroller and our SX1509 Arduino Library.
The tutorial is split into the following sections:
- SX1509 Breakout Board Overview -- An overview of the features of the SX1509 and the SparkFun breakout.
- Hardware Assembly -- Tips and tricks for soldering headers or wires to the SX1509 Breakout.
- Installing the SparkFun SX1509 Arduino Library -- We've written an Arduino library to abstract all of the ugly register bit-operations.
- Example: Digital In/Out and PWM -- An example circuit and Arduino sketch demonstrating some of the simpler I/O expander features.
- Example: LED Driving -- Examples demonstrating how to autonomously blink and breathe LEDs.
- Example: Button Matrices -- How to use the SX1509's keypad engine to monitor a 12-button keypad.
Before delving into this tutorial, there are a few concepts you should already be somewhat familiar with. Check out these related tutorials:
- I2C Communication -- The SX1509 is controlled over an I2C interface. Learn all about this powerful 2-wire interface.
- Logic Levels -- While most Arduino's operate at 5V, the SX1509 works at 3.3V. The GPIO are, at least, 5V tolerant!
- Pulse-Width Modulation (PWM) -- All of the SX1509's output pins are capable of producing a PWM signal. That means you can control the brightness of LEDs!