Musical Card (ATtiny85)




About: To learn is to live!

Intro: Musical Card (ATtiny85)

One of my team was leaving and I thought what better way to wish her all the best than with a singing card.


  • Passive piezo buzzer
  • ATtiny85
  • Lithium Button Cell Battery (CR2450)
  • Momentary button (type commonly used with an Arduino)
  • 10uF Capcitor (used when programming the ATtiny85)


  • Glue (PVA & Craft glue)
  • 4mm Plywood
  • Card (A5)
  • Paper (A4)
  • Solder
  • Varnish


  • Arduino
  • Soldering Iron
  • Wire cutters/strippers
  • CO2 Laser cutter
  • CNC Machine


Step 1: Preparing the Music

Create or download the MIDI file of your choice. I wanted auld lang syne and so I downloaded an existing MIDI file from the web. I then used MuseScore to edit the file, removing surplice notes and lyrics. In editing the notes, I removed Staff 2 so that there was only Staff 1 and wherever there were double notes (or more) I left just the highest one. Once complete I used save as to save the edited file back as a MIDI file.

I then visited https:/, followed the onscreen instructions, uploaded the MIDI file and converted the MIDI file to Arduino code.

Step 2: Programming the ATtiny85

Before the Arduino can be used to program the ATtiny, it needs to be set up as a programmer. To do this, Open Arduino IDE and load the ArduinoISP file found in the examples (File -> Examples -> ArduinoISP). Once loaded, upload it to the Arduino

Connect the Arduino to the ATtiny85 as follows:

ATtiny ----- Arduino

  • Pin PB2 (SCK) ----- Pin 13
  • Pin PB1 (MISO) ----- Pin 12
  • Pin PB0 (MOSI) ----- Pin 11
  • Pin PB5 (Reset) ----- Pin 10
  • Plus (VCC) ----- +5V
  • Minus (GND) ----- GND
  • 10uF Capcitor: Across Arduino pins: RESET ----||---- GND (note -ve capacitor pin goes to ground)

As I will want to make more of these cards, I decided to build a shield as found in

You now need to install the ATTiny code. Initially I installed a depreciated library without realising it which caused me days of pain. Go to File -> Preferences and copy the following URL to Additional Boards Manager URLs:

Then go to Sketch -> Include Library -> Manager Libraries and install the ATTiny library.

Once complete set the Tools settings as shown in the image i.e.

  • Board: ATtiny25/45/85
  • Clock: "8MHz (internal)
  • Confirm the correct port
  • Programmer: "Arduino as ISP" (NB NOT ArduinoISP)

With the ATtiny connected, choose Burn Bootloader (under the tools menu). This will set the clock to 8MHz.

Load the Arduino MIDI code, ensuring the the tonePin is set to the correct pin. In my case this was 1.

Step 3: Testing the Code

Connect the ATtiny85 as per the diagram. You should now hear Auld Lang Syne being played in a repeated loop.

Step 4: Creating the Card

Using the attached SVG files, the card was cut and etched, as was the plywood. The desired images and fonts where downloaded from the web, with InkScape being used to manipulate them and put it all together.

Step 5: Embedding the Electronics

Using FreeCAD I created the tracks where I wanted my components and wires to lie. This was the exported to a STL file and then cut out using a CNC machine.

In the end some sections were too tight and so I needed to use a chisel to make the spaces bigger. Unfortunately in doing so I penetrated the surface of the plywood is some places. Fortunately I was able to camouflage these holes but it was disappointing.

I forgot to photograph the final component placements and so I have simply illustrated them here. It was really challenging soldering the wires directly to the battery and so next time I will see if I can find a compact battery holder or do more research to see if there is an easier way to do this.

Originally I wanted to create a switch that would trigger the music whenever the card was open but I run out of time to work on this. I therefore resorted to a momentary button that doesn't quiet protrude through the plywood. The reader can then push the button while reading the card in order to play the music. I have found some small N/O & N/C reed switches that look perfect for this sort of thing and so next time I will trigger the music automatically using these switches with a small magnet (or should I say, "I will give it a try").

Step 6: Putting It All to Gether

In order to hold the components and wire in place I used a quick-setting gel glue (can't remember the name or type). To attach the plywood and construct the envelope, I used PVA glue.

I also cut the attatched envelop out using the lasercutter.

All in all I enjoyed doing this project. The electronics are simple and easy to build meaning that going forward I can create more interesting cards for the grandkids :)

Step 7: Final Comments

So with so many people pushing the button when signing the card, the battery went flat before we could give it to the recpient. I therefore had to cut a whole in the back, replace the battery and then cover the hole with a round sticker; not ideal but it worked. I did not resolder the battery but simply used the sticker to hold everything in place so that contact with the batter was maintained. This did not work too well, resulting in it being necessary for the reader to apply pressure to the back of the card when pushing the button. This said, the given layout made the process really easy.

Going foward I will see it I can build a slimline battery holder or change the way the battery is held in the card in order to make replacement easier.



    • Audio Contest 2018

      Audio Contest 2018
    • Halloween Contest 2018

      Halloween Contest 2018
    • Side Dishes Challenge

      Side Dishes Challenge



    16 days ago on Step 7

    What a great idea and realized very well under heavy time pressure. Excellent!