LED Pumpkins
Two projects at once
This started as one goal, learn microcontrollers, and turned into a checklist: SMD soldering, 3D modeling in Blender, batch 3D printing, PCB design in KiCad and ATtiny10 programming. Instead of doing them one at a time, I ran two tracks side by side: the pumpkin shell, and the electronics inside it.
A pumpkin that prints fast and cleans up easy

The shell went through several rounds in Blender before it was usable at batch scale. Early versions needed grams of support material on the overhangs and a tedious amount of cleanup per print. I kept at it (thinner walls, reworked overhangs on the eyes and mouth, angles that hold themselves up) until it printed fast, needed almost no supports, and still looked like a carved jack-o’-lantern and not a blob with holes in it. I skipped paint and just swapped filament colors between batches. With fifty of these to make, that beat a paintbrush by a lot.
Getting the ATtiny10 to do anything at all

I picked the ATtiny10 for one reason: it was the cheapest chip that could do the job. Getting it to do the job took a while. I was on the Arduino IDE at the time, and its ATtiny10 support is pretty bare compared to other AVR chips. Just getting it to flash and blink an LED took longer than I expected, before any real project work started.

Hardware: PWM, a transistor, and two pins doing double duty
I wanted to stretch battery life without buying constant-current LED drivers. They’re pennies each, but pennies times fifty adds up, so a decent PWM setup to cut power draw mattered. I also wanted a few different flashing effects, mostly because a chip that only turns an LED on and off doesn’t justify picking the ATtiny10 over something even cheaper, and I needed to justify that somehow.
The ATtiny10 only has a handful of usable pins, so two go to mode selection and one to the LEDs. I wasn’t sure the chip could drive the LEDs directly at the current I wanted, so a 2N2222A transistor sits between the PWM output and the LEDs. The chip just switches the transistor, and the transistor handles the LED current. The two selector pins get switched straight between high and low in hardware (no pull-up or pull-down resistors), which gives four combinations for four modes.

The interrupt fight I lost (and the mistakes I kept)
I spent a couple of weeks trying to get interrupts working for the mode switches and never got them reliable. Turns out that’s a common complaint with the ATtiny10 core in the Arduino IDE, not just me. I gave up and switched to checking the pins in the main loop instead. That works fine, but it left a couple of things I never went back and cleaned up:
- The
volatile booldeclarations forison1/ison2are left over from the interrupt attempt. They don’t need to bevolatilein a polling loop. That was an oversight, not a choice. - None of the modes check the switches mid-animation. Mode 2 (breathing) and mode 3 (candle flicker) both run their full loop before the code looks at the switches again, so there’s a real delay between flipping a switch and the pumpkin changing modes. An early-exit check inside those loops would fix it. I was annoyed enough about the interrupts that I never did it.
Here’s the actual firmware, mistakes included:
#include <avr/io.h> // for the attiny10 pins and all
#include <avr/interrupt.h> // for PWM
#include <util/delay.h> // for millisecond delays
/*
Author--- LogicishDesigns
Date----- July 2024
Function- Basic controller for ATTINY10 microcontroller to light up led(s).
Uses two input pins to select one of four different "modes" from
the user. Output to pin1, designed to push a signal to a switching
transistor for control of an led(s) lights (mA output limit on the
attiny10 restricts direct output for more than one led). Pin1 used
for pulse width modulation to conserve battery life and maximize
brightness. Pull up/down pins not used with plans for hardware
forced high/low toggle. Loop used for detecting user input instead
of interrupts due to problematic/glitchy interrupt sensing on the
attiny10 model.
Notes---- Code not optimized. Designed primarily as an education exercise in
microcontroller design and programming with secondary focus on
function and efficiency.
*/
/*
ATTINY10
1 ~|--|~ 6
2 ~| |~ 5
3 ~|--|~ 4
1 - pin set to output for led trigger, PWM mode
2 - ground pin
3 - input pin for mode selection
4 - input pin for mode selection
5 - voltage in
6 - reset pin, not used
*/
// ----- add some labels for the pins -----
#define in1 PB1 // pin3
#define in2 PB2 // pin4
#define led PB0 // pin1
// ----- some vars that compiler won't optomize so they can
// be dynamically assigned during run time -----
volatile bool ison1;
volatile bool ison2;
void setup() {
// setup pins, define which pins are input or output
DDRB &= ~(_BV(in1) | _BV(in2)); // in pins
DDRB |= _BV(led); // out pin
// setup timer
TCCR0A |= _BV(WGM00); // fast PWM 8bit
TCCR0B |= _BV(WGM02); // fast PWM 8bit
TCCR0A |= _BV(COM0A1); // clear on compare (non-inverted)
TCCR0B |= _BV(CS00); // timer off, for now
// initiate some stuff
OCR0A = 1; // set dutycycle 1/255 for PWM (temp)
ison1 = false;
ison2 = false;
}
// main loop for operation
void loop() {
ison1 = (PINB & _BV(in1));
ison2 = (PINB & _BV(in2));
int i = 1;
// mode "1"
// on at 200/255 dutycycle
if(ison1 && !ison2) {
OCR0A = 200;
}
// mode "2"
// log-ish breathing effect
else if(ison1 && ison2) {
while(i<100) {
OCR0A = i + i;
i++;
_delay_ms(15);
}
while(i>1) {
OCR0A = i + i;
i--;
_delay_ms(15);
}
}
// mode "3"
// candle like flickering effect
else if(!ison1 && ison2) {
int int1 = 180;
int int2 = 130;
while(i<6) {
OCR0A = 200;
_delay_ms(100);
OCR0A = int2;
int2 = int2 + 10;
_delay_ms(75);
OCR0A = int1;
int1 = int1 - 10;
_delay_ms(100);
i++;
}
}
// mode "4"
// blinking effect
else if(!ison1 && !ison2) {
OCR0A = 200;
_delay_ms(200);
OCR0A = 5;
_delay_ms(200);
OCR0A = 200;
_delay_ms(400);
OCR0A = 1;
_delay_ms(400);
}
}
Mode 2’s comment calls it a “log-ish breathing effect.” Half a description of the ramp curve, half a pun I wasn’t going to pass up.
Hand-soldering fifty boards, then wiring none of them

Every board got hand-soldered, ATtiny10 included, at an SMD pitch fine enough that it took a while to get the muscle memory. Three boards didn’t make it: bad joints, and at least one chip I flat-out cooked with too much heat for too long. That’s the cost of doing fifty by hand instead of paying for assembly.
Once a board worked, though, final assembly needed no wiring at all. The PCB clips onto a 3D-printed battery holder, and since the LEDs only need to shine through the eye and mouth cutouts, the board and holder just slide up into the pumpkin from the bottom and stay there on gravity. No connectors, no screws, no glue. That made batching easy too. I’d print five to eight battery holders at a time, then a couple of shells at a time, and assembly was just stacking parts.
Where it ended up

Fifty units, fifty ATtiny10s, zero wires, zero paint. Good enough for a work Halloween decoration, and a crash course in five skills I actually wanted to learn.