Skip to content

SX1509 GPIO Extender

だから edited this page May 8, 2024 · 3 revisions

The PvBrain has 2 slots to use GPIO Extender SX1509.
The SX1509 manages I/O and PWM contacts and works in I2C.

It communicates via I2C.

  • SDA = GPIO8
  • SCL = GPIO9

Slot 0 is provided for the SX1509 with address 0x3E.
Slot 1 is provided for the SX1509 with address 0x3F.

Its configuration file is located in the pvbrain2/base folder and is included in the device_base.yaml package base.

In the device_sx1509.yaml it is defined like this:

sx1509:
  - id: sx1509_hub0
    address: 0x3E
    i2c_id: i2c1_bus
    
  - id: sx1509_hub1
    address: 0x3F
    i2c_id: i2c1_bus

  # - id: sx1509_hub2
  #   address: 0x70
  #   i2c_id: i2c1_bus

  # - id: sx1509_hub3
  #   address: 0x71
  #   i2c_id: i2c1_bus

Note

On the PvBrain Rev1.0, the top row of the SX1509-0 slot is not connected to the ESP!

Top Side Bottom Side With Pin Bottom Side no Pin

How to modify the address of the SX1509?

The change of address of the SX1509 is carried out on its lower side.

By default when nothing is done, its address is 0x3E.

To change address, it will be necessary, depending on the case, to cut the tracks connecting ADDx to GND.

The 4 possible addresses:

0x3E 0x3E
By default No cut or weld
0x3F 0x70 0x71
Cut and weld only ADD0 Cut and weld only ADD1 Cut and weld ADD0 and ADD1

In this example, the SX1509 is at address 0x3F:

Important

After your soldering, make sure using a multimeter in continuity mode that it is not connected to GND.
If the connection to GND is still present, cut the track that connects it again and retest for continuity.

Good to know :

The PvBrain already has a pullup on the I2C used by the SX1509.
But for your other projects, note that it is possible to activate an internal pullup by soldering these three points together:

Tip

... at the end:

To plug 4 SX1509 on the PvBrain, it is possible to use this tip:

Be careful, the !INT and !RST pins must not be soldered to the top card!