I'm making a seven segment stopwatch that I've hacked together from code around the internet. It's displaying the numbers of seconds since switch on accurately so I'm not to worried about the code.
But when digits are all quite dim and when I display a number "1" for example it's a lot brighter than a number "8".
I'm using a HDSP-B03E (Common Cathode) display with each pin connected between pins 2-13 on my Arduino Uno. I'm using current limiting resistors for all the segments (but I've tried removing the resistors and noticed no change in brightness).
Acording to the datasheet for the HDSP-B03E, the nominal mA per segment is 25mA. I thought the Arduino Uno could provide upto 40mA from each pin. What am I doing wrong?
Question: how are you connecting those common cathodes?
My concern is whether you have connected them directly to another Arduino pin. That would mean that pin would have to sink 8 x 25mA - far too much for a single unaided pin and could possibly damage the ATmega chip. That could certainly explain your dimmer segments when more are switched on. If that's the case I recommend you use a ULN2003 to sink the current from the common cathodes. This contains 7 darlington transistors that relieve the strain on the Arduino pins. Alternatively 4 x BC337 (or similar) NPN transistors, with, say, 1K resistors between their bases and the Arduino pins. Note that either the ULN or the transistors "invert" the output of the Arduino pins driving the cathodes, so you would have to change your sketch slightly, so that a HIGH switches the digit on rather than a LOW as now (I assume).
Can you post a full schematic (hand drawn would be fine).
Sorry to waste everyone's time, I just tried to make the schematic and it made it obvious what I was doing wrong. My limiting resistors were placed on the same row of the breadboard as the connecting wires (i'm new to this) so they weren't doing any limiting. Corrected that and it's much less noticeable.
megamef:
My limiting resistors were placed on the same row of the breadboard as the connecting wires (i'm new to this) so they weren't doing any limiting. Corrected that and it's much less noticeable.
Hmmm... but the digits are still quite dim, right? What value of resistor?
With no ULN/transistors, your resistors should be at least 600R, for a peak current of 5mA per segment and 40mA per digit. 5mA per segment, with a 1:4 multiplex ratio is only 1.25mA on average, which will be pretty dim... Also maxing out the Arduino pins at 40mA will shorten its life, according to some experts.
With a uln2803 or a transistor to take the cathode current, your resistors could be as low as 75R, giving a peak current per segment of 40mA and an average of 10mA. However, the danger there is if your sketch freezes and stops multiplexing. Then the segments would be subjected to a continuous 40mA, which would probably destroy the display. Safer to go for 120R, giving an average current of 6.26mA, at least until you are sure you have debugged your sketch, and maybe long term, to maximise the life of the Arduino.