2019-02-27 10:10:09 +01:00
|
|
|
MY9231/MY9291 LED driver
|
|
|
|
========================
|
2018-11-13 16:51:42 +01:00
|
|
|
|
2018-11-14 22:12:27 +01:00
|
|
|
.. seo::
|
2019-02-27 10:10:09 +01:00
|
|
|
:description: Instructions for setting up MY9231 and MY9291 LED drives in ESPHome.
|
2018-11-19 18:32:16 +01:00
|
|
|
:image: my9231.png
|
2019-02-27 10:10:09 +01:00
|
|
|
:keywords: MY9231, MY9291, Sonoff B1, Ai-thinker AiLight WiFi light bulb, Arilux E27 Smart Bulb
|
|
|
|
|
|
|
|
.. _my9231-component:
|
|
|
|
|
2021-02-20 22:02:46 +01:00
|
|
|
Component/Hub
|
|
|
|
-------------
|
2019-02-27 10:10:09 +01:00
|
|
|
|
|
|
|
The MY9231/MY9291 component represents a MY9231/MY9291 LED diver chain
|
|
|
|
(`MY9231 description <http://www.my-semi.com.tw/file/MY9231_BF_0.91.pdf>`__,
|
|
|
|
`MY9291 description <http://www.my-semi.com.tw/file/MY9291_BF_0.91.pdf>`__) in
|
|
|
|
ESPHome. Communication is done with two GPIO pins (DI and DCKI) and multiple
|
|
|
|
driver chips can be chained. There are two models with different number of
|
|
|
|
output channels (MY9291 with 4 channels and MY9231 with 3 channels). They are
|
2020-05-10 21:27:59 +02:00
|
|
|
popular driver chips used in smart light bulbs:
|
2019-02-27 10:10:09 +01:00
|
|
|
|
|
|
|
- Sonoff B1 (MY9231)
|
|
|
|
- Ai-Thinker AiLight WiFi light bulb (MY9291)
|
|
|
|
- Arilux E27 Smart Bulb (MY9231)
|
|
|
|
|
|
|
|
To use the channels of this components, you first need to setup the
|
|
|
|
global ``my9231`` hub and give it an id, and then define the
|
|
|
|
:ref:`individual output channels <my9231-output>`.
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
# Example configuration entry
|
|
|
|
my9231:
|
|
|
|
- data_pin: GPIO12
|
|
|
|
clock_pin: GPIO14
|
|
|
|
|
|
|
|
# Individual outputs
|
|
|
|
output:
|
|
|
|
- platform: my9231
|
|
|
|
id: 'my9231_output1'
|
|
|
|
channel: 0
|
|
|
|
|
|
|
|
Configuration variables:
|
|
|
|
************************
|
|
|
|
|
|
|
|
- **data_pin** (**Required**, :ref:`config-pin_schema`): The pin which DI is connected
|
|
|
|
to.
|
|
|
|
- **clock_pin** (**Required**, :ref:`config-pin_schema`): The pin which DCKI is
|
|
|
|
connected to.
|
|
|
|
- **num_channels** (*Optional*, int): Total number of channels of the whole
|
|
|
|
chain. Must be in range from 3 to 1020. Defaults to 6.
|
|
|
|
- **num_chips** (*Optional*, int): Number of chips in the chain. Must be
|
|
|
|
in range from 1 to 255. Defaults to 2.
|
2020-02-09 14:12:30 +01:00
|
|
|
- **bit_depth** (*Optional*, int): The bit depth to use for all output
|
2019-02-27 10:10:09 +01:00
|
|
|
channels in this chain. Must be one of 8, 12, 14 or 16. Defaults to 16.
|
|
|
|
- **id** (*Optional*, :ref:`config-id`): The id to use for
|
|
|
|
this ``my9231`` component. Use this if you have multiple MY9231/MY9291 chains
|
|
|
|
connected at the same time.
|
|
|
|
|
2021-02-20 22:02:46 +01:00
|
|
|
|
|
|
|
.. _my9231-output:
|
|
|
|
|
|
|
|
Output
|
|
|
|
------
|
|
|
|
|
|
|
|
The MY931/MY9291 output component exposes a MY931/MY9291 channel of a global
|
|
|
|
:ref:`my9231-component` as a float output.
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
# Example configuration entry
|
|
|
|
my9231:
|
|
|
|
- data_pin: GPIO12
|
|
|
|
clock_pin: GPIO14
|
|
|
|
|
|
|
|
# Individual outputs
|
|
|
|
output:
|
|
|
|
- platform: my9231
|
|
|
|
id: 'my9231_output1'
|
|
|
|
channel: 0
|
|
|
|
|
|
|
|
Configuration variables:
|
|
|
|
************************
|
|
|
|
|
|
|
|
- **id** (**Required**, :ref:`config-id`): The id to use for this output component.
|
|
|
|
- **channel** (**Required**, int): Chose the channel of the MY9231/MY9291 chain of
|
|
|
|
this output component. Channel 0 is the most close channel.
|
|
|
|
- **my9231_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the
|
|
|
|
:ref:`my9231-component`.
|
|
|
|
Use this if you have multiple MY9231/MY9291 chains you want to use at the same time.
|
|
|
|
- All other options from :ref:`Output <config-output>`.
|
|
|
|
|
|
|
|
|
2019-02-27 10:10:09 +01:00
|
|
|
Sonoff B1 configuration example
|
|
|
|
-------------------------------
|
|
|
|
|
2020-05-10 21:27:59 +02:00
|
|
|
This component can be used with a Sonoff B1 smart light bulb. To flash
|
2019-02-27 10:10:09 +01:00
|
|
|
the Sonoff B1, open the plastic cover and connect/solder wires to the
|
|
|
|
PCB pads (3.3V, RX, TX, GND, GPIO0). If you connect GPIO0 to GND
|
|
|
|
during power up, the device enters flash mode. For more information
|
|
|
|
about flashing Sonoff devices, see:
|
|
|
|
:doc:`/devices/sonoff_s20`. All LEDs are connected to a
|
|
|
|
chain of two MY9321 chips that are connected to GPIO12 and GPIO14. A
|
|
|
|
complete configuration for a Sonoff B1 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>
|
|
|
|
|
|
|
|
my9231:
|
|
|
|
data_pin: GPIO12 # GPIO13 for AiLight
|
|
|
|
clock_pin: GPIO14 # GPIO15 for AiLight
|
|
|
|
num_channels: 6
|
|
|
|
num_chips: 2
|
2020-02-09 14:12:30 +01:00
|
|
|
bit_depth: 8
|
2019-02-27 10:10:09 +01:00
|
|
|
|
|
|
|
output:
|
|
|
|
- platform: my9231
|
|
|
|
id: output_blue
|
|
|
|
channel: 0
|
|
|
|
- platform: my9231
|
|
|
|
id: output_red
|
|
|
|
channel: 1
|
|
|
|
- platform: my9231
|
|
|
|
id: output_green
|
|
|
|
channel: 2
|
|
|
|
- platform: my9231
|
|
|
|
id: output_warm_white
|
|
|
|
channel: 4
|
|
|
|
- platform: my9231
|
|
|
|
id: output_cold_white
|
|
|
|
channel: 5
|
|
|
|
|
|
|
|
light:
|
|
|
|
- platform: rgbww
|
|
|
|
name: <LIGHT_NAME>
|
|
|
|
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: 2800 K
|
|
|
|
|
2020-06-14 00:50:17 +02:00
|
|
|
And here is a complete configuration for the AiThinker AiLight:
|
|
|
|
|
|
|
|
.. 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>
|
|
|
|
|
|
|
|
my9231:
|
|
|
|
data_pin: GPIO13
|
|
|
|
clock_pin: GPIO15
|
|
|
|
num_channels: 4
|
|
|
|
num_chips: 1
|
|
|
|
bit_depth: 8
|
|
|
|
|
|
|
|
output:
|
|
|
|
- platform: my9231
|
|
|
|
id: output_red
|
|
|
|
channel: 3
|
|
|
|
- platform: my9231
|
|
|
|
id: output_green
|
|
|
|
channel: 2
|
|
|
|
- platform: my9231
|
|
|
|
id: output_blue
|
|
|
|
channel: 1
|
|
|
|
- platform: my9231
|
|
|
|
id: output_cold_white
|
|
|
|
channel: 0
|
|
|
|
|
|
|
|
light:
|
|
|
|
- platform: rgbw
|
|
|
|
name: <LIGHT_NAME>
|
|
|
|
red: output_red
|
|
|
|
green: output_green
|
|
|
|
blue: output_blue
|
|
|
|
white: output_cold_white
|
|
|
|
|
|
|
|
|
2018-11-13 16:51:42 +01:00
|
|
|
See Also
|
|
|
|
--------
|
|
|
|
|
2019-02-07 13:54:45 +01:00
|
|
|
- :doc:`/components/output/index`
|
|
|
|
- :doc:`/components/output/esp8266_pwm`
|
|
|
|
- :doc:`/components/output/ledc`
|
|
|
|
- :doc:`/components/light/monochromatic`
|
|
|
|
- :doc:`/components/fan/speed`
|
|
|
|
- :doc:`/components/power_supply`
|
2019-05-12 22:44:59 +02:00
|
|
|
- :apiref:`my9231/my9231.h`
|
2018-11-13 16:51:42 +01:00
|
|
|
- `MY92XX LED driver library for Arduino AVR and ESP8266 <https://github.com/xoseperez/my92xx>`__ by `@xoseperez <https://github.com/xoseperez>`__
|
2019-02-07 13:54:45 +01:00
|
|
|
- :ghedit:`Edit`
|