Hi, It's maybe weird but I have PWM output to control ws2812B(which I cant edit the code to change order of RGB) and when I wired ws2812b to it. Green turn blue and vice versa
So now I want to ask is there any chance I can use the arduino or any chip on the market that can convert RGB order to RBG. simply just swap green to blue
thanks !!!!!!!!!!!!!!!
It's maybe weird but I have PWM output to control ws2812B
How does that work then? The WS2812b uses a data signal not a PWM signal.
What driver libiary are you using?
Their will be an option in that.
Otherwise simply swap the colours over as you program, you don't need anything to convert anything.
So you want to take in the current data stream, manipulate it, and send it back out?
Where is the code coming from now? Some device you didn't program and now can't reprogram?
CrossRoads:
So you want to take in the current data stream, manipulate it, and send it back out?
Where is the code coming from now? Some device you didn't program and now can't reprogram?
yeah. that's what exactly I want to say
that device I cant reprogram. now I have data output pin from that device which drive ws2812b fine but wrong color
I want to manipulate the signal come out from it with an arduino and then send it out to the led
How many LEDs are we talking about here?
the number of the led is about 30-40 leds in a strip. I can configure the led number in the main device(which I can edit the code but I can change the led number..)
There must be an option to swap colours in code.
As Grumpy_Mike already asked in post#1
What library are you using.
Leo..
the Chip as I found is stm32(that device) and the library must be ws281.h
STM32?
This is an Arduino forum, so which Arduino are you using?
Is there something like this in your code.
#define WS2811_STRIP_RGB
try
#define WS2811_STRIP_RBG
Leo..
I think the real problem here is that the OP only has a data stream from some device controlling the LED strip which is controlling the LED strip. But that data stream is for another type of strip with the R and B swapped over, hence he says:-
kaitoukid93:
yeah. that's what exactly I want to say
that device I cant reprogram. now I have data output pin from that device which drive ws2812b fine but wrong color
I want to manipulate the signal come out from it with an arduino and then send it out to the led
But it would help if he described what he had and provided links. Like most beginners here he has not read the how to use this forum sticky post.
What you need to do is to decode the RTZ bit stream, store it in memory, fish out the colour information and swap the R and B components.
Having said that, it is a fast data stream and memory is limited so I am not too sure if it can be done purely in software.
Grumpy_Mike:
I think the real problem here is that the OP only has a data stream from some device controlling the LED strip which is controlling the LED strip. But that data stream is for another type of strip with the R and B swapped over, hence he says:-But it would help if he described what he had and provided links. Like most beginners here he has not read the how to use this forum sticky post.What you need to do is to decode the RTZ bit stream, store it in memory, fish out the colour information and swap the R and B components.
Having said that, it is a fast data stream and memory is limited so I am not too sure if it can be done purely in software.
yeah you're right.
I'm sorry that I've made a mistake
with the ws2812B. the color is true
when I connect the ws2811 instead of ws2812b. the color swap as I said
so the problem is the chip design of the LED?
What you have to do is to decode this signal:-
this is tricky but perhaps not impossible. If you arrange one of the timers to use the input pulse to start the counter running when the input signal is high and stop it when low. Then on the falling edge of this signal you also trigger an interrupt to look at the number in the counter. If the result is a number below 0.55uS treat it as a one otherwise treat it as a zero, and shift that state into a byte.
Now you want another timer that is reset when that line is high, and when that timer exceeds 50uS you know you have finished receiving and it is time to swap over the R and B bytes and send it out.
This will require some careful reading of the timer section of the data sheet for what ever processor your Arduino is using. Or else it need to be programmed in assembler.
Note for a 16MHz Arduino:-
0.9uS represents 14.4 clock cycles
0.35uS represents 5.6 clock cycles
EDIT I am not sure of the overhead in calling an interrupt, it probably rules out using timers.
Ws2812B can have datastream at 800 KHz too:
Data transfer time( TH+TL=1.25μs±600ns)
Coming out of a 32-bit stm32 device that is certainly possible.
That might be tough for Arduino to capture and decode into 1 and 0 and store as bytes.
40 LEDs in a strip = 120 bytes = 960 bits.
If the timing difference between high & low can be determined, I suppose there is enough SRAM to store the 960 bits, then send the bytes out in a swapped order.
Might need some assembly programming to decide between a high and a low fast enough.
WS2812B.pdf (381 KB)
Ws2812B can have datastream at 800 KHz too:
Yes that is what that diagram shows:-
1 / (0.9 + 0.35) = 0.8 or 800 KHz.
Whatever MCU you use, the above suggestions will take as long to send out the revised data signal as it did to receive the incoming signal. If there are not significant gaps where the controller is not sending out any data, your convertor will miss some of the data. To overcome that, you would have to write code that can simultaneously read the input data at 800KHz and send out modified data at 800KHz, but delayed by 3 bytes. A tall order for both MCU and coder! But only a 3 byte long buffer needed.
I think it's going to have be saved and then sent out in a block so there is no gap in the output timing to kick off the WS2812Bs output updates, resulting in only same parts getting the data meant for the later parts, and then the same parts getting a 2nd set of data.
thank all of you that paying attention to my topic
Im working on it and I'' tell you the result. thanks
Why can't you edit the code?
You're probably using the wrong set of parameters in whatever library you're using.
This is a common problem for people who use code without understanding what it does, and the fix is as simple as uncommenting the correct line and removing what us chosen currently.
Why can't you edit the code?
My reading of the post is because it is on a device that is pre made and he does not have programmable access to it.
No idea. Says he's using PWM on an MCU for smart LEDs and that he can't change code on it, except that he says he actually can change code on it, now he's going to add in an Arduino.
Really, just ditch the first MCU and do it all with an Arduino and have more control.