Why are there so many songs about rainbows
And what's on the other side?
Rainbows are visions, but only illusions
And Rainbows have nothing to hide

So we've been told, and some choose to believe it
I know they're wrong, wait and see
Someday we'll find it, the rainbow connection
The lovers, the dreamers and me.

- Rainbow Connection, Kermit the Frog

Make a beautiful rainbow colored glowing bottle lamp with fairy lights inside. You don't need to catch actual fairies, or chase down a real rainbow, but it will look as though you did! Decorate it with your favorite stickers and place it on your windowsill, and I guarantee you it will attract both rainbows and fairies into your life.

We decorated ours with an Ada Lovelace sticker. Ada Lovelace is famous for being the world's first computer programmer - she wrote computer programs before computers even existed! I think she deserves to have some art made for her.

Difficulty Level

This is a very easy beginner project that's perfect to do with kids who are interested in learning about making things light up. The assembly is easy enough for kids as young as 4-5 (with a little help from an adult). Kids that young can also pick their own colors with the MakeCode drag-and-drop app, and slightly older school-aged kids will have fun coding the whole project by themselves.

If you're a Grown Up Kid like me who still loves rainbows and fairies, this is a great place to get introduced to programmable lights, and you'll end up with a stunning piece of art when you're done. Let's get crafty and make stuff light up!

Supplies Needed

From the Adafruit shop, you'll need a Circuit Playground Base Kit and a strand of fairy lights. There are also a lot of fun stickers to choose from for decoration! I've linked to my favorite, a sticker of Ada Lovelace, below. Search in our shop to see all the fun options.

It's the Circuit Playground Express Base Kit! It provides the few things you'll need to get started with the new
Out of Stock
Add sparkle to your project with these lovely silver wire LED strands. These strands are very interesting, they use two silver wires that are coated so they don't short if they...
$4.95
In Stock
Celebrate Lady Ada Lovelace, one of the world’s first computer programmers. Adafruit offers a fun and exciting stickers to celebrate achievement for electronics, science and...
$5.00
In Stock

You'll also need a bottle. Frosted bottles look the best, because the frosted coating will diffuse the light and make the whole bottle shine with rainbow lights. You can find these online or at craft stores, or get creative and re-use wine bottles or barbecue sauce bottles or whatever you can find. 

If you found the perfect bottle but it's not frosted, look at your local hardware store or online for "Frosted Glass Spray Paint". There are several brands available, and one can is enough to frost dozens of bottles. 

This project uses MakeCode to light up the project. MakeCode is a free web-based app that lets you control the lights on your Circuit Playground board. Choose your colors, make the lights move (this is called "animating"), control the motion speed and brightness and much more.

Go to https://makecode.adafruit.com/ and select "New Project".

Here's your work environment. You can see the Circuit Playground with its lights simulated on the left. In the middle are tabs containing all the code blocks you can use, and on the right side is the workspace where you'll build your code.

You may see a block that says forever, but no block that says on start. Let's add this one since we want to use both.

Click the LOOPS tab and find on start. Drag it into your workspace above forever. 

Anything we put inside the on start block will happen one time, when you power up your board. Anything we put in the forever block will run over and over, forever.

Let's choose some colors for our lights! First let's tell the board we want the lights to be very bright. Click the LIGHT tab and find set brightness. Drag it inside your on start loop and drag the slider all the way to the right, so it reads 255 - that's as bright as it can go.

Now, when we power up the board, it will know to turn the lights all the way up.

Next drag show ring into the forever block. You'll see the lights on the emulator turn bright red. 

Click the color wedge, then click one of the light circles in the show ring block to choose a color for each light. This is fun! Make the lights shine in your favorite colors. 

If you're happy with how it looks, you can click Download and skip down to the Download section to see what to do next. Or, if you want to learn how to make the lights move, read on...

MakeCode has six different pre-programmed LED animations you can pick from. Open your LIGHT tab again and scroll down until you find show frame of animation. (There's also one called show animation up higher - we're not using that one right now).

Delete the show ring block from your forever block and move this one in there instead.

Open the dropdown menu and you'll find six different animations to pick from. Select each one and watch the emulator on the left to see what it does. Choose your favorite. I like the rainbow animation for this project.

The rainbow animation is really cool, but it moves a little bit too fast for a lamp project. I want a nice slow rainbow that doesn't make me feel so frantic. We can slow it down using the pause block, which is under the LOOPS tab. Choose different values from the dropdown until the animation moves at the speed you like. 

Once you're happy with your code, give it a name, and click the Download button to download the file to your computer.

Download Code

Let's test to see if it's working. 

  1. Plug your Circuit Playground Express into your computer with a USB cable. 
  2. Click the reset button. 
  3. Green lights will appear on the Circuit Playground's face  and it will appear in your list of devices, called CPLAYBOOT

If you don't see this, try double-clicking the reset button instead of single-clicking.

Click the pink Download button on your MakeCode screen and the code you just made will download to your computer.  Drag it onto the CPLAYBOOT device.  

Plug the light strand into power and you will see a pretty rainbow animation.  Hooray!

If you want to change something, no problem. You can reprogram your Circuit Playground as many times as you like. Experiment and play around, and see what you can get it to do! 

Things to Try

  • Make two animations play, one after the other
  • Make your favorite color lights come on for a few seconds, then play an animation
  • Look under the INPUT tab to make your Circuit Playground change when you shake it or shine a light on it, or clap your hands. This board has a whole bunch of cool sensors that can make your lights interactive. (This is a bit more advanced but there are lots of guides in the Adafruit Learning System that show how to do this!)

If you're having trouble or are getting frustrated, no worries. Here's the completed project that you can play with directly. Just click Download and drag it to your board.

Unwind your fairy light strand and stretch it out until it's straight. Then slip the lights down into the bottle one by one.

Line the battery holder up with the neck of the bottle and wrap some tape around to hold it in place.

Tie some ribbon around the tape and battery holder to make your bottle look fancy.

Make sure you can still reach your on/off switch for your fairy light strand!

Put stickers on your bottle to decorate it and show your style.

Put the batteries inside your battery holder, making sure the + and - sides align with the markings on the box. Plug in your Circuit Playground and flip the switch to "on" to make the lights glow.

Put your Circuit Playground and battery into the clear plastic box so the lights shine through the clear side.

Put your bottle lamp on top of the box to catch the lights and make the rainbow lights shine into the bottle. 

Put your bottle in a dark room or on a windowsill and enjoy your beautiful lamp!

This guide was first published on Oct 06, 2020. It was last updated on Oct 06, 2020.