Wednesday, July 15, 2015

Whammy Bar Display Select Revisited Part 4

I started to simulate each diode again while paying attention to the model parameters, and sure enough, I deduced the culprit. A little value called 'n', which is the "emission coefficient" or the "ideality factor" depending on where you look. By observation, LED's with a smaller 'n' value worked better than those with a larger one. What effect does 'n' have? Let's look at Schockley's equation:

If we consider all other variables to be constant other than 'n' and '$V_D$' (the voltage applied to the diode), we can look at how the diode will behave. For n = 1, we find that the current through the diode increases quite rapidly as the voltage applied is increased. In fact, if n = 0 you have an ideal diode for any positive $V_D$ (yes, dividing by zero is undefined, but the limit as you approach a zero denominator is infinity, giving rise to a huge exponent). On the other hand, if n begins to increase, we can see that any increase in $V_D$ starts to produce a smaller increase in the current thru the LED. Now the LED appears more ohmic, requiring more voltage to carry more current. This should demonstrate why 'n' is called the "ideality factor". An ideal diode is a perfect conductor when a forward voltage is applied. Let's compare some values of 'n':
LTSpice doesn't let you use a value of n = 0, so i used n = 0.01. But you can see that the slope for the smaller values is much steeper than larger values. Another thing to note is that the "on" voltage increases with n as well. The knee (part of the curve as a diode transitions from off to on) is also becomes much more gradual too.
So what does this all mean again? The ideality factor determines the performance of the LED's in biasing the transistors. A larger 'n', being less ideal, behaves more like the resistors we initially simulated, whereas a smaller value behaves more like the ideal voltage sources.
Does this matter? Well, maybe. First off, if the current thru the LED connected to the base is only a single order of magnitude (or less) smaller than the current going thru the active LED, it may be somewhat visible. That's no good. Also, this circuit will likely run off of a battery. If i can drive the LED with 10uA of bias current instead of 300uA, that is considerable savings, especially considering the whole device only draws around 7mA. And those bias currents are cumulative. To display an "8" requires seven segments. At 300uA a segment that's a whopping 2.1mA worth of bias, ouch. I'll take the 70uA please.
So what does the Virtual Whammy Bar circuit do? Good question. The seven segment display appears to be a Fairchild MAN74A, and fortunately there is a datasheet. And it has graphs:
 Looks nice and steep to me. My guess is that we'll find the real thing performs well.
So it was a little difficult to measure currents since my circuit is already built on a PCB and I don't have the spare parts to mock it up on a breadboard. My test then, was to set a breakpoint in the software right after the "TENS" display was activated. This way I wasn't measuring average voltages as the displays are strobed on and off with duty cycles based on the brightness. What did I measure? the voltage between the Emitter and Base of Q1. Why? Well, the more ideal the LED's the closer to 0 this measurement will be, whereas the worse the LED's are, the closer the value will be to a diode drop. What did I get? 176mV. That's pretty good. And that was with 6 segments illuminated. It may not be a definitive test but I'm gonna go ahead and say there's a lot of current gain goin' on here and call it a success.
Well that more or less concludes my offshoot into this whole topic. It was a whole lot of work and discussion over such a small thing, but I hope you found it interesting nonetheless. What started as an accidental mis-wiring turned out to be kind of a neat phenomenon. Until next time...

Tuesday, July 14, 2015

Whammy Bar Display Select Revisited Part 3


So let's simplify the original circuit again. I've replaced the diodes this time with voltage sources to approximate ideal diodes in the forward active region. And look at the results. The current gain nearly equals β, but the current is also near enough to saturation. So we're turning the LED fully on but using very little base current to do so. However, we don't have to tweak anything to optimize this; using a different transistor (with a unique β) and you'll still see a similar current thru V1. Using a 2N2222 yielded 2.606mA, a difference of about 10uA. Changing the forward voltage drop of V1 and V2 will only adjust the "saturating" current thru V1. It's like the circuit is self adjusting. Let's look at the characteristic curve and load line:
So the Y-intercept of the load line is the theoretical max current of the circuit and is given by Imax = (Vcc-V1)/R1 = 3.3mA. The X-intercept is the maximum voltage that can be dropped across Q1 for the given circuit: Vmax = Vcc-V1 = 3.3V. I put the cross hair as close as possible to the intercept point, and sure enough, we see our 2.6mA from the simulated circuit. While our operating point is somewhat close to the saturation region, the gain indicates that there is very little saturation occuring. Again, changing the transistor or voltages of V2 & V3 will give similar results.
At this point I've done a few examples and a bunch of math and analysis, but why again? Well initially, our simulated LED's were behaving either like the resistors or like the voltage sources depending on the particular part that was used. The question is why do they operate differently?

Monday, July 13, 2015

Whammy Bar Display Select Revisited Part 2


 
Let's start by looking at the circuit in a more traditional manner by using passive loads. Above I've shown the simulation results using 1K resistors instead of LED's. Of course, this circuit saturates rather dramatically. We only see a gain of 1.6. Using Ohm's law and assuming a Vb for the transitor of about .7V, we find that R2 can only draw around 700uA more than R3 before Q1 saturates. Our above simulation confirms the estimate. Why is this? Well if we remove R1 altogether (it doesn't change the circuit in any significant way) we can derive the following equations:

I(R2) = (Vcc-Vc)/R2 with ideal saturation: I(R2) = (5-0)/1000 = 5mA
I(R3) = (Vcc-Vb)/R3 with subsitutions: I(R3) = (5-.7)/1000 = 4.3mA

Current Gain = I(R2)/I(R3) = 5/4.3 = 1.163

The approximate calculations match fairly close to the simulation results. It turns out that Vb is greater than the assumed .7V diode drop due to the fairly large base current. Also, Vc cannot be pulled all the way down to 0V. Even so, the number differ only slightly. And besides, the ultimate point is that any additional current thru R2 is going to be related to the difference in voltage between Vb and Vc, essentially the diode drop from base to emitter. Typically we'd push a much smaller current through the base by using an appropriate resistor so that we can drive a large load from some no so tough part, such as a microcontroller. So by using identical resistors on the base and collector, we don't really see much advantage. But we do with the LED's.....

Sunday, July 12, 2015

Whammy Bar Display Select Revisited Part 1

Warning:  This series of articles is more academic in nature and is aimed at those who have a formal understanding of electronics..... so there will be math, and an assumed knowledge of jargon and concepts.

So I wanted to take another look at the digit display selection from the Virtual Whammy Bar. After it initially worked I laid it out in LTSpice, and simulated it. I noticed that the current thru D1 was almost 300 times (the β of the 2N3904 model) larger than the current thru D2. Swapping transistor models and measuring the current gain provided consistently similar results for each respective β. At that point I decided that I recognized what was going on and moved to the next thing. But wait... Driving an LED is typically a switching (and thus in the saturation region for a transistor) application where the current gain is typically much smaller than β and what we have here seems to be operating in the linear active region....
Admittedly, I didn't put it all together right away. I observed as I was simulating the circuit in LTSpice that if I used certain LED's the current gain would drop dramatically. From nearly 300, to say, 10. Right there should have been the clue about saturation. This circuit is a bit challenging to analyze because of how the components all seem to interact. D1 and D2 provide "active" loads on both the base and collector of the transistor Q1. But the harder you drive the base of Q1, the more current it tries to draw into the emitter, which increases the voltage drop across R, which reduces the ability to drive the base, which makes... wait...hmm.

We'll take a look at this over the next few posts.