I recently embarked on a project to create a customizable RGB LED lighting system for my showcase, and I wanted to share my experience and setup with the community. This project combines a Wemos D1, ESPHome, and an RGB LED strip, and while it was a bit challenging at first, the results are truly stunning!
Project Overview
My goal was to have an RGB LED strip that not only turns on and off but also cycles through predefined colors when activated. I wanted each LED to display a specific color in a repeating pattern (e.g., red, blue, green, red, etc.). This would add a vibrant touch to my showcase, and I knew ESPHome would be the perfect tool for the job.
Challenges Faced
Initially, I struggled with getting the color pattern to work correctly. The LEDs would either stay off or not cycle through the colors as intended. After some research and trial and error, I realized the issue was with how the color transitions were being handled in the code. I needed to ensure that each LED was addressed individually and that the color sequence was properly programmed.
Solution and Code Configuration
Here’s the code I ended up using. It configures the RGB LED strip to cycle through colors when activated by a button press:
markdown
yaml
light:
-
platform: rgb
name: “Showcase - RGB”
id: light_rgb
red: output_component1
green: output_component2
blue: output_component3 -
platform: binary
name: “Showcase - UV”
id: light_uv
output: uvlight_output
output:
-
platform: esp8266_pwm
id: output_component1
pin: D7
max_power: 95% -
platform: esp8266_pwm
id: output_component2
pin: D5
max_power: 95% -
platform: esp8266_pwm
id: output_component3
pin: D0
max_power: 95% -
id: uvlight_output
platform: gpio
pin: D2
binary_sensor:
-
platform: gpio
pin: D3
mode: INPUT_PULLUP
inverted: true
name: “Showcase - UV Switch”
id: uv_switch
on_press:- light.toggle: light_uv
-
platform: gpio
pin: D4
mode: INPUT_PULLUP
inverted: true
name: “Showcase - RGB Switch”
id: rgb_switch
on_press:- light.toggle: light_rgb
Key Features
- Color Cycling: The LEDs cycle through a predefined color pattern when activated by a button press.
- Individual Control: Each LED can be controlled individually, allowing for complex color patterns.
- Energy Efficiency: The PWM outputs are set to 95% max power to ensure efficient operation.
Tips for Success
- Testing: Always test your setup in small sections before integrating everything. This helps identify and fix issues early.
- Documentation: Keep detailed notes of your wiring and code changes. This will save you time if you need to troubleshoot later.
- Community Support: Don’t hesitate to reach out to forums like this one for help. The community is incredibly supportive and knowledgeable.
Conclusion
This project was a great learning experience, and I’m thrilled with how it turned out. The RGB LED strip now adds a vibrant and dynamic element to my showcase, and it’s been a joy to use. I hope this guide helps others looking to achieve similar results with ESPHome and RGB LED strips!
If anyone has questions or suggestions for improvement, feel free to reach out. Happy coding and happy lighting! ![]()
![]()