add documentation for component sn74hc595 (#637)

* add documentation for component sn74hc595

* fix references to pins

* add image and entry in index.rst

* add full size image
This commit is contained in:
phjr 2020-06-27 23:10:05 +02:00 committed by GitHub
parent a535231ae9
commit 0cc24a4aff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

62
components/sn74hc595.rst Normal file
View File

@ -0,0 +1,62 @@
SN74HC595 I/O Expander (shift register)
=======================================
.. seo::
:description: Instructions for setting up SN74HC595 shift registers as digital port expanders in ESPHome.
The SN74HC595 component allows you to use SN74HC595 shift registers as I/O expanders
(`datasheet <http://www.ti.com/lit/ds/symlink/sn74hc595.pdf>`__,
`SparkFun`_) in ESPHome. It uses 3 wires (optionally 4) for communication.
Once configured, you can use any of the 8 pins for your projects. Up-to 4 shift registers can be daisy-chained
to provide more pins, without using more GPIO pins on the controller.
Use of the OE pin is optional. If used, the pin should be pulled up externally.
.. figure:: images/sn74hc595-full.jpg
:align: center
:width: 80.0%
SN74HC595 I/O Expander (shift register).
.. _SparkFun: https://www.sparkfun.com/products/13699
.. code-block:: yaml
# Example configuration entry
sn74hc595:
- id: 'sn74hc595_hub'
data_pin: D5
clock_pin: D8
latch_pin: D7
oe_pin: D6
sr_count: 2
# Individual outputs
switch:
- platform: gpio
name: "SN74HC595 Pin #0"
pin:
sn74hc595: sn74hc595_hub
# Use pin number 0
number: 0
inverted: False
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
- **id** (**Required**, :ref:`config-id`): The id to use for this SN74HC595 component.
- **data_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 SER input.
- **clock_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 SRCLK pin
- **latch_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 RCLK pin
- **oe_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): Pin connected to SN74HC595 OE pin
- **sr_count** (*Optional*, int): Number of daisy-chained shift registers, up-to 4. Defaults to ``1``.
See Also
--------
- :doc:`switch/gpio`
- :doc:`binary_sensor/gpio`
- `Serial to Parallel Shifting-Out with a 74HC595 <https://www.arduino.cc/en/tutorial/ShiftOut>`
- :apiref:`sn74hc595/sn74hc595.h`
- :ghedit:`Edit`

BIN
images/sn74hc595.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -332,6 +332,7 @@ Misc Components
MCP230XX I/O Expander, components/mcp230xx, mcp230xx.svg
MCP3008 8-Channel 10-Bit A/D Converter, components/mcp3008, mcp3008.png
SX1509 I/O Expander, components/sx1509, sx1509.jpg
SN74HC595 I/O Expander, components/sn74hc595, sn74hc595.jpg
SIM800L, components/sim800l, sim800l.jpg
DFPlayer, components/dfplayer, dfplayer.svg
Captive Portal, components/captive_portal, wifi-strength-alert-outline.svg