Introduction: Musical Greeting Card

Picture of Musical Greeting Card

A small six pin processor is programmed with a melody to be played back through a piezo speaker. A lithium button cell provides the power and a leaf switch closes when the card is opened, turning the music on.

Step 1: The Circuit Diagram

Picture of The Circuit Diagram

The circuit is very simple and consists of just four components: the battery, microcontroller, piezo speaker and switch.

The switch (not shown in the diagram) is just two strips of metal pressed together, with a piece of paper in between. As the card is opened, the paper is pulled away and the two contact each other, thus closing the circuit.

A fragment of the code is shown, too. The program takes up 56 locations in memory. The PIC10F200 has 256 such locations available. A melody consisting of 200 notes or so can be fitted in to this chip.

This should be sufficient for a musical greeting card.

Step 2: The Chip

Picture of The Chip

The microcontroller is one of the smallest six pin PIC10F series manufactured by Microchip. This application does not need to use any of the advanced peripherals available and so any one of them can be used, provided the program is modified to switch off the unused sections and set the internal oscillator to 4 MHz.

For a really small card, the SOT23 package can be used. I have tested this with the small versions of the 10F200 and 10F206.

The figure shows a PIC10F206.

Step 3: The Board

Picture of The Board

Since the chip is so small, it is liable to get lost unless it is fixed to a larger board. I used a small piece of prototyping (vero) board with parallel strips for this purpose. Two breaks were made in two adjacent tracks.

Step 4: The Chip

Picture of The Chip

The two middle pins of the chip were bent up. This resulted in a chip with four pins down, and two pins up. The two 'aerial' pins are the supply and ground for the device.

Step 5: Soldering

Picture of Soldering

The four 'down' pins were soldered to the board.

Step 6: The Supply Leads

Picture of The Supply Leads

Two pieces of wire were used to connect the two middle leads to two outside tracks on the circuit board.

Step 7: Program the Melody

Picture of Program the Melody

The melody is in the form of a HEX file and will have to be programmed into the device. You can use any of the PIC programmers avalilable out there, they need five connections to be made to the chip, as shown.

The Hex file for the tune of "Go Tell it on the Mountain" is provided here.

Step 8: The Program

Picture of The Program

The figure shows the screenshot from the relevant portion of the program, showing the stored melody.

I have used a version of what I call the tonic sol-fa notation to write the notes. Old timers might remember: "Doe a deer, a female deer, Ray, a drop of golden sun ... "

However, it is not what musicians call notation or anything. It is just a convenient way of passing delay values to the routine which makes those music notes. The Assembly Language program is included. You can process it with MPLAB to produce the HEX file.

Change the dt lines to make it sing the tune of your choice.

If you can provide proof that you made it (put up pictures) I can write the program to make it sing the tune of your choice - ONE time. So hurry up.

Step 9: CPU V2

Picture of CPU V2

This picture shows the version of the circuit I cooked up for the purpose of testing the program. The PIC10F200 is soldered to six pins from a turned pin IC socket and thus it can easily be programmed and then plugged to the battery and buzzer for testing.

Step 10: Piezo Speaker

Picture of Piezo Speaker

A piezo diaphragm consists of a brass plate, usually round, which has a round piezo element cemented to it. One connection is the brass plate and the other is the silvered surface of the piezo element.

This, by itself, does not sound loud enough to be heard. Its volume can be boosted by coupling it to a resonant chamber.

Here, I have used the hub from a 3 1/2" floppy disk for the chamber. It has a rounded rectangular cutout which I plugged with a piece of circuit board, drilled to accept the two wires that connect to the piezo element.

The two are stuck together using superglue. The reulting resonant piezo speaker is quite loud, over the range of notes in which it is resonant.

Step 11: The Card

Picture of The Card

Feast your eyes on the unsullied whiteness of the card, before I start to spoil it. The card is ordinary thick white card stock, folded into two.

It has to be thick enough, and stiff enough, so that it does not lose shape when the electronics and battery gets attached to it.

Plan your layout on the card so that the circuitry does not hide the sentimental text you have printed on it.

It would be wise to do any artwork on the card forehand, because it would not go through any sort of printer after you have attached the electronics to it.

Step 12: The Switch

Picture of The Switch

This is an important component. It keeps the battery disconnected when the card is kept closed. When the card is opened to view the message, it closes, connecting the battery to the circuit.

