← Back to Guides
Circuitsintermediate

Building Logic Circuits with the Circuit Simulator

Build three circuits from scratch: an AND gate, a half adder, and a multiplexer. Learn to place gates, wire components, and test with interactive simulation.

What You Will Build

In this tutorial, you will build three circuits of increasing complexity using the Circuit Simulator: a simple AND gate demo, a half adder that adds two bits, and a 2-to-1 multiplexer. By the end, you will understand how to place gates, connect wires, toggle inputs, and verify outputs using the interactive simulation.

Prerequisites

  • An AI Diagram account (free tier works)
  • Basic understanding of logic gates (AND, OR, NOT, XOR) — if you need a refresher, read our blog post on circuit diagram basics

Getting Started with the Circuit Simulator

Opening the Simulator

Navigate to the Circuit Simulator from your dashboard or the main navigation. You will see a blank canvas with a component palette on the left side. The palette contains all available gates and components: inputs, outputs, AND, OR, NOT, NAND, NOR, XOR, and special components like seven-segment displays.

The Interface

  • Component palette — Drag gates and components from here onto the canvas.
  • Canvas — The main area where you build your circuit. Components snap to a grid for clean alignment.
  • Simulation controls — Toggle inputs by clicking them. Outputs update in real time as signals propagate through the circuit.

Circuit 1: Simple AND Gate

Step 1: Place the Components

Drag two Input switches onto the left side of the canvas. These will be your inputs A and B. Then drag an AND gate to the center. Finally, drag an Output indicator to the right side.

Step 2: Connect the Wires

Click on the output pin of Input A and drag to the top input pin of the AND gate. A wire will form connecting them. Repeat for Input B to the bottom input pin. Then connect the AND gate's output pin to the Output indicator.

Step 3: Test the Circuit

Click the input switches to toggle them between 0 and 1. Verify the AND gate behavior:

  • A=0, B=0 → Output=0
  • A=0, B=1 → Output=0
  • A=1, B=0 → Output=0
  • A=1, B=1 → Output=1

The output should only be 1 when both inputs are 1. If this matches, your first circuit works correctly.

Circuit 2: Half Adder

A half adder adds two single bits and produces a sum and a carry. It uses an XOR gate for the sum and an AND gate for the carry.

Step 1: Place the Components

Start a new circuit. Place two Input switches (A and B) on the left. Place an XOR gate and an AND gate in the center, stacked vertically. Place two Output indicators on the right — label one "Sum" and the other "Carry."

Step 2: Wire It Up

Connect both inputs to both gates. Input A connects to the top input of the XOR gate and the top input of the AND gate. Input B connects to the bottom input of both gates. The XOR output goes to the Sum indicator. The AND output goes to the Carry indicator.

Step 3: Verify the Truth Table

Test all four input combinations:

  • A=0, B=0 → Sum=0, Carry=0 (0+0=0)
  • A=0, B=1 → Sum=1, Carry=0 (0+1=1)
  • A=1, B=0 → Sum=1, Carry=0 (1+0=1)
  • A=1, B=1 → Sum=0, Carry=1 (1+1=10 in binary)

The last case is the most interesting: 1+1 equals 10 in binary, which is a sum of 0 with a carry of 1. This is exactly what a half adder computes.

Circuit 3: 2-to-1 Multiplexer

A multiplexer selects one of multiple inputs based on a selector signal. A 2-to-1 MUX has two data inputs (D0, D1), one selector (S), and one output (Y). When S=0, the output equals D0. When S=1, the output equals D1.

Step 1: Understand the Logic

The Boolean expression for a 2-to-1 MUX is: Y = (NOT S AND D0) OR (S AND D1). This means we need a NOT gate, two AND gates, and one OR gate.

Step 2: Build the Circuit

  1. Place three Input switches: D0, D1, and S (selector)
  2. Place a NOT gate and connect S to its input
  3. Place the first AND gate. Connect NOT S output to its top input and D0 to its bottom input. This produces (NOT S AND D0).
  4. Place the second AND gate. Connect S directly to its top input and D1 to its bottom input. This produces (S AND D1).
  5. Place an OR gate. Connect both AND gate outputs to the OR gate inputs.
  6. Connect the OR gate output to the Output indicator

Step 3: Test the Multiplexer

Set D0=1 and D1=0. Toggle S: when S=0, the output should be 1 (D0); when S=1, the output should be 0 (D1). Now try D0=0 and D1=1 — the behavior should reverse. The selector controls which input passes through to the output.

Tips for Circuit Building

  • Plan before building — Write down the Boolean expression or truth table first. Building without a plan leads to spaghetti wiring.
  • Keep signals flowing left to right — Place inputs on the left, processing in the middle, and outputs on the right. This makes the circuit easy to read and trace.
  • Label everything — Name your inputs and outputs clearly. When circuits get complex, unlabeled wires become impossible to follow.
  • Test incrementally — After connecting each gate, test the partial circuit to make sure it works before adding more complexity.
  • Use the grid — Snapping to the grid keeps wires straight and the layout clean.

Next Steps

Try building these more advanced circuits:

  • Full adder — Extends the half adder with a carry input, allowing you to chain adders for multi-bit addition.
  • 4-to-1 multiplexer — Uses two selector bits to choose from four inputs.
  • SR latch — Your first sequential circuit that stores one bit of memory using cross-coupled NOR gates.
  • 4-bit counter — Chains flip-flops to count from 0 to 15 in binary.

Ready to start?

Put this guide into practice — open the tool and start building.

Open AI Diagram