I originally posted this as a how-to article on Hackster.io
Requirements:
Video of effect in pumpkin available here: https://youtu.be/a9WEidFeCPM
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: http://ledcalc.com/) . 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.
/* LED Flicking candle flame effect to PIMP DAT PUMPKIN Halloween 2016 Barry Wise Borrowed and enhanced code from: http://www.instructables.com/id/Realistic-Fire-Effect-with-Arduino-and-LEDs Made ATTINY85 shield for Arduino like this: https://www.youtube.com/watch?v=9LjfkjwMqXI How to use Arduino as ISP for programming via said shield: http://www.kobakant.at/DIY/?p=3742 */ 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); delay(random(200)); digitalWrite(ledPin3, LOW); }
Arduino, ATTiny85, circuit, code, diagram, Featured, Halloween, Jack O Lantern, maker, pumpkin, schematic