**UPDATE** I also made a CMOS version here: https://www.instructables.com/id/DIY-CMOS-RAM-Memory/
If you have ever looked at a microcontroller's datasheet, you have probably seen something about registers.  Registers are little one or two byte memory storage units in microcontrollers.  The register in this instructable can hold 3 bits of data (b/c I ran out of room on my breadboards) using transistors.  I did this to prove that I can, however, its not practical as an 8 bit register requires 64 transistors, about 64 resistors and lots of space.

The register is a neat device. It can recieve data when the enable input is, in my circuit, low and it can then latch and save the data even it the data line is changing. My circuit is not the conventional D-type latch because it used more transistors than I had.

Step 1: Materials

The materials for this project are quite simple as it is a prototype kind of project.

8 NPN transistors for each bit - mine is 3 bits (do the math)
8 resistors for each bit - 1K for the supply connection and 1K or more for signal. get a few more (you will need some more)
A pushbutton switch - N.O.
A DIP switch - at least 4 switches
A solderless breadboard - if you dont have one then your missing out because these things are great
An LED for each register to display  the stored bit
Some wire
Pliers are a great help for placing wires in tight places

Step 2: What's Going On?

The basis of the circuit is the SR Flip Flop.  This flip flop circuit uses 2 inputs, Set and Reset, to control 2 outputs, Q and ~Q (not Q).  When the Set line goes high, Q will go high and stay high even after Set goes low.  If, however, Reset goes high, then Q will go low and ~Q will go high. 

Now the question becomes how do we make all of this happen with only one input?  We do this by connecting the data line to the Set input and connecting it to the Reset line through an inverter.

So far, when Data is high, Set is high and Reset is low so Q is high. If Data goes low, then Set goes low and Reset goes high making Q go low and ~Q go high.  Now we have another problem.  The register changes states when the Data does, it doesn't latch like we want it to. How do we fix this? By adding a Write Enable.  We can do this by adding a gated buffer.  It acts as a switch so if the switch line goes high or low the buffer will either turn off or on, respectively. Now, even when the data line can change states, the data can remain the same.

Step 3: The Circuit

So now that you know what is going on, we can begin to construct the circuit. When starting the construction, I would recommend placing the NOR gate transistors on the board first. it makes things much easier as you go along. The output transistor is needed because there isn't enough power to drive the led brightly.  If you notice, it is an inverter in the circuit diagram, however, whether or not you have to invert the signal going to the led is based on which NOR gate you take the output from.  If the led's state is opposite of that of the data input, then you must either change which NOR gate you take the signal from, or change the transistor's output (inverted, or non-inverted).

Step 4: You're Finished

Now, you should have a working register! If you don't check your wiring very closely, any mistake could produce very undesirable results.

If your are familiar with registers, you may be asking why I didn't go with the conventional D-Flip Flop or D-Latch.  The main reason is that I wanted to challenge myself. I did't want to get online and look up a circuit, i wanted to design my onw. I would also need another transistor for each bit in order to make a D-Flip Flop. So in my opinion, i made an efficient circuit.

I will be remaking the circuit with MOSFETs in a CMOS arrangement so check it out when I finish it!!

