# Worksheet: Digital electronics fundamentals

*Tactiverge Academy · Embedded Systems, module 1 · https://tactiverge.win/academy/embedded-systems/#digital-electronics-fundamentals*

Name: ______________________    Date: ____________

## Learning objectives

Tick each one when you can do it without looking at your notes.

- [ ] Explain voltage, current and resistance and apply Ohm's law to simple circuits.
- [ ] Represent numbers in binary and hexadecimal and convert between them.
- [ ] Describe the behaviour of AND, OR, NOT and XOR gates using truth tables.
- [ ] Explain how logic levels map physical voltages to digital values.

## Lesson 1: Voltage, current and resistance

The three quantities behind every circuit, how Ohm's law ties them together, and where the popular water analogy helps and where it misleads.

Read online: https://tactiverge.win/academy/embedded-systems/digital-electronics-fundamentals/voltage-current-resistance/

#### Project: Paper project: Ohm's law practice

Work these out on paper or with a calculator, then check them with a short Python program or a free online circuit simulator.

1. Find the current through 100 Ω, 330 Ω, 1 kΩ and 10 kΩ resistors, each connected across 5 V. Give answers in mA.
2. A device draws 0.15 A from a 9 V battery. What is its effective resistance?
3. Plot current against voltage for a 1 kΩ resistor from 0 V to 5 V in 1 V steps. What shape is the graph, and what does its slope represent?
4. In two or three sentences, explain one way the water analogy would mislead someone, using your own example.

This project needs no hardware.

**Deliverables**

- Four currents with working shown
- The effective resistance of the device
- A current–voltage graph with its slope explained
- A short explanation of one limit of the water analogy

**Safety (adult supervision required):** This project is paper and simulation only. If you later try any of it with real parts, do so only with adult supervision, using small batteries (no more than a few volts), never shorting a battery's terminals and never using mains electricity.

### Check your understanding

1. A 2.2 kΩ resistor has 3.3 V across it. What current flows through it?
   A) 7.26 mA
   B) 1.5 mA
   C) 0.67 mA
   D) 15 mA

2. Why is voltage always described between two points?
   A) Because voltage is the energy difference per unit charge between two places in a circuit
   B) Because voltmeters have two wires for safety
   C) Because current flows in two directions
   D) Because voltage only exists in batteries

3. How should a multimeter be connected to measure the current through a resistor?
   A) Across the resistor, one probe on each side
   B) Across the battery terminals
   C) In the loop, so the current flows through the meter
   D) With the power switched off

4. Which statement shows a limit of the water-in-pipes analogy?
   A) More pressure gives more flow, like more voltage gives more current
   B) A narrow pipe resists flow, like a resistor
   C) The flow into a sealed section equals the flow out
   D) A broken wire does not spray electrons the way a broken pipe sprays water

5. An LED does not obey Ohm's law. What does that mean in practice?
   A) Its current is not proportional to the voltage across it, so you cannot treat it as a fixed resistance
   B) It has zero resistance
   C) It can only be used with alternating current
   D) It always draws exactly 20 mA

### My notes

______________________________________________

______________________________________________

## Lesson 2: Power, series and parallel circuits

How much power a component dissipates, how resistors combine in series and parallel, how a voltage divider works, and how to calculate the resistor for an LED.

Read online: https://tactiverge.win/academy/embedded-systems/digital-electronics-fundamentals/power-series-and-parallel/

#### Project: Design project: an LED indicator

Design, and optionally build, a single-LED indicator powered by two AA cells in series (about 3 V).

1. Look up or assume a forward voltage of 2.0 V for a red LED. Calculate the exact resistor for 5 mA, then choose the next E12 value up and recalculate the current and the resistor's power.
2. Fresh AA cells can read a little above 1.5 V each. Recalculate the current for a 3.2 V supply. Is your design still safe?
3. Draw the circuit diagram, marking the direction of conventional current.
4. Optional build, only with an adult: assemble the circuit on a solderless breadboard with your chosen resistor, and measure the voltage across the LED and across the resistor with a multimeter. Do they add up to the battery voltage?

You can also build the circuit in a free online simulator instead of with real parts.

**Deliverables**

- Resistor calculation with the chosen standard value, current and power
- The recalculation for a 3.2 V supply
- A labelled circuit diagram
- If built: measured voltages compared with your predictions

**Safety (adult supervision required):** Build only with adult supervision. Use only two AA cells (about 3 V); never use mains power or mains adapters. Always include the series resistor; never connect an LED, or a bare wire, directly across the battery, as shorted batteries can get hot. Disconnect the battery before changing the circuit, and do not look directly into a bright LED at close range.

### Check your understanding

1. A 47 Ω resistor carries 0.1 A. How much power does it dissipate?
   A) 4.7 W
   B) 0.47 W
   C) 0.047 W
   D) 470 W