Finally, and, quite importantly, when the victim has heard enough of the squeaky melody and wishes for some peace and quiet, closing the card should turn the &%£*&!! thing off again. Or they might have to resort to taking an axe to the thing, just to make it shut the heaven up.

It is made with two pieces of metal, touching each other.

A piece of plastic, (transparent in my version) pushes itself between the said two pieces when the card is closed.

You make it by sticking a stiff piece of plastic or card near the hinge of the card as shown in the figure. Mark its position when the card is closed and open, and then arrange for two metal wires or plates to touch each other in the area covered in between the open and closed positions.

Step 13: The Switch

Picture of The Switch

Here I have glued a copper plate from an old variable capacitor to be one plate of the switch. The transparent plastic piece which operates the switch has been guided through a paper sleeve so that it will reliably cut the music off every time.

Step 14: The Finished Switch

Picture of The Finished Switch

So this is how my switch looks when finished. That silvery piece is stainless steel, from a broken keyboard. The copper wire is pressed to it as it is impossible to solder to stainless steel.

Fashioning the switch is the most critical stage in making a musical card. If you would rather avoid all this work, it might be better to buy a musical greeting card and just replace the melody generator with one of your own.

Step 15: The PIC10F Six Pin Processor - V3

Picture of The PIC10F Six Pin Processor - V3

That figure shows version 3 of my attempts to wire up a microchip 10F2XX series processor. I have soldered wires directly to the pins of the processor, without a circuit board. This can be done, provided you use a magnifying glass when you do it, and you use a soldering iron with a tip as small as the joint you are trying to make.

Those wires are in a sort of colour code. Black is ground, or zero volt rail, that Microchip calls Vss. Red is positive, +5 volts, or the supply rail, that Microchip calls Vdd. Orange is the programming voltage, and the white and grey carry the Data and Clock for programming respectively.

The white wire is GP0, and the grey wire is GP1. The GP2 connection of the micro is not used, and so it is not soldered. GP1 and GP2 connect to the piezo buzzer after it has been programmed.

Since the PIC will be, in most cases, programmed once and then connected up into its circuit, I find that connecting it to the programming signals in this way is sufficiently quick. If you are trying to program it several times, for example when developing a melody, it might be better to solder it to a socket to accept the connections from your programming circuit.

Step 16: The Finished Card

Picture of The Finished Card

The picture shows my card, finished and playing back a squeaky version of "Go tell it on the Mountain". Anyway, it is recognizable as that tune, anyway. Anybody out there who knows better music than me is welcome to improve on this rendering.

When I was looking for a coin cell holder for the lithium cell I came across this set of three cells as part of an LED torch in a pen. Since three new cells will give around 4.5 Volts against the three volts available from a lithium coin cell this will be louder, when new, and so is adopted.

There should be a capacitor of about 0.1 microfarad across the supply terminals of the PIC. No difference was evident with new cells, but when I tried it with three rather 'tired' cells the music stopped and started stuttering half way through. So adding that capacitor will give you more playing time from the batteries.

Step 17: How It Works

Picture of How It Works

The program in the PIC10F2XX microcontroller has to do two things: it has to produce a musical note, and it has to change that musical note after a specific length of time.

It produces a musical note by exciting a piezo speaker with a square wave. One output is made high and the other is made low, for a certain time. After some time this state is reversed, the output that was low going high and the other going from high to low. The piezo element, connected between these two outputs, sees a square wave of twice the supply voltage across it and so produces a loud note, louder than that produced if a single output was used.

The musical notes are produced by varying the delay between toggling the pins. The table of delays is according to the data taken from Don Lancaster's website,, and reproduced here. He also provided the delay routine with a resolution down to a single instruction period. The frequency of the note is produced by a software delay, and the numbers to be fed to this counter form the table that forms the melody. A 'zero' denotes that the end of the music is reached, and that playing is to be resumed from the beginning. A 'one' denotes that a rest is needed, and a period of silence instead of a tone is produced.

The period for which each note is sounded is measured in terms of the timer tmr0. It is set to increment from the instruction clock with a prescaler of 256, the maximum possible. Five overflows of the timer register TMR0 make up one note length.

A copy of the most significant bit of the timer register is maintained in (flags,tmrh) and if the flag is high when the timer MSB is low a rollover is deemed to have taken place. This check is done within the loop framed within the label "forever" and the instruction "goto forever".

