30 min read
From a Real Problem to a Circuit
Turn sensors and switches into inputs, rules into a truth table, the table into an expression, and the expression into a circuit.
The Problem
Step 1 — Define the Inputs and Outputs
Every sensor or switch becomes an input that is either 1 or 0. Say exactly what 1 means, including any threshold (the value at which a sensor switches).
| Inputs and outputs | |||
|---|---|---|---|
Step 2 — Write the Rules in Words, Then as Logic
Pump: run if (tank low AND mains water) OR (manual button AND mains water).
Alarm: sound if tank low AND NOT mains water.
Step 3 — Build the Truth Table
| Truth table for the water-tank controller | |||||
|---|---|---|---|---|---|
Step 4 — From the Table to an Expression (Sum of Products)
If you only have a truth table, you can still write the expression. This is called the sum of products method:
- Find every row where the output is 1.
- For each row, write an AND term of all the inputs, putting a bar on any input that is 0 in that row.
- OR all the terms together.
Step 5 uses the redundancy rule . You can prove it with the second distributive law: .
Step 5 — Draw the Circuit
| L | W | M | R | Pump |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 1 | 0 |
| 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
| L | W | R | Alarm |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
Bigger Systems: Four Sensors
| Inputs — decide what 1 means | ||
|---|---|---|
"Rises above" and "falls below". A sensor reports a problem either when its value goes above a threshold or when it drops below one. You choose what 1 means — just say it clearly:
- Define the input so that 1 = problem (for example "E = 1 when the power has failed"). Then no NOT gate is needed.
- Or define 1 = normal (as we did for E). Then the problem is , and the circuit needs a NOT gate.
Both are correct if your input table states the meaning.
One output per device. Each device follows one sensor, so its equation is short: Fan , Dehumidifier , UPS , Fire alarm . The interesting output is the warning lamp W, which combines all four.
Four inputs → rows. List them in binary order from 0000 to 1111, so none is missed. The first input (T) changes every 8 rows, H every 4, E every 2 and S every row.
When the output is 1 in most rows, look at the 0 rows instead. A sum of products here would need 15 terms. But W is 0 in only one row, so:
Take NOT of both sides and use De Morgan (break the bar, change the sign):
This matches the rule in words: the lamp lights if T or H or the power is not on or S.
| T | H | E | S | P | R | Q | Lamp |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
| 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 0 | 1 | 0 | 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 | 1 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
Practice
More lessons in Boolean Algebra and Logic Gates · Next: Logic Gates Worksheet · Previous: De Morgan's Theorems
