Ho Ho Ho! The Christmas Spirit is only one potentiometer away with our penultimate hack! Let’s display it with 23 LEDs.


You’ll need:

  • 23 mixed LEDs
  • 3 shift registers
  • 1 potentiometer
  • Arduino Uno
  • Breadboard + wires
  • Cardboard
  • Paint

1) LEDs and shift registers
I think you’re becoming familiar with shift registers now; we’ve been using them a lot! (And the more LEDs, the more useful they get).
Like for the Chimney Climber game on Saturday, we are going to use 3 shift registers, and only 3 pins on the Arduino. (I hope you’ve got a big breadboard though!)


To start with, we’ll only make the lights switch on one after the other, that’s what the Arduino sketch below lets us do:

//Pin connected to Pin 12 of 74HC595 (Latch)
int latchPin = 8;
//Pin connected to Pin 11 of 74HC595 (Clock)
int clockPin = 12;
//Pin connected to Pin 14 of 74HC595 (Data)
int dataPin = 11;

int sequence[] =   {1,3,7,15,31,63,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255};
int sequence2[] = {0,0,0,0,0,0,0,0,1,3,7,15,31,63,127,255,255,255,255,255,255,255,255,255};
int sequence3[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,7,15,31,63,127,255,255,255};

void setup() 
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);

void loop() 
  for (int i = 0; i < 24; i++) 
    //set latchPin low to allow data flow
    digitalWrite(latchPin, LOW);

    //set latchPin to high to lock and send data
    digitalWrite(latchPin, HIGH);

      delay(500);// we leave the last light on a bit longer
    } else {
      delay(200); //sets the speed, shorter means faster

void shiftOut(byte dataOut) 
  boolean pinState;
  digitalWrite(dataPin, LOW);
  digitalWrite(clockPin, LOW);
  for (int i=0; i<=7; i++) 
    digitalWrite(clockPin, LOW);
    if ( dataOut & (1<<i) ) 
        pinState = HIGH;
        pinState = LOW;
  digitalWrite(dataPin, pinState);
  digitalWrite(clockPin, HIGH);

digitalWrite(clockPin, LOW);

And what it looks like:

2) Santa’s Sleigh
Now, all we want to do it to map the lights above with a potentiometer, to be able to control them; and of course shape Santa’s sleigh.

(I probably should have told you by now that the Claus-o-meter comes from the film Elf, and people spreading the Christmas Spirit is what enables it to fly).

After wiring the potentiometer to pin A0, just amend the loop() function like so:

  int sensorReading = analogRead(potPin);
  // map the result to a range from 0 to the number of LEDs:
  int ledLevel = map(sensorReading, 0, 389, 0, 24);

  //print out sensorReading to know the maximum value you're getting, to map out the lights and potentiometer properly
  digitalWrite(latchPin, LOW);
  digitalWrite(latchPin, HIGH);

All you’ve got to do now is turn the potentiometer up to the level you think your Christmas Spirit is (you can sing along too, it might help 😉 )


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s