so, I wanted to check if a led strip can receive information from 2 arduino boards simultaneously, so I uploaded a blue moving led to one board, and a red moving led to a second board. if the led strip is connected to the first board, the blue moving led is displayed and if it is connected to the second board, the red moving led is displayed, but when I connect the data cable to both boards, the action freezes.
Any thoughts?
I know that this is a very unconventional way of sending info to a led strip, but for experimental reasons I would like to know if this would be somehow possible.
If both boards are sending data to the leds at the same time the data that the leds would receive would be a jumble. If it’s something like WS2812 data, odds are the signal would be so corrupted that the 2812 chip wouldn’t accept any of the incoming data as valid (e.g. things too high for too long, or too low for too long). If it’s something like APA102 data, where you’re sharing clock/data, odds are you’ll end up messing with the timing of received data to the point where it is complete garbage.
You can have two boards connected to one set of leds - but then you need to have something in place to make sure that only one board is writing to the led at any given time.
There is no good way to “merge” the data from two boards onto a single strip. Either you’d need to run two strips in parallel close enough to each other so that with diffusion the viewer can’t tell there’s two sets of leds, or instead have one of your boards talk to the other board to tell it what to add to the led data, and the only have one board physically talking to the leds.
That is because the 2 data outputs are ‘fighting’ each other and generating a combined data stream that is total nonsense to the strip’s first pixel.
I really can’t imagine why you would want to switch between 2 different Arduino boards in the first place but in any case, there is NO WAY to have them working at the same time !!
It’s an interesting thought. The strips work on a data string. It gets pushed down the strip led to led like cars on the freeway. When they hit their address (number of hops really ) they either continue on down or are removed (I don’t actually know). Either way having a second device on the same bus throwing out data at the same time will be an issue.
Obviously if both arduinos are talking they talk over one another.
If one talks, writes blue to led 4. Then arduino2 writes red to led 4 , then led will switch to red afer being blue.
Is arduino 1 writes blue led2 and and arduino2 writes red led3 and they done talk over each other it will work.
@JP_Roy there’s reasons for potentially having multiple controllers talk to a single set of leds (I have a test rig setup here that’s basically N MCU’s all wired to a single set of leds for rapidly testing multiple platforms, for example). Other reasons could have to do with integrating with certain types of hardware where it is difficult to have multiple things on the same MCU, in which case you’d have multiple MCUs, one per piece of hardware. In this case, having those MCUs then talk to one that’s dedicated to writing LED data would be the way to handle merging data from multiple sources.
For chipsets like the APA102, if you’re willing to write a custom controller, you could possibly do something that zippers together multiple controllers where the controllers advance along their led data in lock step, but only one is allowed to actually write the data at a given time. E.g. a simple version of this would be one controller that wrote data for leds 0, 2, 4, 6, 8 and the other that wrote data for leds 1, 3, 5, 7, 9. However, then you get into fun synchronizing games to get an effect that would be roughly similar to the two parallel strips idea I mentioned above.
(Generally speaking, if someone asks for how to do something, even if you can’t imagine a reason why they would want to - it’s not a bad idea to give them the benefit of the doubt that they’ve actually thought through a reason why they would want to and focus on answering the question/solving the problem than dismissing it with a “I can’t imagine why you’d want to” – or at the very least, asking for an expansion on why they’d want to - you never know when you might end up learning something or getting new ideas for your own work that way
@Daniel_Garcia Well… I think you wrongly interpreted my comments and/or my intentions. I never dismissed the problem or take away the benefit of the doubt in this specific case!
When I said “I really can’t imagine why you would want to switch between 2 different Arduino boards in the first place” I am a lot more describing my inability to imagine the purpose of his setup than criticizing what or why he would do that… Something that you corrected promptly by providing a very valid reason. Thank you !
I see the “I can’t imagine why you would want to …!” phrasing most often used as a sarcastic statement. I think that’s because it is a statement, expressed with a certain amount of finality (more so if some one is writing an answer with an air of authority), as opposed to asking the question “Why do you want to … ?”, which carries the conversation forward vs. potentially shutting it done.
(Given the number of folks here at a variety of skill levels, I try very hard, in my own answering of questions, to look for more supportive ways of answering, as well as how someone might take the tone of answer - I don’t always succeed, of course. Especially when I’m still waking up - the joys of being human
I understand the sentiment, Daniel. The amount of times I ask something in a forum (or find someone asking the question as well) only to see about 10 posts firsts asking for justification. It’s annoying. I don’t think JP was doing that though. It mainly happens to me when dealing with a customers existing infrastructure that I have no control over and everyone wades in saying that isn’t the ideal way to do things. Drives me nuts. Happy new year everyone!
Even though I can think on a couple of reason why I would like to merge data from 2 boards on 1 strip, more important for me sometimes is to simply ask the question (as stupid it might be) since the different answers are for sure going to be good sources of further thinking and knowledge expansion.
Since I do not know lot about electronics, the explanation on why is not possible to do this, helps me understanding more on what is actually possible.
and regarding tones and forums, it is true. very often happens that you cannot feel comfortable asking a silly question without being judge. silly questions come with very interesting answers.
The arduino is sending a digital signal down the control wires, so adding two of them by wiring them together just produces noise because the signals are not coördinated. To combine two animations, you have to combine the animation code into one program in one arduino. I recommend looking in the code samples, though I’m not familiar enough with them to point to a best pedagogical example.