Projects / One-bit adder from gates

One-bit adder from gates

Beginner2.5 hGuided buildReviewed

Build it step by step

0 of 8 done
  1. Place both chips

    Straddle the gap, notches to the left.

  2. 74HC08

    Wire power

    Pin 14 to 5V and pin 7 to GND on each chip.

  3. 74HC08

    Tie unused inputs

    Pins 4, 5, 9, 10, 12 and 13 on both chips to GND.

  4. Wire the inputs

    Button A to pin 1 of both chips, button B to pin 2 of both chips.

  5. Add the pull-downs

    A 10 kilohm from each input node to GND.

  6. 74HC8674HC0814.5 mA

    Wire the outputs

    Pin 3 of the XOR to the sum LED, pin 3 of the AND to the carry LED, each through 220 ohm.

  7. Test all four combinations

    Check against the truth table.

  8. 74HC08

    Draw it

    Sketch the circuit and the table in your notes.

In short

How do you build a one-bit adder from gates?

An XOR and an AND gate add two bits and show the sum and carry on two LEDs. You need 74HC86 quad XOR gate, 74HC08 quad AND gate, Tactile push button 6 mm × 2, Resistor 10 kΩ × 2, LED 5 mm red × 2, Resistor 220 Ω × 2, Micro USB breakout board, 5 V 2 A USB adapter, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 8 steps and about 150 minutes.

Level
Beginner
Time
About 150 min
Parts
10

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Both chips pin 14 (VCC)5V from the USB breakoutPower
Both chips pin 7 (GND)GND from the USB breakoutGround
Button A5V to the A node, with a 10 kilohm from the A node to GNDInput A is 1 when pressed
Button B5V to the B node, with a 10 kilohm from the B node to GNDInput B is 1 when pressed
A node74HC86 pin 1 and 74HC08 pin 1Input A to both gates
B node74HC86 pin 2 and 74HC08 pin 2Input B to both gates
74HC86 pin 3 (XOR output)Red LED (sum) through 220 ohm to GNDSum bit
74HC08 pin 3 (AND output)Red LED (carry) through 220 ohm to GNDCarry bit
Unused gate inputs on both chipsGNDPins 4, 5, 9, 10, 12 and 13

Code

Adding two single bits gives a result that needs two bits: a sum and a carry. The sum is 1 when exactly one input is 1, which is what an XOR gate does. The carry is 1 only when both inputs are 1, which is what an AND gate does. Together the pair is called a half adder, and it is the first building block of every computer's arithmetic unit. A full adder adds a third input, the carry from the previous column, by chaining two half adders and an OR gate; chaining full adders side by side adds numbers of any width. The buttons use pull-down resistors, so an unpressed button reads 0 and a pressed button reads 1. The two LEDs show the answer as a two-bit binary number. Unused gates on the chips have their inputs tied to ground, because unconnected CMOS inputs can pick up noise and flicker or waste power. Draw the truth table by testing all four button combinations and compare it with the table in the code panel.

No code is needed. The adder is built from two gates.

Truth table (A and B are the two bits to add):
  A  B   Sum (XOR)  Carry (AND)
  0  0      0          0       0 + 0 = 00
  0  1      1          0       0 + 1 = 01
  1  0      1          0       1 + 0 = 01
  1  1      0          1       1 + 1 = 10 (two in binary)

Read the two LEDs as a two-bit number: carry is the left bit, sum is the right bit.

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Neither pressedBoth LEDs off
Only A pressedSum lit, carry off
Only B pressedSum lit, carry off
Both pressedCarry lit, sum off
Release bothBoth off

If it does not work

LEDs never light

Check pins 14 and 7 on both chips and the LED direction.

Wrong results

Check the chips, the XOR is 74HC86 and the AND is 74HC08.

Flickering LEDs

A floating input, tie unused pins to GND.

Buttons do nothing

Check the pull-down resistors and the 5V on the button.

Both LEDs always lit

An input is stuck high, check the pull-downs.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the one-bit adder from gates?

74HC86 quad XOR gate, 74HC08 quad AND gate, Tactile push button 6 mm × 2, Resistor 10 kΩ × 2, LED 5 mm red × 2, Resistor 220 Ω × 2, Micro USB breakout board, 5 V 2 A USB adapter, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the one-bit adder from gates take to build?

About 150 minutes for a beginner maker, in 8 steps.

How do I know the one-bit adder from gates works?

Neither pressed: Both LEDs off. Only A pressed: Sum lit, carry off. Only B pressed: Sum lit, carry off.

LEDs never light: what should I check?

Check pins 14 and 7 on both chips and the LED direction.

Wrong results: what should I check?

Check the chips, the XOR is 74HC86 and the AND is 74HC08.

Flickering LEDs: what should I check?

A floating input, tie unused pins to GND.

Buttons do nothing: what should I check?

Check the pull-down resistors and the 5V on the button.