PCA6416A I/O Expander

The PCA6416A component allows you to use PCA6416A or PCAL6416A I/O expanders in ESPHome. It uses I²C Bus for communication.

Once configured, you can use any of the 16 pins for your projects. Within ESPHome they emulate a real internal GPIO pin and can therefore be used with many of ESPHome’s components such as the GPIO binary sensor or GPIO switch.

Note

The 7 bit I²C device address ranges are:

  • PCA6416A: 0x20 to 0x21

  • PCAL6416A: 0x20 to 0x21

For the PCA6416A and PCAL6416A, the actual choice of the I²C device address depends on state of the address pin. Please refer to the individual datasheets linked at the bottom of the page for further details to set the address.

Up to two PCA6416A or PCAL6416A devices can reside on the same I²C bus.

The PCA6416A and PCAL6416A provide 16 bits of GPIO’s (pin numbers 0-15).

Only the PCAL6416A supports pull-up resistors.

Any option accepting a Pin Schema can theoretically be used, but some more complicated components that do communication through this I/O expander will not work.

# Example configuration entry
pca6416a:
  - id: 'pca6416a_device'
    address: 0x20

# Individual outputs
switch:
  - platform: gpio
    name: "PCA6416A Pin #0"
    pin:
      pca6416a: pca6416a_device
      # Use pin number 0
      number: 0
      # One of INPUT or OUTPUT
      mode:
        output: true
      inverted: false
# Example configuration entry
pca6416a:
  - id: 'pcal6416a_device'
    address: 0x20

# Individual outputs
switch:
  - platform: gpio
    name: "PCAL6416A Pin #0"
    pin:
      pca6416a: pcal6416a_device
      # Use pin number 0
      number: 0
      # One of INPUT, INPUT_PULLUP or OUTPUT
      mode:
        input: true
        pullup: true
      inverted: false

Configuration variables:

  • id (Required, ID): The id to use for this pca6416a component.

  • address (Optional, int): The I²C address of the driver. Defaults to 0x20.

Pin configuration variables:

  • pca6416a (Required, ID): The id of the pca6416a component of the pin.

  • number (Required, int): The pin number.

  • inverted (Optional, boolean): If all read and written values should be treated as inverted. Defaults to false.

  • mode (Optional, string): A pin mode to set for the pin at. One of INPUT or OUTPUT.

See Also