Lets Make Tech

How RAM Works

If you would like to test out this circuit for yourself, try this website for simulating it. 

To store one bit of data we need two NAND logic gates. A NAND logic gate is an and, and a not. If you are not familiar with logic gates I will briefly explain.

Logic Gates

Logic gates are pieces of hardware that perform logical operations such as "AND", "OR", "Exclusive OR", and "NOT". They deal with digital logic, 1's and 0's or high and low. For example an AND gate with two inputs requires both inputs to be high for the output to be high, any other input will have a low output. An OR gate, either or both can be high to have a high output, an Exclusive or either input being high (but not both) will result in a high output, and a not just flips the output. This circuit deals with NANDS (AND + NOT) so I will give you the truth tables for that logic gate showing every possible combination.


Input A | Input B | Output

   0        |       0       |        1

   0        |       1       |        1

   1        |       0       |        1

   1        |       1       |        0


Latch Circuit 

A latch circuit uses two NAND logic gates and holds one bit of information. When you think about how many bits of RAM your phone or computer or any of your electronics has, it is really amazing. So to store this bit of data with two NAND gates, they have to be connected the right way. The output of each NAND will go to one of the inputs of the other NAND. One of the outputs, will also be the output where the bit is stored. The remaining two inputs (one on each NAND gate) control this. One acts as a reset switch, the other as a set switch. When the reset switch is flipped, the output will 0 no matter how many more times you flip the reset switch. When the set switch is flipped, the output will stay 1, no matter how many times the set switch is flipped. This allows you to set and reset whether the bit is high or low and keep it set to that position until you want to reset it. Which input is set vs reset depends on which output you are measuring.  


Explaining circuits with text is never easy, so here is a picture of it using this website.

The top NAND is set and the bottom NAND is reset. 


So lets test this circuit.

First, lets turn both switches off.



Now lets hit set once to set the bit as high.



 Note that the light turned on. Try flipping set again.

Flip the set switch as many times as you like, it will stay on.  



Now we will flip reset to turn it off. Keep flipping reset as many times as you want, it will stay off.




There are 8,000,000,000 bits in one gigabyte. That is a lot of latches. Really gives you an appreciation for the massive amounts of RAM we can fit into such tiny chips.

You will notice that the site I linked you to to simulate this has a category called flip flops, one of which is the circuit we just built with NANDS. 


 If you want to try and build your own logic gate circuit with memory for fun, now you can. If you make something cool be sure to share it. 

I made something real quick to show how multiple latches can be used to store a value.


Now lets press the 7 button. 


You can see that on the screen to the right, after a button is pressed it forgets what button was hit, while the screen on the bottom remembers what button was pressed.

Try for yourself! (The lone button resets it so you can enter a new number)

If you make this you will notice that which pin is set to high on the LCD, means different things. 1, 2, 4, and 8. These values are added then the sum is displayed on the LCD. Because of this each bit we store with the latch means something different. This is known as the memory's address. This is how RAM works everywhere. In micro controllers such as the PIC, editing the values of a register can do different things, such as change the pin mode or other settings so it is important to know what that registry does before changing any values.     

How to Wire Wrap

Wire wrapping is a great way to get a semi-permanent circuit built. It is quick, easy, and oddly satisfying.

For this tutorial I will not be guiding you though an entire circuit. I will be connecting one end of a resistor using wire wrapping solely to demonstrate how to wire wrap.


First lets gather up all of our supplies.


-Board to solder components on


-Soldering Iron

-Wire cutters

-Wire wrap

-Wire wrap tool

-Whatever components your circuit calls for

Optional BOM

-Solder wick or pump (if you mess up)

-Helping Hands Magnifier



1. Place the component on the board.


2. Bending one wire to hold the component in place can be helpful.


3. Cut a short length of wire from your roll (I cut mine a little long because I plan on reusing it). Measure to make sure yours isn't too long or short for the distance between your components. If you have a multiple colors try to use color code to make it easy to keep track of your connections later.


4. Strip the ends of the wire using the wire wrapping tool.



5. Thread the wire into the wire wrap tool. Note that there is a large hole and a small hole, you want the small hole. If you do it correctly you will see the wire through a grove. 



6. Place a wire from the component into the larger hole.


7. Hold the wire and twist the wire wrap tool.


8. You can leave it as it is for a temporary connection or you can solder it.

9. To solder, heat the component with your solder iron (My soldering iron isn't actually on this is for demonstration only).


10. Once the component is hot touch it with some solder, this should keep the component and wire firmly on the board. 

11. Repeat with the other components.

Here is an example of what your finished product might look like. This is a circuit that I made awhile back for the PIC18F4520. I used this to connect to an EMG circuit I made awhile back and a stepper motor. Check out the tutorial and paper.