Introduction: DIY CMOS RAM Memory

Picture of DIY CMOS RAM Memory

If you have seen my other instructable on ram memory, you probably know that I used transistors to make a register. In this instructable I will show you how to make a register using CMOS gates.

If you haven't seen my other instructable, check it out

Step 1: What Is CMOS?

Picture of What Is CMOS?

CMOS stands for Complementary Metal Oxide Semiconductors.  Its a form of logic that uses very little current and requires no resistors.  It uses MOSFETs in a complementary arrangement, so you use a P-channel and an N-channel MOSFET at one time.  The cool thing about CMOS is that when one MOSFET is on, the other is off, so gates don't use very much current. Another thing about MOSFETs is that the gate is not connected in any way to the drain or source so it requires no resistor, unlike ordinary bipolar transistors.

Step 2: Why Use CMOS?

Now the question becomes, why use CMOS? The other circuit used half the number of transistors, and wasn't as complex. Well a reason for using CMOS is power consumption. The CMOS circuit uses less than 5 milliamps per bit maximum (when both switches are off and the LED is off, it uses less that a microamp). The other circuit used 15-25 milliamps per bit (depending on the switches and LEDs. Now let's put that into perspective, an 8-bit CMOS register would use less than 40 mA, but an 8-bit RTL (resistor-transistor logic) registe would use 120-200 mA!! Thats a huge difference.

Step 3: What You Will Need

Picture of What You Will Need

There is a very simple parts list for this project:

***These are per-bit numbers***

8 2N7000 Small signal n-channel mosfet
8 BS250 Small signal p-channel mosfet
2 Pushbutton switches
2 10K ohm resistors
1 1K ohm resistor (or whatever value is needed for your LED)
***These are necessary no matter how many bits you make***
5V power
pliers (not necessary, but very very close)

Step 4: How It Works

Picture of How It Works

This version uses a conventional Data Latch (D-Latch). Its basically a shortcut version of the Master-Slave D-Flip Flop. It uses 4 NAND gates to operate. When the clock goes high, the Q output will follow any changes from Data. When the Clock goes low again, the bit is latched. Now the Q output will not change states, even when Data does.

Step 5: The NAND Gate

Picture of The NAND Gate
The basis of this circuit is the NAND gate. Its function is the not of A and B (~A*B):

A    B    Y
0    0    1
0    1    1
1    0    1
1    1    0

It requires 4 MOSFET to operate, 2 P-channels and 2 N-channels in the configuration below. The P-channel FETs are in parallel, but the N-channel FETs are stacked up, in a "Totem Pole" configuration. If either A or B is low, then current can flow through one of the the P-channel FETs, making Y logic 1. This is true to the truth table. If both A and B are high, then the P-channel FETs turn off and both N-channel FETs turn on, making Y logic 0. As true to the table.

Step 6: Building the Circuit

Picture of Building the Circuit

The complexity of this circuit is much greater than that of the last one, so I am not going to make a schematic for it. But don't fret, because you know how to arrange the MOSFETs to make a NAND gate, and you know how to connect the NAND gates together, so you can build it. To connect the switches, you need to tie the side of the switch connected to the first NAND gates to ground with a 10K ohm resistor. The other side of the switch can be tied directly to positive 5 volts.

Step 7: Finished It

Picture of Finished It

I hope you did well with building this (if you attemped it) and you learned something new. This very stuff is in our computers, iPods, and Xboxs. These circuit may be impractical in their current state, but this is the exact same circuitry used in little tiny ICs!


bob491 (author)2017-11-06

this is a really cool project. Could it run at 1kHz?

elias.alberto (author)2010-11-25

Any tests on the frequency you can achieve with this? (i'm not thinking of any practical use, I'm just curious)

Teslaling (author)elias.alberto2010-11-25

No tests, but the MOSFETs are rated at a few MHz so it should be theory...

pyrohaz (author)Teslaling2010-11-25

I think the main limiter of frequency for this would be the capacitance of the breadboard its self, i managed to get about 60khz out of a 555 timer cleanly driving a mosfet, remembering that if a mosfet isnt driven properly, it heats up due to being stuck between cut off and saturation :) Crossing wires also add capacitance.

Ruby Laser (author)pyrohaz2017-08-18

I agree. In addition I also think that the plastic encapsulation of the MOSFETS (epoxy) would play a role in slowing it down. Even though it's not very much (maybe a couple nf). But still, it's worth considering.

