Overview

For this project we will create a "fiber optic" rainbow archway using glue sticks and a NeoPixel LED dot strand. The NeoPixels hidden beneath the glue sticks guide the light in a curved path away from the LEDs. Because each glue stick connects two different NeoPixels, they are able to mix colors in the center, allowing tons of different color combinations to be achieved.

You can make neat sculptures with light effects!

This guide demonstrates how to make, assemble, and code your own glue-stick-fiber-optic art piece, demonstrating how to control the speed, color, and interactive potential of the light display, as well as alternative glue stick arrangements. 

Fiber Optic...-ish

Fiber optic cables work by virtue of a unique property called "total internal reflection", allowing them to carry huge amounts of information in the form of light almost losslessly. Glue sticks do not make good substitutes for fiber optic cable because they do not have total internal reflection, rather they act like light pipes, both scattering and reflecting light that enters them. This does, however, make them great light diffusers, which suits this project just fine. 

Electronics

Circuit Playground Express

PRODUCT ID: 3333
Circuit Playground Express is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and...
$24.95
IN STOCK

USB cable - USB A to Micro-B

PRODUCT ID: 592
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or...
$2.95
IN STOCK

Adafruit NeoPixel LED Dots Strand - 20 LEDs at 2" Pitch

PRODUCT ID: 3630
Attaching NeoPixel strips to your costume can be a struggle as the flexible PCBs can crack when bent too much. So how to add little dots of color? Use these stranded NeoPixel dots!...
$27.50
IN STOCK

3 x AAA Battery Holder with On/Off Switch and 2-Pin JST

PRODUCT ID: 727
This battery holder connects 3 AAA batteries together in series for powering all kinds of projects. We spec'd these out because the box is slim, and 3 AAA's add up to about...
OUT OF STOCK

Or, for a rechargeable version:

Lithium Ion Cylindrical Battery - 3.7v 2200mAh

PRODUCT ID: 1781
Need a big battery for your project? This lithium ion battery contains a 2200mAh and a protection circuit that provides over-voltage, under-voltage and over-current protection. Yet, it...
$9.95
IN STOCK

Adafruit Micro Lipo - USB LiIon/LiPoly charger

PRODUCT ID: 1304
Oh so adorable, this is the tiniest little lipo charger, so handy you can keep it any project box! Its also easy to use. Simply plug in the gold plated contacts into any USB port and a...
$5.95
IN STOCK

Other Materials

For this project you will need:

  • Scrap corrugated cardboard
  • Scissors and/or box cutter
  • Hot glue sticks (10 inches long x 0.44 inches wide is ideal)
  • Laser cutter + acrylic (optional)

MakeCode

Getting Familiar

The code for this project was created using Microsoft MakeCode for Adafruit, a web-based code editor. MakeCode provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users.

If you'd like to learn more about MakeCode, this guide is a good place to start.

Click the button below to enter the portal to interact with the code for this project

How to Upload Code

To upload code, connect Circuit Playground Express to your computer using a micro USB cable and press the small reset button in the center of the board. All the LEDs will flash red briefly, then turn green. Your computer should now show removable drive called CPLAYBOOT. 

Click the Download button to download the .uf2 file to your computer, and drag 'n drop that .UF2 file onto the CPLAYBOOT drive in your computer's file explorer or finder.

The drive will automatically eject itself (your computer may give you a "failed to eject drive correctly" error, you can ignore this). The code is now on your Circuit Playground Express and ready to run!

What's Happening?

First, in the on_start loop we tell Circuit Playground Express that a NeoPixel strand with 20 pixels is going to be connected at pin A1. Then we tell it how bright we want our lights to be (as bright as possible). 

Then in the forever loop, we tell the strip to show one frame of the "rainbow" animation at a time, with a 5 millisecond delay between each frame.

If you'd like to play with this code, click "Edit" and a new window will open in which you can create your own version.

MakeCode is fun to work with and easy to customize, allowing you to get some great results with just a little trial-and-error. 

Changing the NeoPixel Animation

If you'd like to change or add anything to your light show, you will find the NEOPIXEL section becomes available after you click on the LIGHT section. 

Click on the LIGHT block at the top of the list.  The code in this block deals with the Circuit Playground's onboard lights. When you click this tab, a new block called NEOPIXEL appears. This is the block you want.  The options in this block deal with any light strips extraneous to the NeoPixels already onboard the CPX and provide many fun options for animating your NeoPixel strip. 

To reveal the NEOPIXEL section in MakeCode, first click on LIGHT

