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
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
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
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
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
The four 'down' pins were soldered to the board.
Step 6: The supply leads
Two pieces of wire were used to connect the two middle leads to two outside tracks on the circuit board.