esphome-docs/components/pcf8574.rst

69 lines
2.0 KiB
ReStructuredText
Raw Normal View History

2018-05-13 11:37:02 +02:00
PCF8574 I/O Expander
====================
2018-11-14 22:12:27 +01:00
.. seo::
2019-02-16 23:25:23 +01:00
:description: Instructions for setting up PCA8574 digital port expanders in ESPHome.
2018-11-14 22:12:27 +01:00
:image: pcf8574.jpg
:keywords: Xiaomi, Mi Flora, BLE, Bluetooth
2018-05-13 11:37:02 +02:00
The PCF8574 component allows you to use PCF8574 or PCF8575 I/O expanders
(`datasheet <http://www.ti.com/lit/ds/symlink/pcf8574.pdf>`__,
2019-02-16 23:25:23 +01:00
`Sparkfun`_) in ESPHome. It uses :ref:`I²C Bus <i2c>` for communication.
2018-05-13 11:37:02 +02:00
Once configured, you can use any of the 8 pins (PCF8574) or 16 pins (PCF8575) as
2019-02-16 23:25:23 +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
2018-05-13 11:37:02 +02:00
binary sensor or GPIO switch.
2018-06-01 18:10:00 +02:00
Any option accepting a :ref:`Pin Schema <config-pin_schema>` can theoretically be used, but some more
2018-05-13 11:37:02 +02:00
complicated components that do communication through this I/O expander will
not work.
2018-06-01 18:10:00 +02:00
.. figure:: images/pcf8574-full.jpg
:align: center
2018-06-08 11:46:57 +02:00
:width: 80.0%
2018-05-13 11:37:02 +02:00
2018-06-08 11:46:57 +02:00
PCF8574 I/O Expander.
2018-05-13 11:37:02 +02:00
.. _Sparkfun: https://www.sparkfun.com/products/retired/8130
.. code-block:: yaml
2018-05-13 11:37:02 +02:00
# Example configuration entry
pcf8574:
- id: 'pcf8574_hub'
address: 0x21
pcf8575: False
# Individual outputs
switch:
- platform: gpio
name: "PCF8574 Pin #0"
pin:
2018-05-14 21:15:49 +02:00
pcf8574: pcf8574_hub
# Use pin number 0
number: 0
2018-05-13 11:37:02 +02:00
# One of INPUT, INPUT_PULLUP or OUTPUT
2018-05-18 08:21:52 +02:00
mode: OUTPUT
2018-05-13 11:37:02 +02:00
inverted: False
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
2018-06-01 18:10:00 +02:00
- **id** (**Required**, :ref:`config-id`): The id to use for this PCF8574 component.
- **address** (*Optional*, int): The I²C address of the driver.
Defaults to ``0x21``.
- **pcf8575** (*Optional*, boolean): Whether this is a 16-pin PCF8575. Defaults to ``False``.
2018-05-13 11:37:02 +02:00
2018-06-01 18:10:00 +02:00
See Also
--------
- :ref:`i2c`
- :doc:`switch/gpio`
- :doc:`binary_sensor/gpio`
2018-08-24 22:44:01 +02:00
- `PCF8574 Arduino Library <https://github.com/skywodd/pcf8574_arduino_library>`__ by `Fabien Batteix <https://github.com/skywodd>`__
- :apiref:`io/pcf8574_component.h`
- :ghedit:`Edit`
2018-10-12 16:33:22 +02:00
.. disqus::