# Common Anode 5" 7-segment LED

Hi all,
I’ve been using Arduino for about 18 months now, but this is my first post on the forums. I came up with a control scheme for a 7-segment LED and I just want to run it by everyone to see if you can think of any issues.

My friend ordered 4 cheap 5" 7-segment LEDs to display scores in the game we’re building. When they arrived we tested them to find (1) they like to be driven by 12V and (2) they have a common anode when I was expecting a common cathode. They were advertised as already having the resistors in-line with the LED’s.

Inspired by charlieplexing, I came up with an way to control 1 digit using only the Uno (USB powered) and an external 12V supply. I hook the positive 12V up to the Common Anode of the display, and I connect the cathode for each segment to its own IO pin on the Uno. I start by setting all 7 pins to INPUT, effectively removing them from the circuit and keeping the whole display off. Then to turn on each individual segment, I set that segment’s pin to OUTPUT LOW (0V), allowing the pin to sink the current running through the LED from the 12V supply. Does anybody see any problems with this?

I was worried about operating current of the LEDs and if each pin could sink that much. I put my ammeter in series with an individual segment. It would not light the circuit when on the mA setting; and when I switched to the 10A setting, it lit, but current did not register on the meter. I then put the ammeter in series with the common anode, so all current from all segments is passing through it. When I have the number 8 displayed at 12.5V, the anode current reads 0.01A on my display, so it seems as if the whole digit is only drawing a maximum of 14mA at 12.5V. To me this seems to be well within the range of 20mA per pin. I am testing this on an Uno, but the final project will probably utilize a Mega2560 as 7 * 4 = 28 pins would be needed just to drive the 4-digit display, not to mention sensors and buttons.

I have included a schematic below. What are everyone’s thoughts on this control scheme?

The photo is way too big to see, scale it to 600 pixels wide before posting.

I set that segment's pin to OUTPUT LOW (0V), allowing the pin to sink the current running through the LED from the 12V supply. Does anybody see any problems with this?

Yes when the segment is off the arduino pins will "see" a 12 volt input on them. This exceeds the maximum input voltage (the same as the supply) and so will damage them.

Grumpy_Mike:
The photo is way too big to see, scale it to 600 pixels wide before posting.

Yes when the segment is off the arduino pins will "see" a 12 volt input on them. This exceeds the maximum input voltage (the same as the supply) and so will damage them.

I scaled it down for more visibility.

I guess I thought that they will be seeing 0v because of the resistor.

If this doesn't work would you suggest a transistor for each segment? Or would some sort of shift register be able to handle 5v logical input and 12v power?

Use TPIC6B595 shift register to pull individual cathodes low, need a resistor per cathode if you find they are not built in.
Can use OE/ with PWM output from Arduino for brightness control as well.

I guess I thought that they will be seeing 0v because of the resistor.

Classic newbee mistake, a resistor with no current flowing through it drops no voltage across it, so if one end is at 12V the that is the voltage at the other.

I scaled it down for more visibility

Thanks.

a transistor for each segment?

Yes that would work.
Or a ULN2003 or similar array, that would be just one chip.

Or would some sort of shift register be able to handle 5v logical input and 12v power?

No, the shift register needs to have what is called open collector outputs, which is what the one CrossRoads talked about has.

The shift register is nice, use one for each digit, only need a couple of pins to control multiple digits then.
This board was designed to drive 4 digits plus arduino functionality with off-board USB/Serial adapter, and do some other stuff

and this one up to 12 digits plus arduino functionality with off-board USB/Serial adapter
Both are available for purchase, details on website.

I am putting together my own project using a CA 7-Segment display using a shift register, a 2 digit 7-Seg and the ULN2003. It is somewhat working well though I may be having a flickering problem (I can't split apart the 2 digits). However, it is perfectly reasonable to use a PNP or P-Chan transitor on each of the CA, and then connect the cathodes of the 7-Segments to a single ULN2003 (Assuming you don't need the decimal), and then you just mux the 4 CA Transistors and cycle through them, and control the pins directly rather than use a shift register. It requires more pins to use, but is a little simpler software wise. It does limit the brightness of the display though, since each only gets 1/4 of the on time.

If you do need pins, shift register is the way to go.

Non-shift register, single digit multiplexing.

And a non-multiplexed example with open drain shift register TPIC6B595

Use TPIC6B595 shift register to pull individual cathodes low, need a resistor per cathode if you find they are not built in.
Can use OE/ with PWM output from Arduino for brightness control as well.

Crossroads, By /OE I take it you mean not-G (pin 9) on the TPIC6B595? I guess the process is that pin enables/blanks the display so, if pulsed with a PWM output, the intensity of the display is changed.

Would it be possible to use a light dependant resistor (LDR) as part of a divider circuit to feed into an analoge input that, when read, will alter the PWM duty cycle and therefore the intensity of the display? I’m thinking of an automatic circuit for daylight sensing that will dim the display in dark conditions. If so, will the PWM routine be part of loop{} or an interrupt routine?

Yes, pin 9.

Just make it part of loop: