Here’s an neat idea for a jack-o’-lantern: Hide a single white LED just beneath the thin surface of the pumpkin. And program it with the same slow “breathing” effect that indicates sleep on Mac computers.
The result? A pumpkin that sleeps like a Mac. It’s actually quite striking, in part because the effect becomes invisible every few seconds. It’s also an easy microcontroller project: our demonstration video and build instructions follow.
Here’s a quick walkthrough of the project, hosted at youtube:
This project is based on an ATtiny2313 microcontroller. The other essential components are an LED, resistor, and power source; we suggest using 3xAAA holder with switch, but a 3xAA holder will work just as fine. You’ll also need some way of programming your chip. We use the Adafruit usbtinyisp programmer hooked up to the chip with a minimal target boardconfiguration. The only essential part that you need for the target board is the six-pin header (shown above) that hooks up to the programmer.
Here are two examples of target boards for the ‘2313– the minimal one from the target board article, as well as our custom built ‘2313 target board. We’ll be using this one from here on out, just for ease of wiring.
First step is to wire up the target board with the chip, 6-pin ISP header, and powerA neat trick is to wrap the wires through existing but unused holes on the board for strain relief.
We are using an ultrabright 5 mm white LED with a clear lens. We hooked it up to the target board through some long insulated wires so that it can be arbitrarily positioned within the pumpkin. We also used a layer of black heat shrink tubing to make sure that the leads don’t touch and an overall wrapper of clear heat shrink tubing. The pumpkin is a moist environment, and it can help to keep the moisture off of the electronics.
Here’s a close-up of the connections on the board. The output signal comes out of OC1A, goes through the resistor, to the LED, and from there to ground. For a white LED and 4.5 V power (3xAAA), about 20 ohms is appropriate for the resistor.
That’s actually all the electronics hardware that there is– the rest is programming and pumpkin carving.
The source code for this project– and you’ll need to program the chip before it lights up the LED — is available for download
here (12 kB .zip archive) It’s an avr-gcc source file. (If you’re new to AVR programming, you might want to start by looking at our list of resources for getting started with AVR microcontrollers.) We got some hints for how to get the feel right by looking at this old project from Adafruit.
We found a nice face on our pumpkin, where we could locate the LED. On the opposite side, we cut an opening that would not be visible from the front– going for that “no visible seams” look, right?
Then we scooped out the contents of the pumpkin, washed and dried the inside, and thinned the front wall. We used a 3/16″ (4.75 mm) drill to make an incision that would hold the LED dead center in the front. This is the tricky part– you need to twist the drill so that it almost pokes through.
Put the electronics– except the LED –in a plastic bag, sealed to the extent practical.
Stick the LED in its hole, and (optionally) wedge it in place with a couple of toothpicks.
And that’s all there is to it. But beware: the LED effect is convincing. You might have to keep explaining, “No, I didn’t hide a Mac Mini in there.”
You can find more pumpkin projects in our Halloween Project Archive.