Last updated: 19 November 2026, 13:47
Higher · Electronics and Control › Digital Electronics

Digital Electronics — Course Notes

Six logic gates, Boolean expressions, truth tables, design from a specification and NAND equivalents

← Back to Digital Electronics
Before you start. This topic builds on National 5, where you met NOT, AND and OR gates, truth tables and Boolean expressions. At Higher you add the NAND, NOR and EOR gates, work with up to four inputs, and learn to build any circuit from NAND gates alone. To revise, use the National 5 Digital Electronics notes.

Section 1: Digital Signals and Logic Levels

In Analogue Electronics, a sensor voltage divider produced an analogue signal: a voltage that can take any value between 0 V and the supply, changing smoothly as the light or temperature changes. That gives fine control, but many control decisions only need to know whether something is on or off.

A digital signal relies on physical voltages but restricts them to only two distinct, discrete states. Typically, a specific high voltage level (such as 5 V) is defined as logic 1 (ON), and a low voltage level (such as 0 V) is defined as logic 0 (OFF). A comparator is a common way to turn an analogue sensor signal into a digital one: its output is either high or low depending on whether the sensor voltage is above or below a reference.

Analogue signalDigital signal
Valuesany value within a rangeonly two: logic 0 and logic 1
Exampleoutput of a thermistor voltage divideroutput of a comparator, a push switch or a logic gate
Best formeasuring how muchdeciding yes or no
A digital electronic system is often called a logic system. Its signals are combined using logic gates.
✏️ Task 1 — Analogue and digital
a) State whether each signal is analogue or digital, and give a reason: (i) the voltage from a soil moisture sensor as a plant pot dries out in the sun; (ii) the signal from a microcontroller commanding a solenoid to actuate; (iii) the output from a mechanical limit switch as a lift moves from floor to floor.
Answer
b) An automated greenhouse window uses a motor relay that needs a simple ON or OFF command. State the type of signal needed to drive this relay, and justify your choice.
A greenhouse roof window held open by an automatic window opener
Answer

Section 2: Logic Gates

At Higher you need to know six logic gates. For each one, learn the symbol, the Boolean expression and the truth table — and be able to say in words when the output is 1.

NOT gate
AZ
Z = A
AZ
01
10

The output is the opposite of the input. Also called an inverter.

AND gate
ABZ
Z = A · B
ABZ
000
010
100
111

The output is 1 only when all inputs are 1.

OR gate
ABZ
Z = A + B
ABZ
000
011
101
111

The output is 1 when any input is 1 (including all of them).

NAND gate
ABZ
Z = A · B
ABZ
001
011
101
110

NOT AND: the output is 1 unless all inputs are 1.

NOR gate
ABZ
Z = A + B
ABZ
001
010
100
110

NOT OR: the output is 1 only when all inputs are 0.

EOR gate
ABZ
Z = A ⊕ B
ABZ
000
011
101
110

Exclusive OR (EOR): the output is 1 only when an odd number of inputs are 1. With two inputs, that means the inputs are different.

Gates with three or four inputs

Logic gates can have more than two inputs, and exam questions use up to four. They follow exactly the same rules: for example, a 4-input AND gate gives 1 only when all four inputs are 1, and is written Z = A · B · C · D; a 3-input NOR gate gives 1 only when all three inputs are 0.

How many rows? Every extra input doubles the number of rows in a truth table: 2 inputs → 4 rows, 3 inputs → 8 rows, 4 inputs → 16 rows. Always list the inputs by counting up in binary from 0000 to 1111.
✏️ Task 2 — Logic gates
a) State the name of the logic gate that gives an output 0 only when all its inputs are 1.
Answer
b) State the name of the logic gate that gives an output 1 only when an odd number of its inputs are 1.
Answer
c) A logic system has four inputs. How many rows does its truth table need?
Answer
d) Complete the truth table for a 3-input NOR gate.
ABCZ
000
001
010
011
100
101
110
111
e) Explain the difference between an OR gate and an EOR gate.
Answer

Section 3: Boolean Notation

Boolean algebra is a short way of writing what a logic circuit does. You must use the notation exactly, because one misplaced bar changes the meaning.

SymbolMeaningExampleRead as
·ANDA · BA and B
+ORA + BA or B
bar overNOTAnot A (A bar)
⊕EORA ⊕ BA exclusive-or B
( )grouping(A · B) + Cdo A and B first