2. What is the combined resistance of a 1 kΩ and a 1 kΩ resistor in parallel?
   A) 2 kΩ
   B) 1 kΩ
   C) 0 Ω
   D) 500 Ω

3. A voltage divider has Vin = 9 V, R1 = 2 kΩ (top) and R2 = 1 kΩ (bottom). What is Vout with no load?
   A) 3 V
   B) 6 V
   C) 4.5 V
   D) 1 V

4. Which statement about components in series is correct?
   A) They all have the same voltage across them
   B) The total resistance is less than the smallest resistor
   C) The same current flows through all of them
   D) Removing one leaves the others working

5. For a 5 V supply and an LED with a 3.0 V forward voltage, which resistor gives about 10 mA?
   A) 500 Ω
   B) 330 Ω
   C) 200 Ω, rounded up to 220 Ω
   D) 50 Ω

### My notes

______________________________________________

______________________________________________

## Lesson 3: Binary, hexadecimal and digital signals

How computers count with only two symbols, why engineers write numbers in hexadecimal, and how a physical voltage becomes a reliable 0 or 1.

Read online: https://tactiverge.win/academy/embedded-systems/digital-electronics-fundamentals/binary-and-digital-signals/

#### Project: Paper and Python project: a conversion toolkit

1. By hand, convert 37, 100 and 255 to binary and to hex. Then convert 0x7F, 0xA5 and 0b10110011 to decimal.
2. Check every answer with Python's `bin()`, `hex()` and `int(text, base)`.
3. Write a Python function `to_binary(n)` that uses repeated division by 2 (without calling `bin()`) and returns the binary digits as a string. Test it against `bin()` for every number from 0 to 255.
4. Using the example 3.3 V thresholds in this lesson, decide whether each of these input voltages reads as 0, 1 or not guaranteed: 0.3 V, 1.4 V, 2.1 V, 3.0 V.

No hardware is needed for this project.

**Deliverables**

- Hand conversions with working, checked by Python
- A working to_binary function and its test loop
- Classified input voltages with reasons

### Check your understanding

1. What is the binary number 10110 in decimal?
   A) 22
   B) 11
   C) 26
   D) 10110

2. What is 0x4E in binary?
   A) 0100 1101
   B) 0100 1110
   C) 0010 1110
   D) 1110 0100

3. How many different values can a 12-bit number represent?
   A) 12
   B) 144
   C) 2048
   D) 4096

4. Using the lesson's example thresholds, an input reads high above 2.0 V and a guaranteed high output is above 2.4 V. What is the high-level noise margin?
   A) 2.0 V
   B) 0.4 V
   C) 2.4 V
   D) 3.3 V

5. Why can a digital signal pass through many stages without the noise building up?
   A) Digital wires are immune to interference
   B) Digital signals use higher voltages
   C) Each stage only decides high or low and outputs a fresh, clean level, so noise smaller than the margin is removed
   D) Digital signals carry more information per wire than analogue ones

### My notes

______________________________________________

______________________________________________

## Lesson 4: Logic gates and Boolean algebra

The basic gates that make decisions from bits, truth tables that describe them completely, and the algebra that lets you simplify logic before you build it.

Read online: https://tactiverge.win/academy/embedded-systems/digital-electronics-fundamentals/logic-gates-and-boolean-algebra/

#### Project: Paper and Python project: a safety interlock

A machine has three inputs: S (start pressed), G (guard closed) and E (emergency stop pressed). Its output M enables the machine.

1. Write a specification in words: M should be 1 only when S and G are 1 and E is 0. Write the Boolean expression.
2. Write out the full 8-row truth table by hand.
3. Using the NAND constructions in this lesson, rewrite your expression using only NAND gates. Draw both the original and the NAND-only version as gate diagrams.
4. Adapt the Python truth-table code in this lesson to three inputs, and use it to check that your two versions agree on all 8 rows.
5. Simplify L = A · B + A · B′ and A + A′ · B by hand, and check both with Python.

No hardware is needed for this project.

**Deliverables**

- The Boolean expression and its 8-row truth table
- Gate diagrams for the original and NAND-only versions
- A Python check that all versions agree
- Two simplifications with working and Python checks

### Check your understanding

1. Which gate outputs 1 only when its two inputs are different?
   A) AND
   B) OR
   C) NAND
   D) XOR

2. What is (A + B)′ by De Morgan's law?
   A) A′ + B′
   B) A′ · B′
   C) A · B
   D) A + B

3. Simplify A · B + A · B′.
   A) A
   B) B
   C) A · B
   D) 1

4. How many rows does a truth table for a four-input function have?
   A) 4
   B) 8
   C) 16
   D) 32

