Full Adder

A full adder uses multiple logic gates to add inputs A, B, and carry in. It has two outputs which are the carry-out bit and the sum bit. By sending the carry-out bit to the carry-in of the next full adder an extra bit is added to the output. This means that a larger number can be summed. For example, a single full adder can only add to 11 in binary which is three. When two full adders are wired together the output can be 111 which is seven.

Full Adder 1 Built With XOR, AND, and OR Logic Gates

full adder 1 built on a breadboard using npn transistors

The photo above shows a full adder that I built on a breadboard using individual transistors. There are a total of 5 logic gates used to build the full adder. The logic gates used are two XOR gates, two AND gates, and an OR gate. This took 21 transistors to build. Inputs A and B come from the positive 5-volt rail on the upper left side of the breadboard. The inputs are turned on and off by using two dip switches. The two LEDs in the upper left corner represent inputs A and B. While the two LEDs on the right side of the breadboard represent the two output bits. The resistor values used are all 2.2K.

The circuit in the photo has inputs A and B on and the carry-in off. This makes the carry-out on and the sum bit off which makes the output value 10 in binary which is two. The adder case is therefore 1 + 1 + 0 equals 10.

On the upper half of the breadboard, the two XOR gates are built. The first 6 transistors are the first XOR gate and the second 6 transistors are the second XOR gate. On the bottom half of the breadboard are the two AND gates and the OR gate. The first three transistors are the first AND gate, the next three transistors are the second AND gate and the final three transistors are the OR gate. Different color wires are placed to make each connection type clear. Black jumper wires are always used to connect to the ground.

In the video above I show the 4 different ways to build a full adder. I start by showing how to build a half-adder which is more simple but not nearly as useful. The best way to build a full adder will depend on the requirements. It may be best to use all the same type of logic gate, or it might be best to use the least number of transistors.

Full Adder Truth Table

full adder truth table

The truth table for a full adder is shown above. Even though I will show four different ways to build a full adder the truth table is always the same. The truth table shows the value of the output bits carry out and sum based on the input bits A, B, and Carry in. If all the inputs are off the outputs are off. When only one input is on only the sum bit is on. If two inputs are on then only the carry-out bit will be on. Finally when all three inputs are on the carry-out bit and sum bit will be on.

The inputs can equal zero or 1. Outputs are binary values that are based on the base 2 number system. When the sum bit is on it represents a value of 1 and when the carry-out bit is on it has a value of 2. So outputs of 00 equal 0, 01 equal 1, 10 equal 2, and 11 equal 3 in binary. The highest value a single full adder can add is three.

Full Adder 1 Logic Gate Circuit Diagram

full adder xor gate circuit diagram

The logic gate level circuit diagram for a full adder is shown above. It is clear that 5 different logic gates are used. Inputs A and B get sent into the first XOR gate and AND gate. The carry-in gets sent to the second XOR gate and AND gate. When building larger circuits such as a 4-bit calculator the sum bit usually keeps its value while the carry-out is sent to the carry-in location of the next full adder.

Full Adder 1 Transistor Level Circuit Diagram

full adder transistor level circuit diagram

The component-level circuit diagram is often the best way to see all of the connections in the circuit. From the circuit diagram, the circuit design can be built on a breadboard or PCB. This was drawn in a circuit simulator called easyeda. Resistor values in the circuit are 1K but are 2.2K when I built them on the breadboard. This was because the simulation in easyeda ran better with lower resistor values.

Full Adder 2 Built With NAND Logic Gates

full adder 2 built using nand logic gates

Full adder 2 is built using 9 NAND gates. Each NAND gate is built with 2 transistors so a total of 18 transistors is needed. This is the simplest and best way to build a full adder out of individual transistors. A full adder could be built using only the upper half of the breadboard, In this case, the switches did use some of the lower half of the breadboard. The resistor values used to build the actual circuit are 2.2K. In the photo inputs A and B are on and the carry-out bit is off. This is why the output value is 10 which equals two in binary.

Full Adder 2 Logic Gate Circuit Diagram

full adder nand gate circuit diagram