Where the bar goes matters

A bar over a whole expression means the whole result is inverted (a NAND or NOR). A bar over each letter means each input is inverted first. These are not the same:

ABA · B (NAND)A · B
0011
0110
1010
1100

The two right-hand columns differ in two rows, so A · B ≠ A · B.

Use brackets to show which parts belong together, e.g. Z = (A · B) + (B · C). Markers look for brackets in the right place. You do not need to simplify expressions at Higher.
✏️ Task 3 — Writing Boolean expressions
a) Write a Boolean expression for: Z is 1 when A is 1 and B is 0.
Answer
b) Write a Boolean expression for: Z is 1 when either A or B is 1, as long as C is 0.
Answer
c) Write a Boolean expression for a 3-input NAND gate with inputs A, B and C.
Answer
d) Is A + B the same as A + B? Complete the truth table, then explain your answer.
ABA + BA + B
00
01
10
11
Answer
e) Investigate. Open the NoNANDSense simulator. Build Z = A + B using a single NOR gate, and Z = A + B using two NOT gates and an OR gate. Test every row of both circuits. Which single gate does Z = A + B behave like?
Answer

Section 4: Analysing Logic Circuits

A circuit made from several gates is a combinational logic circuit. Exam questions often give you the logic diagram and ask you to complete a truth table — usually with columns for points inside the circuit — and to write its Boolean expression.

  • Label the output of each gate (D, E, F…) before you start. Use letters that are not already inputs.
  • Fill in one column at a time, working from the inputs towards the output. Each column only depends on the columns feeding that gate.
  • Build the Boolean expression the same way: write an expression for each labelled point, then substitute. Your final answer must use only the inputs.
ABCZDE
Worked example circuit. The intermediate points D and E are labelled in purple.
Worked example — truth table and Boolean expression
1
Column D is the NOT gate: D = A, so D is the opposite of A.
2
Column E is the AND gate fed by D and B: E = 1 only where D = 1 and B = 1. So E = A · B.
3
Column Z is the NOR gate fed by E and C: Z = 1 only where E = 0 and C = 0.
4
Boolean expression: Z = (A · B) + C
5
ABCDEZ
000101
001100
010110
011110
100001
101000
110001
111000
✏️ Task 4 — Analysing logic circuits
a) (i) For circuit (a), complete the truth table, including columns D and E.
ABCZDE
Circuit (a).

Tip: click in a cell in column D, E or Z. The columns that feed that gate light up, so you can trace along the row.

ABCDEZ
000
001
010
011
100
101
110
111
(ii) Write the Boolean expression for circuit (a).
Answer
b) Write the Boolean expression for circuit (b).
ABCDZEFG
Circuit (b).
Answer
c) Write the Boolean expression for circuit (c).
ABCDZEF
Circuit (c).
Answer
d) For circuit (c), find the logic states of B, C and D that turn the output Z ON (Z = 1), given that input A is 1.
Answer

Section 5: Boolean Expressions from Truth Tables

Sometimes you are given a truth table and asked for the Boolean expression. Use the sum of products method:

  • Find every row where the output is 1.
  • At the end of each of those rows, write its term: AND the inputs together, putting a bar over any input that is 0 in that row.
  • Put a + (OR) between the terms, with brackets around each term.
Worked example
1
ABCZTerm
0000
0011A · B · C
0100
0110
1001A · B · C
1010
1101A · B · C
1110
2
The output is 1 in rows 001, 100 and 110.
3
Write the term at the end of each of these rows. Row 001 gives A · B · C; row 100 gives A · B · C; row 110 gives A · B · C.
4
Put a + between the terms: Z = (A · B · C) + (A · B · C) + (A · B · C)
You do not need to simplify. A correct simplified expression also gains the marks, but a correct unsimplified one is the safe answer.
✏️ Task 5 — Expressions from truth tables
a) Write the Boolean expression for this truth table.

Click in the Term cell at the end of each row where Z = 1, then use the buttons to build that row’s term. When every term is done, press Combine to put a + between them.

ABCZTerm
0000
0010
0100
0111
1000
1011
1101
1111
Answer
b) A machine has four sensors A, B, C and D. Its output is 1 only for the input combinations 0111, 1110 and 1111. Complete the Z column, build the terms, then write the Boolean expression.