5. Why is NAND called a universal gate?
   A) It is the only gate that works at 3.3 V
   B) Any logic function, including NOT, AND and OR, can be built using NAND gates alone
   C) It outputs 1 for every input
   D) It can store a bit

### My notes

______________________________________________

______________________________________________

## Lesson 5: Combinational logic: adders, multiplexers and decoders

How gates combine into circuits that do useful work: adding binary numbers, choosing between signals and selecting one device out of many.

Read online: https://tactiverge.win/academy/embedded-systems/digital-electronics-fundamentals/combinational-logic/

#### Project: Paper and Python project: build and test an adder

1. Fill in the full 8-row truth table of a full adder by hand, from the definition (add three bits, write the two-bit result).
2. Check that the expressions S = A ⊕ B ⊕ Cin and Cout = A · B + Cin · (A ⊕ B) give the same table.
3. Extend the Python ripple adder in this lesson to 8 bits, and write a loop that checks every pair of numbers from 0 to 255 against Python's own `+` (remember to include the carry out as bit 8).
4. Write a Python function for a 2-to-1 multiplexer using only `&`, `|` and `1 - s`, and test all 8 combinations of A, B and S.
5. Draw the gate diagram of a 2-to-4 decoder.

No hardware is needed for this project.

**Deliverables**

- Full adder truth table checked against the expressions
- An 8-bit ripple adder that passes all 65,536 tests
- A tested multiplexer function
- A decoder gate diagram

### Check your understanding

1. Which pair of gates makes a half adder?
   A) OR for the sum, AND for the carry
   B) AND for the sum, XOR for the carry
   C) XOR for the sum, AND for the carry
   D) NAND for the sum, NOR for the carry

2. A full adder has A = 1, B = 0 and Cin = 1. What are S and Cout?
   A) S = 0, Cout = 1
   B) S = 1, Cout = 0
   C) S = 1, Cout = 1
   D) S = 0, Cout = 0

3. A 4-bit ripple-carry adder adds 1010 and 1000. What happens?
   A) The sum bits are 0010 and the carry out is 1, because 10 + 8 = 18 does not fit in four bits
   B) The sum bits are 1010 and the carry out is 0
   C) The adder outputs 18 on four bits
   D) The adder stops working

4. How many select lines does a multiplexer need to choose among 16 inputs?
   A) 16
   B) 8
   C) 2
   D) 4

5. What makes a circuit combinational rather than sequential?
   A) It uses only NAND gates
   B) Its outputs depend only on its present inputs, with no memory of past inputs
   C) It runs from a clock
   D) It has more than one output

### My notes

______________________________________________

______________________________________________

## Lesson 6: Sequential logic: latches, flip-flops and clocks

How circuits remember: the latch, the edge-triggered flip-flop, registers and counters, and the clock that keeps a whole chip in step.

Read online: https://tactiverge.win/academy/embedded-systems/digital-electronics-fundamentals/sequential-logic-and-clocks/

#### Project: Paper and Python project: counters and dividers

1. Draw a timing diagram by hand for the 3-bit counter in this lesson: one row each for the clock, Q0, Q1 and Q2, over 10 clock edges. Mark where each output changes.
2. Change the Python simulation to a 4-bit counter. After how many edges does it wrap?
3. Modify the counter so that it counts down instead of up. (Hint: work out when each bit should flip.)
4. Make a counter that counts 0 to 5 and then returns to 0 (a modulo-6 counter), by detecting the value 5 and forcing the next state to 0.
5. A microcontroller's clock is 8 MHz. What is its period? What frequency comes out of the top bit of a 10-bit counter driven by it?

No hardware is needed for this project.

**Deliverables**

- A hand-drawn timing diagram for the 3-bit counter
- Working 4-bit up, down and modulo-6 counter simulations with their output
- The period and divided frequency calculations

### Check your understanding

1. An SR latch has Q = 1. Both S and R are now 0. What is Q?
   A) 0
   B) Unpredictable
   C) 1, because the latch holds its previous state
   D) It oscillates

2. What is the key difference between a D latch and a D flip-flop?
   A) A latch stores more bits
   B) A flip-flop captures D only at a clock edge, while a latch passes D through for as long as it is enabled
   C) A flip-flop has no memory
   D) A latch needs a clock and a flip-flop does not

3. What is the clock period of a microcontroller running at 20 MHz?
   A) 50 ns
   B) 20 ns
   C) 5 ns
   D) 0.05 ns

4. A 4-bit counter starts at 0. What value does it hold after 18 clock edges?
   A) 18
   B) 15
   C) 0
   D) 2

5. Why must the clock not run faster than a certain limit?
   A) Faster clocks always overheat the chip instantly
   B) Signals need time to pass through the slowest logic path and settle before the next clock edge, including the setup time
   C) Flip-flops can only count to 255
   D) The clock must match the supply voltage

