WLED icon indicating copy to clipboard operation
WLED copied to clipboard

Support for solid RGBW LED strips

Open Def3nder opened this issue 7 years ago • 38 comments

Hi Aircooookie,

thx fir this awesome project - it's amazing!

I have quite a lot of non-digital LED strips attached to MagicHome Adapters re-flashed with Tasmota. Unfortunately beside a simple "color-change" there is no single effect available.

I think some of the effects in WLED would look good on single colour strips as well (like rainbow or breath etc.).

Do you think it would be possible to use WLED with an analogue 3 pin RGB strip (+ the common cathode) ?

The NeoPixelBus library does hide so much so that I could not find the point in the code where the colour(s) is passed to the PIN.

I would love to use WLED for the analogue RGB strips.

Greetings from Berlin, Def3nder

Def3nder avatar Oct 18 '19 23:10 Def3nder

Same for me too! I have 3 Magic home controllers with fixed RGB strips (non-addressable) running some custom MQTT code. But would love them all to be Wled. I really like it.

Philje123 avatar Oct 19 '19 08:10 Philje123

Guys you can't have effects like rainbow on non-addressable strips. Imagine that on electricity level. You can only control each color on whole strip, not single diode without led-IC that controls it. Just buy addressable strips and you are done, they are pretty cheap. WLED project is only for addressable led strips, so the neopixelbus library, so the ws2812fx library.

theshadowsvk avatar Oct 19 '19 09:10 theshadowsvk

Sure, you can. Just define a WLED strip with a single pixel - all you can do with that can get done with an non-addressable strip, too. You will have one colour on the whole strip, but iterating through rainbow colours or having the brightness changing like the breath effect would be cool.

Def3nder avatar Oct 19 '19 22:10 Def3nder

I think the way implementing this could bei tweaking the NeoPixelBus Library to offer another hardwsre type and add the logic to drive the three pins there... What do you think?

Def3nder avatar Oct 19 '19 22:10 Def3nder

That's not the way it works. It can behave like single pixel cause it is analog. It lacks the IC which controls the chip, wled project,neopixelbus library etc sends data to this IC, it is data stream. And one IC cant control the whole led strip if you add one external like ws2811.

theshadowsvk avatar Oct 19 '19 23:10 theshadowsvk

This will do what you want:-

http://www.freetronics.com.au/freenfet3

Schematic / PCB files here:-

https://github.com/freetronics/FREENFET3

creativeretail avatar Oct 20 '19 14:10 creativeretail

@Def3nder this is a Duplicate of #58 Please see that issue for info on to make this work for you

brentbrooks70 avatar Oct 21 '19 20:10 brentbrooks70

@Def3nder this is a Duplicate of #58 Please see that issue for info on to make this work for you

@brentbrooks70 Thx - this looks exactly what I was looking for - I will try it and post my results here for reference.

Def3nder avatar Oct 22 '19 11:10 Def3nder

@Aircoookie : I saw you yesterday on Youtube in the Video-Chat with DrZzs and you mentioned the (analog) RGB strips and asked yourself "Why should anybody want to use analog RGB strips ?". Normaly you're totally wright: the WS281x or SK6812 strips are way better but there is one big advantage of the old analog ones:

  1. they are much brighter when you compare at price level you can get a 12V 5m RGBWW strip with 60 Pixel per meter for the same price of a 5V 5m WS2812B strip and the later one is far less bright.

So, if you don't want an "effekt light" but rather want to have another lightsource, this is more effective.

I have a 7m long Aluminium profile attached right below the ceiling in my daughter's room with 12V RGBWW strips in it and the light is as bright as 200W (old) halogen light. She uses it for reading and additional lighting in gernal and I use it (controlled from Home Assistant) to display a color that tells her how much time is left in the morning: green = keep laying in the beed, yellow = time to stand-up, red = time to hurry up and begin with breakfast.

Right now I use Tasmota for this, but WLED is way more cooler ! So my goal is to get WLED running with analog 5-PIN RGBW strip, too.