The logic gate level circuit diagram shows how the inputs and outputs should be connected for each NAND gate. When building a full adder with NAND gates you can look at the circuit I built on the breadboard or this diagram. Each NAND gate had two inputs and a single output but the output can be sent to multiple input locations.

Full Adder 2 Transistor Level Circuit Diagram

full adder nand gates

The circuit diagram shows all the connections needed to make a full adder out of 9 NAND gates. This shows all the connections need to make the circuit including the ground connections. The inputs get sent to the base of the transistors, and the output is sent from the collector side of the second transistors that make each NAND gate. Ground connections are made on the emitter of the first transistor that makes up each AND gate. Resistor values of 1K are shown but values from 330 ohms to 2.2K would work.

Full Adder 3 Built With NOR Logic Gates

full adder 3 built using nor logic gates

Full Adder 3 is built with 9 NOR gates. Each NOR gate requires two transistors so a total of 18 transistors is needed to make the full adder. Using NOR gates is an OK way to build a full adder on a breadboard but the wiring is a bit more complex than when using NAND gates. Each transistor in the NOR gate needs a ground. The collector of each transistor in the NOR gates is connected with an orange jumper wire. This helps the wiring to be clear and concise. The circuit in the photo has inputs A and B on and the carry-in bit off. This is why the carry-out bit is on and the sum bit is off.

Full Adder 3 Logic Gate Circuit Diagram

full adder nor gate circuit diagram

The logic gate level circuit diagram using NOR gates is shown above. It is common to look at the logic gate level drawing when outlining the circuit design. This does not give the details of how each NOR gate should be built. However, it does show how the inputs and outputs of each gate should be connected.

Full Adder 3 Transistor Level Circuit Diagram

nor gate full adder

The component level circuit diagram for the full adder built with NOR gates is shown above. Overall the circuit may seem complicated but if you look at it NOR gate by NOR gate is actually pretty simple. The collector of each NOR gate is wired together. Inputs are sent to the base of the transistors and outputs are sent from the collector side of the second transistor in each NOR gate.

Full Adder 4 Built With Integrated Circuits

full adder 4 built with integrated circuits

Full adder 4 is built using integrated circuits rather than individual transistors. The logic gates used are two XOR gates, two AND gates, and an OR gate. This is the same high-level design as full adder 1. The first integrated circuit had four XOR gates built on a single chip. However, only two of these XOR gates are needed to make a single full adder. The AND gate chip and OR gate chip also have four logic gates in each chip. Two of the AND gates are used and one of the OR gates is used.

Full Adder 4 Circuit Diagram with Integrated Circuits

full adder built with integrated circuits

The layout of each chip is shown in the circuit diagram. Inputs are labeled A and B and the output is labeled Y. The resistor values used are 2.2 K everywhere except 1K for the outputs that connect the LEDs. Note that the first three resistors are connected to the ground, not to the positive 5-volt rail. This is because if the input is floating the integrated circuit will set it to high which means on by default. A positive 5 volts is sent to those inputs when the input is on.

Breadboard, Components, Tools, and Power Supply

Breadboards are used to build and test electrical circuits. These are used by hobbyists and professional electrical engineers. Using a breadboard allows for electrical connections to be made without using solder which is why they are also called solderless breadboards. Not having to make a permanent connection with solder makes it so the placement of wires and discrete components such as resistors, LEDs, and transistors can be easily changed.

A breadboard is typically used in the prototyping stage of a circuit design. This makes it so that mistakes can be made without having to build an entirely new printed circuit board (PCB). Different designs can be tested quickly with almost instant results.  Sometimes it is easier to design circuits in a circuit simulator. However, at some point in the circuit design, it should be tested with actual components to verify it works as expected. Once a final design is made on a breadboard it can then be made on a PCB which makes the circuit smaller, and easier to mass produce.

breadboard

Buy from Amazon

There are several different size breadboards but each one is built in a similar way. Power is supplied to the power rails which run along the outside of the breadboard. The power rails are horizontal rows. On the inside, there is a grid of holes where the rows are labeled a-j and the columns are numbered 1-60. The holes in the power rail rows are electrically connected but the rows on the inside are not electrically connected. Vertical columns are electrically connected between rows a-e and rows f-j.

