Introduction: LED Christmas Cards Using PIC 10F200

This is an instructable on how to build an LED Christmas card using the PIC 10F200 microcontroller.

As this PIC has six pins and is the size of an SMD transistor, it is ideal for low profile applications and can easily be reprogrammed as and when needed.

In this case I am using the "reverse polarised LED" trick to get six LED's working from three I/O lines, as detailed in Microchip's "Application Notes".

Runs on two 3V cells, as the PIC's maximum voltage is around 7V this is acceptable and the cells last a lot longer this way.

can be used with any of the 10F20x series but you may need to modify the code slightly.

Have fun, -Andre

Step 1: Program the PIC(s)

I've used the K182 programmer here, in order to make prototyping easier I soldered a 10F200 to a carrier PCB (cut down from inside an old Sony battery pack) and then soldered wires to this.

Note that this PIC requires ICSP, which means if your programmer doesen't support this then you will need to find one that does. External 5V is needed, here it is provided from a 9V battery and 7805 regulator.

Step 2: Wire Up the PICs

Having programmed the PICs, you will now need to connect them to the wires. I used the individual strands from some cable for this (about 30ga), and first tinned the PIC's leads, then soldered a wire to each pin. A pair of tweezers with a locking function is very useful for this, as you can hold the PIC securely while soldering.

Its also possible to program the PICs once they are soldered in this way.

You will need a prototyping board and some component leads for this step, wind the wire(s) round the component leads and connect to the correct leads on the programmer.

Step 3: Test the PICs Before Installation

Its a good idea to test the PICs before installation, I've used the prototyping board for this.

Wind wires round component leads, and then plug in as normal. If required the solder can be reworked prior to installation if needed.

Especially important if you are glueing the PICs in place as otherwise you will have a hell of a job correcting your mistakes :)

Step 4: Wire Up the LED's

I used SMD white LED's here, with the light emitting side facing the paper. The effect has to be seen to be believed, it looks like the paper itself is glowing (!). To make wiring easier I wired them as pairs, with a clockwise arrangement.

Three wires are needed to the PIC, one to each GPIO line. MCLR isn't used here but it can be if you want the card to be dark activated. A simple phototransistor works well here but so will a red LED if you have one, connect between MCLR and Gnd, and 1M resistor from MCLR to Vdd.

PIC and LED's are glued to the card with epoxy, but any non conductive glue will work; I avoid Superglue as it mucks up the glow effect.

Step 5: Battery Wiring/paper Shielding

To prevent damage and ugly exposed wiring, I've taped a piece of paper over the guts. As you can see the LED's are bright enough to shine right through the paper, even on 3V.

