This is a simple project, called LED candle. I will be using yellow LED’s of 2 and a simple PWM code that runs on AVR (ATmega328p) chip make’s the LED flickering that almost looks like candle. 😛 for candle I will be using LED’s+translucent paper.

circuit:
code is very straight , Simple PWM code runs on ATmega48/328p
#define F_CPU 1000000UL #include avr/io.h #include util/delay.h #include avr/interrupt.h void timer1_init(void); void timer1_init() { DDRB |= 1<<PINB1; // DDRB |= 1<<PINB2; TCCR1A |= 1<<COM1A1 | 1<<WGM11; // TCCR1A |= 1<<COM1B1; TCCR1B |= 1<<WGM12 | 1<<WGM13 | 1<<CS10; // ICR1 = 49; //top value } int main(void) { timer1_init(); _delay_ms(1000); while(1) { OCR1B = rand() % 47 + 1; OCR1A = rand() % 47 + 1; } }
video: