3

I accidently bought a "Common Anode" 7-segment display instead of a "Common Cathode".

I understand that the polarity of the leds within the display is 'reversed'. So instead of putting the common pin on GND I have to put it to 5v (with current limiting resistor)

My questions on this are:

  1. Can I still use only one current limiting resistor on the common pin? Instead of a resistor on every segment pin.
  2. Can I use the pins from arduino to drive it (withouth pull-up/pull-down?) By making the signal LOW the current will flow from 5V common anode to the arduino and thus the segment wil light?
  3. Can I still use a shift register to drive the segment led? (By inversing the outputs (in software))

Obviously I would like to have wiring more like this (but then I would ofcourse change the GND line to a 5V line.

Better wiring


The wiring below is the worst-case wiring I can think of.

Wiring

^ So can I avoid this, when using a Common Anode 7-segment display or am I forced to buy a Common Cathode 7-segment display?

  • Both thanks for the help and explanation! I was able to test the segments :) (They arrived today) They'll fit nicely in my "Alarm clock" project. For further reference, be sure to read both answers, especially note that the maximal sink current for all the pins together is different as for each pin itself. – Paul Apr 10 '15 at 17:37
  • @mathsman, are you sure that there are small 7 segment displays that consume 80mA per chip? That would correspond to ~ 10 mA per segment. I've been looking around a lot and haven't found anything that matches those specifications. The closest that I have found is the yellow displays here: jameco.com/Jameco/Products/ProdDS/24782.PDF But those are still 20mA / segment, so ~ 160mA total. I'd love to find a concrete example of a display that can be driven directly from the arduino without requiring a bunch of transistors. – user16516 Jan 19 '16 at 5:24
3

You can use a single resistor on the common pin if you want. The problem is that lighting up multiple segments at the same time will substantially reduce the brightness of each one. You could work around that by lighting each segment one at a time in very quick succession though.

It should be possible to control the display directly from the IO pins by setting them LOW. In this configuration, they will be sinking current (rather than sourcing it). It depends on the specification of the display and on what resistor you use though.

Basically, try to keep the current below 20mA and it should be OK (assuming you're using a standard 5V Arduino). For example, if each segment has a forward voltage drop of 2V, you would want to use a resistor of around 180 Ohm.

Controlling the display directly from a shift register is probably not possible, although once again it depends on its specification. Shift registers usually aren't designed to sink enough current so you'll need something like a transistor on each output.

  • So, if I find out how much current my shift register can sink, I have to use a resistor that limits the current to this level (taken into account my arduino is 5V). Though the brightness of the led's will be lower the less current flows through. And by sourcing it, the only problem would be sourcing too much current to the LED's thus be safer for arduino/shift register than sinking it in most cases. Basically I should buy "Common Cathode" next time :) (did check it on the RGB leds and 8x8 segment I bought though) – Paul Apr 10 '15 at 10:32
  • @FuaZe There will be a limit on how much current the Arduino or shift register pins can safely source too, so it's not necessarily any safer than sinking. – Peter Bloomfield Apr 10 '15 at 11:04
  • Peter R. Ah, ofcourse, I was thinking that sourcing too much will cause your LED to fail, but yeah, it's not safe to rely on that. – Paul Apr 10 '15 at 11:57
4

Sorry about the crudity of my image, but you don't always need those transistors. Peter has already said so, but I wanted to explain a bit further. schematic

The only thing is that you need to set a pin to LOW to light up the led, and HIGH to turn it off. Just use a ! to make your code more intuitive if your like. So e.g. digitalWrite(segmentA, !HIGH)

Some limitations. A pin can sink up to 40mA (no problem here), but the total sink current for the digital pins 0 to 4 shouldn't exceed 100mA. The same goes for pins 5 to 13. And the same goes for the analog pins. So either limit the current through the leds to around 10mA, or make sure no more than 5 leds are lit at the same time, or connect half of the segments to on of the above mentioned groups, and the other half another (f.y.i. analog pins can be used just like digital pins).

  • Thanks for the heads up on the total sink limitation! I didn't know that, what would go wrong if I sink more than 100mA? – Paul Apr 10 '15 at 14:56
  • Fry the input pin, fry the entire chip, unstable behavior, having less current going through the pins (dimmer leds), who knows. The ratings are conservative, so you're probably fine if you go a little over. – Gerben Apr 10 '15 at 15:30
  • PS I prefer common anode displays. Easier to wire. – Gerben Apr 10 '15 at 15:32
  • How's common anode easier to wire? The pic of my fritzing drawing is a common cathode, the only thing is that you have a GND and not a 5V? And I think arduino can source more current than sink, so it should be safer for your arduino to source, or you'll have brighter segments? – Paul Apr 10 '15 at 17:09
  • Like I said above, you are going to hit the 100mA limit. Easiest way to solve this is by adding transistors. Having the transistors at the low side, sinking the current, means you can always use regular NPN transistors. Sourcing the current can be done with NPNs but only if you use the same voltage for the leds, as you do the arduino. Otherwise you'd need PNP which are a bit of a pain (to me at least). If you are just using resistors, there is no real difference. Source limit is 150mA, so that's a bit higher. PS see edit above. – Gerben Apr 10 '15 at 19:41
1

Peter and Gerben have already said what is needed , but I wish to explain things even further.

A normal small 7-Segment display consumes only 70-80mA when all segments are HIGH.So you can use the Arduino directly without damaging it. Also note, depending on the quality of the project, you could either use a common resistor for all segments, or use separate ones. Separate ones will give much brighter light and better quality.
A medium size one will require max consumption of around 400mA current, so use cheap transistors.
A large size one will require max consumption of upto 1.5-2A current , so use MOSFETS or other high current Transistors.
An Extra Large one will require max consumption of upto 10-25A current, so use good MOSFETS or maybe even Relays.

Usage
Small- Wrist watches
Medium- Small clocks
Large- Big clocks
Extra Large- Very big clocks like ones in Railway stations

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.