The next note to be fetched is kept in count1. The instruction "call table" returns with the note delay in W. It is ORed with zero to check for the end of the melody. Then it is checked for the value One to check for a rest. If neither, the value in W is passed to the delay routine.

The program flow in the note generation loop has been equalised to take the same number of cycles for all conditions, except for the time that tmr0 rolls over. This is audible as a sort of ticking in the background.

The provided Hex file has been tested with a 10F200 and a 10F202 and found to work. The source code has the necessary changes to be made in order to make it suitable for a 10F204 or 10F206. It has also been tested with a 10F206.

A 10F220 or 10F222 could be used, but will need additional instructions to turn off the peripherals that are not used, and the fuse settings will also need to be modified.

Have fun, and do write if you manage to get a music maker to work. The eight pin DIP versions of these micros are available, and they are easier to handle, and they will work as well in this circuit.


shazni (author)2016-07-20

Can voice recordings be done...say I want the words ' warning!' To be played repeatedly when switched on. Can it be done? Please help as I want to make something for instructables.

karthamay47 (author)2015-12-21

I would like to have a sound that is produced when a box is opened. I actually need to do the same sound for 30 boxes. I don't know how cost prohibitive that would be.

The boxes are invitations. Any help/suggestions are greatly appreciated. I am just now starting my research on this, and, admittedly, I know nothing at this point!

Many thanks for any suggestions.

karthamay47 (author)2015-12-21

I would like to put a sound module (or whatever it is that I need) inside the top of a box that would play when the box is opened. I need to do the same sound for 30 boxes. Is this going to be cost prohibitive? These are actually for party invitations.

Your help would be great!! Many thanks.

DavinEdgar (author)2014-10-01

I actually own a company that sells the sound modules (or music chips / voice chips) used to make your own greeting cards. It's pretty simple to record or program your own modules. I even made some videos showing how this is done. Here are some links showing how this is done, how to make your own musical greeting cards, and how to purchase. We even put lcd video screens as well as webkeys and NFC tags (near field communication, rfid) in greeting cards, brochures, and invitations and sales folders as well.

DIY musical sound modules and voice chips, blank recordable greeting cards, usb programmamble sound, music box (light sensor), user programmable motion sensor sound boxes. Mainly for education, crafts, scrapbooking, and hobbies.

Prerecorded sound modules, and video lcd screens (with a sound or video you provide) and custom printed cards and invitations. Mainly for events (personal or business), and marketing purposes.

Please share your thoughts as we are trying to expand our business.

- Edgar Davin

sweetflamma (author)DavinEdgar2015-02-17

Edgar, I had a question about chips for the greeting cards. Do they work the same for the lights that light up in greeting cards? I working on a project and if it works I would love to try it. Suggestions?

lyavoga.wumbaikwaominde (author)2014-08-10

I know how to make musical notes. These cards have great demand in my country Kenya. Whom can I partner with so that we produce these products? +254733779750

Microchip, who manufactures the integrated circuit used in the card.

Notorious69 (author)2013-12-19

Hi, first time on here, nice site!

I have a comment, and a question! I want to be able to make, and program chips like those in music cards, so I can create and record my own songs.

What is the equipment I need to have to make these chips, and how will I be able to program the music chips myself? A list of equipment, and parts, or some help in the right direction would be appreciated! :)

dheadz (author)2011-12-04

Congrats for this tiny project - I have been listening it for many-many minutes non- stop :)
However, I would have 2 small corrections:
1. You connected the piezo to the ports 2 and 3, but in the program they are at 0 and 1 (and the latters are the correct - GPIO0, GPIO1);
2. I built with PIC10F222 - in this type of ICs , to disable the extra functions on the pins, the ADCON0 register has to be cleared(CLRF ADCON0).
And 1 idea: if I connect one wire of the piezo to the GND, it will result a little bit lower volume.

nodoubtman (author)dheadz2012-12-25

thanks for pointing that! :)
much appreciated!
Merry Xmas! :)

RYUNOROBERT (author)dheadz2012-01-18

I got this whit MPLAB

