# Driving 3.3 V LEDs with an Arduino and a shift register

I'm planning to build a simple LED matrix with an Arduino and some 74HC595 shift registers. However my Ardiuno outputs 5 V to the registers which will pass that 5 V on. How and where along the line do I reduce this voltage to 3.3 V?

Edit: Found this after a while of Googling. Is a resistor in front of every LED all i need (which i need anyway)?

(5–3.3) / 0.02 = 85 ohm for a 20 mA 3.3 V LED?

Edit 2: Can i provide 3 V from a different source to the Vcc pin of the shift register, but send 5 V logic on the serial pins? Im guessing that won't work but just wanted to double check.

• Passerby points out something useful: I just assumed that you have some sort of a LED system that really doesn't want to see anything above 3.3V. I think what Passerby notes is that perhaps there was a mistake in reading LED specifications? It might be worth it to post the link to the LEDs as Passerby suggests. – angelatlarge Mar 30 '13 at 23:07
• @angelatlarge farnell.com/datasheets/1639232.pdf Also, the 74HC595 was just an example as it can't take the load of 8 of those LEDs at the same time. Looking at an STP16CP05MTR – Maciej Swic Mar 30 '13 at 23:43
• Right. So the 3.3V is not the max voltage to be supplied to the LED, rather it is the voltage drop across the LED when conducting 20mA. So in the end, you will not need any voltage shifting. Note though that it has a maximum 5V reverse voltage. – angelatlarge Mar 31 '13 at 4:35

There are a number of options, most of them discussed in this post. Since the communication is one way you can use:

• Voltage dividers: cheap and easey: 2 resistors. Cannot provide stiff voltage sources unless you lose a lot of power through them
• A diode with a resistor circuit. Same as previous
• Level shifter (something like a 74LVC245)

There are shift registers that do run on 3.3V: depending on how many lines you need, an easier solution might be to shift the Arduino output to 3.3V, and feed that to a 3.3V shift register. This will likely (again, depending on your setup) in fewer lines to be level-shifted.

EDIT: Yes, you will need current-limiting resistors for your LEDs, however, voltage divider != a single resistor. Voltage divider looks like this: simulate this circuit – Schematic created using CircuitLab

EDIT2: Usually not. You should read the datasheet for the shift register you are planning to use about its various maximum voltages. P.S. When you say "serial pins" you don't mean the Serial TX and Serial RX, right? Usually, one drives shift registers using general purpuse digital IO pins. You can use serial pins for two of those, but usually you need a more pins to drive a shift register (usually at least three in the case of 74HC595). The point is 74HC595 is driven via SPI protocol, not RS-232

• Thanks, I'll consider these. Can you check out my edit please? – Maciej Swic Mar 30 '13 at 22:33
• Yes, I didn't mean serial TX/RX but thanks for the clarification :) – Maciej Swic Mar 30 '13 at 22:43
• So i understand a current limiting resistor is not a voltage divider, but does that also mean a current limiting resistor in it's own is not enough like this? led.linear1.org/… – Maciej Swic Mar 30 '13 at 22:46
• The answer is "it depends" on the power source and your LED. Assuming that your LED will die if it sees 5V across it then the circuit you link to crucially depends on the power source (in this case a battery) not maintaining 5V when sourcing current. – angelatlarge Mar 30 '13 at 22:50
• @angelatlarge The 74HC595 isn't SPI, the Arduino crowd just uses a SPI like implementation. – Passerby Mar 30 '13 at 22:52

Like pretty much every IC without specially designed over-voltage tolerances, the 74HC595's input voltage level has a maximum of VCC or VCC + 0.3v. Powering the 74HC595 from 3v is okay, but directly connecting the Arduino's 5v outputs to the 74HC595 at 3v will not be good. A level shift as @angelatlarge has shown would work.

That said, the other thing is that the IC does not pass along the voltage from the inputs to the outputs. While it's logical diagram does not show any transistor/mosfet used, it does have buffered outputs. Outputs are referenced to the 74HC595's VCC and GND. For example, at 4.5v VCC, the Logic Level High only needs to be 2.4v (typical) to be a level high, but the output will still be 4.32v Typical.

So, you can power the 74HC595 from 3v, use a voltage shifter to bring the inputs to the 3v level, and connect your leds that way. But you would still want resistors on the leds to control any current.

In fact, using the resistors will make powering the 74HC595 at 3v AND using the voltage divider moot. The resistors should be calculated the same way you would if you were directly connecting a led + resistor to a battery.

Note this schematic: Powered from 5v, considering each led, as most standard LEDs go, will be anywhere between 2 to 3.5 Volts at 20mA forward current, means there will be 3 to 1.5v in excess. The resistors will, when calculated for a (5v Source Voltage - LED Forward Voltage Drop) / LED Current, will "Take up" the remanding voltage, while setting that current. Same applies for LED Matrix on the 74HC595 as well, except the location of the resistor would vary and all. You haven't told us what type of matrix you want.

• When you say "will be anywhere between" you mean 5.0V - Fvdrop = 2.4-3.5? – angelatlarge Mar 30 '13 at 23:06
• @angelatlarge Other way around. the 2.4 to 3.5 is the average forward drop of a led of any given color. Obviously red/orange are more 2.4-2.6 while blue is 3.2 to 3.4, white 3.3 to 3.5. I gave a general number along with the actual formula. Did clarify it a bit though. – Passerby Mar 30 '13 at 23:26
• I thought regular red leds had forward V under 2V, no? That's what wikipedia has anyway. – angelatlarge Mar 31 '13 at 4:37
• Ha. Havent't used red leds in a few years. You are right. @angelatlarge – Passerby Mar 31 '13 at 21:51