Teslaling (author)pyrohaz2010-11-25

I didn't think of that, but it would definitely play a factor in speed. Thanks for that information.

Ruby Laser (author)2017-07-28

Oh yeah, nice project!!! I'm currently working on some I2C ROM for my Arduino. Do you have any thoughts on it? Have you done something similar in the past?

WakeUpWolfgang (author)2011-10-19

I am looking for a schematic so I can make my own ssd even if it is 1 to 8 bits big. Where could I find one or an instructable. I want it to remember the bits even with no power.

It's possible, just not with a transistor. You can accomplish it using a technology called "Magnetic Core Memory" (not to be confused with core-rope memory). Basically it uses a ferromagnetic core and saves a binary value of zero or one based on the direction of the magnetization (clockwise or counter-clockwise). I must warn you though that the current difference between the two states is very low, meaning that the amplifier stage must be extremely sensitive.

Teslaling (author)WakeUpWolfgang2011-10-19

The problem with an electronic circuit that remembers its data when the power is lost is that it requires a floating-gate transistor. Floating-gate transistors have a gate, source and drain like regular fets, but there is also a second gate that isn't connected to anything, hence it's floating. Putting a large charge on the gate will put a small charge on the floating gate, just enough to turn on the transistor. Then a large charge of the opposite polarity on the gate to remove the charge on the floating gate. The best option you would have is a really big capacitor on the gate and a transmission gate between the transistor-capacitor pair and the rest of the circuit. It won't be permanent, but it will last for a long time (depending on the size of the capacitor.)

WakeUpWolfgang (author)Teslaling2011-10-19

So is that how it works in a flash drive and a ssd and there is no permanent soultion? I am planing on making a computer from scrach and making my own parts this is the only part i am having trubbles with. sry for bad spelling i dont have spell check on my tablit

Tanmay Deuskar (author)2016-10-15


Wonderful instructable and really helps understand logic gates. Though I have a question about the cmos inverter. Why do you need the n-type mosfet in it? As, when HIGH is given to the gate of the p channel mosfet it is off (no connection between the drain and source) and so the output is LOW. When LOW is given to the gate of the p channel mosfet it is on (connection between the drain and source) and so the output is HIGH. So why do you need the n channel mosfet in the cmos inverter?


Arduino Projects (author)2014-11-25

Could you share the schematic please.

nancyjohns (author)2013-05-26

How do you program it? I think its really cool.

MattTheGeek (author)2011-02-01

it's Incredible how far we have gotten in electronics and semiconductors. Great instructable.

Goodhart (author)MattTheGeek2011-07-06

I have GOT to find that article I had (it was an April Fools article in an electronics magazine) that showed how to construct a one BIT memory with tubes......foot print, about the length and width of an large encyclopedia, and the height off the table, about 14 inches. :-) It worked too, if you could find a USE for a single BIT LOL

Teslaling (author)Goodhart2011-07-06

THATS AWESOME!!!!!!!!! I would so build it (or maybe 8)!!!

Goodhart (author)Teslaling2011-07-06

So far, I haven't found the schematic nor the plans, in hard copy nor on line, the closest thing I have found so far is the WOM (write only memory) :-)

tinker234 (author)2011-06-25

hey is this computer memory and could i make a 16 trigbyte hard drive

Teslaling (author)tinker2342011-07-03

Technically yes, it is computer memory, but it is ram, not a hard drive. A hard drive saves memory even when it loses power, this will lose its data after the power is removed.

And as takide said, it would take trillions of transistors.

tinker234 (author)Teslaling2011-07-03

ok thanks so i could

Teslaling (author)tinker2342011-07-03

Yeah if you really want to...

tinker234 (author)Teslaling2011-07-03

so hey could i put a cell phone battery on board to power it alll the time

Teslaling (author)tinker2342011-07-03

Haha!!! The next solid state drive, and its easier than ever to clean up your hard drive, just disconnect all power!!!

tinker234 (author)Teslaling2011-07-04

i know but im talking about using a cell phone bTTERY TO POWER IT WHENM THE COMPUTER IS OFF

Teslaling (author)tinker2342011-07-04

Yeah, i understood that, but the first thing i thought of was a sales gimmick thing. You could use a phone battery to keep power, just make sure that it can be recharged in circuit, and can go for a while in between charges.

