loading
Picture of DIY SRAM
100_0986.JPG
100_0987.JPG
Static Random-Access Memory.  What is it?

SRAM is a type of memory that will store information, but lose it when power is disconnected, which is why it is RAM.  It is called static RAM because it doesn't need to be refreshed, unlike Dynamic RAM (DRAM) which has to be refreshed every few milliseconds to keep its data.  DRAM is common in computer memory, because of fast access times and it only requires 1 transistor and 1 capacitor per bit making it high density.  SRAM is common among microcontroller memory and some low power applications because it doesn't need to be refreshed, and uses less power.  It is slower than DRAM and has a lower density at 6 transistors per cell.

This instructable will show you how you can make a SRAM bit using the real design, not the register versions I previously demonstrated.  The SRAM is the 6t circuit, meaning that this version uses 6 transistors per bit (in reality, ours will need 8 per bit).

Why build such a device, when you can get an IC with a few thousand times more storage?
Because its cool to see how those little chips actually work.  Plus you can say that you made your own RAM... and maybe tell all your friends that your computer is running off of homemade RAM...
 
Remove these adsRemove these ads by Signing Up

Step 1: Get The Stuff

Picture of Get The Stuff
The parts list for this is nice and small.
  • 8 2N7000 transistors - These are N-channel MOSFETs
  • 4 BS250 transistors - These are P-channel MOSFETs
  • 1 LED
  • 1 Resistor to match LED current - 220 - 1K will be fine.  http://led.linear1.org/1led.wiz is a good calculator if you aren't sure
  • 2 Buttons
  • 2 Resistors 1k to 10k will work
  • Wires
  • A breadboard
  • A 5-ish Volt Power Supply

Step 2: The Circuit

Picture of The Circuit
6T SRAM2.jpg
The 6t SRAM Circuit is relatively simple.  It is 2 CMOS inverters with an enable circuit on both sides.  The output of one inverter is connected to the input of the other and vice versa.  This creates a very simple latch because when one of the inputs is low, that inverter's output goes high, this makes the other inverter's input high, so its output is now low.  To change the inverters' states, you would pulse a high current on the low side AND a low current on the high side.  This pulse is enough to change the input of that inverter, so the output changes, and the circuit latches again, but in the opposite state.  It is bi-stable, and won't freely oscillate.  The enables connect and disconnect it from the rest of the circuit, so that it can't be accidentally changed when a bunch of them are connected together.

Step 3: What On Earth is CMOS

Picture of What On Earth is CMOS
symbol_N_Chan1.JPG
CMOS (see-moss) does NOT grow in water.  It is a type of logic that uses MOSFETs and it uses very little current.  CMOS stands for complementary metal-oxide semiconductor (The MOS part is also the same for the first part of MOSFET) This doesn't mean that the transistors compliment each other, but that they complement, as in the opposite, each other.  CMOS uses both an N-channel MOSFET and a P-channel MOSFET.

How does it work?
The N-channel MOSFET will turn on when it's gate is brought up to the supply voltage, typically 3.3v or 5v, and turn off when the gate it brought down to ground.
The P-channel MOSFET will turn on when it's gate is brought down to ground and turn off when it's gate is brought up to the supply.
What is neat is that when one is on, the other is off. The pictures above demonstrate how this works for the humble inverter (also known as a NOT gate)

Step 4: The Enable Circuit

Picture of The Enable Circuit
Ideal FET.jpg
Real FET.jpg
The first thing we have to tackle is the Enable Transistor.  The schematic shows that all you need is one N-channel MOSFET to be the enable.  That, however, is an ideal MOSFET.  An ideal MOSFET is a symmetrical device that can switch currents in both directions.  The 2N7000* is not an ideal MOSFET, there is a small diode built into it that is parallel with the actual FET.  This means that current can be switched on and off when flowing in one direction, but it will flow freely through the other direction whether the FET is on or off. I don't know why the MOSFETs are made that way, it is probably a manufacturing thing.  My guess is that for some reason, it is easier to make MOSFETs with a diode than without.

