Introduction: DIY SR Latch Out of Transistors
An SR latch is a kind of circuit that is called "bistable." Bistable circuits have two stable states, hence the name BI-stable. One of the simpler versions of this kind of circuit is the SR latch, which stands for "Set/Reset Latch." The SR latch is most notably used for memory, because after you select a value, it is 'latched' so if there is no change in input, or the inputs turn off, the outputs stay the same.
Step 1: Design
On the highest level of design we have two NOR gates hooked up with their outputs tied to one of the others' inputs. Let's think through this: If the output is already that Q is 0, then we activate the S input, then the output of the NOR gate would be 0 (because the output of a regular OR gate is 1 if one, the other, or both of the inputs are high) which, if R is off, would turn the other NOR gate on, and pull the Q output high. In this state where Q is high, if we activate S nothing happens to the output state, because the bottom NOR gate is already active and the top is unaffected. But if, in this state, we activate the Reset input, the same thing that already happened would happen mirrored and the Q output will turn off.
To make a NOR gate out of transistors, we can build a regular OR gate (with the transistor Collectors and emitters in parallel), and just tie the emitters to ground, and the output to a pull-up resistor.
The next step is to just tie those types of NOR gates in the organization of an SR latch. Since a transistor is a current controlled switch, we need to make some considerations about the resistors we are using. The main thing we have to keep in mind is that our outputs split into parallel loads, one driving the output LED, and the other driving the gate of the other NOR gate. I drew up a simplified schematic of this output circuit in order to choose resistor values, assuming we want our base current to be 0.0001 Amperes, and our LED current to be 0.01 Amperes. I encourage you to take a look at the schematic and see if you can come to the same conclusion as I did, and if you come to a different conclusion about the resistor values give it a try in your circuit, and let me know how it goes!
Step 2: Initial Board Setup
The power rails should be tied together and the whole thing should be powered with some sort of 5V power source, such as an Arduino or lab bench power supply. Whatever you choose, try to get a current limited source so you don't burn anything up on accident.
Step 3: Add Transistors and LEDs
Step 4: Add Resistors
Step 5: Add Hookup Wires
Step 6: Testing
Now that you have it all hooked up give it a shot! Try setting it, resetting it, setting it then setting it again, and reseting it twice. If something isn't working like it should, test for current through the LEDs and see if it is working, just with too low a current to drive the LEDs. Another thing to test would be the resistance of each of the NOR gates when they're supposed to be active. Any resistance other than around 0 Ohms would mean that the output is trying to pull too much current (more than 100-150x the base current per the datasheet of the 2N2222, the transistor I used) which could mean the base current is too low, or the output current is too high (Which shouldn't be so if your LEDs are correctly current limited).
Step 7: Looking for More?
If you liked what you saw in this Instructable, please consider checking out my new book "The Beginners Guide to Arduino." It gives one a concise overview of how the Arduino platform works in a way that is both applicable and relevant.
We have a be nice policy.
Please be positive and constructive.