WS2812B and sensors

Good morning,
I'm having some troubles trying to integrate sensors to multiple strings of WS2812B leds using only 3 pins (Voltage, Data and Ground).
The aim is to send an unique ws2812b signal with colors and animations of every led in the string, while each led may be switch on and off by his sensor (or switch/button).
To better understand what I'm meaning I attached a schema.
My question is about the WS2812b signal: would this be "elaborated" by the WS2811 driver integrated into the WS2812Bs even if there is no voltage?

Thanks in advance
Leo

I don't see your schema, only a signal timing diagram?

I don't understand your question. What did you mean by "elaborated even if no voltage"?

Your signal timing diagram is also confusing. What does each trace represent? Do you know that the signal protocol used by ws2811/2 is more complex than this?

yeah, sorry, it's just a signal trace of data sent through the ws2812b devices.
Each 8bit data with any data out of 00000000 is indicated as "up", otherwise (led off) data is "down".
The question is about the ws2811 driver, if you look at the datasheet what I understand is that it is taking the whole string in DIN, estrapolate the first 24bit (8bit each led) and output each R/G/B as PWM according to. Led will blow as there is a 5V source applied. After that he returns the rest of the string (DIN minus without the first 24bit) as DO, is it right?
My question is what will happen if I apply 0V to VDD? will the signal go through the WS2811 anyway? will the WS2811 return all the string or without the first 24 bits as it is supposed to be?

hope to have explained me better.

Greatings. Leo

IMG_20201001_144744.jpg

IMG_20201001_144744.jpg

Leopesto:
My question is what will happen if I apply 0V to VDD? will the signal go through the WS2811 anyway? will the WS2811 return all the string or without the first 24 bits as it is supposed to be?

If you tun off the supply voltage, the chip will not operate. Simple as that. “Common sense” tells you this.

However, if you send data to it with the supply voltage turned off, the protection diode will feed current from the data input into the supply terminal - VDD. Because the protection diode is not rated to do this, you may damage the chip.

So the point is - this is something you would never do! :roll_eyes:

But just in case, this is one reason why you use a 330 or 470 Ohm resistor in series with the data feed to the first chip in any separate strip.

Paul__B:
If you tun off the supply voltage, the chip will not operate. Simple as that. "Common sense" tells you this.

However, if you send data to it with the supply voltage turned off, the protection diode will feed current from the data input into the supply terminal - VDD. Because the protection diode is not rated to do this, you may damage the chip.

So the point is - this is something you would never do! :roll_eyes:

But just in case, this is one reason why you use a 330 or 470 Ohm resistor in series with the data feed to the first chip in any separate strip.

Hi Paul,
thank you very much for the explanation.

I take this opportunity to ask you what advice you give me to do what I thought, that is to shutdown a single LED if its corresponding switch/sensor is off.
Everything must be done electronically, acting on a signal that wants the led to be on, this is because arduino would be far away and doesn't know if the sensor is active or not.
Even more interesting would be to have 3 switches per led, each controlling a single color.

From what I understand I should replace the first 24bit with a signal equal to 24x "code 0" (switch any T1 to T0), how is that possible?

Thanks in advance
Leo

Well, though there are some ASICs designed to operate these LED strings, here we discuss the use of the Arduino and similar devices (such as ESP8266) to generate the data stream that codes to these LEDs.

Now very few of us feel the need to get "down and dirty" with the actual data streams, because there are the "FastLED" or "NeoPixel" libraries provided for us to perform the coding. These libraries, installed via the IDE Library Manager and including code examples for their use, implement an array of variables corresponding to the number of LEDs you specify, in which you can then choose to set individual LEDs or groups to a given colour followed by the command which in a single action once you have the entire pattern determined, transfers the array to the strip.

So what you need to do is to use the examples to learn to control your own strip, then starting with such an example code, write a program which firstly determines the default pattern and then reads your inputs and (only) when they change, makes the appropriate changes to the array and writes the new pattern to the strip. :sunglasses:

Paul__B:
Well, though there are some ASICs designed to operate these LED strings, here we discuss the use of the Arduino and similar devices (such as ESP8266) to generate the data stream that codes to these LEDs.