### My notes

______________________________________________

______________________________________________

---

## Answer key (for self-checking after you try)

**Lesson 1: Voltage, current and resistance**

1. B — I = V / R = 3.3 V / 2.2 kΩ = 1.5 mA. Multiplying instead of dividing gives 7.26, a common slip.
2. A — Voltage is a difference, like height difference on a hill. A single point only has a voltage relative to a chosen reference, normally ground.
3. C — Current is measured through a component, so the meter must become part of the loop. Connecting a current meter across a supply makes a near short circuit.
4. D — The first three are where the analogy works well. With a broken wire, the current simply stops; nothing leaks out.
5. A — An LED passes almost no current below its forward voltage and then current rises very steeply. You control its current with a series resistor instead.

**Lesson 2: Power, series and parallel circuits**

1. B — P = I² × R = 0.1² × 47 = 0.01 × 47 = 0.47 W, which is too much for a 0.25 W resistor.
2. D — Product over sum: (1 × 1) / (1 + 1) = 0.5 kΩ. Two equal resistors in parallel give half of one. 2 kΩ would be the series value.
3. A — Vout = 9 × 1 / (2 + 1) = 3 V. The bottom resistor gets the share proportional to its resistance.
4. C — There is only one path, so the current is the same everywhere in it. Equal voltage and smaller total resistance are properties of parallel circuits.
5. C — R = (5.0 − 3.0) / 0.010 = 200 Ω; rounding up to the standard 220 Ω gives about 9.1 mA. Forgetting to subtract the LED voltage gives 500 Ω.

**Lesson 3: Binary, hexadecimal and digital signals**

1. A — 16 + 4 + 2 = 22. Place values from the right are 1, 2, 4, 8, 16, and the 1s are in the 16, 4 and 2 places.
2. B — Each hex digit becomes four bits: 4 → 0100 and E (14) → 1110, giving 0100 1110. The last option has the nibbles swapped.
3. D — n bits give 2ⁿ patterns: 2¹² = 4096, so the values run from 0 to 4095. 2048 is 2¹¹.
4. B — The noise margin is the gap between the worst-case output and the input threshold: 2.4 − 2.0 = 0.4 V of noise can be tolerated.
5. C — Digital wires do pick up noise, but as long as it stays within the noise margin each gate regenerates a clean level, so errors do not accumulate.

**Lesson 4: Logic gates and Boolean algebra**

1. D — XOR is 1 for inputs 01 and 10 and 0 for 00 and 11. OR is also 1 for 11, which is the difference.
2. B — Break the bar and swap the operator: not (A or B) = (not A) and (not B). 'Neither is true' means 'both are false'.
3. A — Factor out A: A · (B + B′) = A · 1 = A. Whatever B is, the output follows A.
4. C — Each input can be 0 or 1, so there are 2⁴ = 16 combinations, the same as the number of values a 4-bit number can take.
5. B — A NAND with its inputs tied together is a NOT, NAND then NOT is AND, and De Morgan gives OR. From those, anything can be built.

**Lesson 5: Combinational logic: adders, multiplexers and decoders**

1. C — The sum is 1 when the inputs differ (XOR); the carry is 1 only for 1 + 1 (AND). OR would wrongly give a sum of 1 for 1 + 1.
2. A — 1 + 0 + 1 = 2, which is 10 in binary: sum bit 0, carry 1. Check: 1 ⊕ 0 ⊕ 1 = 0 and Cout = 0 + 1 · 1 = 1.
3. A — 18 = 16 + 2. The four sum bits hold 0010 (2) and the carry out of 1 represents the 16. Ignoring the carry gives the overflow result 2.
4. D — n select lines choose among 2ⁿ inputs, and 2⁴ = 16.
5. B — A combinational circuit is defined by having no memory. Circuits with memory, which usually use a clock, are sequential.

**Lesson 6: Sequential logic: latches, flip-flops and clocks**

1. C — S = R = 0 is the hold condition. The cross-coupled gates keep each other in their current state, which is what makes the latch a memory.
2. B — Edge-triggering means the flip-flop samples at one instant per cycle, so changes on D at other times cannot pass through. A latch is transparent while enabled.
3. A — Period = 1 / frequency = 1 / 20,000,000 s = 0.00000005 s = 50 ns.
4. D — A 4-bit counter wraps after 16 edges, so after 18 it holds 18 − 16 = 2. It can never show 18, which needs five bits.
5. B — If the next edge arrives before the combinational logic has settled and the setup time is met, flip-flops capture wrong or unsettled values.

---

This work is licensed under the Creative Commons Attribution 4.0 International licence (CC BY 4.0): https://creativecommons.org/licenses/by/4.0/. Attribute as: Tactiverge Academy, https://tactiverge.win.