In the unlikely event of an LED failure its probably better to cut the leads flush and glue another one in place next to it, or you will rip a hole in the card :(

I recommend using CR2016's but any 3V coin cell will work. To connect them use a drop of epoxy to secure the lead and drop some silver paint on each contact point, or use one of those mini battery holders from a broken PC motherboard.

Soldering batteries is *NOT* recommended (Kaboom!!) .. so please don't.

Step 6: Final Thoughts: Its Over

As you can see the finished card is most impressive. The LED's used can be any colour as long as they are matched pairs (i.e. green/blue/etc) or you will get brightness variations.

I've provided the source code under the GPL, but if you find it useful and wish to contribute to my components fund then please send Paypal payment of £3 to

Have fun and merry Christmas!


source code starts here...

LIST P=10f200

;LED fader/flicker routine v0.01
;Written by Andre de Guerin ""
;W register is 0x00
;f register is 0x01
;GPIO 0 to 2 are outputs
;Note that ICSP requires external Vcc, and assumes no load on ICSPCLK/DAT pins
;Note that W register context status needs to be preserved, am using 0x1F for this
;Note that i am now using a different output routine to get 6 outputs using 3 io pins
;this code is published free under the GPL licence, however if you like it and wish to
;contribute to the author's electronic components fund please send Paypal payment of £3 :)
;Originally written as proof of concept for the 10F20x series
;Thanks again to Quasar Electronics for their K182 programmer and MicroBrn, and
;their extremely helpful technical support staff.
;Circuit layout:- Pairs of LED's with inverse polarity between each combination of outputs
;Can reduce the number of interconnects by wiring the LED's in series pairs
;i.e. ---0-AK-0-AK-0-AK----to start, where 0's are GPIO lines.

GPIO EQU H'0006' ;define GPIO
TMR0 EQU H'0001' ;define TMR0
OSCCAL EQU H'0005' ;defines OSCCAL

bcf OSCCAL,0 ;enables GPIO 0 *IMPORTANT*

clrwdt ;essential clearing of WDT prior to prescaler change
start movlw b'11000100' ;No Wake on pin change,
;No pull ups, ignore timer
;Enable 256:1 ratio on TMR0 prescaler

movlw b'11001000' ;all except GPIO 3 are outputs
tris GPIO

movlw b'00100100'
movwf 0x10
movlw b'10010010'
movwf 0x11 ;note, fewer registers on 10f200
movlw b'01001001'
movwf 0x12
movlw b'10010010'
movwf 0x13
movlw b'01001001'
movwf 0x14
movlw b'00100100'
movwf 0x15
movlw b'10010010'
movwf 0x16
movlw b'01001001'
movwf 0x17
movlw b'00100100' ;may have bug in register routine, but works atm
movwf 0x18
movlw b'00010001'
movwf 0x19
movlw b'10001000'
movwf 0x1A
movlw b'01000100' ;generates twinkle-like effect
movwf 0x1B
movlw b'00100100'
movwf 0x1C
movlw b'10010010'
movwf 0x1D
movlw b'01001001'
movwf 0x1E

movlw b'11001000' ;all except GPIO 3 are outputs
tris GPIO
goto loop ;unconditional jump to loop

loop btfss TMR0,7 ;sets up outputs so only changes state on tmr0 timeout (11111100)
goto loop ;effectively uses TMR0 as a long delay loop
btfss TMR0,6
goto loop
btfsc TMR0,5
goto shift

shift movlw b'00000000' ;resets TMR0 initial value
movwf TMR0

rlf 0x10,f ;Perform shift, even though one register is redundant
rlf 0x11,f
rlf 0x12,f ;uses all available registers as delay line
rlf 0x13,f
rlf 0x14,f
rlf 0x15,f ;useable registers are 0x10 to 0x1E ONLY
rlf 0x16,f
rlf 0x17,f
rlf 0x18,f
rlf 0x19,f
rlf 0x1A,f
rlf 0x1B,f
rlf 0x1C,f
rlf 0x1D,f
rlf 0x1E,f

movlw b'11001000'

btfsc 0x10,3 ;output routine
bsf 0x00,0 ;enables GPIO bit 0

btfsc 0x12,3
bsf 0x00,1 ;enables GPIO bit 1

btfsc 0x14,3
bsf 0x00,2 ;enables GPIO bit 2

tris GPIO ;moves current state of W to GPIO

btfsc 0x10,7
bsf GPIO,0
btfss 0x10,7 ;tests 0x10 bit 7
bcf GPIO,0 ;clears GPIO if 0x10 bit 7 clear
btfsc 0x15,7
bsf GPIO,1
btfss 0x15,7
bcf GPIO,1 ;this is done due to dual outputs
btfsc 0x1A,2
bsf GPIO,2
btfss 0x1A,2
bcf GPIO,2 ;detaches TRIS from GPIO state so effectively 3 "outputs"

reg bsf 0x1F,7 ;Sets 1E bit 8 to F
btfss 0x10,0 ;Tests to see if 0x10 bit 0 is 0
bcf 0x1F,7 ;Clears 1E bit 8 if not

goto loop


hex code starts here:-