mirror of
https://github.com/esphome/esphome-docs.git
synced 2024-11-08 09:52:07 +01:00
63 lines
1.9 KiB
ReStructuredText
63 lines
1.9 KiB
ReStructuredText
PCF8574 I/O Expander
|
|
====================
|
|
|
|
The PCF8574 component allows you to use PCF8574 or PCF8575 I/O expanders
|
|
(`datasheet <http://www.ti.com/lit/ds/symlink/pcf8574.pdf>`__,
|
|
`Sparkfun`_) in esphomeyaml. It
|
|
uses :ref:`I²C Bus <i2c>` for communication.
|
|
|
|
Once configured, you can use any of the 8 pins (PCF8574) or 16 pins (PCF8575) as
|
|
pins for your projects. Within esphomelib they emulate a real internal GPIO pin
|
|
and can therefore be used with many of esphomelib's components such as the GPIO
|
|
binary sensor or GPIO switch.
|
|
|
|
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.
|
|
|
|
.. figure:: images/pcf8574-full.jpg
|
|
:align: center
|
|
:target: `Sparkfun`_
|
|
:width: 50.0%
|
|
|
|
PCF8574 I/O Expander. Image by `Sparkfun`_.
|
|
|
|
.. _Sparkfun: https://www.sparkfun.com/products/retired/8130
|
|
|
|
.. code:: yaml
|
|
|
|
# Example configuration entry
|
|
pcf8574:
|
|
- id: 'pcf8574_hub'
|
|
address: 0x21
|
|
pcf8575: False
|
|
|
|
# Individual outputs
|
|
switch:
|
|
- platform: gpio
|
|
name: "PCF8574 Pin #0"
|
|
pin:
|
|
pcf8574: pcf8574_hub
|
|
# Use pin number 0
|
|
number: 0
|
|
# One of INPUT, INPUT_PULLUP or OUTPUT
|
|
mode: OUTPUT
|
|
inverted: False
|
|
|
|
Configuration variables:
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
- **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``.
|
|
|
|
See Also
|
|
--------
|
|
|
|
- :ref:`i2c`
|
|
- :doc:`switch/gpio`
|
|
- :doc:`binary_sensor/gpio`
|
|
- :doc:`API Reference </api/misc/pcf8574>`
|
|
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/pcf8574.rst>`__
|