Build C:\PRUEBA\Prueba for device 10F200
Using driver C:\Program Files (x86)\HI-TECH Software\PICC\LITE\9.60\bin\picl.exe

Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\LITE\9.60\bin\picl.exe" -C C:\PRUEBA\Prueba.asm --chip=10F200 -P --opt=default -q -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Error [141] C:\PRUEBA\Prueba.asm; 19.21 can't open include file "": No such file or directory

********** Build failed! **************

Numbuh1Nerd (author)2012-07-08

Is there any way to make this function with an mp3 or .wav file? Size and shape won't be an issue, since I'm trying to make my door play a specific sound when opened.

mwilson213 (author)2012-02-15

Cool DIY. We actually make and sell musical sound chips and sound modules for crafts, hobbies, education, and DIY projects through our online store at We also have light sensor, motion sensor, push button, and slide tongue greeting card modules (making musical greeting cards). However ours are programmed through USB using an MP3 file.

We also put video lcd screens in cards, and USB flash drives webkeys, but these are for our commercial customers such as printers, marketing agencies, etc.

I liked this posting very much. Looking eager to the next one!

techxpert (author)2011-09-23

the pic10f206 is apparently an 8 pin microcontroler

Brickmodder (author)techxpert2011-11-11

Try looking at the SOT-23 size. That's a 6 pin chip. The other package sizes of this chip are 8 pin.

yonsje (author)2008-09-19

hi, could anyone please give me the compiled hex? I tried doing it myself, bur i can't seam to figure out MPLab:s I use proton. I found a way to make a hex file out of it but that didn't work, my programmer program couldn't load it:s

nodoubtman (author)yonsje2011-11-04

see in the beginning of the page... thanks!

neelandan (author)yonsje2008-09-19

Which processor do you intend to use?

yonsje (author)neelandan2008-09-19

10F200 but i found it, i diden't see it in the instructable at first

yonsje (author)yonsje2008-09-19

now it won't program :s i keep getting an error message saying: rom programming error at adress 0x0000 Good 0x0A84 Bad 0x0FE I'm using the 8 pin DIP version instead of the 6 pin SMD version

nodoubtman (author)2011-11-04

i cannot get it to work.. can someone help me out please... with pic10f206..

THanks !:)

schorhr (author)2010-04-18

I picked up a few (ebay, 3*25, about 30 cents each) pic10f202 and it worked like a charm :-) Using a detector radio's headset though for testing. With the help of a friend I somewhat got "popcorn" playing, but in university I lost the darn microcontroller on the carpet ;-)
Once I got the thing back running, I'll post again. Thanks for this instructable.

urbanmari (author)2010-03-24

One day, maybe, when I become experienced with electronics, I'd like to try this out.  Sorry you caught so much relative flak but this really cool instructable. 

locofocos (author)2007-11-26

I've always wanted to learn to use those little tiny processors. Some1 should make a little kit with instructions about them. I know some of you had those that would let you make a little magnet, or a light, or maybe a little buzzer or somethin.

Scoticus1 (author)locofocos2010-02-21

The data sheets from the manufacturers are usually the best instructions that there are, just google the chip name followed by data sheet, and (with a little understanding of digital devices) you can do whatever you want.

3XTR3M1ST (author)2007-12-16

where can i get the software and hardware to reprogram my musical module from a greetings card?

neelandan (author)3XTR3M1ST2007-12-16

Nowhere. You can't reprogram the module in a greetings card. What you can do is to get a six pin PIC from Microchip, program it to play the melody you want and stick it in place of the module in a greetings card.

3XTR3M1ST (author)neelandan2007-12-24

i did some googling and found out that there are reprogrammable PIC chips out there. is it possible that the chip from my music card is reprogrammable? if i were to get a new module, where can i get the necessary hardware that connects my computer to the card to program it?

neelandan (author)3XTR3M1ST2007-12-25

I have never seen a reprogrammable music module in a store bought greeting card. My way of building your own is the only way to go if you want a customised tune in your card.

3XTR3M1ST (author)neelandan2007-12-25

where can i get the necessary hardware that connects my computer to the card to program it? can you give me the specific name of that hardware.?

nil0lab (author)3XTR3M1ST2008-01-30

google "pic programmer"

Scoticus1 (author)nil0lab2010-02-21

Pretty much all pic microcontrollers are dead easy to reprogram, the problem is that when they're programmed at the factory, they can set a bit high that makes the chip unreadable, to prevent a company from stealing another company's code, unfortunately it also makes it unwriteable.