The power rails are labeled + and – for where the positive and negative terminals of the power supply should be connected. Multiple breadboards can be connected together by sliding the tabs of one breadboard into the grooves of another. A breadboard can also be secured to a flat surface as the bottom has a sticky layer that can be exposed by removing the paper backing.

working with breadboards

In the photo above I am working on multiple breadboard projects involving digital logic gates. An oscilloscope is used to measure voltages within the circuits. On the desk, there is a large number of cut wire scraps as each wire is custom cut to length. Both full-size and half-size breadboards are being used.

Breadboard Components

Wire

all the different types of breadboard wires

There are three different types of wires used for breadboarding. These are jumper wires, spools for wire, and pre-cut wire. Each will be discussed in detail below.

breadboard jumper wires male to male connector

Flexible jumper wires are the quickest and easiest way to make a wire connection on a breadboard. These are made with multistrand wire with a PVC coating. Multistrand cable is flexible but does not fit well into breadboard holes. For this reason, there are metal pins on the end that fit properly into the holes of the breadboard. The disadvantage of using jumper wires is the extra length of wire makes it less clear where each wire is going to and from. This is especially true when lots of wired connections are made. Jumper cables are great for quick testing but are not to build circuits to take pictures of and show circuit designs to others.

breadboard wire kit with precut wires

Precut wires can be nice because the wires are cut and bent to specific lengths. This does help speed up the process when breadboarding. The problem is that the wires are color coated based on length. Often times when building circuits it is nice to color code the wires based on the connection type. For example black going to the ground, red going to the positive rail, blue wires sending data, etc. I do use precut wire when the wire I need is shorter than the precut wire. This way I can cut it down and still use the color I want. It saves some time as one end is stripped and bent already.

solid copper wire spools 22 gauge wire for breadboard

Buy from Amazon

The best wire to use for breadboards comes on spools. It is a 22 gauge solid core wire. Each spool has over 25 feet of wire. Common wire colors are red, black, yellow, blue, white, and green. The disadvantage of the wire spools is that each wire needs to be cut to length and stripped on both sides to expose the wire. When this is done properly it makes for a very nice-looking circuit where it is easy to see where the wires are going to and from. So it is often worth the extra time. Each wire should be cut so that it lays flat and the stripped ends fit securely in the holes.

Resistors

resistors for breadboards

Buy from Amazon

Resistors are one of the most common components used when breadboarding. Each resistor is marked with color-coated bands to display its value. Common resistor values used for breadboards range from 1 ohm to 1 mega ohm which is 1 million ohms. Often times the exact value of the resistor is not needed so one with a slightly higher value should be used. For example, if your calculations show you need a 945-ohm resistor, using a 1K resistor will work in most cases.

Resistors come with long wires on each end that need to be cut and bent to fit properly in the breadboard. The full length can be used but in most cases, this will make the resistor sit high above the breadboard. Having resistors lie flat makes the breadboard look more organized and is easier to see where connections are being made.

LEDs

LEDs for breadboards

Buy from Amazon

LEDs are often used in breadboards to show that the power is on. Using an oscilloscope or multimeter can provide the exact power value. However, often times it is advantageous to just see that power is on. Also, the brightness of the LED gives insight into how much current is being applied across the LED. When using LEDs it is important to have a current-limiting resistor or the LED can be damaged.

Most LEDs have a voltage drop ranging from 1.8 volts to 3.2 volts. This is different from standard diodes which have a voltage drop of around .6 volts. The common input voltage for breadboards ranges from 3 volts to 9 volts. If the resistor is larger than 350 ohms it should limit the current to less than 20 milliamps. The max current rating for LEDs is typically 20-25 milliamps. Common colors for LEDs are red, yellow, white, blue, and green.

Transistors

transistors for breadboards

Buy from Amazon

