1
\$\begingroup\$

I am trying to drive 8 strips of led WS2812 (5V) with a CPU STM32F030. The output from the CPU is at 3V3. So, I used a 2N3906 connected to 5V with resistor. I've got no problem with that.

Now,I want to drive 8 strips of WS2812 with the same CPU, one strip at the time. Can I use a 74HC373 (@3V3 or 5V ?) connected to the CPU and 78HC08 (@5V) as showed.

Is there any other design to be used to drive the leds.

Thanks

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
3
  • 2
    \$\begingroup\$ PNP used backwards works with a current gain of 1 \$\endgroup\$ Nov 19 '19 at 1:10
  • \$\begingroup\$ You may Mux then in parallel or in series as in a daisy-chain as they were intended with unique addresses. \$\endgroup\$ Nov 19 '19 at 4:47
  • \$\begingroup\$ I don't understand what "input 3V3" means. Is that where you select which strip you control? \$\endgroup\$
    – user253751
    Dec 3 '20 at 18:08
2
\$\begingroup\$

Your scheme should work OK if...

  1. Fix your incorrect PNP transistor to be an NPN with emitter to GND. Putting the NPN in the signal path means that the signal from the MCU to the LED strings is logically inverted. You will have to account for that in the software that drives the pin.
  2. Make sure the BUF and AND gate parts are powered from 5V so you get a full 0 - 5 V swing at their outputs.
  3. Use a BUF chip that has an 74HCTxxx type part number so that the inputs work correctly with 3.3V swings despite the part operating at 5V.
  4. Beware to only drive one of the BUF inputs high at a time.
  5. Be aware that the NPN transistor may exhibit a non symmetrical propagation delay from low to high versus the high to low transitions. This will somewhat distort the timing pulses that you send to the WS2812's. This could be significant if you are trying to drive the signals to the LED strings at the upper end of its timing range. A fix for this could be to replace the NPN transistor with another 74HCTxxx buffer to get better operational speed.
  6. For that matter you could consider using a 74HCT08 gate and feed the 3.3V signals from the MCU directly into it and fully eliminate the transistor and BUF parts entirely.
\$\endgroup\$
1
  • \$\begingroup\$ Thanks Michael. I will try it \$\endgroup\$
    – YvonBlais
    Nov 19 '19 at 3:36
1
\$\begingroup\$

The easiest way would be to use a 74HCT238 operating from a 5V supply with 3.3V inputs.

enter image description here

E3 would be your data input (ground /E1 and /E2).

The "T" version (as opposed to 74HC238) has TTL-compatible inputs which will work with 3.3V.

If there is any possibility at any time of the 5V supply being less than 3V while the 3.3V supply is on (even very briefly during power up/down etc), then add series resistors (1K or so) on all inputs. Pretty much the only way to guarantee this is if the 3.3V supply is derived from the 5V supply.

Or use a proper level translator chip and an HC238.

\$\endgroup\$
0
\$\begingroup\$

Hmm, I am usually using N+P MOSFET pair for that purpose. But now I want to use only one IRLML6344 N-MOSFET transistor for voltage level translation.

It inverts the signal. No problem when you write bitstream generator yourself. The problem I encounter right now is MicroPython that I has no option for inverted logic control and the bitsream write is part of the MCU specific code so I do not want to touch that.

I was wondering if it is possible to provide 255-n for RGB colors in this situation and that seems to work partially. Because WS2812B seems to reshape signals, first LED does not light, but following LEDs in the chain gives correct light and color. The first LED has DIN pulled High by default so it has 1 as idle. Due signal reshaping of the first LED following LEDs have 0 as idle.

I am wondering if WS2812B was designed with this situation in mind that it could be driven over an inverting transistor. The initial reset sequence seems to be only problematic here for the first LED.

If anyone knows the trick how to drive WS2812B with non inverted bitstream generation over inverting transistor that would be nice to know :-)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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