In the first part of what’s fast becoming a novel of a blog post I discussed some of the theory behind the transistor latch circuit demonstrated by Dino at Hack A Week back in August. In this section I’ll discuss what happened when I first attempted to get the circuit working myself.
Figure 1: Initial BJT Latch Circuit
Here’s a quick recap of what was covered so far about Figure 1:
~ Instead of the BC547 and BC557 BJTs used by Dino I had to use 2N3904s and 2N3906s because that’s all I have available.
~ When C1 is charged pressing the pushbutton switch will cause the LED to latch on. Pressing the pushbutton when C1 is discharged turns the LED off.
~ The area in the yellow box can be views as a bias network similar to one that may be used on an IC. It has two desired state of operation, off and on which is why it was chosen for a latching circuit.
~The rest of the circuit forms a start up/shut off circuit which is used to snap the bias network into either one of its two states of operation.
Immediately upon firing up the circuit once it was breadboarded I saw a problem. The LED lit right away and pressing the switch did nothing to turn it on or off (though occasionally it would flicker). Probing the circuit with my multimeter I discovered that something was causing the three transistors to turn on independently of whether or not the pushbutton was pressed. All three VBE voltages (VEB technically for Q3) were sitting solidly at 0.7 V which was more than enough to turn them on. Checking the voltage on C1 showed it to be in the low millivolt range which could be expected since Q2 was turned on.
In order to check for an error on my part when wiring the circuit together I then broke it up into three separate networks and tested each one individually. Network 1 consisted of the start up circuitry Q2, R1, R2, R3, and C1 which on its own properly charged and discharged the cap when Q2’s base was tied low or high. Networks 2 and 3 were each a single string of the bias network with the bases of each transistor kept floating for testing purposes. The LED load and pushbutton were removed during these tests. On their own, each section of the circuit worked as I expected it to and it was only when the entire circuit was wired together that something was going wrong.
Leafing through Chapter 4 of Gray and Meyer again I recalled that these types of bias networks operated as a positive feedback loop. Basically, all it takes is a small disturbance on one of its nodes to cause it to turn fully on. The addition of a start up circuit is merely insurance that the small disturbance occurs every time power is applied. Okay, I thought, what could be disturbing a node so much that the circuit would self start? Perhaps it was the way I was applying power, some initial surge of current? I had a 9V battery with a snap connector from Radio Shack on it to connect the battery to my breadboard and was just plugging and unplugging the positive lead when I wanted the circuit on or off, maybe that was doing it? I tried slapping a few 1µF bypass caps to the 9V rail to improve circuit by smoothing out any initial pulses. It didn’t work but proper bypassing is always good practice so I left the capacitors on the board anyways.
At this point I was getting stumped so I started going back over each piece of the circuit again looking for clues. Something was nagging me about Q3 and R8 (outlined in green in Figure 1) but I couldn’t quite place it. Lifting the one end of R8 from the 9V rail caused the LED to turn off but as soon it was reconnected, the LED would instantly turn on. Ah ha! Something I could work with. I began to suspect leakage current at this point. My theory was perhaps the base of Q3 was pulling current from the battery through R8 even though the circuit was supposed to be off. This would cause a voltage to be dropped across R8 which might turn Q3 on just enough for the circuit to drive itself out of the off state. Making R8 smaller should help alleviate this problem, less resistance, less voltage drop, and Q3 is not turned on as much. I tried various values of R8 between 1kΩ and 1MΩ before finding a sweet spot between 30kΩ and 50kΩ. Less than 30kΩ and the circuit would never turn on, greater than 50kΩ and it would never turn off. Even in the sweet spot however the circuit was finicky and would often refuse function properly. I had improved things but I still wasn’t satisfied.
To further try to prove my theory I studied the datasheets of the BC557 and the 2N3906. I was thinking that Dino’s transistors had to be drawing less base current than mine which would explain why most of the time his circuit was working and mine wasn’t. Sure enough the 3906 was drawing just over 3 times as much current in the off state than the 557 (see Figure 2 below). As far as I could tell, the increase in off-current for the 3906 was enough to barely turn on Q3 which would then cause the positive feedback of the bias network to drive the circuit fully on. Feeling validated, I then set out to improve upon the circuit with the components I had available…
Figure 2: Off State Base Current Comparision