Click in the Term cell at the end of each row where Z = 1, then use the buttons to build that row’s term. When every term is done, press Combine to put a + between them.

ABCDZTerm
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Answer
c) Explain why it is useful to write the truth table before the Boolean expression when designing a logic system.
Answer

Section 6: Designing from a Written Specification

Real design problems start as a description in words. Turn it into a circuit in four steps: truth table → Boolean expression → logic diagram → test. Decide first what logic 1 and logic 0 mean for each input and output.

Worked example — hydraulic ram safety system
1
The ram may only operate (Z = 1) when the safety guard is closed (A = 1), the operate button is pressed (B = 1) and the emergency stop is not activated (C = 0).
2
Truth table: work through each condition. Only one row meets all three: A = 1, B = 1, C = 0.
ABCZ
0000
0010
0100
0110
1000
1010
1101
1110
3
Boolean expression: Z = A · B · C
4
Logic diagram: C goes through a NOT gate, then A, B and C go into a 3-input AND gate (or two 2-input AND gates).
5
The finished logic diagram:
ABCCZ
Hydraulic ram safety system: Z = A · B · C
✏️ Task 6 — Designing from a specification
a) A distillery bottling line conveyor (Z) must run when a bottle is in position (P = 1) and the capper is ready (R = 1), or whenever the manual override (M = 1) is pressed. Write the Boolean expression and describe the logic diagram.
Answer
b) A lift door may close (Z = 1) when the close button is pressed (C = 1), unless something is blocking the door sensor (S = 1) or the open button is pressed (O = 1). Complete the truth table, build a term for each row where Z = 1, then write the Boolean expression.
Inside a lift: the floor-selection keypad beside the open lift door, with a spaniel sitting by the door

Click in the Term cell at the end of each row where Z = 1, then use the buttons to build that row’s term. When every term is done, press Combine to put a + between them.

COSZTerm
000
001
010
011
100
101
110
111
Answer
c) A warning lamp (W) on a quarry machine must light when exactly one of two guards (A, B) is open (logic 1). Which single gate does this? Write the expression.
Answer

Section 7: NAND Equivalent Circuits

Logic gates are bought as integrated circuits (ICs), each containing several gates of one type. A circuit needing one AND, one OR and one NOT gate would need three different ICs, most of whose gates would sit unused.

Any logic function can be built from NAND gates only. Using a single type of gate means:

  • only one type of IC (the 7400, which contains four 2-input NAND gates) needs to be bought and stocked — and it can be bought in bulk, so it is cheaper;
  • fewer ICs are often needed, so the circuit board is smaller and cheaper to make;
  • assembly is simpler, with fewer different parts.

The NAND equivalents to learn

There are five NAND equivalents that you must learn for the exam. Before you learn them, find out what each one does: build each NAND-only circuit in the simulator, complete its truth table and decide which single gate it behaves like. Then reveal the answers to check.

🔢 NoNANDSense simulator — logic circuits
⛶ Full screen
Build each NAND-only circuit in Investigation 1 below. Use switches for the inputs and an indicator on the output, and test every row of the truth table. NoNANDSense can also show your design as logic ICs, with the wiring between them.
NoNANDSenseSim V1.4
🔍 Investigation 1 — Discovering the NAND equivalents
Circuit 1. Build this circuit in the simulator and complete its truth table. Which single gate is it equivalent to?
AZ
AZ
0
1
Answer
Circuit 2. Build this circuit in the simulator and complete its truth table. Which single gate is it equivalent to?
ABZ
ABZ
00
01
10
11
Answer
Circuit 3. Build this circuit in the simulator and complete its truth table. Which single gate is it equivalent to?
ABZ
ABZ
00
01
10
11
Answer
Circuit 4. Build this circuit in the simulator and complete its truth table. Which single gate is it equivalent to?
ABZ
ABZ
00
01
10
11
Answer
Circuit 5. Build this circuit in the simulator and complete its truth table. Which single gate is it equivalent to?
ABZ
ABZ
00
01
10
11
Answer

Converting a circuit: three stages

  • Stage 1: replace every gate with its full NAND equivalent.
  • Stage 2: connect them up exactly as in the original circuit.
  • Stage 3: look for two NAND inverters in a row. Two inverters cancel each other out, so remove both. Show this by crossing them out.
