Fall. So it’s that time of the year.  It’s cold and foggy in the northern hemisphere; the skies are all grey and cloudy, the days kind of dull; and all of the staff of bitStream is pinned down under the weight of our fast-approaching endsems, and bitStream has hit a some three-week slowdown. You see, electronic engineering isn’t nearly all that fun when it comes to exams and textbooks. Depressing stuff

And yet, it’s that time of the year – the earth is nearing the completion of the 2016th revolution of the sun since the birth of Jesus, and the entire world’s gearing up for the festivities ahead, with a plethora of festivals and holidays and relatives and family time – you get the drift – lined up. One common thing across festivals and other such special occasions would be the fun. The second would be greeting cards. We all, like it or not, send greeting cards to our near-and-dear ones on several occasions.

When we were little, we used to make these clumsy, fussy, but nonetheless, adorable greeting cards with what little resources we had at hand, crayons, colour-pencils, ruled sheets from our four-ruled ‘hand-writing’ notebooks, with funny caricatures, cute, misspelled messages, kindergarten innocence.  As we grew up, plagued with the shortage of time, the busy individuals that we turned out to be, we skipped all the way to the end to ready- made greeting cards, and earned Archies and Hallmark a fortune; or perhaps got so polished with our skills that our computer-printed greeting cards using word-processing and imaging programs that we nearly outdid the ready-made greeting cards. Yet seldom do the faces of the recipients light-up as they do when they receive these the clumsy, fussy old greetings, than when they’re presented with store bought cards. There lies some kind of charm in fussy DIY craft, when it comes to greeting cards.

Alright,  that’s enough of fanciful writing. The points behind this some close-to-300-word long intro I just typed in are that one, provide an explanation as to why the posts on bitStream have been coming on so painfully slow off late, and two, that we’re going to tell you how to make a DIY musical greeting card.

Okay, so before we get started, thanks go out to our friends at jarv.org, who came up with this DIY, as well as allowed us to re-post this up here on bitStream; and Lifehacker, where I originally found the link to this article.

Also, all the images,  the code, and the video included in this post, is/are courtesy of jarv.org. Check them out for some other cool DIYs and tutorials involving AVRs and Linux.

Alright,  sodown to the main thing. For this, we’re going to need to following hard and soft resources:

  • Attiny85 – Thru-hole, no frills AVR running at 8MHz
  • Piezzo speaker(s) (x2, in this DIY)
  • Battery holder – Plastic, through hole
  • Coin cell battery
  • Soldering iron, wires, the rest of the usual electronic DIY tools
  • A greeting card, which I shall not tell how to make

Reading this could provide you with some vital background knowledge, about how to put the codes, scripts and libraries to use.

Okay, chop-chop, time to work. The assembling part is incredibly easy, just connect the red wires of the speakers to port 1 and 2 of the Attiny85,  connect the positive terminal of the battery to VCC, ground everything else. Here’s a pin-diagram of the Attiny85 and the assembled circuitry for reference:

Note: After the software part is done, I suggest you place this circuit between two thick cards pasted together. Make a hole on the card that has the message, and right underneath the hole, place a photo-electronic device connected to act as a switch, so the card would automatically play every time somebody opened it.

Okay, now to get to the software part. First, get a MIDI sequence that works for upto a couple of parts. Next, load it into MuseScore, and clean up the chords, so that it doesn’t come up too heavy on the cheap set of speakers we’re using. If you understand musical notations, then make changes as you fancy,  otherwise just leave it that way, and save it as an XML.

Next, use the xml2h.py script to covert it into a header file for the PlayTune library. You should be seeing something that looks like this:

Finally, use this code. Bear in mind, gotafriend.h is the name of the header file generated for the song used in this DIY, in your case, use your own generated header file in your program.

Load the code onto your Attiny85, and you’re good to go.

Here’s a video of the assembled circuit playing ‘You’ve Got a Friend in Me’:

Now, as I mentioned in a note above, use a photo-electronic device as a switch instead of the paper switch, place it under a hole on the side of the message (which is ‘closed’ when the greeting card is ‘closed’). Affix the circuitry on the backside of the card, then conceal the circuitry by pasting a thick card on the back-side, making it the back-cover.

So there’s a DIY musical greeting card you’ve got yourself. There’s one catch in the level of personalization you can give it, and that is, you cannot add spoken messages or audio to this. This is because this is made to custom suit MIDI files, which are basically a representation of music notes, rather than audio. However, if you’re anything of a composer, you can compose your own piece, maybe for that special someone, load it up on the tiny micrcontroller, and there you have super-personal, super-awesome musical greeting card. Nonetheless, if you aren’t much of a Beethoven or a Bach yourself, then I believe we’ve got a workbench in the works that plays an audio message of your choice, so if that’s what you’re looking for, then just hang on for a little, we should be coming up with that some time real soon.

Anyway, back to the context of clumsy DIY cards and musical cards: many people find musical greeting cards annoying, but pre-tweens or (post-)sexagenarians might receive it with a twinkle in their eyes. Also, your relatives from semi-urban/rural locales or those not living on the same edge of technology as you do, might really like it. Either way, no matter who they are, they’ll like it (secretly perhaps), because it’s you who’s made it, with your personalization behind it. So if you make one, no matter whether they liked it, or it pissed the hell out of them, share with us in the comments below!

Advertisements