The SX1509 Breakout is a convenient solution for expanding the number of input/output (I/O) pins available on a microcontroller. Based on the Semtech SX1509 chip, this breakout board allows users to add 16 additional I/O pins through a simple I2C interface, which requires only two pins on the microcontroller. This component is particularly useful in projects where there is a need to control a large number of LEDs, buttons, or other digital devices, and it is commonly used with platforms like Arduino, Raspberry Pi, and others.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (1.2V to 3.6V) |
2 | GND | Ground connection |
3 | SDA | I2C Data line |
4 | SCL | I2C Clock line |
5 | INT | Interrupt output (active low) |
6-21 | IO0-IO15 | Bidirectional I/O pins |
Powering the SX1509: Connect the VCC pin to a power supply within the range of 1.2V to 3.6V and the GND pin to the ground.
Connecting to a Microcontroller:
Address Selection: The SX1509 supports multiple I2C addresses. Set the address by connecting the ADDR pins according to the datasheet.
Initialization: Initialize the SX1509 in your microcontroller's setup routine.
Configuration: Configure the I/O pins as either inputs or outputs depending on your application.
#include <Wire.h>
#include <SparkFunSX1509.h> // Include SX1509 library
// Create an SX1509 object
SX1509 io;
void setup() {
Wire.begin(); // Start I2C
if (!io.begin(0x3E)) { // Start SX1509 at I2C address 0x3E
Serial.println("SX1509 not found. Please check wiring.");
while (1);
}
// Configure pin 7 as an output
io.pinMode(7, OUTPUT);
}
void loop() {
// Blink LED on pin 7
io.digitalWrite(7, HIGH); // Turn on LED
delay(500);
io.digitalWrite(7, LOW); // Turn off LED
delay(500);
}
Q: Can I use the SX1509 with a 5V microcontroller? A: Yes, but ensure that the SX1509's VCC is connected to a voltage within its range (1.2V to 3.6V), and use level shifters for the I2C lines if necessary.
Q: How many SX1509 boards can I chain together? A: You can chain multiple boards by setting unique I2C addresses for each SX1509 using the ADDR pins.
Q: Is it possible to use the PWM functionality on all pins? A: Yes, all 16 I/O pins of the SX1509 support 8-bit PWM output.