tinker234 (author)Teslaling2011-07-04

yaha i know hey what about the power always powering the circut but the cell phone battery in case of blackout

Teslaling (author)tinker2342011-07-04

That would definitely be a much more secure way to do it.

tinker234 (author)Teslaling2011-07-04

i know

takide (author)tinker2342011-07-03

you would need TRILLIONS of transistors dude, thats why most computer ram systems are put into microchips so that they can cram TONS of transistors into a chip, thus storing your data.

tinker234 (author)takide2011-07-03

ok how do i do that

takide (author)tinker2342011-07-03

you could do it though....

mnova (author)2011-05-13

What should my input voltage be?

Teslaling (author)mnova2011-05-13

It really depends on your transistors, but 3.3v to 5v should work. 5v will almost definately work, 3.3v might work. I would not reccomend going over 5v because most small signal msofets have a gate voltage of 5v

mnova (author)Teslaling2011-05-13

I used 4.5 volts (3 AAA) batteries, BS170 for the N-channel MOSFETS and zvp2106a for the P-channel MOSFETS. . . . . I actually heard the circuit fry. -_-

Teslaling (author)mnova2011-05-13

Thats not good!! My guess is that a few of your transistors are backwards. The BS170 has a reverse voltage diode in it (which shorts if the transistor is backwards) that will fry if you put too much current thru it. 3 AAA's is definitely enough to fry the transistors.

The Datasheet for the ZVP2106A didn't say whether or not it has a diode in it, but be cautious and check your circuit.

Good luck!!!

laserjocky (author)2011-01-04

Wow this gives me some renewed appreciation for RAM... I've got a few billion of these little puppies sitting beneath my fingertips at the moment. Incredible.

gamini (author)2010-12-22

Thanks for this .

Can I save some of my information ?

parukboy (author)2010-12-06

This looks very similar to a negative edge flip flop

Teslaling (author)parukboy2010-12-07

Thats because it IS very similar. The main differences are that this is a latch not a flip flop, and that it is positive edge triggered!

Thereyouhaveit (author)2010-11-20

Woah , good start for you .
Who knows , you might join a big shot company dealing in memory and taking care of the ... 10nm process ? ;)

Geosync (author)2010-11-18

Thanks for the excellent demo. It's a great reminder of what VLSI chips comprise. I see the beginnings of a real iPod killer here. All you need is more CMOS and an acre (or two) of land to wire them on.

Teslaling (author)Geosync2010-11-18

What would we call it? The iPod MEGA?!?!

seanroberts (author)2010-11-16

Thanks for this. I was trying to make logic from discrete components myself and I decided to go with cmos because it is easier to implement (not having to worry about resistor values, how many gates can be connected together and such). People told me that I wouldn't be able to find complimentary p channel and n channel mosfets in order to make this work. I was excited to see your other transistor instructable because I thought you could provide me with some answers, but was bummed to see it was ttl. I am glad you have made the cmos one and I can finally move along with my project.

A quick question, how closely matched are the p channel and n channel mosfets? Was time spent to determine a suitable pair or were two just picked that were on hand?

seanroberts (author)seanroberts2010-11-16

Also, where did you purchase the transistors?

Teslaling (author)seanroberts2010-11-17

I got them at Jameco, but Mouser and Digi-Key both have them. The bs250s are a lot more per transistor (close to $0.50) but the 2n7000s are very cheap.

seanroberts (author)Teslaling2010-11-17

Ya I was afraid of that... I saw the $0.50 at Jameco and was hoping you got them cheaper. It seems to add up fast!

Teslaling (author)seanroberts2010-11-17

Yeah, the problem is that p- silicon is more expensive to make for mosfets, and that the demade for descrete ones is a lot lower than n-channel mosfets. It really stinks!!

seanroberts (author)Teslaling2010-11-17

No, it really "sinks!"... Anyone?

iEdd (author)seanroberts2010-11-18

I lol'd.

Once you're done playing with this, you can go one step higher and buy some quad 2 input NAND gate ICs, eg 74HCT00 and make anything, eg. two's complement adders/subtractors, shift registers, accumulators, combo locks, etc. Do it in binary and use LEDs as well as a BCD decoder and 7 segment display.

Digital design is good stuff. :-)

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 OverdriveBuild Your Own 555 TimerHelios 3: Homemade Rocket Candy Powered Rocket
Add instructable to: