esphome-docs/components/pca9554.rst

94 lines
3.0 KiB
ReStructuredText
Raw Normal View History

2022-12-22 06:39:29 +01:00
PCA9554 I/O Expander
====================
.. seo::
:description: Instructions for setting up PCA9554, PCA9554A, PCA9536 digital port expanders in ESPHome.
2023-03-25 12:43:12 +01:00
:image: ../images/pca9554a.jpg
2023-03-25 12:43:12 +01:00
The PCA9554 component allows you to use **PCA9554**, **PCA9554A** or **PCA9536** I/O expanders in ESPHome.
2022-12-22 06:39:29 +01:00
It uses :ref:`I²C Bus <i2c>` for communication.
.. figure:: ../images/pca9554a.jpg
:align: center
PCA9554A I/O Expander chip
Once configured, you can use any of the **8** pins (PCA9554, PCA9554A) or **4** pins (PCA9536) as
2022-12-22 06:39:29 +01:00
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::
2022-12-22 06:39:29 +01:00
The 7 bit I²C device address ranges are:
2022-12-22 06:39:29 +01:00
- PCA9554: ``0x20`` to ``0x27``
- PCA9554A: ``0x38`` to ``0x3F``
- PCA9536: ``0x41``
2022-12-22 06:39:29 +01:00
For the PCA9554 and PCA9554A, the actual choice of the I²C device address depends on state of the 3 address pins.
2023-03-25 12:43:12 +01:00
Please refer to the individual datasheets linked at the bottom of the page for further details to set the address.
2022-12-22 06:39:29 +01:00
Up to eight PCA9554 and an additional eight PCA9554A devices can reside on the same I²C bus.
Please note that only one PCA9536 device is allowed per I²C bus due to its fixed address.
2022-12-22 06:39:29 +01:00
The PCA9554 and PCA9554A provide 8 bits of GPIO's (pin numbers 0-7).
The PCA9536 provides 4 bits of GPIO's (pin numbers 0-3).
2022-12-22 06:39:29 +01:00
Any option accepting a :ref:`Pin Schema <config-pin_schema>` can theoretically be used, but some more
complicated components that do communication through this I/O expander will not work.
2022-12-22 06:39:29 +01:00
.. code-block:: yaml
# Example configuration entry
pca9554:
- id: 'pca9554a_device'
address: 0x38
# Individual outputs
switch:
- platform: gpio
name: "PCF9554A Pin #0"
pin:
pca9554: pcf9554a_device
# Use pin number 0
number: 0
# One of INPUT or OUTPUT
mode:
output: true
inverted: false
2022-12-22 06:39:29 +01:00
Configuration variables:
************************
- **id** (**Required**, :ref:`config-id`): The id to use for this ``pca9554`` component.
2022-12-22 06:39:29 +01:00
- **address** (*Optional*, int): The I²C address of the driver.
Defaults to ``0x20``.
Pin configuration variables:
****************************
- **pca9554** (**Required**, :ref:`config-id`): The id of the ``pca9554`` component of the pin.
2022-12-22 06:39:29 +01:00
- **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
--------
- :ref:`i2c`
- :doc:`switch/gpio`
- :doc:`binary_sensor/gpio`
2023-03-25 12:43:12 +01:00
- `PCA9554 datasheet <https://www.ti.com/lit/ds/symlink/pca9554.pdf>`__
- `PCA9554A datasheet <https://www.ti.com/lit/ds/symlink/pca9554a.pdf>`__
- `PCA9536 datasheet <https://www.ti.com/lit/ds/symlink/pca9536.pdf>`__
2022-12-22 06:39:29 +01:00
- :apiref:`pca9554/pca9554.h`
- :ghedit:`Edit`