I made the first tests to get (analog) solid color strips to work and basically is does work (with some restrictions - see below). I made the following insertions in npbWrapper.h: void Begin(NeoPixelType type, uint16_t countPixels) { [...] //init PWM pins pinMode(5, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); pinMode(15, OUTPUT); analogWriteRange(255); analogWriteFreq(880); } } void SetRGBPWM(uint8_t r, uint8_t g, uint8_t b, uint8_t w) { analogWrite(5, r); analogWrite(12, g); analogWrite(13, b); analogWrite(15, w); }

void SetPixelColor(uint16_t indexPixel, RgbColor color) { if (indexPixel == 0) //5050 strip is first pixel { SetRGBPWM(color.R, color.G, color.B, 0); } [...] }

void SetPixelColor(uint16_t indexPixel, RgbwColor color) { if (indexPixel == 0) //5050 strip is first pixel { SetRGBPWM(color.R, color.G, color.B, color.W); } [...] }

With this the RGBW Color is set to the four ESP PINs, but:

  • the master brightness-slider does not work as expected.

You need to set master brightness to MAX and then choose the color with the RGB color wheel. This way you can get dimmed colors with effect "Solid Color".

But if you want to use other effects they will always run at 100% brightness no matter what is used in the master slider.

I will try to peek the NeoPixel Brightness and multiply it with the RGBW-Values next time ...

Does anybody have other ideas ?

Def3nder avatar Oct 28 '19 09:10 Def3nder

I use it (controlled from Home Assistant) to display a color that tells her how much time is left in the morning: green = keep laying in the beed, yellow = time to stand-up, red = time to hurry up and begin with breakfast.

:-)

raoulteeuwen avatar Oct 28 '19 18:10 raoulteeuwen

@Def3nder that's a fair point with the higher brightness/lower cost of analog strips!

About the brightness slider not working, this is to be expected since that is handled by the NeoPixelBus driver library. We can easily implement the brightness ourselves though (with this it might even make sense to use 10bit instead of 8bit analog resolution, don't know if that makes a difference). First of all, make a new byte bright; var in the top of NpbWrapper. In the SetRGBPWM then put:

uint16_t rt = (r*bright) >> 8;
uint16_t gt = (g*bright) >> 8;
uint16_t bt = (b*bright) >> 8;
uint16_t wt = (w*bright) >> 8;
analogWrite(5, rt);
analogWrite(12, gt);
analogWrite(13, bt);
analogWrite(15, wt);

and in the setBrightness just add bright = b. Hope it works fine! (and I believe i will make analog LED PWM outputs available with a simple #define, making them officially supported)

Aircoookie avatar Oct 28 '19 23:10 Aircoookie

@Aircoookie I looked at this yesterday and found a similar solution - I did out the call to SetRGBPWM into the show() function. This way the brightness does work while using the effects, too.

I used the color of the first LED for the strip: RgbwColor colorW = _pGrbw->GetPixelColor(0); byte b = _pGrbw->GetBrightness(); SetRgbwPwm(colorW.R * b / 255, colorW.G * b / 255, colorW.B * b / 255, colorW.W * b / 255);

As the NeoPixels can only display 255 levels of brightness, I set the analog range to 255 steps, too: analogWriteRange(255);

Maybe you can put this (or your logic - it does not matter to me) into the master branch ? https://gist.github.com/Def3nder/2bd20d76fda6f3157f4ee4eed89cf35c

If you need someone to test the code, I can do this :-)

Def3nder avatar Oct 29 '19 09:10 Def3nder

...I've added the code to a new branch of a fork: https://github.com/Def3nder/WLED/commit/d1c289b709f0f9137180f8ff02ad5662f363b883

Def3nder avatar Nov 06 '19 12:11 Def3nder

This looks exactly what I need. I have some solid strips already installed and don't need some fancy effects but would love to utilize them via wled. Question is, can I flash this onto some of these controllers? https://github.com/arendst/Tasmota/wiki/MagicHome-with-ESP8285 I managed to compile it with the modification of @Def3nder and was able to flash it via nodemcu flasher. I see the wled hotspot, can connect to it but won't get a proper webif. Do i need to mod the code for the ESP8285 on this controller? These are pretty cheap and come in a nice package, so pretty ideal for the job. Sorry if this might a little oftopic but I'm kinda new to this.

rantanlan avatar Nov 14 '19 16:11 rantanlan

Hi @mason-xx , yes, I do have some of them in use, too. I would suggest to get the one with RGBW and IR (U can use them for both RGB and RGBW) - I did get mines here: https://www.aliexpress.com/item/32884865866.html

They run perfectly with the modified WLED.

There are two basically different versions out there: one with RGB only and another one with RGBW.

I have some with RGBW in use - to get the right colors from Alexa there are some additional changes necessary - if you want RGBW to drive, have a look here: https://github.com/Aircoookie/WLED/issues/315

Let me know if you have any problems.

Def3nder avatar Nov 15 '19 10:11 Def3nder

Thanks for the answer @Def3nder I wasn't able to get it up at all and went the esphome route. For the simple task of on/off and color change it works very well. and since I already had 3 of the RGB ones in use it won't justify a new purchase. I'll get back to WLED for the ws812b led ones.

rantanlan avatar Nov 15 '19 18:11 rantanlan

I would love to see this included in the basic firmware as i have many analog strips and would love that they can work with the digital ones

gijsje avatar Nov 17 '19 19:11 gijsje

Hi @mason-xx , yes, I do have some of them in use, too. I would suggest to get the one with RGBW and IR (U can use them for both RGB and RGBW) - I did get mines here: https://www.aliexpress.com/item/32884865866.html

They run perfectly with the modified WLED.

There are two basically different versions out there: one with RGB only and another one with RGBW.

I have some with RGBW in use - to get the right colors from Alexa there are some additional changes necessary - if you want RGBW to drive, have a look here: #315

Let me know if you have any problems. Hi Def3nder! Thanks for answering about the Magichome device, its what I have and I was looking for this info! When you say "they run perfectly with the modified WLED" what modification do you mean? do you refer to #315 you mention or some other modifications?

wezmininger avatar Nov 21 '19 01:11 wezmininger

...I've added the code to a new branch of a fork: Def3nder@d1c289b

Worked great for me using a H801 controller. had to change the gpio output. Thanks for this

gijsje avatar Nov 23 '19 15:11 gijsje

Hi @gijsje : this weekend I figured out how to use an IR Receiver with the H801. Is this interesting for you, too ?

I used this remote: https://www.aliexpress.com/item/32987617960.html From the Controller I ripped out the IR Sensor - the PCB is labled so you know the right PINs for Vcc, GND and Signal of the sensor.

Then I connected the sensor to +3.3 , GND and GIOP0: image

In the Code (in NpbWrapper.h) I disabled the button: #define BTNPIN -1, changed the IR PIN to 0: #define IR_PIN 0 and added the logic for the 40-key Remote in wled20_ir.ino.

The complete code is here: https://github.com/Def3nder/WLED

Def3nder avatar Nov 25 '19 09:11 Def3nder