BJT transistors have three pins that are designed to work with breadboards. The three pins are the emitter, base, and collector. Which pin is which will vary depending on if it is an NPN or PNP transistor. The most common transistor used with breadboards is the 2N2222 NPN transistor. This is an amplifying transistor and also works as a switching transistor. I have used these to build digital logic gates. Like LEDs, transistors should also have a current-limiting resistor to prevent damage.

transistors kit with many types of BJT transistors

Transistors often come in large sets where the are many types of NPN and PNP transistors. The most common NPN transistors are the 2N2222 and the 2N3904. For PNP transistors the most common are the 2N2907 which is equivalent to the 2N222 and the 2N3906 which is equivalent to the 2N3904. Each transistor does have different specifications so using the proper model number is important.

Capacitors

capacitor kit

Buy from Amazon

The three types of capacitors used with breadboards are ceramic capacitors, aluminum electrolytic capacitors, and metalized polypropylene capacitors which are also called film capacitors. In the photo above is a set of ceramic capacitors. These have a capacitive range from 0.1 µF to 10 µF. Ceramic capacitors are non-polarized meaning the orientation of the capacitor is not important. Electrolytic capacitors are polarized meaning one terminal must be connected to the positive voltage and the other side must be connected to the ground side. If this is done in reverse the capacitor will quickly heat up and break, often resulting in a popping noise and the smell of melting capacitor material. Most film capacitors are not polarized. Breadboard capacitors can range in size from 10 pF to 10,000 µF.

Integrated Circuits

integrated circuit on a breadboard

Breadboards are also designed to work with integrated circuits. An entire microprocessor can be placed on an integrated circuit so ICs drastically increase the potential of what can be done on a breadboard. Common integrated circuits to use on breadboards include logic gates, 555 timers, op-amps, shift registers, EPROM, FPGAs, gyroscopes, and microprocessors.

BreadBoard Tools

Wire Stripper

wire stripper tool

Buy from Amazon

Wire strippers are needed to cut wires and remove the wire insulation on the end of the wire. Breadboard wires are 22 gauge so the stripper needs to have a slot to strip 22 gauge wire insulation. The wire stripper above can cut and strip wire from 10 gauge to 22 gauge. It also has a crimper to make crimp connections. When cutting breadboard wire to exact lengths some type of cutter and wire stripper is needed.

Wire Cutter

scissors to cut wire

Buy from Amazon

Scissors or a wire cutter make cutting wire much easier. The wire stripper tool does have a cutter but only on the back of the jaws. Having a tool with a cutter on the front jaws makes it easier to mark where the wire needs to be cut. Resistor wire is very thin and is easy to cut with scissors. I often cut multiple resistor wires down to the proper size with just one cut on each side. A small wire cutter is probably best but scissors do work if that is what is available.

Breadboard Power Supply

A breadboard can be powered by a variety of power supplies. Batteries used to be the most common way to power a breadboard. Two 1.5-volt batteries in series make a 3-volt power source. Three 1.5-volt batteries in series can be used to supply 4.5 volts. One 9-volt battery works with connector clips and power wires. There are also breadboard power supply modules that can provide 3.3V or 5 volts. The module can receive input power through a 2.1 mm jack plug or USB cable. The disadvantage of the breadboard module is that it takes up space on the breadboard. Power can also be sent from an Arduino, Raspberry Pi, or microcontroller to the breadboard.

USB Battery Pack

external 5 volt batter pack and USB connector for breadboard

Buy from Amazon

In the photo above I am providing power to a 4-bit calculator that is built on breadboards using a 5-volt battery pack. I modified a USB power cable so that it could go into the positive and negative terminals of the breadboard. This was done by splicing solid core 22 gauge wire from the stranded cable that was in the original power cable. The only downside to using this battery pack is it does have an auto shut-off feature if the output current is too low. It stops supply power after about 30 seconds when this is the case. Pushing the button on the battery pack will allow the current to flow for another 30 seconds. This is ok when testing circuits because you typically know within 30 seconds if the circuit is working properly. For larger circuits, it will not shut off as the current used is high enough to not shut the power off.

Cell Phone Charger and USB Cable

USB power cable for a breadboard

