esphome-docs/components/output/sm16716.rst
2021-12-02 17:10:24 +13:00

189 lines
5.3 KiB
ReStructuredText

SM16716 LED driver
==================
.. seo::
:description: Instructions for setting up SM16716 LED drivers in ESPHome.
:image: sm16716.svg
:keywords: SM16716, Feit Electric A19 Smart WiFi Bulb, Merkury Innovations A21 Smart Wi-Fi Bulb
.. _sm16716-component:
Component/Hub
-------------
The SM16716 component represents a SM16716 LED diver chain
(`SM16716 description <https://github.com/sowbug/sm16716/blob/master/SM16716%20Datasheet%20%5BChinese%5D.pdf>`__,
`SM16716 description <https://github.com/sowbug/sm16716/blob/master/SM16716%20Datasheet%20%5BChinese%5D.pdf>`__) in
ESPHome. Communication is done with two GPIO pins (MOSI and SCLK) and multiple
driver chips can be chained. It is used in some smart light bulbs:
- Feit Electric A19 Smart WiFi Bulb
- Merkury Innovations A21 Smart Wi-Fi Bulb
To use the channels of this components, you first need to setup the
global ``sm16716`` hub and give it an id, and then define the
:ref:`individual output channels <sm16716-output>`.
.. code-block:: yaml
# Example configuration entry
sm16716:
data_pin: GPIO14
clock_pin: GPIO4
num_channels: 3
num_chips: 1
# Individual outputs
output:
- platform: sm16716
id: output_red
channel: 0
- platform: sm16716
id: output_green
channel: 1
- platform: sm16716
id: output_blue
channel: 2
Configuration variables:
************************
- **data_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin used for MOSI.
- **clock_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin which SCLK is
connected to.
- **num_channels** (*Optional*, int): Total number of channels of the whole
chain. Must be in range from 3 to 255. Defaults to 3.
- **num_chips** (*Optional*, int): Number of chips in the chain. Must be
in range from 1 to 85. Defaults to 1.
- **id** (*Optional*, :ref:`config-id`): The id to use for
this ``sm16716`` component. Use this if you have multiple SM16716 chains
connected at the same time.
.. _sm16716-output:
Output
------
The SM16716 output component exposes a SM16716 channel of a global
:ref:`sm16716-component` as a float output.
.. code-block:: yaml
# Example configuration entry
sm16716:
data_pin: GPIO14
clock_pin: GPIO4
num_channels: 3
num_chips: 1
# Individual outputs
output:
- platform: sm16716
id: output_red
channel: 0
- platform: sm16716
id: output_green
channel: 1
- platform: sm16716
id: output_blue
channel: 2
Configuration variables:
************************
- **id** (**Required**, :ref:`config-id`): The id to use for this output component.
- **channel** (**Required**, int): Chose the channel of the SM16716 chain of
this output component.
- **sm16716_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the
:ref:`sm16716-component`.
Use this if you have multiple SM16716 chains you want to use at the same time.
- All other options from :ref:`Output <config-output>`.
Feit Electric A19 Smart WiFi Bulb
---------------------------------
This component can be used with a Feit Electric A19 smart light bulb. You can use
tuya-convert to flash the bulb. The cold white LEDs are connected to PWM1 and the
warm white LEDs are connected to PWM2. The RGB LEDs are connected to a SM16716
chip that is connected to GPIO4 for clock, GPIO14 for data, and GPIO13 for power.
A complete configuration for a Feit Electric A19 looks like:
.. code-block:: yaml
esphome:
name: <NAME_OF_NODE>
platform: ESP8266
board: esp01_1m
wifi:
ssid: <YOUR_SSID>
password: <YOUR_WIFI_PASSPHRASE>
api:
logger:
ota:
password: <YOUR_OTA_PASSWORD>
sm16716:
data_pin: GPIO14
clock_pin: GPIO4
num_channels: 3
num_chips: 1
output:
- platform: sm16716
id: output_red
channel: 0
power_supply: rgb_power
- platform: sm16716
id: output_green
channel: 1
power_supply: rgb_power
- platform: sm16716
id: output_blue
channel: 2
power_supply: rgb_power
- platform: esp8266_pwm
id: output_cold_white
pin: GPIO5
- platform: esp8266_pwm
id: output_warm_white
pin: GPIO12
light:
- platform: rgbww
name: ${friendly_name}
id: light
red: output_red
green: output_green
blue: output_blue
cold_white: output_cold_white
warm_white: output_warm_white
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K
power_supply:
- id: rgb_power
pin: GPIO13
.. note::
The white LEDs are much brighter than the color LEDs and will fully overpower
the set color when the white level is set even a little bit high. You will need
to set the white level to 0 in order to get usable colors from this bulb.
See Also
--------
- :doc:`/components/output/index`
- :doc:`/components/output/esp8266_pwm`
- :doc:`/components/light/rgb`
- :doc:`/components/light/rgbw`
- :doc:`/components/light/rgbww`
- :doc:`/components/power_supply`
- :apiref:`output/sm16716_output_component.h`
- `An Arduino controller for SM16716-based LED strings. <https://github.com/sowbug/sm16716>`__ by `@snowbug <https://github.com/sowbug>`__
- :ghedit:`Edit`