In this activity guide, you will learn to program an infrared remote control to change the color of lights on a NeoPixel strip.
Total read time: <7 minutes
Skill level: Beginner
Street Corner STEAM
On Wednesday evenings, I lead a free STEAM activity in a location that also serves free meals. Activities are designed for 10-12 year old students, but in reality we have five-year-olds through senior adults who attend. There are three activity tables: sewing, painting, and drawing, as well as one special project I bring each week – such as this one. The goal of Street Corner STEAM is to offer socially-distant and spontaneous play to build skills and confidence with technology. Below you will see pictures from Street Corner STEAM.
When you attach the NeoPixel strip and infrared sensor, be sure to line the black wire up next to the letter /G/ which stands for ‘ground.’ If you plug the wires in backwards, your program won’t run properly. Make sure the slide switch on the basic:bit is set to ‘P0’, not to the speaker.
Get to know your materials
Connect your micro:bit via USB to your computer.
Open MicroBlocks and be sure you have a green circle in the top left corner.
Add the NeoPixel library to MicroBlocks.
At this point you can play with the NeoPixel library. Below is sample code I shared with the students in Street Corner STEAM. With these code snippets, they were able to create new scripts.
Infrared sensor and remote control
Infrared light is invisible to the human eye, but if you look at it through the lens of a video camera, including most cellphone cameras, you can see it. Below is a way to use the remote control with your NeoPixel strip.
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.
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.
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?
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.
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.
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.
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.
From potato-powered to micro:bit-powered
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.
Draw and play with electricity
While exploring electricity as a raw material, I like to sketch and write what I am learning.
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.
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: https://microblocks.fun/learn#activity_cards
Use physical objects to control digital animations and sound
Use math (you won’t realize you did)
Use music (you’ll probably realize you did)
What you get
Three ways to help Pete find his beat using micro:bit, MaKey MaKey, and Scratch
Loads of supplemental teaching resources for music, coding and Scratch 3.0
Most people don’t know this, but there is a reason Peter Cottontail always came hip-hoppin’ down the bunny trail.
He was a famous DJ, and he loved to make music. Though the secret to his music lived in his tail.
One day a terrible DJ accident happened and Peter lost his cottontail.
Now he is just known as “Pete who lost his beat.”
Can you help Pete find his beat?
Part 1 – Make Pete, micro:bit glove, and MaKey MaKey dance pad
Pete: 1 sock, fist-full of stuffing, two rubber bands, and scissors
micro:bit glove: glove, binder clip, micro:bit with battery pack
MaKey MaKey dance pad: 1 file folder, aluminum foil (about the size of half a sheet of computer paper), glue, scissors, MaKey MaKey
First, make Pete.
Pete is just a sock bunny. Follow this tutorial to make your own. If you don’t like this tutorial, search “No sew sock bunny” to find many versions. You can also search “No sew sock animal” to finds lots of other creatures to make with a sock.
Materials: 1 sock, fist-full of stuffing, two rubber bands, and scissors.
Glue a piece of foil onto the bottom of Pete. This will help him to dance on the MaKey MaKey dance pad.
Second, make your micro:bit glove.
Materials: glove, binder clip, micro:bit with battery pack
5) In Scratch, select: File –> open, and open the code you downloaded in step 4. (Be sure to open that code AFTER you do steps 1-3. The Facemesh2Scratch extension has to be open first.)
6) Click the green flag and start playing the game.
HACK THE CODE
Q: How can I speed up the scroll?
A: Increase the speed of the “glide.”
Q: How can teachers suggest students modify the code?
Increase speed of the game
Change the Flappy Bird sprite to your favorite character
Reduce distance between the pipes
Play a sound when the Flappy Bird touches a pipe
Create a score board. Add a point when Flappy Bird makes it through a pipe. Lose a point if Flappy Bird touches a pipe.
Create a fun game for others who are in quarantine and not moving as much. How can you help more people move in a fun way? Not everyone can do push-ups. What other kinds of movement can you inspire with your game?
Q: What is the easiest way to share code with students?
A: Students need the Facemesh2Scratch extension loaded in Scratch before they open the code linked in the above section “Copy the Code”. Follow steps for “Copy the Code” above to share with students.
Otherwise, consider creating your own instructional sequence.
STEP ONE – Students open Facemesh2Scratch extension in Scratch.
2) Click on the “Add extension” icon (bottom left corner)
3) Scroll down and select “Facemesh2Scratch” extension. Note: It will take a while to open. Your computer will look like it’s locked up, but it isn’t.
4) Practice using this code to see what happens.
STEP TWO – Learn to create scrolling sprites.
Does anyone in your class know how to do this? Let them teach others. Students can also use tutorials, such as the one below.
STEP THREE – Students identify problems to solve
What problems do your students still need to solve in making their game?
Form interest-based groups around remaining problems using a platform like Flipgrid. Allow students who are trying to solve similar problems to work together. Get the students name their own problems and find people who share similar problems. Don’t go too fast at this step. There is a lot of learning in being able to name the problem you are trying to solve. Answer their questions with questions.
Encourage them to:
Name the problem
Identify resources they already know about that could help
Identify resources they wish they had
Ask them how they can obtain the resources that they wish they had.
There will likely be many problems. Ask them to focus on the hardest problem first.