Track: Robots & Electronics · Lesson 4 of 10 · Ages: 7+ · Time: 40 minutes
In the last lesson, your LED glowed as soon as you squeezed it onto the battery. But what if you want to turn it on and off? You need a switch. Today you will make one from paper and foil, and see that a switch is really a tiny decision-maker.
Beep says I have a bump switch on my front. When I bump into something, the switch clicks and I know to stop. A switch is the simplest sensor there is. Beep boop!
What you need
- Your coin cell battery and LED from the last lesson.
- A strip of thin card or stiff paper, about 1 cm wide and 8 cm long, cut by a grown-up.
- A small piece of kitchen foil.
- Sticky tape and a rubber band.
- A grown-up who stays close the whole time.
Safety first Do this with a grown-up nearby, and use only the CR2032 coin cell. Never use mains electricity or wall sockets. Never put a battery in your mouth. Coin and button batteries are dangerous if swallowed, so keep them away from little brothers and sisters and pets, and tell a grown-up right away if one goes missing. Never open, crush or heat a battery. Do not let foil or metal touch both sides of the battery, because that is a short circuit and can make the battery hot. Keep your foil pieces smaller than the flat face of the battery, and away from its edge. No soldering, ever.
Grown-ups Please cut the card strip for your child and keep the battery in your care when it is not being used. Use ordinary kitchen foil, trimmed to a small piece. Check that the foil never wraps around a coin cell’s edge, because the edge of the cell is part of the plus side and foil can bridge the two sides. Put the battery away straight after the activity.
A switch opens and closes the loop
You learned that electricity needs a closed loop. A switch is a part that can open or close the loop on purpose.
- When the switch is closed, the loop is complete and the LED glows.
- When the switch is open, there is a gap and the LED goes dark.
A torch has a switch. So does a toy. A robot’s bump sensor is a switch too, and it clicks closed when something presses it. A light switch on the wall works the same way, but it is connected to the mains, so never open it or poke anything into it.
Build a paper-and-foil slide switch
This switch slides in between one LED leg and the battery. Paper is an insulator, so it blocks the electricity. Foil is a conductor, so it lets electricity through.
- Make the foil end. Fold a small piece of foil over one end of the card strip, like a little sleeve, so there is foil on both sides of the card. Keep the foil patch about 1 cm long. Tape it in place. The rest of the strip stays bare paper.
- Hold the coin cell flat with the plus side up.
- Rest the long LED leg on the plus side.
- Slide the strip between the short LED leg and the minus side, with the bare paper part in the middle. The LED stays dark.
- Ask your grown-up to wrap a rubber band around the legs and battery to hold things together. Keep the legs from touching each other.
- Slide the strip along until the foil is in the middle of the battery’s flat face, well away from the edge. The LED glows!
Slide it back, and the light goes out. You have made a working switch.
If the LED will not light when the foil is in, check that the foil sleeve is on both sides of the card, that the foil is touching the leg and the battery, and that the long leg is on the plus side.

A switch is like an if
Look at the flowchart. It asks a question with a yes or no answer, and the circuit does something different for each answer. That is exactly what if does in a program.
switch_is_closed = True
if switch_is_closed:
print("Loop closed. The LED glows!")
else:
print("Loop open. The LED is off.")
Loop closed. The LED glows!
Now let us test the slider in three positions. A list holds what is between the leg and the battery each time.
slider_positions = ["paper", "foil", "paper"]
for position in slider_positions:
if position == "foil":
print(position, "-> ON")
else:
print(position, "-> OFF")
paper -> OFF foil -> ON paper -> OFF
Pixel says Notice that == has two equals signs. One = stores a value in a name. Two == ask a question: “are these the same?” Meow!
Did you know? Computers are made of switches! A modern computer chip contains billions of tiny electronic switches, flicking on and off incredibly fast to make decisions.
Challenges
Try it Add a fourth reading, "foil", to the end of the slider_positions list. What will the program print for it? Then try it.
Show the answer
Python checks the new reading with the same if. It is "foil", so it prints a fourth line:
slider_positions = ["paper", "foil", "paper", "foil"]
for position in slider_positions:
if position == "foil":
print(position, "-> ON")
else:
print(position, "-> OFF")
paper -> OFF foil -> ON paper -> OFF foil -> ON
Try it Beep’s bump switch closes when it hits a wall. Write in words what Beep should do when the switch is closed, and what it should do when it is open.
What you learned
- A switch opens or closes the loop on purpose.
- Insulators like paper block electricity, and conductors like foil let it through.
- A switch works like an
if: one answer does one thing, the other answer does something else. - A robot’s bump sensor is just a switch.
