These potatoes can do what my computer does

What you get in this post: Seven activity ideas for exploring coding and electronics, including printables, slides, a materials list, and sample code. The first activity is ideal for students as young as 8.

I used to think coding was overwhelming – that for every one thing I learned, there were a million more that I would never learn. Coding felt like a list of endless and unknowable details that I would drown under. But through activities like this potato battery experiment, I’ve learned that’s not true. Whether you code with a single block of code or 86 million lines of code, you’re doing the exact same thing: playing with electricity.

One russet potato cut into four parts and used to power an LED. Click on the activity sheet below for a materials list and printable diagram to try this experiment with your students. [Photo: John Maloney]

Connecting a potato battery to an LED allows current to flow, making the LED light up. My computer works the same way: tiny transistor switches control the flow of current in millions of tiny wires. Although my computer has a lot more wires and switches, at the lowest level it is just turning things “on” and “off” with electricity, just like my potato battery.

After I realized that, coding and electronics were no longer overwhelming and I started to play. Anyone creating technology – making us laugh with animated films, healing us with medicine, keeping us safe while we travel – is taking up tools to do one thing: creatively move electrons.

I hope the activities below will help you to think of electricity as a raw material that you and your students can play with.

Getting started playing with electricity

In this hands-on activity, students will create a potato-powered night light by connecting several potato “battery cells” in series to light an LED. In an optional extension, students can experiment with different colored LEDs to discover how many potato cells are needed to light each color. Finally, they apply what they have learned by designing (on paper) their own night lights. This potato-battery night-light project was created by John Maloney and myself.

A simple diagram to illustrate the photo above

Ellie needs help from her sister

Sara and her little sister Ellie are home alone when a big storm makes the power go out. It’s getting dark, and Ellie is afraid. Sara knows that even a small light would comfort Ellie but, unfortunately, their flashlight doesn’t work. However, Sara recently learned how to make a battery in science class and, even better, she still has some LEDs from that class in her backpack! In science class, they made lemon batteries, but Sara remembers that her teacher said that potatoes might also work. After a quick search, she’s found everything she needs. Can she put the pieces together to light up the LED and keep Ellie from being afraid?

Lesson plan ideas, including materials list

Resources for your students (Make a copy of these slides)

What comes after potato batteries?

A picture like the one below is a good example of something that used to intimidate me (and sometimes still does). However, instead of feeling like I am about to drown, now I just think of the potatoes in the experiment above.

Materials: micro:bit, sensor:bit edge connector, breadboard, and 7-segment display.

Look closely at the 7-segment display plugged into the breadboard above (only three of the seven segments are lit up). Each segment is like a single LED from Sara and Ellie’s nightlight project above. One wire is connected to one LED segment on the display. The picture above is like setting up seven potato battery experiments, one potato battery experiment for each LED segment on the display.

However, in the potato battery experiment, I had to clip and unclip the wires to make the LED turn on and off. In this set up, I can write code to turn the LED segments on and off. The 7-segment display stays wired up, and my code turns the lights on and off.

Each section of a 7-segment display is named with a letter. By turning some sections on and others off, you can display numbers 0-9. [Image from:]
Using MicroBlocks to program my seven segment display

Bridging potatoes and 7-segment displays

Going from potato-powered LEDS to programming 7- segment displays isn’t as big of a leap as you might think.

You can start by plugging your potato-battery into the computer using a micro:bit and measuring the voltage of your potatoes using MicroBlocks.

A reading of 267 equals about .75 volts. If one potato cell equals about .75 volts, approximately how many volts do you think all four potato cells make?

Step 1: Connect the potato cells in series (as described in the activity sheet above).

Step 2: Connect an alligator clip to pin 1 of your micro:bit (I did this with a yellow wire in the picture above). Then, connect a second alligator clip to the GND pin on your micro:bit (I did this with the green wire in the picture above).

Step 3: Open MicroBlocks and create a script that reads the analog value of pin 1. Above I am using the “say” block to show the number on the screen. 1.5 volts will read as about 500.

Step 4: Measure the voltage of one potato cell. Clip the yellow wire to a penny and the green wire to a nail. Write down the number you see (For me, it’s 267 in the picture above). Then, move the green wire to the nail of the next potato (keeping the yellow wire on the penny of the first potato). What number do you see now? Do this two more times, moving the green wire to the next nail each time.

Step 5: How many volts does your four-cell potato battery generate?

Another way to play with electricity

Here is another way to use MicroBlocks and your micro:bit to play with electricity as a raw material.

This activity card and more like it can be found here:
The activity card above is the same activity as using a voltmeter to measure voltage.

From potato-powered to micro:bit-powered

The LED above is drawing electricity from the micro:bit (not potatoes).

Instead of clipping and unclipping the LED to turn it on and off (as I had to do with the potatoes), I can code the A button on the micro:bit to turn the LED on and the B button to turn it off. In other words, pressing A switches electricity to flow and pressing B stops electricity from flowing.

These scripts were written using MicroBlocks.

Draw and play with electricity

While exploring electricity as a raw material, I like to sketch and write what I am learning.

Programming a relay to control an LED.
Sketching and building a circuit allowing either of two switches to turn an LED on or off.
On the left I am making a truth table to illustrate the circuit’s activity. If you’ve ever turned lights on at the top of a staircase, walked to the bottom of the stairs, and turned the lights off as you go out, you’ve used a circuit like this.

Tiny electronics

With the power of coding, you can create anything! Below is an example of electronic jewelry that communicates secret messages by fast-flashes of light. 1 flash = A, 2 flashes = B, and so on.

Geo (left) is wearing an LED powered by a micro:bit and D (right) is wearing a light sensor powered by a micro:bit.
D’s name is short for Decipher. She deciphers the secret message flashing on the LED with her light sensor.
Geo’s name is short for Geologist (she loves collecting rocks and minerals). She is sending a secret message to D with flashes of light on her LED bracelet.
This is the code powering Geo’s LED bracelet. Remember: We are only playing with electricity. Letter A needs to flash once, Letter B needs to flash twice, etc. So when I type a message to send, the code on the right looks at each letter and decides how many times to flash.

Here is a link to download the sending code and the receiving code:

Want more programming fun?

Try coding your own flashlight tag game to play with friends – it’s like laser tag, but with flashlights! Use the activity cards below to help you. Find more activities here:

[Photo from:]

Thank you for stopping by!

I can’t wait to see what you make.