Quote:
Originally Posted by jeff88
I've been trying to understand the use of the transistors. With some research, I've seen that transistor have a million and one uses, so just to confirm, the transistor is not acting as an amplifier, rather as a switch in order to multiplex each display.
|
Yes, as a switch.
Quote:
In the sketch I will set it up so that the base pin (D37 & D38 in my diagram) will be high when that particular display/transistor will be on and it will switch back and forth. How do I set it up so pins D37 and D38 switch high and low back and forth in the sketch?
|
The "joy" of the sketch is that there's not a single "right" way to do it. If you go back a few posts I put up a link to a page from a computer magazine (APC) that was using two 7-segment displays to display a "weather station" output. That has a circuit diagram for the display and Arduino and, most relevant, a downloadable zip file with the sketch that includes how the display is switched. Basically, it sets up an array for each numeral and accesses them as required, assigning them to the pins to perform the switching.
The array used is 21 by 7 but some of those are used to display things specific to the weather station. You will need just 10 by 7 i.e. one for each numeral. That does present another means by which you could indicate a negative slope though; set up an eleventh row (11 by 7 array) to flash a "-" in between the numbers.
The Arduino programming is based on C++ and there are additional information sources around for C++ as well as what is described in the context of Arduino. You might like to use that if you want more info. on (say) arrays.
Quote:
Isn't the current flowing through each segment flowing through the collector of the transistor, not the base, or is my diagram setup wrong?
|
There is current flow (at times) through both C-E (i.e. Ic) and B-E (i.e. Ib). The current flow from collector to emitter, that goes through the LED, is only present when the current flow that goes through the base to emitter is present.
Quote:
Using your calculations, but assuming the current through the collector, not the base, I've tried to work out the resistance for R2. Ic will be 10mA and Ib will be 20mA, with an Hfe of 100 (20mA * 5V). So my resistor has to be able to drop the current to no less than .2mA (20mA/100Hfe). So the calculation is (5V-.7V)/.2mA = 215Ω. I think I went wrong somewhere...
|
A bit. With (your) 10mA per LED segment and all the segments on a digit lit (i.e. with an '8' and dp displayed; the worst case), Ic is: (7+1) x 10mA = 80mA.
With an Hfe of 100, Ib is then: 80mA/100 = 0.8mA.
From the pin that is switching the digit, (5V - 0.7V)/0.8mA = 5375 Ohm = 5.375k Ohm. Use the next resistor value that is larger than that.
If you are still stuck, if you go back to the APC weather station link above, and assuming that the display that is being used for that (I haven't looked for the specs. for it) has the same Vf (3.0V) as the one you will be using, you can simply use those resistor values.