ABCZE
Stage 0: the original circuit, Z = (A·B) + C.
ABCZ
Stages 1 and 2: every gate replaced by its NAND equivalent and connected up. The two NAND inverters in a row (crossed out in red) cancel each other.
ABCZ
Stage 3: the simplified NAND equivalent — just 3 NAND gates, so one 7400 IC does the whole job (with one gate to spare).
Double inverters appear wherever an AND (which ends with an inverter) feeds an OR (which starts with inverters). Look there first.

Task 7 uses the three circuits below. Draw your NAND equivalents on paper or build them in the simulator, then add a photo or screenshot to your answer.

ABZ
NAND task 1.
ABCZ
NAND task 2.
ABCZ
NAND task 3.
✏️ Task 7 — NAND equivalents
a) Draw the NAND equivalent of NAND task 1. How many NAND gates does it need, and how many 7400 ICs?
Answer
b) Draw the NAND equivalent of NAND task 2. How many NAND gates does it need?
Answer
c) Draw the NAND equivalent of NAND task 3, simplifying it fully. How many NAND gates and 7400 ICs are needed?
Answer
d) Draw the simplified NAND equivalent of Z = (A · B) + C. How many 7400 ICs are needed?
Answer
e) Give two reasons why a manufacturer might build a logic circuit entirely from NAND gates.
Answer

Section 8: Logic ICs and Practical Circuits

Logic gates are built into 14-pin ICs. In the 7400 family, pin 14 connects to +VCC (5 V) and pin 7 to 0 V. Common ICs:

ICContents
7400four 2-input NAND gates
7402four 2-input NOR gates
7404six NOT gates (inverters)
7408four 2-input AND gates
7432four 2-input OR gates
7486four 2-input EOR gates
7420two 4-input NAND gates
7421two 4-input AND gates
7427three 3-input NOR gates

Connecting an LED: source and sink

R+5 VSINK: LED on when output is 0R0 VSOURCE: LED on when output is 1
Connecting an LED to a logic gate output.
Always include a series resistor to limit the current.
  • Source: LED and resistor from the output to 0 V. Current flows out of the gate, so the LED lights when the output is 1.
  • Sink: LED and resistor from +VCC to the output. Current flows into the gate, so the LED lights when the output is 0.

The series resistor drops the voltage the LED does not use: R = (Vsupply − VLED) / ILED. For higher-current loads such as motors or relays, the gate drives a transistor or MOSFET, as in Analogue Electronics.

Logic ICs in the simulators. In the NoNANDSense simulator you can view any design you build as logic ICs, with the wiring between them — a quick way to check how many ICs a circuit needs. NoResistanceSim also has logic ICs that you can wire into complete circuits with switches, LEDs and drivers.
✏️ Task 8 — Logic ICs
a) A circuit needs 6 NAND gates. How many 7400 ICs are needed, and how many gates are left spare?
Answer

For circuits 1 to 4, use the IC table at the start of this section. Before conversion, each type of gate needs its own IC.

b) For circuit 1: (i) convert it to NAND gates, simplifying where you can; (ii) state how many ICs it would need before conversion; (iii) state how many 7400 ICs it needs after conversion.
ABZ
Circuit 1.
Answer
c) For circuit 2: (i) convert it to NAND gates, simplifying where you can; (ii) state how many ICs it would need before conversion; (iii) state how many 7400 ICs it needs after conversion.
ABCZ
Circuit 2.
Answer
d) For circuit 3: (i) convert it to NAND gates, simplifying where you can; (ii) state how many ICs it would need before conversion; (iii) state how many 7400 ICs it needs after conversion.
ABCDZ
Circuit 3.
Answer
e) For circuit 4: (i) convert it to NAND gates, simplifying where you can; (ii) state how many ICs it would need before conversion; (iii) state how many 7400 ICs it needs after conversion.
ABCZ
Circuit 4.
Answer
f) Using your answers to circuits 1 to 4, explain the benefit to a manufacturer of converting a logic circuit to NAND gates. Refer to a circuit where the number of ICs does not go down.
Answer

Section 9: Design Challenges

Each challenge gives a real context and a written specification. Work through the same stages as the Higher assignment: analyse, design, build or simulate, test and evaluate.

