Cylon Pumpkin

In a fun diversion, I decided the day before a pumpkin carving contest to make a cylon pumpkin. Things got real when I realized I could use the polymorph I had to hold the LEDs in a curve. Here’s an example pic of polymorph in action from an instructable.

polymorph
Polymorph A.K.A Shapelock

And here’s the LED fixture held together with the stuff. I got mine at SparkFunย (I also got the heat gun there).

Shapelock, heat gun and finished eye
Shapelock, heat gun and finished eye
Closeup of "eye"
Closeup of “eye”

I shopped around for a bit looking for something to use for the “lens”. I ended up at an art supply store ordering a strip of translucent grey acrylic. Their computerized saw was down so they couldn’t get it right away, so I was going to go back the next morning.

When I got home I soon had the idea to use a CD jewel case, which is what you see above. It adhered very nicely to the warm polymorph.

The LEDs used are some bar indicators I picked up at Ra-Elco for 20ยข each. There’s actually 2 LEDs in each bar, 4 total in each unit. I only lit one LED per bar, because I got tired of soldering wires. :p

Next I wired it all up and wrote the code (arduino) to control the shift registers. The main loop consists of 2 smaller loops. The first shifts a single 1 down the registers after the single 1 is shifted in. The second loop shifts all 12 bits in with the single 1 bit positioned back one each iteration.

int ndigits = 12;

#define OFF LOW
#define ON HIGH

#define SCLK 2
#define SLATCH 3
#define SOUT 4

// 1 second for full cycle
#define DELAY 1000 / 24

void shift(bool b) {
  digitalWrite(SOUT, b);
  digitalWrite(13, b);
  pulse();
  digitalWrite(SOUT, OFF);
  digitalWrite(13, OFF);
}

void pulse() {
  digitalWrite(SCLK, HIGH);
  //delay(10);
  digitalWrite(SCLK, LOW);
}

void latch() {
  digitalWrite(SLATCH, HIGH);
  //delay(10);
  digitalWrite(SLATCH, LOW);
}

void setup() {
  pinMode(SCLK, OUTPUT);
  pinMode(SLATCH, OUTPUT);
  pinMode(SOUT, OUTPUT);

  digitalWrite(SOUT, OFF);
  digitalWrite(SCLK, LOW);
  digitalWrite(SLATCH, LOW);

  shift(ON);
  latch();

  delay(DELAY*8);

  for (int i = 0; i < ndigits; i++) {
    pulse();
    latch();
    delay(DELAY*8);
  }
}

void loop() {
  int i = 0, j=0;

  // assume already lighted
  // shift lighted position to end
  delay(DELAY);
  for (i = 0; i < ndigits-1; i++) {
    pulse();
    latch();
    delay(DELAY);
  }
  delay(DELAY);
  // Shift backwards
  for (i = ndigits-1; i >= 0; i--) {
    for (j = i; j < ndigits; j++) {
      pulse();
    }
    shift(ON);
    for (j = 0; j < i; j++) {
      pulse();
    }
    latch();
    delay(DELAY);
  }
}

And here it is all wired up! I had to tear apart my sous vide to use my redboard. ๐Ÿ™ Hopefully I’ll have my sous vide PCBs by the time I want to have a controller again. ๐Ÿ˜•

Everything wired up!
Everything wired up!

That nice silvery finish? I superglued a strip of static bag to the front. I only had to glue the ends.

Once I had the pumpkin all carved it was time to shove the eye into the hole. I tried only briefly to fit the whole board inside the pumpkin, the bundle of wires was very stiff and I didn’t want to risk pulling out of the breadboard or breaking the solder joints on the lens side. So I gave up and just left it hanging out the back.

Ready to cut
Ready to cut
Carved and assembled
Carved and assembled

The whole build took approximately 8 or 9 hours. A good chunk of that late into the night with a little dozing. 1 hour looking for the soldering iron. Another hour debugging the code when in fact the problem was my arduino had a fried output pin. CURSES! Soldering 24 wires to DIP leads was of course a time consuming and frustrating portion. The polymorph was easy to work with and I had the eye assembly done in only about 1 hour.