I am working on a wall art piece of an old Ford pickup truck, and lighting the grill, headlights and signal lights.
I am using the AC/DC 4-ch relay board with am ESP8266.
I figured I’d load the whole project here in case someone wants to refer to any piece of it, but I do have a question at the end…
Some pics:
Half way into the project, realized the board is not the most ideal for this project.
ESP8266 does not suppoer Fastled_clockless in ESPHome, so stuck with neopixelbus, which also does not support WS2815.
So I am back to 5V WS2812b strip, which is a lot of power. So be it. Just in case someone is thinking about using the board for lighting, know the limitations.
I printed a nice case for it courtesy of dewgenenny on printables (link here)
And here is the backside for now. Only setup the strip, waiting on 5V bulbs for the signals and 5V white strip for the headlight halo.
Once setup, I plan on reducing the LED brightness in code and going with a smaller power supply.
Here is the code:
#Name the Project here to dentify the specific node
substitutions:
project: Ford Truck Art Light
id: ford-truck-art-light
#Include the board used
<<: !include common/esphome/esp8266.yaml
#include common Wifi-OTA-API, etc
<<: !include common/common.yaml
binary_sensor:
#Include the status
- !include common/binary_sensors/status.yaml
power_supply:
id: power_supply_id
pin: GPIO13
enable_time: 500ms
keep_on_time: 250ms
switch:
#Include restart button
- !include common/switches/restart.yaml
- platform: gpio
name: $project - Headlight
pin: GPIO16
- platform: gpio
name: $project - Left Signal
pin: GPIO14
- platform: gpio
name: $project - Right Signal
pin: GPIO12
sensor:
#Include wifi signal sensor
- !include common/sensors/wifi_signal.yaml
- !include common/sensors/uptime.yaml
output:
# Register the blue LED as a dimmable output ....
- platform: esp8266_pwm
id: blue_led
pin: GPIO5
inverted: true
# Configure WS2812
light:
# ... and then make a light out of it.
- platform: monochromatic
name: "Traffic Light Controller LED"
output: blue_led
internal: true
- platform: neopixelbus
variant: WS2812X
id: ford_truck_art_grill_light
pin: GPIO4
power_supply: power_supply_id
num_leds: 275
type: GRB
name: $project Grill Light
default_transition_length: 0s
#color_correct: [50%, 50%, 50%]
restore_mode: ALWAYS_OFF
effects:
- addressable_rainbow:
- addressable_color_wipe:
- flicker:
- strobe:
- random:
- addressable_scan:
- addressable_twinkle:
- addressable_random_twinkle:
- addressable_fireworks:
- addressable_flicker:
- addressable_rainbow:
name: Rainbow Effect With Custom Values
speed: 10
width: 50
# LED programmed to know if it is connected to wifi or if it’s also connected to HA.
# “Wifi only”: Steady Flashing
# "HA Connected" Fast Flashing
interval:
- interval: 1s
then:
if:
condition:
wifi.connected:
then:
- if:
condition:
api.connected:
then:
- output.turn_on: blue_led
- delay: 200ms
- output.turn_off: blue_led
- delay: 200ms
else:
- output.turn_on: blue_led
- delay: 500ms
- output.turn_off: blue_led
- delay: 500ms
else:
- output.turn_off: blue_led
Now the question. I have the relay programmed as a power supply for the LED strip, so it turns on before the output for the LED is needed, and turns off when the LEDs are off. Save power.
However, when I select a few patterns that have some “blinking”, like fireworks or twinkle, the relay turns on and off as the patterns runs, messing it up.
Is there a workaround I am missing? So the relay stays on through any pattern, and only turns off when the actual off button is turned off in Home Assistant?