Using a 5-volt cell phone charger is becoming a popular way to power a breadboard. Most cell phone chargers and USB ports from computers provide a 5-volt power source. In the photo above I modified a 6-foot USB cable to have breadboard jumper cable ends. Now, most USB power supplies will work to power the breadboard at 5 volts.

External Circuit With USB Power Supply

breadboard 3 volt and 5 volt power supply with USB battery pack

The photo above shows how to connect power to a breadboard power supply module using a USB cable. A 5-volt battery pack is supplying the power. The module receives power from the USB cable. Jumpers above each power rail can be moved so that 5 volts, zero volts, or 3.3 volts is supplied to the power rail. The top and bottom power rails can be set to different values. In the photo, the top power rail is set to 5 volts and the bottom power rail is set to zero volts. A green LED on the board indicated the power is being supplied to the board. There is a button that turns the power off to the board and the LED will shut off when power is not being supplied to the breadboard.

Power Supply Module

breadboard power supply module with USB cable

Buy from Amazon

The close-up view of the power supply modules shows all the features of the board. Input power can come from the jack plug or USB cable. Power going into the power jack needs to be between 6.5 and 9 volts. Power coming from the USB should be around 5 volts. The module is connected to the breadboard with 8 pins. Four pins on each side go into the power rails. This is an ok option to power a breadboard. I personally prefer when power is supplied over two wires. It makes it so there is more room on the breadboard and makes the breadboard less cluttered. When making demonstration videos it is also nice not having people wonder what is going on with the power supply. It is simpler to just show a red wire and a black wire going into the positive and negative slots in the breadboard.

digital multimeter

Buy from Amazon

A multimeter provides a way of measuring the current in the circuit. It is also a way to measure the voltage levels within the circuit. I do use this multimeter to determine the current. For voltage levels though, I prefer to see the output on the oscilloscope as this provides transient information as well.

Siglent digital oscilloscope1

Buy from Amazon

Having a digital oscilloscope is really handy when working with circuits. It is often difficult to know what is going on within the circuit without looking at the voltage values at different locations within the circuit. The oscilloscope not only shows the voltage values but shows the values over time so you can see transient conditions within the circuit.

4-Bit Computer Built on Breadboards Using Individual Transistors

To learn how computers work it is helpful to build a simple computer. This 4-bit computer is built on 32 breadboards and uses 962 NPN BJT transistors. It is powered by a 5-volt rechargeable battery pack and uses about 1 AMP of current. Other components used include resistors LEDs, capacitors, and 22 gauge wires. It is awesome that a functional computer can be built using only these discrete electrical components.

4-bit computer built with individual transistors on breadboards

The photo above shows the completed computer. When operating the computer can add or subtract values up to 15. It can hold seven operational commands and store three values to load A, add, or subtract.

The video above describes exactly how the full computer works. I would highly recommend watching the entire video.

When the computer was about half finished I made the video above. The computer is actually functional however the registeres, databus, and ALU signals need to be controlled manually. This is actually a very helpful way to show exactly how information is being sent around the computer and performing mathematical operations.

4-bit computer circuit diagram

A complete logic gate-level circuit diagram of the 4-bit computer is shown above. Sections of the computer include the clock, program counter, ring counter, opcode register, opcode decoder, control matrix, data bus, 10 bytes of 4-bit memory, accumulator register, output register, register B, and the arithmetic logic unit which is also called the ALU.

Computer Clock

The computer clock is built with an a-stable multi-vibrator. This circuit produces an even square wave where the output signal is either on or off. It is built with four transistors and two 10 microfard capacitors. In the video, the clock is completing a full cycle once every 1.75 seconds. The clock rate can be increased significantly higher than this but to see how the computer works this is a good clock rate.

Program Counter

In most computers, the program counter is a binary counter which is shown in the video below. For the 4-bit computer, it was easier to have the program counter be a 7-stage ring counter. This is because if a binary counter was used the memory module would have had to decode the binary number into individual signals. The ring counter already has the individual signals as the default output.

Ring Counter

The 7-stage ring counter was built with four edge-triggered data flip flops. Each trigger is built with a 330 picofarad capacitor and a 1K resistor. Each time the clock completes one full cycle the ring counter increments. The output of the ring counter goes to the control matrix and enables when information will be sent to different parts of the computer.

