I have been working at understanding how to add a custom component for controlling led strip sections with a 24 channel tlc5947 chip attached via SPI to an ESP32.
I feel like it should be quite easy as Adafruit has a library that could be used for communication.
Purley and simply I have not been able to get my head around adding such a thing even after reading the documentation many of times. Any help to get a better understanding would be very useful.
Anyone got an idea still not been able to create a working component for this.
I managed to get it working via an ESP8266 and one of those boards like the adafruit one. I had some trouble at first building ESPHome from my Raspberry Pi HA server but those were sorted as I upgraded to an RPi4. Here’s my ESPHome YAML (I may want to go the MQTT route but for now this works so here goes) :
esphome:
name: "tlc5947-unit1"
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Optional manual IP
manual_ip:
static_ip: 192.168.1.66
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "tlc5947-unit1"
password: "whatever" -------> insert yr own pwd here
# Example configuration entry
tlc5947:
data_pin: GPIO12 #DIN D6
clock_pin: GPIO14 #CLK D5
lat_pin: GPIO15 #LAT D8
# Individual outputs
output:
- platform: tlc5947
id: output_00
channel: 0
- platform: tlc5947
id: output_01
channel: 1
- platform: tlc5947
id: output_02
channel: 2
- platform: tlc5947
id: output_03
channel: 3
- platform: tlc5947
id: output_04
channel: 4
- platform: tlc5947
id: output_05
channel: 5
- platform: tlc5947
id: output_06
channel: 6
- platform: tlc5947
id: output_07
channel: 7
- platform: tlc5947
id: output_08
channel: 8
- platform: tlc5947
id: output_09
channel: 9
- platform: tlc5947
id: output_10
channel: 10
- platform: tlc5947
id: output_11
channel: 11
- platform: tlc5947
id: output_12
channel: 12
- platform: tlc5947
id: output_13
channel: 13
- platform: tlc5947
id: output_14
channel: 14
- platform: tlc5947
id: output_15
channel: 15
- platform: tlc5947
id: output_16
channel: 16
- platform: tlc5947
id: output_17
channel: 17
- platform: tlc5947
id: output_18
channel: 18
- platform: tlc5947
id: output_19
channel: 19
- platform: tlc5947
id: output_20
channel: 20
- platform: tlc5947
id: output_21
channel: 21
- platform: tlc5947
id: output_22
channel: 22
- platform: tlc5947
id: output_23
channel: 23
light:
- platform: monochromatic
output: output_00
name: "tlc5947-unit1-00"
- platform: monochromatic
output: output_01
name: "tlc5947-unit1-01"
- platform: monochromatic
output: output_02
name: "tlc5947-unit1-02"
- platform: monochromatic
output: output_03
name: "tlc5947-unit1-03"
- platform: monochromatic
output: output_04
name: "tlc5947-unit1-04"
- platform: monochromatic
output: output_05
name: "tlc5947-unit1-05"
- platform: monochromatic
output: output_06
name: "tlc5947-unit1-06"
- platform: monochromatic
output: output_07
name: "tlc5947-unit1-07"
- platform: monochromatic
output: output_08
name: "tlc5947-unit1-08"
- platform: monochromatic
output: output_09
name: "tlc5947-unit1-09"
- platform: monochromatic
output: output_10
name: "tlc5947-unit1-10"
- platform: monochromatic
output: output_11
name: "tlc5947-unit1-11"
- platform: monochromatic
output: output_12
name: "tlc5947-unit1-12"
- platform: monochromatic
output: output_13
name: "tlc5947-unit1-13"
- platform: monochromatic
output: output_14
name: "tlc5947-unit1-14"
- platform: monochromatic
output: output_15
name: "tlc5947-unit1-15"
- platform: monochromatic
output: output_16
name: "tlc5947-unit1-16"
- platform: monochromatic
output: output_17
name: "tlc5947-unit1-17"
- platform: monochromatic
output: output_18
name: "tlc5947-unit1-18"
- platform: monochromatic
output: output_19
name: "tlc5947-unit1-19"
- platform: monochromatic
output: output_20
name: "tlc5947-unit1-20"
- platform: monochromatic
output: output_21
name: "tlc5947-unit1-21"
- platform: monochromatic
output: output_22
name: "tlc5947-unit1-22"
- platform: monochromatic
output: output_23
name: "tlc5947-unit1-23"
And then in ESPHome just configure the newly discovered unit. I added a separate entry in the sidebar, and then when you edit that dashboard and add a card just select the newly created entity, tick the ''SELECT ALL" box and all 24 buttons are added just like that :
When you click on a button you get to see the dimmer functionality of that LED.
I have tested both the direct LED connection to the TLC5947-breakout-board using the ESP to power the LED, as well as as the external power supply option running that from from 5V all the way to 24V. All works well I find 12V a fine balance for the luminosity of my Niko 6-button pushbuttons.