Introduction: Animated Heart

Just in time for Valentine’s day, a small gadget to be given to your sweetheart: a heart that loops through multiple animations. It nicely fits on a desk or table to have your loved one remember you!

This animated heart is very compact and simple: just switch it on and the 12 LEDs that form a heart will cycle through a loop of animations that you can fully customize.

It runs off a coincell and is based on a very common and cheap microcontroller, the 8-pin ATTINY13, which can be conveniently programmed with an Arduino Uno. Through the special technique of charlieplexing, 12 LEDs can be individually controlled with only 4 output pins.

Step 1: Materials and Tools:


  • 12 5mm red LEDs
  • A 3x7cm prototype board (10x24 holes, the thick green double-sided is the best)
  • An Attiny13A microcontroller
  • An 8-pin DIP socket
  • A mini-switch
  • A coin cell holder
  • A CR2032 coin cell
  • 20cm of coloured multi-stranded hookup wire
  • 15cm of thick solid-core wire


  • An Arduino Uno to program the ATTINY
  • A soldering iron
  • A wire clipper

Step 2: Build the Heart

The 12 LEDs are inserted in a prototype board in a heart-shaped arrangement, as shown in the diagram. Pay attention to the polarity: 6 LEDs have the anode right and the cathode left, 6 LEDs are inserted in the opposite way. Cover the LEDs with cellotape to prevent them from falling out while we work on the back side.

The leads of the LEDs are to be connected in an intricate pattern. Bend the pins and cut them off following the diagram. Beware that the diagram shows the front side, while we’re working on the back side, so it should look as the mirror-image of the diagram, as shown in the picture. The leads can now be soldered together and the cellotape removed.

Test that it works: the heart has four electrical connections indicated as blue, green, yellow and white in the diagram. Connect ground to one connection and +5V in series with a 1kOhm resistor to another. 1 LED should light up, and all 12 LEDs should be able to be lit up this way.

Step 3: Run the Heart From an Arduino.

Upload the attached sketch to an Arduino UNO or Nano and attach pins D8-D11 to the 4 electrical connections of the heart: D8 to blue, D9 to green, D10 to yellow and D11 to white. The heart should show an animation that lasts about 1 minute.

The code can be customized to change the speed or change the animation. The array ‘patt’ contains the animation pattern. Two bytes of each step indicate which LED lights are on in each step. The LED’s are numbered 0-11 starting from the bottom and running counterclockwise all around. LED0 corresponds to bit 0, LED1 to bit 1 etc.

The pattern array is stored in program memory, which is allows for a much richer animation than if they were stored in RAM. The present sketch has 168 steps. For the Arduino, there is space for thousands more, and even for the ATTINY13, which has only 1kByte of program memory, there is space for approximately 400 steps.

The speed of the animation is determined by ‘steptime’ defined on line 196. To speed up the animation, make this number smaller. Beware that on the ATTINY, the animation will run somewhat slower because we will run it at a lower clock speed.

Step 4: Moving to the ATTINY

The code is small enough to fit on a very convenient small 8-pin microcontroller, the ATTINY13A. The sketch from the previous step will work without any modification on the ATTINY.

  • There are dedicated instructables how to program the ATTINY13A. A brief summary is below:
  • Starting up the Arduino IDE, open 'Preferences' then add for additional board managers.

  • Under 'Tools/Board', select 'Board Manager' and at the bottom of the list, install 'MicroCore by MCUdude'
  • Connect the Arduino Uno and upload 'ArduinoISP'. It is available under 'File/examples'
  • Connect the Arduino to the ATtiny, easiest done by putting the ATtiny on a prototype shield: Arduino pin 13 - ATtiny pin 7 Arduino pin 12 - ATtiny pin 6 Arduino pin 11 - ATtiny pin 5 Arduino pin 10 - ATtiny pin 1 Arduino +5v - ATtiny pin 8 Arduino GND - ATtiny pin 4
  • Choose 'Board ATtiny13', 'B.O.D 2.7V', 'Clock 1.2 MHz internal' and programmer 'Arduino as ISP' (attention: not 'ArduinoISP' but 'Arduino as ISP' )
  • Do ‘Burn Bootloader’ - there is no bootloader for the attiny, and it may give an error, but this step is needed to ‘set the fuses’ to the correct clock setting Upload the sketch.

Test if it works: connect the blue, green, yellow and white connections of the heart to PB0 (pin 5), PB1 (pin 6), PB2 (pin 7) and PB3 (pin 2), respectively. The heart should animate in the same way as with the Arduino, just a little bit slower. Check also that it works when the ATTINY is powered from a coincell.

Step 5: Finalizing the Project.

Now that you have the heart circuit and a programmed ATTINY, the project can be finished. Solder the IC socket, the coin cell holder and the on/off switch to the prototype board and complete the connections as shown in the diagram. Insert the ATTINY, the coincell and switch on to check that it works.

Finally, I added a stand to it make of ~15cm solid-core electrical wire. Strip off the isolation 2cm on both sides and bend it in the shape of a stand. The stripped off part can now be soldered to the pads of the prototype board.

All set to make an amazing Valentine’s gift!

Heart Contest

Runner Up in the
Heart Contest