Opcode Register

Information is sent from the memory module into the opcode register where this value gets latched. Once the data is latched it is continuously being sent into the opcode decoder. The opcode register gets enabled from a control signal coming from the control matrix.

Opcode Decoder

A binary value is continuously being sent from the opcode register into the opcode decoder. Using inverters and multiple input NAND gates the opcode decoder turns the binary value into a single on output which represents load A, add, subtract, output, and halt commands. These commands get sent into the control matrix to control when circuits in the computer are enabled.

Control Matrix

Signals from the ring counter and opcode decoder are sent to the control matrix. Depending on the values of these signals will determine the output of the control matrix. Circuits in the control matrix are inverters or multiple input NAND gates.

Data Bus

The data bus allows signals to be connected from one circuit to another. Only one circuit should be sending data to the data bus at one time. By default, the data bus has all the data lines on. This is because pull-up resistors are connected from positive 5-volts to each data line.  When a circuit connects to the data bus it actually just grounds the data lines that should be off. This makes it so the proper value is on the data bus. When no circuits are connected to the data bus all the data lines are on. There are four other lines of the data bus which include ground, positive 5 volts, the clock signal, and clear. When the clear line is connected to ground it sets the counters to 1 and the output register to zero.

10 Bytes of 4-Bit Memory

The memory module consists of the memory display with buffers and 10 bytes of memory. When memory is being sent to the data bus the display will show which byte is being sent. Each byte of memory is hard coded based on whether resistors are connected to positive or ground. If the resistor is connected to the ground it is on and it if is connected to 5 volts it is off. This is because each byte is connected to the data bus via simplified tri-site buffers which invert the value. The first seven bytes of memory store the opcode instructions, byte 8 contains the load A value, byte 9 is the add value, and byte 10 holds the subtract value.

Accumulator Register

Data is sent to the accumulator register via the data bus. These values get latched in the master-slave data flip-flop and are continuously being sent into the ALU. During the 5 and 6 stages of the ring counter cycle, the value for the ALU will be sent to the data bus and latched into the accumulator register. This makes it so the value the ALU computes can be used in the next ring counter cycle.

Output Register

The output register is made with four regular data flip-flops. When the entire program is complete the final value gets latched into the output register. How this computer is built the output is displayed on LEDs but does not get sent to other circuits.

Register B

Data gets sent from the memory module to the data bus to get latched in register B. Once the value gets latched it is continuously being sent into the ALU. Each bit value gets latched into a regular data flip-flop. This register is built very similarly to register B.

Arithmetic Logic Unit, ALU

The ALU allows the computer to add and subtract numbers up to 15. This is done by using four full adders and four XOR subtract gates. Data is sent into the ALU from the accumulator register and register B. The output is displayed on LEDs and is sent to the data bus via tri-state buffers.

Most people are familiar with the base 10 number system. Computers operate using the base two number system which is also called binary. The video above shows how computers add numbers by using a 4-bit calculator I built on breadboards. If you watch this you will have a good understanding of how the ALU of the computer works.

This video shows how to build a 4-bit calculator using individual transistors. Four full adders are built to be able to add numbers up to 31 as the output has 5-bits.

Final Thoughts

Building a transistor computer on breadboards helps explain how a computer works. It also helps teach logic gate circuit design, data flip-flop design, and how to build each circuit of the computer. If I tried to build the processor in my current personal computer which has about 3 billion transistors it would take about 100 million breadboards to build. This computer also has 32 GB of RAM which has around 35 billion transistors, the 8GB NVIDIA GPU has around 7 billion transistors, and the 1 TB SSD has around 3 trillion transistors. So clearly this could not be built on breadboards.

However, when computers were first being built they were much larger than this breadboard computer. As technology progressed transistors and computers were able to be built much smaller. My next goal is to build artificial neurons. At first, they will be large and bulky but eventually, we should be able to build billions of neurons and trillions of synapses on a very small silicon or carbon substrate.

Leave a Comment