Logic gates and truth tables – AND, OR, NOT, NAND, NOR, XOR, half adder and circuit builder
Design & TechnologyElectronics & MicrocontrollersAges 17–18
How do you mainly use this simulation?
Use it with your class: students open it from a link or a QR code, with no account needed.
Pick a logic gate, flip the input switches (0/1), and watch the logic level travel along the wires to the output LED; the truth table beside it highlights the current row, together with the Boolean algebra expression. Half adder mode combines an XOR and an AND gate to compute the sum S and carry C of two bits; the Auto Run button steps through every input combination in turn. The circuit builder lets students drag AND, OR, NOT, NAND, NOR and XOR gates onto a board and wire a circuit with 2–4 inputs, or type a Boolean expression; the truth table, expression and Karnaugh map are generated, with real-world problems to check against a target truth table and simplification steps using Boolean identities. The Sequential logic screen adds D-type and JK flip-flops with a clock, a 4-bit binary counter built from them, and a 555 astable whose R₁, R₂ and C set f ≈ 1.44/((R₁ + 2R₂)C) as it drives the counter, all with timing diagrams.
Lesson: Introduction to digital electronics: logic gates, truth tables, logic circuits, Boolean expressions and simplification
What it shows
Digital circuits represent information with two logic levels, 1 and 0. Combinational circuits such as AND, OR, NOT, NAND, NOR and XOR gates and the half adder have outputs set only by the present inputs, shown in a truth table and a Boolean expression, and the circuit builder simplifies them with a Karnaugh map. Sequential circuits also remember: a flip-flop changes only at a clock edge, a chain of toggling flip-flops counts clock pulses in binary, and a 555 astable makes the clock pulses, at a frequency set by two resistors and a capacitor.
How to use
Choose a gate under Gate / circuit and click the input switches, asking students to predict each output first, or build a circuit in the Circuit builder. Then press Flip-flops, counter, 555. On the D flip-flop and JK flip-flop tabs change the inputs and press One clock pulse or Run, and watch the timing diagram and truth table. On Binary counter and 555 + counter watch the count; change R₁, R₂ and C and press Record frequency.
Parameters you can change
- Gate / circuit AND, OR, NOT, NAND, NOR, XOR (exclusive OR), Half adder (XOR + AND), Circuit builder (drag gates, expression, Karnaugh map)
- Number of inputs (AND/OR/NAND/NOR/XOR gates) 2–3
- Show truth table
- Automatically step through input combinations
- Builder task Free building, Problem: security alarm, Problem: staircase light, Problem: majority vote, Problem: machine guard, Match a random truth table
- Expression notation (builder) A·B, A + B, overbar, A ∧ B, A ∨ B, ¬A, A AND B, A OR B, NOT A
- Screen Logic gates, Sequential logic (flip-flops, counter, 555)
- Sequential circuit D-type flip-flop, JK flip-flop, 4-bit binary counter, 555 astable driving the counter
- Counter built from JK flip-flops (J = K = 1), D-type flip-flops (D = Q̄)
- 555 resistor R₁ 1–100 kΩ
- 555 resistor R₂ 1–100 kΩ
- 555 capacitor C 1–100 µF
Questions to explore
- For which input combinations does a NAND gate output 0?
- How many rows does the truth table have for a gate with 3 inputs, and why?
- With two inputs, in which row do the outputs of OR and XOR differ?
- Why does a D-type flip-flop ignore changes of D between two rising clock edges?