To counter this, we put 2 FETs together with their diodes facing opposite directions. That way, current can't flow in either direction freely UNLESS the MOSFET is switched on.  This is why our SRAM will need 8 transistors instead of 6.

*It should be noted that most discrete MOSFETs have a body diode, as its called, in them.

Step 5: Our Circuit

Picture of Our Circuit
Ok, so we have the SRAM circuit in the middle, but what the heck is all of the rest of that stuff?

The LED is simple, it is the output, so we know what the bit is set to.  The write enable switch turns on the enables, allowing you to write to the SRAM.  The Bit Line Switch is used to write the data to the SRAM. These switches need the pull-down resistors because the gates of MOSFETs are slightly capacitive, meaning that if you disconnect them from anything, they may hold their charge and stay switched on.  The ~BL inverter is used to invert the signal to go to the NOT Bit Line.  Then the BL inverter reverts the signal to its original state.  The reason for this second inverter is that the Pull-Down resistor doesn't draw enough current to switch the SRAM latch (more on this in step 13) so to counter this, we just use another inverter.

Step 6: Let's Start the Fun Part

Picture of Let's Start the Fun Part
100_0932.JPG
Ok, well the fun part also happens to be the tricky part.  I took a lot of pictures so, hopefully, it won't be a scary, daunting task.  The circuit starts out simple, but gets scary rather quickly.  A picture is worth a thousand words (actually a 10MP picture is about 10 million 32-bit words), so I plan on a few words and a lot of pictures.

To start we are going to make the two inverters.  They are simply a BS250 and a 2N7000 with their drains connected together.  To do this, the BS250 goes on the left, and the 2N7000 goes on the right.  Both should have the rounded side facing you. WARNING: if the rounded side is facing away, then the body diodes will short the supply and ground, and the transistors will release their blue smoke! Also, the rightmost pin (pin 3) of the BS250 and the leftmost pin (pin 1) of the 2N7000 should be connected together.

Step 7: Connect Them Together

Picture of Connect Them Together
Now we are going to connect the inverters together.  The output of one is connected to the input of the other.  To do this, connect a wire to pin 2 of a transistor on the left inverter and connect it to the output of the other transistor.  The output of the inverter is where pin 3 of the BS250 and pin 1 of the 2N7000 are connected together.  Repeat this, but with the input of the right inverter and the output of the left one.

If you are confused, refer to the picture.

Step 8: Add the Enable

Picture of Add the Enable
The enable is simple.  One 2N7000 has its rounded side facing you, the other has its flat side facing you.  The right-most pin of the left transistor is connected to the left-most pin of the right transistor. Confused? The picture says it all, and then some.  Next, the gates get connected together via a wire.  Lastly, we need to connect the enable to the SRAM bit.  To do this, put a wire on either the very left or very right pin. Next, put the other end of the wire on the gate of the closest inverter.

Step 9: The Full Cell

