1
\$\begingroup\$

I'm trying to replicate a communication signal from a Raspberry to Arduino Uno. The signal is an output that comes from Adafruit Neopixel library to take the control over WS2812 LED. I want to put that output signal as an Arduino input, because Led is a status led, then, Arduino only reads led status when Raspberry is on. When Raspberry is starting the led blinks until Raspberry system have started, and when Raspberry is shuting down, the led starts a fadeout light (control taken by Arduino one more time). The problem is I don't know what kind of communication is needed to communicate with the LED.

Only thing I know from LED Datasheet is that sends data at speeds of 800Kbps, and NeoPixellibrary must be connected to GPIO10, GPIO12, GPIO18 or GPIO21 to work, GPIO18 is the standard pin (i don't know why, some are SPI, some are PCM...) .

I attach a block diagram to explain me better:

enter image description here

\$\endgroup\$
12
  • \$\begingroup\$ Have you looked into library code? \$\endgroup\$
    – Ilya
    Commented Sep 23, 2021 at 11:17
  • 1
    \$\begingroup\$ Why do you want to do it this way? You are unlikely to get the Arduino to read the WS data stream and pass it on accurately. \$\endgroup\$
    – Transistor
    Commented Sep 23, 2021 at 11:28
  • 2
    \$\begingroup\$ Where exactly will you be running the NeoPixel library? From your description it sounds like it will be running on the RPi, but then it makes no sense to have an Arduino in between, as you could connect the RPi directly to the WS2812 LED string (with a simple level converter in between), like these examples \$\endgroup\$
    – StarCat
    Commented Sep 23, 2021 at 11:46
  • 1
    \$\begingroup\$ @Juanma your post is an XY question ... you are asking for help with what you consider to be a solution to a problem, even if the solution is misguided, without revealing what problem you are trying to solve .... please edit your post and ask a question about the real problem \$\endgroup\$
    – jsotola
    Commented Sep 23, 2021 at 14:26
  • 2
    \$\begingroup\$ The WS2812 uses a NRZ communication protocol at 25 kHz. Trying to use the arduino as a pass through is difficult. You want to share the ws2812 only when the RPi is off. The better solution is to switch the data line when the RPi is on. I'll provide an answer shortly. \$\endgroup\$
    – Passerby
    Commented Sep 23, 2021 at 15:52

2 Answers 2

3
\$\begingroup\$

As said in the comments, attempting to man in the middle a signal like the ws2812b NZR high speed data connection is a tough project. Reading would require listening and processing it at twice the speed of the protocol which is 25khz. Then add processing time to push it out the other side.

The better solution especially if you are not modifying it when the RPi is on and in control, is to switch the data lines.

Using a standard analog switch IC or module like the common TS5A23157 Analog Switch modules for a buck on the usual auction sites, would do that. You can even make it automatic.

enter image description here

enter image description here

As you see it's a two channel you can ignore the second channel for now. By connecting the led data pin to the common pin and the RPi to one side and the arduino to the other, and tying the in (control pin) with a high or low state you can switch between who controls the led.

As the RPi has a number of pins with default states of high-z and weak pull up or down when on, you can add a weaker pull down/up. Once the Pi turns on, the pin goes to its default state (say pulled up to 3.3V weakly) and takes control of the led.

You could use the second channel as a input to your arduino so that it also knows the Rpi is on or off, or just a direct connection. Keep in mind the RPi uses 3.3V logic and not 5V.

\$\endgroup\$
-1
\$\begingroup\$

As far as I can tell, you are only asking for help with communication between the Arduino and the WS2812 LED control. The datasheet seems to layout the communication method fairly clearly: There is one data line between the Arduino and the WS2812. You need to send 24 bits over that line, 8 bits for each color in the RGB scheme (although the order you send is GRB).

enter image description here

On Page 4 it lays out how to send a 1 and how to send a 0 for each bit:

enter image description here

\$\endgroup\$
1
  • 1
    \$\begingroup\$ That's not what they are asking \$\endgroup\$
    – Passerby
    Commented Sep 23, 2021 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.