Now very few of us feel the need to get "down and dirty" with the actual data streams, because there are the "FastLED" or "NeoPixel" libraries provided for us to perform the coding. These libraries, installed via the IDE Library Manager and including code examples for their use, implement an array of variables corresponding to the number of LEDs you specify, in which you can then choose to set individual LEDs or groups to a given colour followed by the command which in a single action once you have the entire pattern determined, transfers the array to the strip.

So what you need to do is to use the examples to learn to control your own strip, then starting with such an example code, write a program which firstly determines the default pattern and then reads your inputs and (only) when they change, makes the appropriate changes to the array and writes the new pattern to the strip. :sunglasses:

Thank you Paul,
I was thinking of ICs too, but thught it may be possible just using some logic (like cutting off after T0H in order to switch any code1 to code0.
Problem with ESP8266 is that it's too expensive as I'll need one par every led, maybe an attiny13 will work for this purpose?
As said before, I don't want the "switch" signal to go back to arduino, because this will be 10x cable more.
I just find out a tutorial for a project exactly like mine (how-to-control-ws2812b-individually-addressable-leds-using-arduino), here the difference is that the sensors' signal is returning back to arduino, but my idea is just to keep that signal into the table slot and act like a switch for its own led.
A workaround would be to put a ws2811 driver and switch the signal to it when sensor is on so that the signal is "processed" (first led string out), but no led is lighted. Would this work?

I will keep searching for a solution.

A workaround would be to put a ws2811 driver and switch the signal to it when sensor is on so that the signal is "processed" (first led string out), but no led is lighted. Would this work?

No.

but thught it may be possible just using some logic (like cutting off after T0H in order to switch any code1 to code0

That would not work.

You seem to be missing the whole point of an addressable strip.

I don't want the "switch" signal to go back to arduino, because this will be 10x cable more.

Why will that be then?

You seem to be talking in the abstract and getting a lot of this abstraction wrong. Can you try to be more specific as to what you actually want to do as this has all the hallmarks of an X-Y problem

Leopesto:
Problem with ESP8266 is that it’s too expensive as I’ll need one par every led, maybe an attiny13 will work for this purpose?

I very much doubt that. Not that it makes any sense in any case. :roll_eyes:

Thanks all for the answers.
I do understand I was talking in the abstract, I was thinking of get my idea by working on ws2811 signal, but I think I should try something else.
I tried again to explain better my scope by attaching an image of my idea.
since the ws2812b signal can't be "modified" to shutdown each led, I'm now thinking of getting the info of sensors back to arduino. The problem is that I don't want to use more then 4 wires, which means out of 5V, GND and WS2812b there's only one wire left for sensors.

Just what are these sensors? Are they all the same?
How quickly do they need to be read?

Have you come across the one wire bus? There are a bunch of sensors and port expanders that have this interface.

Yes, well you probably could use an ATtiny for each sensor with a serial protocol to "bucket brigade" the sensor data from one to the next in a manner not dissimilar to the WS2812s but in reverse, each tiny adding a byte of information.

In such an arrangement, you would not need to identify each "station" (LED plus sensor) specifically as you would simply use the last byte of sensor data to indicate the state for the first LED and so on.

If the status is only on/ off corresponding to one bit, then you would not need to use a true UART protocol but just a stream of bits with a unique "start" code, again in the same manner as the WS2812s. As I do not know whether am ATtiny13 actually has a hardware UART, this may actually be the easiest approach.

My understanding of the WS2812 protocol is that it is defined by short and long pulses to mark zeroes and ones with a distinctive "stop" iamb.

Grumpy_Mike:
Just what are these sensors? Are they all the same?
How quickly do they need to be read?

In fact, each "device" is not carrying one single led but a string of 8 (8x10 in total), but that doesn't care as if I can get the signals back to the arduino with one wire I can set any led as I want.
Refresh rate of sensors is not that important, I can read them even 1 time par second.

Grumpy_Mike:
Have you come across the one wire bus? There are a bunch of sensors and port expanders that have this interface.

I was reading about 1-wire bus yesterday and looks very interesting! do you have a good tutorial of how may I implement it?

@Paul, you got it! I mean, that's exactly what I want to get! I was thinking also into multiplexing signals in each device and then demux then in the arduino. Would this work?