Christmas lights
This is a project to have some nice lights on the door at christmas time. It uses battery power, it's hard to fit a wire onto the door. A PIC12F675 is used to create av PWM and act as a dark activated switch. The schematic: The Leds used are 6 warm-whites with 120 degress angle from Molelectric ( http://www.molectric.com/product_info.php?cPath=22_50&products_id=382 . The power source is 3 GP2500 NiMH batteries, last year the leds lit for 31 days. The code for the PIC is written in mikroC: /*Led PWM PHermansson 2006 For mikroC compiler for PIC, www.mikroelektronika.co.yu */ char counter; void interrupt(){ counter ++; // increment counter TMR0 = 254; INTCON = 0x20; // set T0IE, clear T0IF . h20=100000 } void main() { OPTION_REG = 0x84; // TMR0 prescaler TRISIO = 0b00010000; //GP4 in, GP5 out. GPIO = 0xFF; // initialize gpio counter = 0; // set counter TMR0 = 254; // set timer0 INTCON = 0xA0; //TMRO interrupt enabled 80=10000000-> T0IE off ANSEL=0; do{ // Loop if (counter > 200) // Counts from 0 to 255 and then flips to 0 // Counter > x sets pwm period, lower value = brighter led. { if ( GPIO.GPIO4 == 1 ) { GPIO.GPIO5 = 1; } else { GPIO.GPIO5 = 0; } } else { GPIO.GPIO5 = 0; } } while(1); } Some more info (in swedish) Lifetime: 2006 - 31 days 2007 - (With modified LDR circuit, same batteries). Started 2007-12-13, ending ?