Skip to main content
Skip table of contents

Digital I/O Expander (SX1509)

This script operates an I/O expander over the I2C Bus. The I/O expander- the SX1509- has 16 channels, which can be configured for digital input or output (including PWM and specialized LED driver functions) and can be used to read a keypad.

The breakout board is available here: https://www.sparkfun.com/products/13601

The script below only uses the basic digital input and output functions of this device. This script can be modified to use other functionalities, such as the PWM driver or keypad engine. 

USER_RAM registers are read by the script to write values to the digital output lines, and a separate set of USER_RAM register is written to by the script to display the digital input states. 

A good understanding of the datasheet and device's functionality is important for understanding and modifying this example.

Before making the decision to use this device, keep in mind that the T7 has 23 DIO lines available.

The EB37 allows for easy prototyping of the entire circuit. The EB37 features a 3.3V regulator, which is being used to supply power to the digital I/O expander. The CB15 provides connection to the EIO lines. A python script was used to change the USER_RAM registers to sequence through all of the digital output pins, and then write them all high at once. 

This example can be found in our Kipling git repository:

https://github.com/labjack/labjack_kipling/tree/master/ljswitchboard-module_manager/lib/switchboard_modules/lua_script_debugger/premade_scripts/i2c/io-expander-sx1059.lua

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.