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.
All the files you need to make your own LED valentine are included in the project archive. Download it here.
Hardware
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.
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.
Capacitors
C5 / 0.1uf (0805)
Diodes
D1 / 1n4148 (SOT-23) *I used BAS16 85V/200ma
Firmware
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.
The software is very rudimentary, less than 100 lines. It works like this:
An interrupt is generated by the touch switch connected to port A, pin 2, that wakes the PIC from sleep mode.
The PIC fades the heart a few times using the hardware pulse-width modulator on port C pin 5.
After a few seconds, the PIC returns to sleep mode and waits for another switch interrupt.
Conclusion
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.
Links New to electronics? Here are some introductory tutorials to help you get started.
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?
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?
Hi, 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.
Reader comments (Page 1 of 1)
What is wron pic not found :(
ReplyData is Clock and Clock is Data ;p
ReplyHow much would such a project cost???
ReplyLess than 25 UDS
ReplyI 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?
ReplyI 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?
Hi,
ReplyDoes 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.