0
\$\begingroup\$

I'm looking for a cheap reliable way (production) to convert an stm32's 3.3V output to the 5V input of a WS2812. I looked at a MOSFET solution with a BSS138 but internet research shows that it is not reliable for a 800kHz signal. I looked at the 74 family of chips but am somewhat confused at the naming scheme LCV, HC, AHCT, HCT, etc. I found a chip called the 74AHCT1G08GW,125 which is a single AND gate. According to the datasheet, 2 volts is the minimum input to registered as a HIGH. If I connect both AND inputs to the 3.3V signal, I should get Vcc=5V at the output. At a cost of less than 3 cents, this would seem to work for my application. Am I missing something here? Is there an easier or cheaper way I am missing?

Edit: I have 2 power supply voltages 3.3V for the stm and 5V for the LED's. I assume powering the 74' chip with 5V will provide a 5V output.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ The "T" in "AHCT" means TTL-compatible. They have a VIH of 2V. So yes, you can use AHCT. You can also use 74AHCT1G125. You can refer to Texas Instruments' documents scyd013 and sdyu001 and Wikipedia's page on 7400. \$\endgroup\$
    – kbrgrty3
    Commented Aug 27, 2020 at 12:27
  • 1
    \$\begingroup\$ Edit your question by using URL link, then copy/paste the datasheet link and name it as WS2812, BSS138 , 74AHCT1G08GW, ... we don't have time to spend searching what those pieces are. \$\endgroup\$ Commented Aug 27, 2020 at 12:57
  • \$\begingroup\$ What is the benefit of using the 74AHCT1G125 over the 74AHCT1G08GW,125 ? \$\endgroup\$ Commented Aug 27, 2020 at 20:32

5 Answers 5

2
\$\begingroup\$

You don't state explicitly the power source for the 125. If it is 5 V, then yes, that will work. To remove the (very small) input ambiguity, drive only one input. tie the other input to 5 V.

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

the WS chip has a standard CMOS Schmitt trigger input with hysteresis from 0.35 to 0.7 of Vdd=5V or a range of 1.75V. even attenuating the 0 to 3.3V swing to 2.7V swing with a passive level shifter ought to work for pennies and keep drive impedance low.

Since the AC coupled Schmitt trigger with bias to Vdd/2 is still a latch, you can make thus work at some defined minimum bit rate.

series R = 100 series C= 0.01uF, R=pu+pd=1k for 10us edge decay pulses.

But how cheap and easy do you want to be? ;)

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

One thing, it would nice if you could link the datasheets for the parts you used, you will get answers way quicker and more accurate!

Anyways, you don't mention what supply you have, but if you can have a 5V supply, you can use 1 BJT transistor and 2 resistors if the goal is to control jus the power flow through your LED (assuming that's what it is!), sth like this:

enter image description here

you need to calculate R1 so that when the 3.3V from your stm32 MCU is applied, the voltage across the base and emitter of your bjt is at the rated value for saturation (it is mentioned on all bjt datasheets). 800KHz would be a O.K. BJTs usually can deal with bandwidths of frequencies in MHz. R2 is your current limiting resistor and you calculate it based on the avergae forward current through your LED (again on the datasheet). If you are making 100's of these (since you mentioned sth about production), I don't think the cost is going to exceed 5 cents.

BTW, mosfets can also be used. try finding an N-chan mosfet and calculate how much delay time you would have theoretically (using the parasitic capacitance stated on the datasheets) and make sure you define a reliable design margin (e.g. 10-20%) since your frequency is not that high (relatively speaking of-course).

Now, if you want to convert 3.3V to 5V w/o a 5V supply, you definitely need a DC-DC converter. you can either buy IC's, or make your own with an inductor, capacitor and a PWM generator. you can step your game up with a feedback loop as well, but if price and time are both on their last drips, this would not be a good option. I don't know how you power up your stm32 (direct usb or mains-operated system), but if its mains operated and you use a 3.3V voltage regulator, just add a 5V regulator in parallel to that and switch it using a transistor as mentioned.

Hope this helps you.

PS: like I said, if you for instance had attached a schematic, I would have had way more detail and could have helped you better.

\$\endgroup\$
1
  • \$\begingroup\$ You would need to invert twice for the protocol \$\endgroup\$ Commented Aug 27, 2020 at 20:46
0
\$\begingroup\$

This may or may not work for you but we successfully drive WS2812 LEDs from both ESP8266 and ESP32 chips using this method. Those chips use a 3.3V rail.

Simply add a 3k3 resistor from the pin driving the WS2812 to the 5V rail. This brings that pin above the 3.3V rail that the chip is running from and increases the logic HI level to just enough to register properly in the WS2812.

This may or may not work for you but it is a dirt-cheap solution if it does work. Use a scope to verify the logic level voltages - both HI and LO.

[Edit]

The pullup resistor injects current into the port pin. This raises the pin above the chip's supply rail. However, the current is small (about 0.5 mA) and is not sufficient to raise that supply rail.

This won't damage the chip if it doesn't work. As such, it is worth a try.

\$\endgroup\$
3
  • \$\begingroup\$ Wouldn't this effectively put 5V on a pin only rated to handle 3.3V? \$\endgroup\$ Commented Aug 27, 2020 at 23:04
  • \$\begingroup\$ The pullup resistor injects current into the port pin. This raises the pin above the chip's supply rail. However, the current is small (about 0.5 mA) and is not sufficient to raise that supply rail. \$\endgroup\$ Commented Aug 27, 2020 at 23:16
  • \$\begingroup\$ I assume you'd have to drive the pin in open-drain mode for that to work. P-channel MOSFETs conduct in both directions. \$\endgroup\$ Commented Aug 27, 2020 at 23:51
0
\$\begingroup\$

You can use a proper voltage translator chip such as 74LVC1T45GW,125 with two power supplies. Around 5 cents in quantity.

The HCT will work, but if the 5V supply ever disappears when the MCU supply is present it will cause excessive current into the input. That can be mitigated with a series resistor, but it's not ideal.

\$\endgroup\$

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.