Troubleshooting

Problem: My NeoPixels won't light up!

Solution: Make sure that your Circuit Playground Express is connected to a power source (anywhere between 3V-5V is safe). If you're using a AAAx3 battery pack, check that the switch on the battery pack is set to "ON".

Problem: My Circuit Playground Express doesn't show up as CPLAYBOOT

Solutions:

  • Be sure you have a Circuit Playground Express.  The Classic will not work with MakeCode.
  • Some USB cables are "charge-only" and won't pass data. Try using a different USB cable and try using a different USB port on your computer.  
  • With the Circuit Playground plugged into your computer with a micro USB cable, click the small reset button in the center of the board. The lights should all turn green. If they don't, try double-clicking the reset button.

If things still aren't working, head over to the Intro to Circuit Playground Express guide for more suggestions.

Assembly & Circuit

There are two ways to create the platform for your glow stick archway: cutting it out of cardboard, or using a laser cutter to create an acrylic piece that will hold the ends of the glue sticks firmly in place.

Below are instructions for a cardboard version, which requires only some cardboard, paper, glue, and a good hobby knife. 

Print Template

 

Download the PDF of the glue stick matrix template by clicking the green button above. Print out the template.

 

Glue the template to a piece of cardboard.

 

Press the cardboard+paper under something heavy. Wait 10-15 minutes for glue to dry.

Cut Holes

 

Use a hobby knife to cut out the small holes in the cardboard.

 

Stay slightly inside the lines to ensure the gluesticks fit tightly in the holes.

Glue NeoPixel Dots

 

Glue the NeoPixel Dots one by one to the underside of each hole.

 

Be careful and work slowly! Hot glue is dangerous and will burn your fingertips if you're not careful.

Hot glue can burn your fingers badly! Be careful when working with it and seek help if you need an extra set of hands.

Add Glue Sticks

 

Once the hot glue has cooled, grab 8 pristine glue sticks and insert the ends of the glue sticks into the top of the holes, pressed them tightly up against the NeoPixel dots.

Clean It Up

 

If desirable, cut around the outside edge to give the rainbow platform a clean and finished appearance. 

The Circuit

On this NeoPixel strip, the red wire is +5V, the middle wire is data, and the other edge wire is ground.

Using alligator clips from the pads on Circuit Playground Express, connect the red wire to Vout, the middle wire to A1, and the edge wire to GND

A combination of short female-female jumper wires and alligator clips are a fast and simple way to connect the end of the NeoPixel strand to the pads on CPX.

 

You can also follow this guide for an alternative method for connecting CPX to the NeoPixel strand (requires soldering). 

Just Add Power

To power your NeoPixel Dot strip, just connect a battery to the JST port on Circuit Playground Express and you should see it boot up after a second or two. 

Adaptations

Getting Fancy

If you'd like your new glue stick archway to do more than just glow beautifully, you can use MakeCode to quickly incorporate some of Circuit Playground Express's many sensors. 

For example, we can alter the original MakeCode so that the rainbow only comes on when the lights are dimmed. This code is available by opening the example below, or you can follow the steps on your own to make these changes. 

First, grab an if/else statement from the Logic block. Drag the previous code into this new if/else statement and place that all back into the forever block.

Insert light level into the if true statement. The light level is measured from 0-255 and can be adjusted to suit whatever light conditions you're in, but 120 is a good starting place.

In the else section, drag in strip clear from the NEOPIXEL block. 

Voila! Your rainbow now responds to light and dark: by covering the light sensor on Circuit Playground Express with my hand, the rainbow is turned on.

Laser Cut Option

If you have access to a laser cutter, some acrylic parts make a beautiful and much more robust platform than cardboard can. 

Download the design file below and import into your laser's software.

NOTE: you may have to adjust the hole sizes depending on the brand of glue stick you have.

Cut out acrylic pieces on a laser cutter.

 

Insert glue sticks into holes.

Tape each NeoPixel dot down.

 

Sandwich the neopixels between the bottom two plates. This will ensure they stay firmly in place. 

Alternative Designs

If a rainbow archway doesn't suit your purposes, there are many other avenues of design that can be explored. 

Other matrix layouts are worth exploring. Weaving glue sticks together may also produce a strange effect. 

Exploring Further

If you enjoy MakeCode and want to continue exploring you can check out lots more MakeCode projects on the Adafruit Learn System.

This guide was first published on Jan 29, 2019. It was last updated on Jan 29, 2019.