NodeMCU MQTT LED Strip Controller Build & Config How-To Videos

still missing something I believe

2019-11-06 22:00:31.676 [WARN ] [t.generic.ChannelStateTransformation] - Transformation service JSONPATH for pattern $.effect not found!

this is a openhab log

Transformations are applicable in Item and Sitemap element labels and inside DSL rules. The relevant transformation service needs to be installed via the paperUI before use. Be aware, that some Transformation services rely on transformation files, while others work by directly providing the transformation logic. Transformation files need to be placed in the directory $OPENHAB_CONF/transform .

Just install JSONPath Transformation on Paper UI…

got that but the strip is just not working. I can see stuff coming in on my MQTT server and reporting back

Just the led does not do anything

When I put the signal on D4 it turns on all the leds. Or at least the first 10. But after that it does not react to any commands. Although the command arrive at the mqtt server and the nodemcu is connected to the broker

Did you configure the proper number of leds? Do you use level shifter between the digital pin and the ledstrip command wire? You have to connect LV / GND, HV / GND and ESP’s pin and the led’s command wire to the level shifter. ESP’s uses 3.3V on digital pins, but the WS2812B needs 5V for command. Is the ledstrip WS2812B? And finally, there is a little cheat from the vendors, these controllers have many pins, but there is only a few usable unconditionally. I"ve got five different ledstrips controlled by wemos d1 minis and pro versions (with external wifi antenna). All of them works fine with this configuration.

I can just use the gpio to send the signal. Don’t need to have 5v at the signal. I power with a external powersupply which powers the esp on VIN.

I tried the ws2813 and now trying the ws2812b

I connected everything like described in the video.

Could it be a misconfig in the file above? I see the topic being hifi_led but in the things file its t-hLED

The configs are working fine, one thing is the thing’s name and another one the channel configuration, where have to use the proper name matching for mqtt. Somebody somewhere wrote that the 3.3V gpio is good for a really short ledstrips only what contains a few leds. Every element of this config must be on the same ground level for the proper signaling. That’s why it’s important to use a common power supply for the controller and the ledstrip also. The hot wire connects to the ledstrip’s positive leg, to the controller’s VIN and the level shifter’s HV leg. The ground goes to the GND on controller, both GND sides on the level shifter and the negative leg of the ledstrip. The data pin goes to the level shifter’s LVx leg, and the ledstrip’s command wire to the same, on the HVx leg.
I use this kind of level shifters:


When I boot up a controller, at the first time the led always starts in solid white at full brigthness when I turn on via the sitemap. After that I can set anything what this config allows. Believe me it works with a proper hardware.

really strange because when I use it with another microcontroller a Particle Argon for example. it works just fine. So not 100% sure its a electrical issue. I use a common 8watts psu. Always worked. this is now the first time a use a esp-12E wifi for this. And like I said if I use D4 all leds turn on. But when I then start doing something in the sitemap, nothing happens. When I check the logs I can see commands being send and I use MQTT FX to keep an eye on the topics…

Also the topic starter didn’t use a level shifter. Is that correct?

Did you use the esp-12e with success?

Unfortunately no, I never used nodemcu for this kind of project. I’ve just tried to compile the code with this board for you. Here is a youtube video, where the guy explains this project, he is a HomeAssistant fan, but the hardware and the code is the same. As far as I remember, Bartus moved this project to OH.

He speaks about the voltage levels, and about the math when you want to choose a right psu.

Cool thanks, But I test with 10led…thats not even working. I think the level shifter should not be the problem right?

And then there is this

UPDATE
The statement I made in this video about voltage drop on the data line isn’t exactly correct. The LED drivers are a shift register and the signal is amplified as it goes through the preceeding LED driver.
There is likely no theoretical maximum length for these digital LED strips. However, as the strip gets longer, it takes more time to transmit the signal and the refresh rate becomes slower. Thanks to @mitchese1 for pointing that out!

Yes, I think 10 leds have to work without level-shifter. I’ve made a theoratical test, I’ve compiled the code for a generic ESP8266 board with data_pin 14 (D5), but I had to write 14 instead of D5. With 14, the code compiled without any errors. As far as I remember, the D4 pin is used for built-in led also, what likes to flashing, when the controller connects to the wifi, so I think you could use an another one.

I use 5m ledstrip, as most longer one, with a 12A@5V psu, when I turn on full brightness white, the ledstrip is white until the half length, after that starts to turn into red until the end.

in his video he uses exact the same NodeMCU as the one that I have …so it should work

I have make this project to. It work fine for me on generic 8266. I modified code to use with Arduino Json v6 version of library and add some Air quality sensors and syslog messages instead of serials log.
This is my code. https://github.com/pistoletov1974/esp8266_mqttnode

If you have questions do not hesitate to ask.

your ino file is rather empty

ok I did exact the same thing. I selected generic esp8266 and selected pin 14 which is D5, So the solid colours are working now. Effect are not working, it just takes a solid green color… So there is something wrong there.

In the MQTT I see that openhab is just setting numbers. Like 5 – instead of json.

It means you are not use map file. Did you put the LEDStripEffectJSON_2.map to the transform folder? If you choose an effect on the sitemap, there is a mapping for show the textual value of the effect. But you need this map file for replacing the single number with a json format. You have to send {“effect”:“blendwave”} instead of 5 on mqtt. You should call the map file on the item:

String          hLED_FX            "Ledstrip FX [MAP(LEDStripEffectJSON_2.map)%s]" 

Did you install JSONPath Transformation on paper ui? Addons on the left, then transformations on the top.
With mqtt fx, you can send json strings to the ledstrip for testing purposes.

I tried sending the json via my mqtt tool and that works. Its openhab who is only sending the number of the effect. I install the jsonpath transformation in openhab

It seems I needed to install the MAP transformation also, not only the json map transformation

OK, it was a long time ago, when I put this together :).
The magic is happens in the rule instead of the item file, I’m sorry.

rule "hLED MQTT JSON effect rule"
    when Item hLED_FX received command
    then 
        val hledFX=transform("MAP","LEDStripEffectJSON_2.map", receivedCommand.toString)
        val actions = getActions("mqtt", "mqtt:broker:sentinel")
        actions.publishMQTT("hifi_led/set", hledFX)
        logInfo("Test", "Led FX command executed: " + hledFX)
end

When the item receives the effect’s number as a command, the hledFX value what will be transformed to the json format, and sends directly via mqtt. On the line “val actions = getActions(“mqtt”, “mqtt:broker:sentinel”)” you should use your mqtt broker name (my broker’s name is sentinel).
It uses MAP transform service, you should install it also. I think, this is the issue.

Yes, you preceded me :slight_smile:

thank you for all your help. Appreciate it. Thanks a milion