This article presents a step by step guide for building a 1 bit memory using just BJTs (bipolar junction transistors) and resistors. It's a nice and simple educational project as it shows how data can be stored in a circuit using basic parts only. I created several diagrams to make each step clear. The complete diagram is at the end of the article. The project is based on DIY RAM Memory: Register Style instructable, with a few minor changes. Following the steps and testing the circuit after each step is recommended, specially if not using the transistors and/or resistors suggested below.
Consider the basic SR latch consisting of two interconnected NOR gates:
The idea of the DIY RAM project is to first implement the NOR gates using BJTs and then add some simple logic to transform the SR latch into a D latch, which is basically a 1 bit RAM. Finally, switches will be added at the input and an LED at the output in order to be able to write/read the bit easily.
Parts and equipment
The parts needed for the whole project are:
- 8 Bipolar Junction Transistors (2N2222 or similar recommended. Most general use BJTs will do it)
- 7 1k resistances
- 2 10k resistances
- 1 LED
- 1 DIP switch (optional)
A breadboard, a multimeter and a power source are the only equipment. A 5V AC/DC adapter is good enough as power source. A 9V battery should also work.
1. SR latch
Consider the SR latch diagram above and the BJT NOR gate implementation using only two transistors:
The SR latch can be built with BJTs interconnecting two NOR gates (just like in the first diagram):
Go ahead and build it in your circuit board. If you can get this circuit to work, you are 90% done. It's the one that does the magic. Test the latch using the truth table above. Be sure to test each transistor before using it.
Note the four 10k resistors in the diagram above.. The two labeled R are necessary to complete and test the SR latch and are removed for the next steps. R3 and R4 are kept. These have a higher resistance in order to be able to get high-enough voltages in Q and Q' nodes. Note that a voltage division occurs between R1 and R3 when T1 and T2 are off and between R2 and R4 when T3 and T4 are off. Play around with R3 and R4 values if your high voltages are too low. I measured 4.5V at Q/Q' when high.
2. D latch
Next step is adding logic to convert the SR latch into a D latch, with a Read/Write line and a D line. First we have to convert the S and R inputs into a single D input and then find a way to force SR = 00 in order to hold the state (see the truth table above).
Using a NOT gate between S and R (so that R is inverted S) will efectively give us one input and transition the SR latch between SR = 01 and SR = 10. An additional buffer, controlled by the Read/Write line can effectively force SR = 00 to make the SR latch hold its current state.
Consider the NOT gate using a single BJT:
Adding the NOT gate between S and R inputs results in the following:
Adding a buffer that takes both S and R to ground is as simple as connecting transistors between S/R and ground and driving them using our Read/Write input (C in the diagram):
When C is low the bit may be written using D and when C is high the bit is hold even if D is changed.
3. Input switches and output LED
Finally, two switches may be added to control D and C more nicely. An LED will allow to read the bit state easily. A simple LED driving circuit connected to the output any of the NOR gates will do it:
I used two simple switches at the input. A DIP switch may also work, though I found them a bit hard to switch due to their small size. A bigger switch should be better if you have to make a demonstration like I had.
4. Complete DIY RAM circuit
The complete 1 bit RAM circuit is:
I measured 4.5V high and 0V low voltages for these transistors and resistors. Please share any suggestions or issues you have with the DIY RAM and I'll do my best to help.