About two weeks before Valentine’s Day, I got the idea of making a Zelda-themed card for a friend of mine. She and I are both big Zelda fans. I searched the web for a card, until I found this one that I liked because of the extra dimensions. It seems that the pop-up style heart container card is a pretty popular one overall, and this is one of many.

I decided to take it another step, incorporating some of my (few) electronics skills into the project. To be honest, it was mostly an excuse to order some parts off of Digikey and super-nerdify what would otherwise be a fairly straightforward project. But hey! It was extraordinarily fun. So did some research for recordable card circuits, and I found this Hackaday post about how to make one on my own. I’d been to Digikey’s website before, but I had never made an order. Consequently, I had no idea what I was in for. I decided to go through with the project, and ended up ordering all the parts about a week in advance. After a minor issue with shipping a lithium-ion battery through UPS and actually finding everything, I got the parts on the Thursday night before Valentine’s Day. I had some debugging left to do, so it was a fairly long night. It was by all means worth it.

The card itself is a relatively simple papercraft model, with some space inside to fit components. I printed it on some cardstock and cut it using an exacto knife.

About the code

I had a bit of an educational experience working on the code. I’m familiar with Javascript and Python, and I’ve worked with Arduino before, but I’d never before really wrote new components. I used a modified version of the Arduino’s Melody example code. Initially, I tuned the values with a tuning application (Instuner on the App Store) for the piezo buzzer, and added flat/sharp notes, as well as some notes an octave up I’d need to play the bit of music. The code, more or less the same but with tuned values, is on GitHub. I then manually wrote transcribed the notes from some sheet music of the specific tune into the code, resulting in this.

Hardware and writing the code to the ATtiny

The electronics components were a bit trickier. I ordered about $5 in parts (parts list) along with some spare ATtinies for future projects. Initially, I thought that I would use a piezo buzzer and reed switch in the circuit, but in the end I opted for a speaker I had on hand (16ohm, 0.5w, salvaged from a similar, pre-recorded greeting card with a ROM) and a regular (SPST) switch (salvaged from the inside of a vending machine). Here’s a photo of the (poorly drawn) circuit diagram: circuit diagram Here’re some of the parts: parts

I connected pins 0 and 1 on the ATtiny to the speaker and switch, respectively. After soldering everything in place, I decided that the reed switch was too difficult to align, so I swapped it for the SPST. I wrote the final version of the code to the ATtiny (or so I thought), connected the battery, and everything looked like it was good to go.

Suddenly, an eerie croaking noise came out of the speaker, audibly changing tones but doing so very slowly. As it was already about midnight at that, I panicked. I guessed the issue was the clock rate on the chip — I tested the code on the Arduino, which boasts a 20MHz crystal (which actually runs at 16MHz most of the time), as opposed to the ATtiny, which has a paltry 1MHz. A quick google search found a Stack Exchange post that told me that I should multiply all values by a factor of sixteen, which worked splendidly. The notes were out of tune, and the croaking sounds remained, but it wasn’t nearly as bad as before. The final code is also on GitHub.

Using the Arduino as an ISP (to program the ATtiny)

programming In order to program the ATtiny, I used the Arduino. I followed the guide at highlowtech.org and it worked, if not with a few hiccups. Initially, I was pushing the ATtiny and a socket down into the breadboard, before I realized that the ATTiny could be pushed directly into it.

Final Product

I have to thank two friends of mine, who provided awesome help throughout this project. Both who work in the tech industry. If you’re a high school student, you should definitely try to communicate with professionals who work in positions you’d like to have. If you’re a professional, you should be open to helping kids pursue their interests. The relationships I’ve developed have been extremely beneficial.


Hilarious Side Note

Listening to serial communication is the coolest thing ever. It sounds a bit like a dial-up modem.