Skip to main content
What's the perfect gift for the special someone that puts up with a soldering iron in the kitchen and little bits of wire underfoot? How about this touch activated, pulsating LED heart? This geeky Valentine's Day card pays homage to the musical greeting cards that are popular this time of year. This isn't just for Valentine's Day -- it's a simple heart, so give it to your loved one any time of the year. You can also make your own shapes using the same basic circuit.

A microcontroller pulses the LED heart for a few seconds when the touch switch is activated. After the fade routine, the microcontroller enters a power saving sleep mode. The card runs from a single button cell battery. A battery should last a long time because little power is consumed in the sleep state.

Touch activated LED valentine(click thumbnails to view gallery)

Front of the LED valentine, lit.LED valentine, lit in the dark.Back of the LED valentine.Front of the LED valentine, off.Rendering of the LED valentine.

All the files you need to make your own LED valentine are included in the project archive. Download it here.


An old, cheap (~$2) PIC 16F684 serves as the brain of the card. It will run perfectly from a 3-volt button cell battery, or any 2-6 volt supply. I would have preferred to use the 8 pin 12F629 (~$1). For a one-off project like this, though, the 14 pin PIC is fine. Some will correctly suggest that a PIC is overkill for this project -- it's better done with a 555 IC, and a handful of resistors, capacitors, transistors, and gumption. Possibly true, but it was faster and easier to use a PIC.

The PIC has an internal crystal oscillator. We'll run it at 500kHz to save a bit of power. It doesn't help too much -- the LEDs are the real gas guzzlers here. At full speed, the PIC uses less power than a single LED.

We need to decouple the single pair of supply pins with a 0.1uf capacitor, and add a resistor and diode for the programming header. Look for more about programming in my next post.

The LEDs are dimmed using a hardware pulse-width modulator (PWM) on the PIC (PORT C, pin 5). The PWM isn't strong enough to directly power all the LEDs; instead, it switches the ground of the LEDs through a transistor. This is the same method used in the RGB color changer and the analog gauge projects.

I used 14 red surface mount LEDs (0806) to outline the heart. My LEDs have a 2.0 forward voltage, and the circuit runs at 3 volts, so a 100 ohm resistor puts about 15 ma of current through the LEDs. Calculate your own resistor using a website like this.

Tiny surface mount transistors switch more than a PIC pin, but not by a lot -- usually about 100ma. One transistor will switch about 5 LEDs with a small safety margin. The card's 14 LEDs are arranged in two groups of 5 and one group of 4.

A touch-sensitive pad triggers the beating heart. The PIC is usually in sleep mode, but a signal from the touch switch circuit will wake it. The switch is based on a simple PNP transistor design that uses almost no power when it's idol. The "switch" part of the transistor is brought out to a pad on the PCB. A tiny charge travels over the skin and into the surrounding ground plain when the pad is touched. The transistor amplifies this and puts a bunch of current on the PIC pin, waking it from sleep mode. One resistor (R1) on the touch pad protects the transistor (Q1) from accidental short-circuits. Another resistor (R2) shunts any transistor leakage to ground, preventing false triggers.

A full sized circuit diagram ".PNG" is included in the project archive.

Touch activated LED valentine, circuit.(click thumbnails to view gallery)

LED valentine circuitDriving LEDs with a microcontrollerBasic touch circuit schematic

Circuit Board
The circuit board is designed with Cadsoft Eagle, you can download a freeware version. The large heart is a restricted area in Eagle, but 'Touch Here' was added to the PDF version -- something to remember if you export your own board. All parts are surface mount, except the battery holder and the programming header. This worked fine -- its better to have the battery on the back. Don't forget the three jumper wires.

Part list -- Part / Type (size)

See a full-sized placement image in the gallery and project archive.

C5 / 0.1uf (0805)

D1 / 1n4148 (SOT-23) *I used BAS16 85V/200ma

R1,3,9 / 1k (1206)
R2 / 10k (1206)
R4,6-8,10-24 / 100R (1206)
R5,13 / 100k (1206)

Q1 / PNP (SOT-23) *I used BCW89
T1,2,4 / NPN (SOT-23) *I used BCW60D 32V/100ma

BAT1 / 2032 battery holder (through hole)
IC1 / PIC16F684 (SO-14-150)
ICSP / strip of 5, 0.1" spaced, right angle, pin headers
LED / 14 SMD LEDS (0805)

Touch activated LED valentine, PCB(click thumbnails to view gallery)

LED valentine, part placement.LED valentine part placement, no values.LED valentine, blank PCB.Rendering of the LED valentine.

This simple project is compiled using mikroBasic. You can download a 2k limited demo for free. The source code, and a compiled .hex file, are included in the project archive. This is a simple project, so working in Basic might help some absolute beginners.

