I recently started learning electronics on my own, never really had a chance to learn that at school. So I need some advice :)
I wanted to use Atmega16 to do some 7-segment LCD multiplexing. I will try to mutiplex 26 LCDs at the same time, not to use too much microcontrollers. I will only use 7 segments of the LCDs (no dot). To reduce number of pins needed, I decided to drive them in a 14pins x 13lcds configuration. This means each segment will be driven only 1/13th of the total time. I intend to use LCDs which have a maximum peak current of 80mA and a voltage drop of standard 2V. Because of the current limit, I thought I will drive each segment with an average of 5mA, thus peak current will reach a maximum of 5mA * 13 = 65mA (I want to increase the peak current so that LCDs won't look so dim). Because of the 14 pins that can be used at the same time, total current can become up to 65mA * 14 segments = 910mA. Because of this, the Atmega can neither source nor sink such current. Nor can it withstand a 65mA current if connected to the cathodes. So transistors is the obvious choice.
I decided to use an ULN2003 chip for cathodes (datasheet says it's Vce = 0.9V) and a PNP transistor for anode switching (SS8550, because of it's maximum current of 1.5A; Vce = -0.28V, hfe = 40 in worst case, Vbe = -1V). Everything is powered from a 5V power supply. My schematic for a single 'frame' of multiplexing looks like this (there will be 13 of these, connected to common ULN2003 chips):
I would like to ask you guys, if my calculations for current limiting resistors for segments and for that of transistor base are correct.
Because ULN2003 already have a 2.7k resistor on base input, we can connect the inputs directly to Atmega's pins. The outputs will work as low-side switches. Thus we first begin calculation for resistors R40-R53:
voltage drop on these resistors will be: 5V - 0.28V (T1.Vce) - 2V (led) - 0.9V (ULN.Vce) = 1.82V
resistor value: R = U / I = 1.82V / 65mA (current we want) = 28om
but let's select a 27om from the available values, so a current will be: I = U / R = 1.82V / 27om = ~67mA
total collector current we need will be 67mA * 14 segments = 938 mA
taking the worst case scenario for upper transistor hfe we get a base current: 938mA / 40 = 23.45mA - for worst case let's select 24mA
voltage drop on R39: 5V - 1V = 4V
thus value of R39: R = U / I = 4V / 24mA = 166.6om - for worst case let's take 160om
And here's my question for you: are my calculations right? Did I choose the right values from the datasheets to account for? Did I change the values for worst case scenarios right, so that all transistors will enter saturation without problems?
Atmega will have to sink a current of 24mA to run T1, and source some current into ULN2003. I am not sure though if it can handle both? Should I add some bigger resistor on input pins of ULN2003?
Thanks in advance! :)