How to approach these: decide what logic 1 and 0 mean for every input and output. Write the truth table first, then the Boolean expression, then the logic diagram. Convert to NAND gates and count the ICs. In your evaluation, refer back to every numbered point in the specification.

Design Challenge 1 — Print-works guillotine

An industrial paper guillotine with a stack of paper on its bed, ready to be trimmed

A guillotine that trims printed comics must only operate when the operator has both hands clear of the blade. Two buttons, A and B, are mounted a metre apart, and both must be pressed.

iEach button gives logic 1 when pressed.
iiA green lamp (G) lights when both buttons are pressed — the blade can operate.
iiiA yellow lamp (Y) lights when only one button is pressed.
ivA red lamp (R) lights when no button is pressed.
vThe final circuit must be built from 7400 ICs only, using as few ICs as possible.
✏️ Design Challenge 1 — Guillotine controller
a) Analysis. Complete a truth table with columns for G, Y and R.
ABGYR
00
01
10
11
b) Design. Write a Boolean expression for each output and name the single gate that gives each one.
Answer
c) Design. Convert your circuit to NAND gates. How many NAND gates and 7400 ICs are needed?
Answer
d) Build and test. Simulate your NAND circuit in NoNANDSense and add a screenshot. Record the lamps for all four input combinations and compare with your truth table.
Answer
e) Evaluate. Evaluate your design against the specification, and suggest one safety improvement.
Answer

Design Challenge 2 — Museum display alarm

A museum display case of ancient pottery beside a case alarm panel with a green All Secure lamp and a red Intruder Detected lamp

A museum wants an alarm for a case of historic artefacts. When the alarm is set, a green lamp shows all is well; if an intruder is detected, the green lamp goes off and a red lamp comes on.

iS = 1 when the alarm is switched on.
iiW = 0 when the case lock is broken (W = 1 when it is secure).
iiiP = 1 when the pressure mat in front of the case detects a person; M = 1 when the motion sensor detects movement.
ivRed lamp (R): on when the alarm is set and the lock is broken, or the pressure mat or motion sensor is triggered.
vGreen lamp (G): on when the alarm is set and nothing is detected.
✏️ Design Challenge 2 — Museum alarm
a) Analysis. Write the Boolean expression for the red lamp R.
Answer
b) Analysis. Write the Boolean expression for the green lamp G.
Answer
c) Design. Describe a logic diagram for both outputs using AND, OR and NOT gates.
Answer
d) Test. Simulate your circuit in NoNANDSense and add a screenshot. How many rows does the full truth table need? Give one input combination for which R = 1 and one for which G = 1.
Answer
e) Evaluate. Suggest one improvement to make the alarm more useful in a real museum.
Answer

Design Challenge 3 — Remote Highland holiday cottage heating

A remote holiday cottage in the Highlands is often empty between bookings. It has a small heating system to stop the pipes freezing and to clear condensation. The system controls a heater and a fan, which can also be switched on manually.

iA cold sensor gives C = 0 when it is cold; a hot sensor gives T = 1 when it is too warm.
iiThe heater (H) comes on automatically when it is cold, or when the heater override switch is on (A = 1).
iiiThe fan (F) comes on automatically when it is too warm, or when the fan override switch is on (B = 1).
ivBuild the logic from 7400 ICs, using as few as possible.
vEach output must switch a 12 V load through a suitable driver.
✏️ Design Challenge 3 — Holiday cottage heating
a) Analysis. Write the Boolean expressions for H and F.
Answer
b) Design. Convert both outputs to NAND gates, simplifying where you can. How many gates and 7400 ICs are needed?
Answer
c) Design. The logic outputs are 5 V and each load runs from 12 V. Explain how each output should switch its load.
Answer
d) Test. Simulate your circuit and check that the heater and fan respond correctly to every combination of A, C, B and T. This circuit can be built in NoResistanceSim, using logic ICs and drivers for the 12 V loads. Add a screenshot of your simulation.
Answer
e) Evaluate. What could go wrong if the heater and fan were both on at once? Suggest a change to the logic.
Answer
Answers saved automatically in this browser on this device.
Last saved: never

Your name

Enter your name once and it’ll be added to the top of every task’s downloaded PDF — no need to write it in by hand each time.

✓ Saved — it’ll now appear on your PDFs

Contents