Skip to main content

Level 0: How computers work · 10 min

Switches: where it all starts

Goal: understand what a switch is, and why every computer is built on it.
You need: nothing. This is the first lesson.

The problem

A computer can show videos, play music and run games. But inside, it is a machine that runs on electricity. It cannot read or think.

So here is the first question: how can electricity hold information?

You already use one

Think of the light switch in your room.

  • You press it one way: the light is on.
  • You press it the other way: the light is off.

You never get "half a press". It is one of two choices. Computers start from this simple idea.

A path for electricity

Four simple parts are enough to begin.

  • Battery: provides electricity.
  • Wire: carries electricity.
  • Switch: opens or closes the path.
  • Bulb: lights up when electricity reaches it.

Connected together, they make a circuit: a path that electricity can flow through.

A switch is a gap in that path that you can close. When it is closed (ON), the path is complete. When it is open (OFF), the path is broken.

The diagram is simplified. A real circuit also has a wire going from the bulb back to the battery, so that the path is a full loop.

Try it

Switch0

The path is broken. No current flows and the bulb is off: 0.

Two states are information

The bulb has only two states: off or on. We can give each state a name.

SwitchBulbWe write
OFFdark0
ONlit1

One of these 0 or 1 values is called a bit. It is the smallest piece of information in a computer.

A bit can answer any yes or no question. You decide what 0 and 1 mean:

Question0 means1 means
Is the door open?noyes
Is the phone on silent?noyes
Is the parking space taken?freetaken

An agreed meaning like this is a rule. Everyone who reads the bit must use the same rule.

Why only two states?

Why not use ten levels of electricity, one for each digit from 0 to 9?

Imagine a friend signals you from far away with a torch. It is easy to see if the torch is on or off. It is very hard to tell ten levels of brightness apart, especially in fog.

Electricity has the same problem. It is noisy: its strength changes a little because of heat, long wires and nearby parts. With ten levels, the levels sit close together, so a small change can turn a 6 into a 7. With two levels, "low" and "high" are far apart. A small change does not confuse them.

So two states are simple to build and reliable.

Inside a real computer

You do not press the switches in a computer. They are tiny electronic switches called transistors, and electricity itself turns them on and off. A modern processor chip has billions of them.

That is the key idea for the next lessons: one switch can control another.

Check yourself

1. What does an open switch do?

2. How many different states can one bit have?

3. Why do computers use two states instead of ten?

Practice

You have one switch. Name two different things its 0 and 1 could mean. Then think: can one switch tell apart three things, such as red, yellow and green?

Show answer

Any yes or no pair works, for example: door closed or open, light off or on. One switch cannot tell apart three things, because it has only two states. You need more switches. That is the next lesson.

Recap

  • A circuit is a path for electricity. A switch opens or closes it.
  • OFF is written as 0 and ON as 1. One such value is a bit.
  • Two states are used because they are simple and reliable.
  • Computers use transistors: switches controlled by electricity.