The inside of a Pringles can is metalic but not shiny.  To reflect the light in interesting ways, you want a shiny surface, maybe one with some "character" (not completely smooth).

Time to raid the house again. Two choices:

  1. The kitchen: get some aluminum foil, cut a square about 235 mm by 245 mm for a 73 mm diameter can (circumference = diameter times pi which is 3.14.16).
  2. The binder or craft store: Find a sheet of mylar (shiny irridescent) plastic. Cut to 235 x 245 mm.

WIth our two shiny surfaces, we now need some sticky to hold the Circuit Playground and the battery at the bottom of the short tube. Best to use non-conductive materials and I do not suggest glues that make the installation permanent unless that is your wish. The suggested method is to use one of the following:

  1. Strong double sided tape, about 30 millimeters long
  2. Blu Tack, silly putty or other non-conductive moldable adhesive.

Put the sticky between the battery and Circuit Playground. Also put it on the bottom of the battery to secure it to the bottom of the can. Don't secure it yet, though


The program below reads the angle at which the Circuit Playground is turned in relation to "down" (gravity, earth). Detecting the angle and how it's turned changes the lights in a pattern that works well as a kaleidoscope. This is not the only algorithm you can use. You can experiment with fading/brightening of lights also as well as other colors and patterns. I didn't use flashing both to make a more traditional effect and to avoid people sensitive to flashing lights, You can experiment with this to your heart's delight,

Copy the program into the Arduino IDE or Codebender per the Adafruit tutorial Circuit Playground Lesson #0. You will need to ensure the Circuit Playground library is installed as described in the tutorial. Download the code to Circuit Playground, turn on and plug in the battery (put batteries into the AAA holder if you need to).  You should be greeted with colored lights. If not, check your download and power. The green power LED will light on the Circuit Playground board if it is receiving power.

// CP Kaleidoscope  Make an inexpensive, fun Kaleidoscope with Adafruit's Circuit Playground
// Change the LED effect on the Circuit Playground NeoPixel ring based on orientation from
//   the accelerometer position (like turning the end of the kaleidoscope)
// Anne Barela  August 30, 2016  MIT License  For Adafruit Industries

#include <Adafruit_CircuitPlayground.h>

const int NUMBER_OF_LEDS_ON_RING = 10;  // NeoPixels on Circuit Playground
const int brightness = 25;              // Change this value to change the NeoPixel brightness

int ledPosition, led, previousLed = 0;
float x, y, nx, ny, angle; 

void setup() {
  CircuitPlayground.begin();                   // Circuit Playground startup

void loop(){

  x = CircuitPlayground.motionX();   // Get the CP accelerometer x and y positions 
  y = CircuitPlayground.motionY();   //   (we ignore the z axis for this one)
  nx = x / 10.0;
  ny = y / 10.0;
  angle = atan((ny/nx)) * 180 / 3.14;  // Figure out the angle of the accelerometer

  if(angle > 0.0) {        // Adjust based on arctangent function (in degrees)
    if(nx < 0.0)
      angle += 180;
  else {
    if(ny > 0.0)
      angle += 180;
      angle += 360;
  if(angle == 360.0)      // a 360 degree angle is the same as a zero degree angle 
    angle = 0;

  led = circularize(angle / (360 / NUMBER_OF_LEDS_ON_RING));

  if(previousLed == led) { 
    // nothing to do 
  else if (counterClockwiseDistanceBetweenLeds(previousLed, led) <= 8) {
    led = circularize(previousLed + 1);
  else {
    led = circularize(previousLed - 1);
  previousLed = led;

int circularize(int pos){
    return(pos - NUMBER_OF_LEDS_ON_RING);
  else if(pos < 0)
    return(pos + NUMBER_OF_LEDS_ON_RING);

int counterClockwiseDistanceBetweenLeds(int prevPos, int nextPos){
  int distance;
  distance = nextPos - prevPos;
  if(distance < 0)
    distance += NUMBER_OF_LEDS_ON_RING;

static int speeds[] = { 0, 5, 10, 20, 35, 50, 70, 90, 120 };

void rainbowCycle(int currentSpeed)  {
    // Make an offset based on the current millisecond count scaled by the current speed.
    uint32_t offset = millis() / speeds[currentSpeed];
    // Loop through each pixel and set it to an incremental color wheel value.
    for(int i=0; i<10; ++i) {
      CircuitPlayground.strip.setPixelColor(i, CircuitPlayground.colorWheel(((i * 256 / 10) + offset) & 255));
    // Show all the pixels.;

This guide was first published on Aug 30, 2016. It was last updated on Aug 30, 2016.

This page (Inside) was last updated on Oct 23, 2021.

Text editor powered by tinymce.