ATTiny85 Flickering Flame circuit for Halloween Jack O Lantern Pumpkin

Arduino,Code Samples

ATTiny85 Circuit: Simulated Flickering Candle Flame

2 Nov , 2016  

I originally posted this as a how-to article on


  • Atmel ATTiny85
  • Resistor 100 ohm × 3
  • 5 mm LED: Red × 3
  • 5 mm LED: Yellow × 3
  • AA Batteries × 3
  • Arduino IDE

Video of effect in pumpkin available here:

I saw a couple circuit diagrams available for the Arduino that performs this kind of simulated flickering fire light, but nothing for the much smaller and cheaper ATTiny85 which is all this project really needs. I used the PWM output via analogWrite() on 2 pins (0 and 1) for a very realistic random flickering flame effect, and then just used digitalWrite() for the 3rd pin (2) to turn it on and off to make it appear to be blinking.

I also wanted it to make it a lot brighter than most projects I’d found online, so I used 3 pairs of LEDs in parallel for a total of 6 LEDs, 2 of which are basically on more than off (not really flickering – using the 3rd pin which can’t use PWM) for even more added brightness. I used 3 AA batteries for 4.5 volts, and you could get away with less than 100 Ohm resistors, probably half that (You calculate resistors needed for LEDs with this online calculator: . You could also power it with 3.3 volts and use smaller resistors still.

Note I lined the pumpkin with tin foil on the inside to make it brighter.

Schematic Diagram for circuit: ATTiny85 Flickering Flame Light

ATTiny85 Flickering Flame circuit Top View

ATTiny85 Flickering Flame circuit Front View

ATTiny85 Flickering Flame circuit Back View



 LED Flicking candle flame effect to PIMP DAT PUMPKIN
 Halloween 2016 Barry Wise
  Borrowed and enhanced code from:
  Made ATTINY85 shield for Arduino like this:
  How to use Arduino as ISP for programming via said shield:


int ledPin1 = 0;
int ledPin2 = 1;
int ledPin3 = 2;

void setup() {

pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);


void loop() {

// analogWrite(ledPin1, random(50)+200);
// analogWrite(ledPin2, random(80)+170);
analogWrite(ledPin1, random(250));
analogWrite(ledPin2, random(250));

digitalWrite(ledPin3, HIGH);


digitalWrite(ledPin3, LOW);

, , , , , , , , , ,

Comments are closed.

ATTiny85 Circuit: Simulated Flickering Candle Flame

by Barry Wise time to read: 1 min