DesertE (author)neelandan2008-02-11

Do you know if those pins can be programmed with more than a simple melody. I am thinkin of a full 3-5 minute song with vocals and all.

neelandan (author)DesertE2008-02-13

I think it can be done with a "high end" micro - one with a megabyte or so of programmable memory, into which you can store your digitised song and a small program to play it back. That sort of chip will have typically eighty to a hundred pins in a quad flat pack - that is, a square chip with twenty to twentyfive leads on each side.

Derin (author)neelandan2008-06-25

or lo-end with some 1 wire eproms

kamlesh2012 (author)2010-02-07

can nyone oplz tell me whether i can do this project on atmega 16 microcontroler or not?i have a little knowledge on can i write d program in my atmega 16 microcontroller?what will be d exart code 4 this??urgent,valentine day is coming nearer..n i have 2 complete it b4..plz understand d situation.... 

vinoth thyagarajan (author)2009-12-26

 want to make my own musical greeting card.
i have try to search it on google but i was getting only sites of dealers & greeting card sellers.

i have read like that they are using either voice recorder IC or micro-controller.

how can i load music files or my own voice in that chip.
is there any software for loading file in it then which format it supports.??

can anyone please tell me how i can get detail of circuit of musical greeting card.

thanking you all in advance...!!

preethikadinesh (author)2009-12-16

can i write program to tell the it possible.

khushboo (author)2009-09-10

i would like to see the circuit diagram but im not able to acess it.

shawnelec (author)2009-08-12

nice project!!! can you tell me where can I buy this microcontroller ??

Derin (author)2008-08-03

doe,a deer,a female deer,ray,a drop of golden sun,me,a name I call myself,far,a long long way to ruuuuuun,sew,a needle pulling thread,la,a note to follow sew,tea,a drink with jam and bread,and that brings us back to dooooooooooooooo!

The Jamalam (author)Derin2008-08-04

... you truely disgust me

Gaark (author)The Jamalam2008-12-18

Im happy to see the lyrics, reminds me of my Grandmother and how she used to sing it to us as kids *sigh*

Derin (author)The Jamalam2008-08-20

thats the whole thing,if you like it or not

Joell (author)Derin2008-10-23

Dude you have to wonder, the line 'la, a not to follow so' .... doesn't it seem just a tad bit lame? A little bit unfinished like? Like as if the writer of the song was getting into the flow of things nicely with the whole song and then suddenly had, like, a stroke or something and when he got back to it he couldn't remember what he wanted to write!! Seems wrong somehow, yea? lol :)

neelandan (author)2008-11-28

Joellsays: Hello there,... sorry but I just needed to ask you something about your musical greeting card project,... how do you convert the hex file of the melody into the 'do re me fa...' notation that you've used in your program? And further, can the output of the piezoelectric speaker be polyphonic? As in, if i were to convert or use the hex version of an mp3 file would it play it decently or would i play a distorted monophonic version. Actually, it goes the other way around. First you convert your melody into the tonic sol-fa notation - get the help of somebody who knows music. Second, these notes are incorporated into an Assembly Language program - the example shows a few tunes. Third, the program is converted to the hex file used for programming the chip. This simple processor, with a simple program inside, is limited to playing a monophonic melody. That is, one note at a time.

Joell (author)2008-10-23

Alright so this might seem like a silly doubt: If i wanted to program a complex tune into this chip, like a full mp3, can i basically just generate the hex file of that mp3 and program it onto the chip? Or is there a tweak to be made to allow me to do this.
Can't see a reason why it shouldn't be possible but then again, i've been wrong before :)

I'll be using filealyzer to generate the hex file; it just gives it to you... download it and try it with an mp3 if you like.


GorillazMiko (author)2007-11-26

always wanted to know how these were made. cool instructable, looks way too hard for me. im only 13 hahaha

DYLEGO (author)GorillazMiko2008-10-16

im 13 and i can make it. so u can too

tyroonelove85 (author)2008-07-16

What are all the pieces i need for the musical card from start to finish including the micro chip,leads and wires? and where can i buy them all at to start building my card?

About This Instructable




Bio: I'm Chandra Sekhar, and I live in India. I am interested in electronics, and building small one-off circuits around tiny chips (the electronic kind).
More by neelandan:Gooseneck Light and MagnifierWireless L E D9V battery case for projects
Add instructable to: