Even before it became clear what the new feed-in tariffs would be after the abolition of the net metering scheme, I was already exploring home batteries. Initially, I mainly looked at the large fixed models such as the Sessy or Tesla Powerwall. But soon I became enthusiastic about another type: modular plug-in home batteries.
The big advantage? You can start small and expand your installation step by step. No hassle with installers or major adjustments to your meter box. Just plug & play. Exactly what I was looking for.
Unfortunately, the out-of-the-box support of RGB LED strips in Domoticz is disappointing. With this blog post I show you how you can implement RGB LED strips in your home automation system and smart home!
Switch on your RGB (W) LED strip, change the color and brightness from domoticz with the help of a simple circuit, WiFi and ESPeasy!
Requirements for connecting an RGB LED strip to an ESP8266
There are many types and sizes of LED strips for sale. Often they are 5 meter RGB LED strips. They are for sale at the discount supermarkets, bol.com and aliexpress. Nowadays they can be bought everywhere.
Example of my RGB LED strip that I use in combination with an ESP8266 and Domoticz
The content of the package often contains a plug adapter (Note! Not always, there are also only strips for sale, for example to expand your set that you already have!) And a control box with remote control with color presets. With the solution that we are going to make, we only need the LED strip and the adapter. The controls will run via domoticz, in combination with ESPeasy and WiFi. So, to control the LED strip with WiFi and add it to your (Domoticz) home automation system, you still need:
To order in China
Wemos D1 mini , an ESP8266 WiFi chip with USB2serial converter on a compact board. You only need to connect with USB, install software once (flashing). Then works completely via WiFi. Automatically goes into flash mode etc .. Remember that you need a micro USB cable .
Wemos D1 mini ESP8266
3 pieces of TIP31C transistors , one piece for each color. It is also handy to order cooling bodies. If you use an RGBW strip, then you need 4, if you have a warm white or another single color LED strip, then you only need 1 TIP31C transistor.
TIP31C Transistor 100V 3A
1x 12v -> 5v converter L7805 (CV). You will need this if you want to connect the ESP to the same power supply as the LED strip. In my case the LED strip was 12V DC with a maximum current of 3A so I chose the L7805. This voltage converter converts 12V to 5V, 1.2A on which the Wemos works. It does get a bit warm so it is best to order a cooling body for this too.
L7805CV voltage converter
Other components that might be handy
It is useful to solder male headers to the LED strip and female to the PCB. So you have a neat plug connection that you can disconnect for maintenance (firmware update) or solving other problems. You can also use screw terminals , but then you lose a little more space on your circuit board.
For the 12V connection it is nice if you can continue to use the existing plug on the adapter. You then need a DC PCB mount , if the plug and the PCB mount do not match, use screw terminals .
Screw terminals DC PCB Jack mount female
Make sure that the components can also handle the maximum current. A long LED strip can demand quite a bit of power! The above parts work well for a 12V RGB LED strip of 5 meters.
You also need some soldering equipment such as a piece of printed circuit board (grid 2.54 mm), tin, soldering iron, some wire and patience 🙂
Always check whether the functions (IN / OUT / GND) of your connection pins match the connection pins of the drawing above.
ESPeasy flashing on the Wemos D1 mini
To be able to control the RGB LED strip with WiFi and home automation, we are going to flash ESPeasy. With this you can easily operate and adjust everything.
Do you find compiling yourself too difficult? You can download a modified version here. This version I made for a Wemos D1 mini but also works for other modules that are based on a 4MB esp8266 (see comments). I am not responsible for any form of damage or brickening of your device!
The ESP uses PWM (Pulse Width Modulation) to control the levels of the colors.
Information
When we control the LED with a PWM signal, the LED will switch on and off at high speed. When the frequency used is high enough, the slowness of the eye will cause the LED to appear softer. (source: Wikipedia )
Why choose custom firmware?
With ESPeasy you can already send PWM commands out-of-the-box. You must give a separate command for each pin (= color):
IP address espeasy/control?Cmd=pwm,PIN,VALUE 0-255
for example, to enable pin 12 (that is, for example, red):
IP address espeasy /control?Cmd=pwm,12,255
off:
IP address espeasy /control?Cmd=pwm,12,0
To make white you have to give 3 commands (all 3 colors in full)
IP address espeasy /control?Cmd=pwm,12,255
IP address espeasy /control?Cmd=pwm,13,255
IP address espeasy /control?Cmd=pwm,14,255
So you have to send the value (0 to 255) per color via the URL. Because I want to adjust the colors with one click with domoticz I have to be able to adjust all colors at once with one URL. With the standard ESPeasy version, that is not possible without all kinds of scripts. That is why we have flashed the modified version.
Set RGB LED strip in ESPeasy
If the flashing and configuration of the modified version is successful, you can set ESPeasy to control the LED strip. How to do the basic settings read in my blog post “How to flash ESPeasy on a Wemos D1 mini” . Go to the ESPeasy page in your browser.
Click on the devices tab
Click on line 1 on Edit
At device choose RGB LED strip
Choose the RGB LED Strip Plugin
Enter the correct ports to which you have connected the colors.
Choose the correct GPIO ports per color
Also don’t forget to tick “enabled”. You do not have to enter “Send to controller”. That doesn’t work (yet).
Click submit
You can now control the LED strip via a URL command. A few examples: (replace the dots with the IP address of your ESP!)
LED strip off: ../control?cmd=RGB.0.0.0
Red: ../control?cmd=RGB.255.0.0
Green: ../control?cmd=RGB,0,255.0
Blue: ../control?cmd=RGB,0,0,255
White ../control?cmd=RGB.255,255,255
You can now make a color with one URL command instead of sending 3 separate commands. The first digit stands for Red, then Green, then Blue. With the value 0 the color is off, with the value 255 it is full on. This way you can mix the colors. You can make your own colors with the RGB color mixer at the bottom of this page !
Other RGB commands
The plugin that we use has support for even more commands! Below you can see a list:
CYCLE, <time 1-999> time for full color hue circle; 0 to return to normal mode
Add LED Strip to Domoticz
Domoticz has out-of-the-box support for RGB LED strips. That support seems nice, but it doesn’t work for a meter. The color is not stored in the database and is only sent to the device itself. We use a device that is not officially supported. That is why the command is not sent to the LED strip in the correct format, and then nothing happens. We also cannot build a script around it because the color is not saved. So we go to work ourselves, with a different approach.
Create a “Selector switch” dummy.
Domoticz selector switch
Go to the switch overview and click on customize and create (for example) the following options:
Selector overview with color LED strip
Off
Blue
Green
Red
White
Enter the following URLs as “script url”: (where the dots: http: // is your ip address of esp /)
If the range of your Zigbee coordinator is a bit disappointing, some sensors will be disconnected from your Zigbee network. Annoying, because you cannot receive information from those sensors. You can improve and enlarge the mesh through a device powered by 230v, such as a lamp. They also act as a Zigbee router and increase your reach and strengthen your mesh network, but it can also be done differently. With some cheap hardware and some free software.
To have a stable and reliable network of sensors and lamps, more and more people are using the affordable alternative to Zwave, Zigbee. By linking a Zigbee Gateway to domoticz you can easily use multiple systems from multiple manufacturers at the same time. Consider, for example, the Ikea Tradfri lamps, Philips Hue or Xiaomi Aqara sensors. You no longer need the expensive Bridges and gateways! In this blog post you can read how you can use the Zigate USB TTL stick in combination with a Synology NAS and home automation software domoticz.
Heeft iemand toevallig nog de aangepast file voor de Wemos D1? De link in het artikel werkt niet meer.
Hoi ernst, Bekijk eens de Nederlandse versie van dit artikel. Daarin staat hoe je de ledstrip met een colorpicker gebruikt.…
Goed artikel Helaas nog niet werkend in domoticz als RGB dimmer fuctie met color picker Wel heel duidelijke uitleg, maar…