See how I program the PIC, and build your own programmer, in my PIC programming tutorial.

The software is very rudimentary, less than 100 lines. It works like this:
  1. An interrupt is generated by the touch switch connected to port A, pin 2, that wakes the PIC from sleep mode.
  2. The PIC fades the heart a few times using the hardware pulse-width modulator on port C pin 5.
  3. After a few seconds, the PIC returns to sleep mode and waits for another switch interrupt.

The 16F684 can be swapped for your favorite microcontroller. It must have at least two IO pins: preferably one with a hardware PWM, and one with a "wake from sleep on interrupt" feature. I mentioned the cheap PIC 12F629 earlier. Low pin-count ATMEL AVRs and TI MSP430 chips are also available for under a buck. Even I think a 16-bit MSP430 Valentine's Day card is overkill, but how can you beat the price?

This was a fun first version, but I'd make a ton of changes in a new design. The LEDs are really bright at 15ma, larger-value resistors would cut their intensity while also saving power. I'd convert the resistors to 0805 size if Iordered new parts for this project. The programming header is ugly – an edge connector or programming pads would be much more attractive.

A touch-activated, pulsating LED heart isn't just for Valentine's Day - you can give it to your special someone any time of the year!

Happy Valentine's Day from DIY Life.


New to electronics? Here are some introductory tutorials to help you get started.

Eagle CAD tutorials
Draw Circuits with Eagle
Turn your Eagle Schematic into a PCB
Eagle Design Rules
Create a Custom Parts Library

Make circuit boards
Toner Transfer
Professionally, online

Soldering Tutorials
How to Solder
Sparkfun Soldering Basics

Microchip's PIC microcontroller
Microchip Website
PIC In-Circuit Serial Programming
The original JDM2 Programmer
Business Card PIC Programmer
USB PIC Programmer

  • dr.ptasiek

    What is wron pic not found :(

  • dr.ptasiek

    Data is Clock and Clock is Data ;p

  • Sarah

    How much would such a project cost???

  • dr.ptasiek

    Less than 25 UDS

  • fizekul

    I really need your help. I've been following these instructions to a tee and I connected the JDM programmer you described in the other tutorial to my card and the computer. I've tried many different programmers: Winpic800, Winpic, PICPgm; I can get them all the recognize the JDM but none of them could see the PIC. What's going on? Could I have a bad PIC?

  • tomato

    I got the same problem as fizekul.
    I wanted to surprisse my boyfriend and make for his 30th birthday above. I have done pic programmer (works fine) and valentines pcb but when I'm trying to program pic on valentines board it doesn't allow me. But I think it's sth within code as when I'm trying to erase device or program it with default setting for PIC16F684 it works fine. Could anyone help me please?

  • Lynn

    Does anyone know where I can have a piece of LED jewelry fixed? This isn't a plastic "flashing" pin from a place like Blinkies. It's a piece of jewlry in square pin form with a picture of changing hearts in the middle. The red outlined hearts change in size and shape on a black background.
    I purchased it over fifteen years ago and wear it on my lab coat. The kids love it! Recently, it just stopped "beating". I put in a fresh battery, but nothing.
    It was made by Chrysalid ID Group, Inc from Santa Cruz CA. Now, long gone. : (
    Thanks for any help!

  • Lynn

    A piece of jewelry like that could be really difficult to fix, especially if it is very small, and especially if you cannot trace the wire connections with your eye. If the heart displays are very complex, it is probably driven by a small microntroller which could have lost a piece of its flash memory, thus giving you the problem that you are having. Unless all the parts are huge and accessible and you don't mind having a new microcontroller scluged on in place of the old with a few extra wires, then you're probably out of luck in fixing it.

  • 8 Comments / 1 Pages

Add Your Comments

  • New Users
  • Returning

If you are posting a comment for the first time, please enter your name and email address in the fields above. Your name will be displayed with your comment. Your email address will never be displayed.

Add Your Comment

Please keep your comments relevant to this blog entry. Email addresses are never displayed, but they are required to confirm your comments.

When you enter your name and email address, you'll be sent a link to confirm your comment, and a password. To leave another comment, just use that password.

To create a live link, simply type the URL (including http://) or email address and we will make it a live link for you. You can put up to 3 URLs in your comments. Line breaks and paragraphs are automatically converted — no need to use <p> or <br /> tags.


Follow Us

  • No features currently available.

  • More Hot Topics The Daily Fix  •  DIY Warrior  •  Home Ec  •  Handmade
    DIY Disaster Doctor  •  In the Workshop  •  Product Picks

    Home Improvement Videos