Picture of The Full Cell
Make another enable on the other side of the circuit, and connect it up (if you connect both enables to the gate on both sides, you will guarantee that they aren't connected to the same side of the circuit).  Now you have a full SRAM cell.  Connect the gates of the enables together then connect another wire from ground to one of the gates.

Add the LED and resistor by putting a resistor on the output or gate of one inverter then to the positive lead of the LED and ground the negative lead of the LED. Now you may want to test in.

Plug in your power supply and watch for the blue smoke!  Actually, a better idea is to keep one hand on the switch, and touch the transistors with the other to make sure they don't get hot.  If it passes that test, set one enable input to ground and the other to +5v (or whatever you are using) turn the supply on, and enable the circuit by disconnecting the gates from ground and setting to +5v.  The LED should turn on, or off.  If it hold its state, disable the circuit and switch the wires around, as in the input that was grounded should be set high and vice versa.  If the LED still doesn't change, check your circuit.

Step 10: Buttons and Input Inverters

Picture of Buttons and Input Inverters
100_0981.JPG
Wiring up the buttons is fairly straight forward. One pin gets tied to +5v and the other is tied to ground through a resistor. The output of the button is the pin that is tied to ground.  The Write Enable button output connected to the enable gates.  The output of the Bit Line button is connected to the first inverter's input.  It's output goes to the enable and to the second inverter's gate.  It's output goes to the other enable.  I'm not going into detail on building the inverters, because I already covered that.

Step 11: It's Finished

Picture of It's Finished
100_0986.JPG
Now, its time to turn the power supply on again and try out your new RAM! If all goes well, you should be able to change the LED's state when the write enable is high, but it should latch when the write enable it low.

Build a few thousand more of these, add some decoding logic and you have your own SRAM chip!

Step 12: More Information

Picture of More Information
This is a very efficient circuit and is what is used in most SRAM chips, but I found out that it isn't a perfect circuit.  Remember how I said earlier that the resistor wasn't enough to change the circuit's state? Well, as it turns out, there is a very brief current spike when the circuit is switched.  This spike lasts for less than a millisecond, but it is as high as 100 milliamps.  This spike is caused by current rushing in through the enable and to ground through the output of the inverter.  This spike is very brief because once the inverter is switched, no more current flows.  This spike can be reduced by using smaller MOSFETs (like on an IC) that have lower capacities and by grouping everything closer together which further reduces the capacitance.

This is the least complex memory circuit I've built so far.  I have made a TTL RAM using an SR Flip Flop, and I made a CMOS RAM that used a D Latch, and I implemented that into a 1 Byte RAM for your favorite microcontroller.

Eventually I'm going to attempt a DRAM circuit and if I can find a few ferrite cores cheaply (<$5 for 100+), I might try to make a Core Memory!!!

i like your INSTRUCTABLE but i disagree on some fact you tell correct one is,

1. SRAM is static while DRAM is dynamic

2. SRAM is faster compared to DRAM

3. SRAM consumes less power than DRAM

4. SRAM uses more transistors per bit of memory compared to DRAM

5. SRAM is more expensive than DRAM

6. Cheaper DRAM is used in main memory while SRAM is commonly used in cache memory (L1,L2,etc in processor).

tsmith882 years ago
im not sure why you have so many transistors? also, you didnt really explain how it works.

i played around with sr latches last weekend, which is essentially what sram is.
you could make a simple 'bit ram' with 2 npns and 4 resistors, if you had a static output (as in, the load on the output will always be the same..led, motor, transistor etc..)

all it is, is 2 nand gates with crossed i\o. since 0-0 is a bad state, iv added a simple transistor inverter on each input (in=1 out =0; in=0 out=1) as to set it to a neutral state. added a transistor on each output so they both have an equal load. the output(s) are coming from the resister-Collector junction.

one of them is a 2bit stack with master reset.

http://postimage.org/image/ekiyoa3cl/
http://postimage.org/image/6jwmqod81/
hope it helps someone here

not sure if this belongs here, im kinda high
Dr. Kreap2 years ago
What types of ICs could I use in place of this project?
seanroberts3 years ago
Has anyone seen these price of these transistors for less than 20 cents for the BS250 and 8 cents for the 2N7000 in smallish quantities? I have wanted to make mosfet logic circuits using discrete transistors but I heard that they had to be "matched" so I am glad this instructable came along with a p and n channel that apparently work together in a circuit..
Wally_Z3 years ago
I really like http://ledcalc.com/ for resistor calculations. Also, for Android there is an app called "ElectroDroid" that I use all the time for my electronics project. Just letting people know about it.
Teslaling (author)  Wally_Z3 years ago
The LED calculator that I provided is just one that I've seen in a few other instructables, so whatever works for you is great. ElectroDroid looks really cool though! I just got it this morning after seeing the comment, and so far, I really like it.
A picture is worth 10million 32-bit words. I love it! Great instructable, and keep the puns coming.
Teslaling (author)  technodude923 years ago
Thanks man!

Just wait until core memory...
hippi973 years ago
Cool. Can i make like this 10mb memory to my project?
Well if you've got a few million spare transistors laying around, and heaps of spare time I don't see why not.
Dear santa...