***Check out my "macroelectronic" 4 bit calculator, https://www.instructables.com/id/4-Bit-Binary-Adder-Mini-Calculator/
<p>how do you program this?</p>
<p>I don't really understand this circuit. Where would you connect the resistors and the switches and the LEDs. How would the LED glow, indicating the previous state and present state, as in a shift register. </p>
<p>I don't get the transistor that is connected to the led because the emitter is connected and also the collector to the led.If i connect the ground to the emitter which is negative and if i connect the positive to the collector it is going to be short circuited.I hope you will understand what i mean.</p>
This is really cool and I built one on my breadboard following your schematic. (I only build 1 bit, just the minimum following your schematic.) Just to be sure, when i power up the circuit my LED is in an 1 state. When I push the momentary switch the LED remains in its current state. When I switch the DIP-Switch to the other position, and press the momentary-save switch, the led goes to the 0 state. And the same happens in the opposite 0 to 1 state. Im really trying to understand logic gates and computers more deeply and flip flops are new to me. Is what i described proper operation? Thanks so much.
How about this?
can i use 1.2k ohm instead of 1k ohm
Yeah, anything higher than 1k should work.
ok i will post some pics when i am finished
Check out this schematic! I painstakingly slaved away on my D Latch memory for all the world to see!<br> <a href="http://i137.photobucket.com/albums/q208/rtty_the_pivot/DLatchMemory.png">here is the schematic.</a>
<strong><u>With the LED on, it draws an additional 5 mA (Milliamps) as compared to having the LED off.</u></strong><br> The circuitry itself draws anywhere from 1 mA to 2 mA depending on the state of the data input. <u><strong>If the data input is HIGH, the circuitry will draw 1 mA more compared to when the data input is LOW</strong></u><br> <br> The most this will draw is <u><strong>7 mA.</strong></u><br> The least this will draw is <u><strong>1 mA.</strong></u>
can i store data in it
How much are you talking?? Bits, bytes, kilobytes, megabytes??? If you want to store more than a few bits or a byte, its not practical.
ok if i want to store something less than a bit<br>can i store it <br>if yes how
A bit is the smallest piece of information you can store, a 1 or 0.
you made 3 bits so you can store 3 bits<br>am i correct<br>how can you store data in it
I only made one. i gave you three pictures of the same thing. so i can only store one bit.
how do you put data into the circuit
If the &quot;D&quot; (data) input is at the desired state, pulse the &quot;Latch&quot; (write) input fairly fast to set the LED (the output) to whatever logic level &quot;D&quot; is.<br><br>When i say &quot;pulse the 'latch' input&quot;, I mean turn it on and then turn it off.
ok<br>i am trying this<br>i have about 50 bc548s
it becomes immensely more practical to store bits after I soldered up my design!<br> <br> Inst'ables.com is not allowing me to post pics in comments right now, so I'll just post some links to them:<br> <br> <a href="http://i137.photobucket.com/albums/q208/rtty_the_pivot/100_9730.jpg">http://i137.photobucket.com/albums/q208/rtty_the_pivot/100_9730.jpg</a><br> <a href="http://i137.photobucket.com/albums/q208/rtty_the_pivot/100_9731.jpg">http://i137.photobucket.com/albums/q208/rtty_the_pivot/100_9731.jpg</a><br> <a href="http://i137.photobucket.com/albums/q208/rtty_the_pivot/100_9730.jpg">http://i137.photobucket.com/albums/q208/rtty_the_pivot/100_9730.jpg</a><br>
it becomes immensely more practical to store bits after I soldered up my design!<br><br>Inst'ables.com is not allowing me to post pics in comments right now, so I'll just post some links to them:<br><br>http://i137.photobucket.com/albums/q208/rtty_the_pivot/100_9730.jpg <br>http://i137.photobucket.com/albums/q208/rtty_the_pivot/100_9731.jpg <br>http://i137.photobucket.com/albums/q208/rtty_the_pivot/100_9730.jpg
Thats cool!!
That's interesting, so it is drawing a lot less current then my circuit at 15-20mA per bit. What ate the values of your resistors? I used 1k ohm for everything, mainly because they were what I had available. If I had a bunch 10K's or 100K's I would have used them instead.
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;I am using 10 Kohm resistors. If you would like to try one of my AND gates out, (I don't know if they are unique or not) here is the schematic:<br> <a href="http://i137.photobucket.com/albums/q208/rtty_the_pivot/ANDgate.png">=<u><em><strong>==http://i137.photobucket.com/albums/q208/rtty_the_pivot/ANDgate.png===</strong></em></u></a><br> <br> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;I suggest R1 and R2 to have a value of anywhere between 10 Kohm and 100 Kohm.<br> R3's value has to be less than R2. preferably half the value of R2.<br> <p> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;The reason for the addition of R3 into the gate is to keep the base-emitter leakage in check. If I make input B HIGH, that high current will go through the base and out the emitter of the transistor. This current will ultimately end up at the output (X) of the gate. The LOW current coming through R3 is going to be double the HIGH current of R2 if the value of R2 is double R3.</p> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;From this we can see that the LOW current from R3 and the HIGH current from R2 will both meet once they have gone out the emitter of the transistor. Now that they have met, the signal with more current will take over. Since the LOW signal from R3 is double the current of the HIGH signal from R2, the output will be LOW.<br> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Alternately, When A is HIGH, it allows a HIGH signal with much more current than the R3 LOW signal to &quot;take over&quot; the emitter as the dominant state, and the end result being a HIGH output (X).<br> <u><em><strong>=====thanks for reading!=====</strong></em></u>
Thats awesome! Great Job!!
can i use bc548<br>i have about 50
Couldn't I replace the two YES gates (buffer gates) with AND gates?
You could, but I did some tests with RTL AND Gates and I got some wierd results. Because of the configuration of an RTL AND gate, when one of the inputs is high, say A. Then the output is semi-high, about 2V with a 5V rail. However, if only B goes high, the output is still low. That's why I created that configuration. <br> <br>If you were to use CMOS or true TTL, then the AND gate would work normally, but with RTL, it doesn't work right.
You can fix that with a pull-down resistor of less value that the resistor connected to &quot;B&quot;. (10,000 &lt; 22,000) <br>This ensures that even if B is HIGH while A is LOW, the HIGH current given to B will not be more than the LOW current from pull-down resistor. (remember that the current given to the base and collector both go to the emitter)
That might work, but the problem I had was when B went high, the little bit of current, even from a 100k ohm resistor was enough to be amplified into a full 5V signal by the next transistor. Its just one of those things that can easily be fixed on paper, but doesn't work in real life, cuz small signal transistors amplify the current too much. I tried putting a pulldown resistor below the emitter of B, but again, the resistor still created a voltage divider that let some current go on to the next stage, enough that it was amplified into a full 5V about 2 gates down. <br> <br>The current best solution I've found is to make a NAND gate, and invert the output. But if that circuit works for you, then go for it!
Very interesting...<br>Good chat.
For a larger image of the below schematic, <a href="http://i137.photobucket.com/albums/q208/rtty_the_pivot/OneANDgateRTL.png">click here</a>
Could you upload the schematic file of your transistor memory? I would really appreciate it if you would! I use CadSoft:Eagle too and I'm loving it!
So how much and how large would a 4GB cluster be?
Well 4GB*1024*1024*1024*8=34,359,738,368 bits!!! And if 1 bit takes up a small breadboard (the small one from Radio Shack) then its gonna take up a huge amount of space!!!!! Also each bit uses about 20 mA (in my circuit) so it would take 687,194,767.36 Amps of current!
So it's a better idea to buy a premade stick? Lol.
It's more practical to buy a stick if you're looking for more memory. &nbsp;But it's better to build if you're looking for experience and a challenge.<br> PS, I briefly considered the same thing about making my own memory too, but figured there must be a reason why no one is really doing that. lol
I want to make a gaming computer from the ground up. How hard would that be?
It really depends what you want to use, if you are using straight transistors is gonna be extremely difficult and large. If you want to use ICs it will be considerably easier, but you still need a screen so that will be a challenge. Good luck! If you do build one, make an 'ible!! I wanna see it :D
I want to go back to basics. Simple as possible. But such a thing is near impossible, lol.
Well... yeah its nearly impossible. But it would be a very intersting project. If you were to go as simple as reasonably possible, then using ICs would be a good project. It will still be a challenging project, and it would be almost as simple as possible, the only difference is that ICs make it smaller. As long you don't have a programmable chip, then its still very, very basic. If your really serious, then I would like to see it!!!
http://www.mycpu.eu/<br><br>http://web.cecs.pdx.edu/~harry/Relay/index.html<br>http://www.electronixandmore.com/project/relaycomputertwo/index.html<br><br>They are part of a web-ring, so have fun.
From the third link:<br> &quot;Why on earth build a relay computer when there are already computers over a hundred thousand times faster?&quot;<br> <br> I think he is off by a couple orders of magnitude there.<br> <br> Those projects are neat (and I mean that in the nerdiest way possible), but I really don't think they add much value after you learn how memory (CMOS and Register type) and logic based arithmetic work.<br> <br> I think it's worth making your own shift register out of transistors once as a learning experience, but I don't think it's worth building a CPU out of discreet IC's.&nbsp; To each his own.&nbsp; Consider that a hobby AVR is about $4 and at least twice as fast as the MyCPU (probably more like 3-4x, considering things like transmission delays and the generally lower speed of the significantly larger transistors) and has a whole pile of features that the MyCPU lacks besides.<br> <br> In other words, I don't really understand the desire to go backward instead of forward.<br>
First of all, you have to step backwards to move foward. Thats why we go to school, to learn the basics. And if you are curious then you want to go backwards so you can understand whats actually going on inside your avr. <br> <br>Next, these people do this stuff because it's fun. It's like when you mix baking soda and vinegar, you know what happens, but knowing isn't enough, you have to see it. Its the same with the MyCPU of relay computer, they know how it works, but its still fun to see it work. <br> <br>Oh yeah, the IC's in the MyCPU can handle much higher speeds (30-40MHz) than an avr. He made it slower because the memory can only go so fast, had he found a faster chip, he probably would have made it faster. <br> <br>BTW, I'm designing a 74ls based microcontroller that has a similar architecture to an avr. It will have timers, SPI, I/O portrs, ADC, etc. It will also have a clock speed of up to 14 MHz.
Some people like to learn how a computer actually works.<br>Oh and the MyCPU is a hell of a lot faster then an avr. The guy uses it as his webserver.<br><br>If I had the money (and time lol) I'd buld it.
I completely agree with you Vadim.
If your looking to build anything to run an x86 arcitecture you will be in for a long journey. If you complete it though you will be hailed as the king of TTL.<br>Just a quick point. The 120MHz version of the Pentum 1 used 3,300,000 transistors, and they are faster than a BC574 or whatever the number is. I wish you well.

About This Instructable




Bio: I like to make things that move, sense, calculate, compute, blink, and make noise. I like making things that create high voltages, electrical arcs, and ... More »
More by Teslaling:The Valve Caster 2.0: Tube Boost and Overdrive Build Your Own 555 Timer Helios 3: Homemade Rocket Candy Powered Rocket 
Add instructable to: