3V to 5V Level Shifting Options Query

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ButterflyChorus
 
Posts: 4
Joined: Fri Sep 18, 2020 11:44 pm

3V to 5V Level Shifting Options Query

Post by ButterflyChorus »

3V to 5V level shifting options for LEDs

Hello,

I’m working on a project (a longer version of the cyber falls wig https://learn.adafruit.com/neopixel-cyber-falls) that requires level shifting from 3.3 V to 5V for the LED control voltage. My current choice of board is the Feather M4 (https://www.adafruit.com/product/3857). Estimating 4 meters or 240 LEDs total in ten 16 inch strips

I’m trying to decide on a 3V to 5V level shifter for the control voltage for the LEDs strips.

1. My current best guess for fitting my project is the 74LVC245 (option #1). Unfortunately it’s also the one I’m not sure about the wiring. Will this work for my purposes? (I'm a bit confused on the DIR and OE pins)
2. If you have any opinions/warnings/corrections/advice on these options for LED projects (especially on 74LVC245), please let me know.


I’ve listed the options I’ve found below.

Option 1. 74LVC245 - Breadboard Friendly 8-bit Logic Level Shifter

https://www.adafruit.com/product/735
https://cdn-shop.adafruit.com/datasheet ... vc245a.pdf
This one looks like it may be a better fit for controlling larger numbers of separate strips, but unfortunately I’m not fully understanding it. I think it can shift both ways (up or down), and I’m probably not reading the data page correctly to do a 3V to 5V shift. The lines I’ve pasted below from the data sheet seem to give conflicting instructions (probably for opposite shifts).

My understanding: Every chip can level set control voltage for 8 separate LED strips.
Control wire from the Feather goes in the A side (A1 through A8).
Wires from the level shifter go from the B side (B1 through B8) to the DIN on the LED.
VCC and GND are 5V power and ground.
DIR - connected to the 3.3V from the Feather?
OE - Connected to VCC (5V power), though I’m not sure what sort of pullup resistor to put with it. 10kΩ resistor? Connected to 5V ground?

Pertinent text from the data sheet for DIR and OE that I need some help with:
The device transmits data from the A bus to the B bus or from the B bus to the A bus, depending on the logic level at the direction-control (DIR) input.
To ensure the high-impedance state during power up or power down, OE should be tied to VCC through a pullup resistor; the minimum value of the resistor is determined by the current-sinking capability of the driver.
connect VCC to your logic level you want to convert to (say 3.3V), Ground connects to Ground. Wire OE (output enable) to ground to enable the device and DIR (direction) to VCC. Then digital logic on the A pins up to 5V will appear on the B pins shifted down to the VCC logic.


Option 2. 74AHCT125 Quad Level-Shifter (3V to 5V)
https://www.adafruit.com/product/1787
https://cdn-shop.adafruit.com/product-f ... AHC125.pdf

My understanding: In short, every chip can level set control voltage for 4 separate LED strips.
1OE through 4OE pins go to ground.
1A through 4A pins get control signal from the board.
1Y through 4Y pins connect to the LED DIN.
VCC and GND pints are 5V supply and ground respectively.

I think that’s how it goes, but the instructions on the Pi wiring page with this level shifter said something about “Be aware, you can only create one strip at a time”….so just making sure I’m not misunderstanding the capabilities. https://learn.adafruit.com/neopixels-on ... w?view=all
The downside to this one is that it can only handle 4 LED strips. So I was hoping to find something more efficient at doing more strips.

Option 3. Adafruit NeoPXL8 FeatherWing for Feather M4
https://www.adafruit.com/product/4537
(or NeoPXL8 Friend https://www.adafruit.com/product/3975 if I were not using a Feather)
https://learn.adafruit.com/holiday-icic ... r/hardware
https://learn.adafruit.com/ooze-master- ... ild-part-2



My understanding: Every chip can level set control voltage for 8 separate LED strips.
5V power to USB pin
Ground to the GND pin
The 0 through 7 pins in the center are connected to the DIN on the LED strip.
NeoPXL8 Feather headers stacked on the Feather M4.

Problems: I still need to familiarize myself better with programming…but the existing code would need to be changed to fit the NeoPXL8 Arduino library. Might not be the simplest fix for level shifting. I’m not sure this product would even work with CircuitPython.


Option 4. 1N4001 Diode
https://www.adafruit.com/product/755
https://hackaday.com/2017/01/20/cheatin ... data-line/
https://learn.adafruit.com/neopixels-on ... w?view=all

This one seems fairly straightforward. It’s dropping the voltage of the first LED by 0.7 (from 5V to 4.3V) Volts to bring it within the tolerance range for control. The lower voltage will cause the first LED to dim, but the rest should be fine.
The example from hackaday is probably not the best option for the wig, since the LEDs are load bearing, and this makes that connection even more complicated/fragile. Though the wiring on the Raspberry Pi link shows that cutting between the first LED and the rest may not be necessary.
Not my first choice, but could be a backup option.

Option 5. 8-channel Bi-directional Logic Level Converter - TXB0108
https://www.adafruit.com/product/395
Non-starter. Even though the level shifter guide (https://learn.adafruit.com/neopixel-levelshifter) mentions it. The product page as well as other posts by admin in this forum say it’s not a good choice for level shifting to control LEDs.
viewtopic.php?f=47&t=166684&p=816898&hi ... 08#p816898

Option 6: Not really a level shifter, but the last option would be to change boards to one of the below 5V control versions:
Adafruit ItsyBitsy 32u4 - 5V 16MHz
https://www.adafruit.com/product/3677
Adafruit Metro Mini 328 - Arduino-Compatible - 5V 16MHz
https://www.adafruit.com/product/2590
Adafruit METRO 328 Fully Assembled - Arduino IDE compatible - ATmega328
https://www.adafruit.com/product/50

Thank you,

Kaitlyn

User avatar
dastels
 
Posts: 15660
Joined: Tue Oct 20, 2015 3:22 pm

Re: 3V to 5V Level Shifting Options Query

Post by dastels »

1. DIR connects to 5v (MCU signal connects to the A side, NeoPixels connect to the B side), OE is active low and should connect to ground (all grounds must be connected together btw). For NeoPixels you don't need to worry about outputs being high impedance. It's overkill for driving NeoPixels since you usually don't need 8 channels and you don't need it to be bidirectional.

2. Simpler, input connects to an A pin and the NeoPixels connect to the corresponding Y pin and the corresponding OE connects to ground.

The Pi isn't a great choice for doing anything involved with Neopixels. As explained in that guide, you can't really do real time control under Linux unless you use some hardware tricks (like PWM and DMA as that guide discusses).

3. The NeoPXL8 Featherwing provides support for 8 NeoPixel strips using a couple of '125s to do level shifting and provides convenient connection options. You won't be able to get the full advantage of the NeoPXL8 in CircuitPython for speed and hardware access reasons.
For connections, it mounts on a feather (be sure to get the right version of the NeoPXL8 for the feather you are using so there's not much to worry about. I recommend the M4 Express. As usual, the NeoPixels would need to be powered with a separate, large 5v supply (remember to connect the all grounds together).

4. This seems to me to be a very hacking "solution" . I don't recommend it.

5. Yes, that was me :)

6. The problem with switching to a 5v board is that they usually use older, smaller, slower processors which will limit what you can do with the NeoPixels.

Summary:

10 strips might be a problem. Can you do it in 8 strips? If so I recommend using the NeoPXL8 Featherwing and a Feather M4 Express.

Dave

BTW, your use of "chip" in incorrect, "channel" would be better. "Chip" generally refers to a physical package. E.g. the '245 is one chip with 8 channels.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”