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
But, have you ever tried to mount a motor into toy stuffing? Making a squishy toy that has motors inside isn’t easy. Below is the story of how I tried – and am still trying. I didn’t have directions to follow. I just knew that I wanted a plushy bunny that would “look around” like a real rabbit.
For each idea in this process, I tried lots of other ideas before I moved on to the next idea. Also, sometimes I got on an airplane in between ideas because I travel a lot for work. (Those photos are below, also.)
My goal is to create a simple robot plushy that mimics life-like behavior. If you have shareable resources on this topic, please email them to me email@example.com. I’d love to see them (and share them in the next blog post.)
This 14 second video has music.
Key Ideas I’ll Try Next Time
Insert electronics from the tail of the bunny, not the head.
Try attaching the head separately and last. This might make for a more emotionally appealing face because you can get the details right before attaching it.
Use fabric that doesn’t shred easily. Felt or wool might be a better option than what you see in my photos. (I used micro felt because it was extra soft. I thought it would move nicely with the micro servos, but it ended up just fraying easily at the edges.)
Try micro servos with plastic gears instead of metal gears to save a few dollars.
First, I started with a simple cardboard version. (Hey, it looked like a rabbit to me.) I programmed it in MicroBlocks.
Well, that was easy enough. I put a picture of the MicroBlocks bunny Rosa on the front and called it a day. That was all I had time for before I went to FETC in Miami, Florida for work.
Once I returned from FETC, I had to go to the BETT show in London right away. So, my bunny project waited a few more days.
Once I got back from BETT, I had a new idea to try. I chopped up a memory foam pillow, and made a servo shelf with 2 pieces of 10 mm Eva Foam. The Eva Foam securely held my servos, but the servos weren’t strong enough to move the 2mm black foam (AKA: future bunny face) the way I liked. So, I ordered micro servos with metal gears, thinking they’d be stronger. (This may not have been necessary because the most recent design I’ve used is fairly small and light weight.)
Also, memory foam is difficult to cut without special tools. Of the tools I had available, a bread knife was the best solution.
After I tried that idea, I had to pack my suitcases again to go to TCEA in Austin, Texas. TCEA was a strangely green trip.
After one of our morning meetings, I started working on the code for my future rabbit. I knew I wanted to use the radio feature of the micro:bit to wirelessly send messages from one micro:bit to another micro:bit, in order to control the servos. Below is the program I wrote.
During the class we taught, I managed to find a few minutes to try making another type of bunny head.
Once I got back from Infosys Winter Pathfinders with John, I was ready to dive into my project because I had 8 full days before traveling again.
First, I decided that I had a good concept for stabilizing the servos with Eva Foam from the memory foam rabbit.
This is a soft and durable way to stabilize the servo motors, so I decided to keep it.
Next, I decided it was time to get a real pattern. I knew I wanted a plushy rabbit, so I searched free rabbit patterns. I chose the pattern below because I thought the servos would fit well in the neck. (I noticed that the distance between the base of the rabbit and it’s neck was similar to the height of my servos stacked on top of each other.) So, I traced the pattern and cut out the shapes from my fabric.
Even though the directions showed me how to stitch these pieces together, I still had to figure out how I was going to insert my motors. I also needed to figure out how I would attach the motors to the rabbit itself.
Next time I will NOT insert the motor in the front (as I tried here). Next time I will stitch up the front of the rabbit and leave the back open. There are several seams on the front of the rabbit, and trying to stitch them together while holding the motors in place was very tricky. This trickiness combined with the fraying fabric makes the front of my first-draft rabbit pretty raggedy.
Here’s what happened. (The black thing sticking out of the side when the head turns is a piece of 2mm foam. You’ll see more about that piece below.)
Fourth/ Some Things I Did Next
See how well it works?
So this is what went inside of the rabbit’s body.
Yes, it’s a bit floppy outside of the rabbit, but once it goes inside, it seems to work okay. There is definitely room for improvement in this form.
Programming My Rabbit
Once I sealed my servo motors inside of the rabbit, I didn’t know how exactly they would move. Using MicroBlocks was a good choice for me because I could quickly make changes to my program. I needed to find out how far my rabbit’s head could move without looking crazy, or worse, falling apart. By using MicroBlocks, I could test in real-time (no waiting for something to download) the range of my servos inside of the rabbit.
Pressing A on the micro:bit causes the rabbit to rest. Pressing B on the micro:bit creates a random rabbit movement. My next step is to make these radio controlled features so that I can remove the wires (as you saw in my example code above.)
This 14 second video has sound.
Need More Resources
If you have shareable resources on the topic of simple squishy robots, would you please email them to me, Katie@katiedays.com? I’d like to learn from them and include them in my next blog post.
The micro:bit is a tiny programmable computer that makes STEM, computer science, and coding easy and fun. With this one device, students can start taking creative risks in nearly any subject. Check out www.microbit.org for free lesson plans and student project ideas.
Why use MicroBlocks?
MicroBlocks is a small, fast, human friendly programming language specifically designed for tools like the micro:bit. MicroBlocks is perfect for libraries, maker spaces, and anywhere with lots of people and resources coming and going.
Just plug your micro:bit into your computer, open MicroBlocks, and click the gear icon to “update firmware”. That’s it. Double-check to make sure the USB icon has a green circle behind it to show the connection is good. (See it in action below.)
You can do a lot with the buttons, sensors, and display built right into the micro:bit, but you can also do more by adding accessories. The basic:bit is one way to easily add accessories.
Attach your micro:bit to the front of the basic:bit with 5 screws that come with the basic:bit. (See photos below.) Use the same battery pack that came with your micro:bit to power it all. MicroBlocks makes it easy to start programming your basic:bit instantly.
Attach your NeoPixel strip to the basic:bit. The MicroBlocks NeoPixel activity card makes it easy to learn. Because the basic:bit comes with a piezo speaker built in, try using the sound and NeoPixels together. The MicroBlocks sound activity card will help you.
This project was made using the winch and crank build videos at the BirdBrain Technologies Build page. This puppet uses two position servos: one in the eyes and one in the mouth. The MicroBlocks servos activity card makes it easy to get started with servos. Also, this puppet is being powered by the ring:bit instead of the basic:bit. You can make a puppet with a basic:bit, but the extra battery in the ring:bit will help your puppet last longer. However, the ring:bit doesn’t have a piezo speaker built in like the basic:bit does.
Add at least one position servo to bring your puppet to life. Consider using a ring:bit instead of a basic:bit to add more power to your puppet (The ring:bit doesn’t have a piezo speaker built in like the basic:bit does.)