Comments: SX1509 I/O Expander Breakout Hookup Guide

Pages

Comments 9 comments

  • Hi there! I am using 3 of those boards to drive 36 LEDs in my Arduino Fibbonacci clock project. Used 5x shift registers 74HC595 before, but got those for the PWM ability, and I am loving them! I wrote the code, everything works. There is just one thing that bothers me. When powering up, Arduino connects with those boards and lights up all the LEDs with full power. I would really like to avoid it. I have checked the library files for that, cannot find it. If you guys could point me to the line in SparkFunSX1509.cpp that does it so I can // it out, or how to disable that somehow. Would appreciate any help, thanks in advance!! Pat

  • To use it with the particle photon what I have to do with the code and connecting ?

  • “VCC1 and VCC2 Jumpers

    SJ1 and SJ2 on the back-side of the board connect VCC2 and VCC1, respectively, to the 3V3 voltage supply input. So, if you’re delivering 3.3V to the board, each of the I/O banks will operate at 3.3V."

    I believe you mean SJ2 and SJ3 on the back-side of the board connect VCC1 and VCC2 respectively.

    Thanks,

    Jeffery

  • Has anyone used an SX1509 pin with a Neopixel?

    Preferably the FastLED library.

  • Steps how to use Sparkfun SX1509 C++ Library on raspberry pi

    you might be facing compilation errors when compiling SX1509 C++ library. Below are the few errors which i faced when compiling and steps to fix them.

    Prerequisites

    • Install wiringPi on raspberry Pi

    • Download the Sparkfun library from github

    To compile

    • g++ -c sx1509_registers.h SparkFunSX1509.h SparkFunSX1509.cpp -std=gnu++11 -lwiringPi -lpthread

    ERRORS

    sx1509_registers.h:142:1: error: ‘uint8_t’ does not name a type uint8_t REG_I_ON[16] = {REG_I_ON_0, REG_I_ON_1, REG_I_ON_2, REG_I_ON_3, ^ sx1509_registers.h:147:1: error: ‘byte’ does not name a type byte REG_T_ON[16] = {REG_T_ON_0, REG_T_ON_1, REG_T_ON_2, REG_T_ON_3, ^

    * Open the file sx1509_registers.h and replace "byte" with "unsigned char"
    * and execute the command above.
    * It should compile successfully and generate an object file "SparkFunSX1509.o" for you.
    

    Generate an archive library using “SparkFunSX1509.o”

    • ar rvs SparkFunSX1509.a SparkFunSX1509.o

    Compile the demo file available in the github

    * g++ main.cpp -o demo SparkFunSX1509.a -lwiringPi -lpthread -std=gnu++11
    

    Demo executable is generated now successfully. Now you can run it on raspberry pi and explore more capabilities of SX1509 I/O Expander Breakout board

  • Not clear on how to utilize and make calls if I’m using two or more SX1509 boards.

    Could someone provide a initialization and pin io example when using two or more boards?

    Is it as straightforward as: …

    const byte SX1509_ADDRESS1 = 0x3E; 
    const byte SX1509_ADDRESS2 = 0x3F; 
    SX1509 io1,io2; 
    if (!io1.begin(SX1509_ADDRESS1))
        {
        while (1)
        ;
        }
    if (!io2.begin(SX1509_ADDRESS2))
        {
        while (1)
        ;
        }
    

    … etc

    • Great question. I’m eager to hear the answer as well. Anyone?

    • It should be as simple as specifying the object:

      SX1509 io1, io2;
      io1.pinMode(SX1509_LED_PIN, OUTPUT);
      

      Would reference the first created object.

      No reason you can’t call them whatever you want, so this should work, too:

      SX1509 demo1;
      demo1.pinMode(SX1509_LED_PIN, OUTPUT);
      
  • the fritzing diagram for the io test is wrong, button is shown connected to pin 0, but the code says 7


If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!