This circuit is so simple, and generated sound may look ugly, but on the other hand, this is a good starting point for newbies with AVR projects. This circuit is made of one IC AT90S2313 (may be substituted by Attiny2313). The circuit is low power and reliable as it consists of very few parts (if SMD chip used, then it can be placed inside a postcard):
A microcontroller can be powered by using from 2.7 to 6 V power supply. If the AT90S2313 microcontroller is used, then you need to connect a crystal resonator. If ATtiny2313 is used, you can use an internal RC clock source and reduce the number of parts needed. Transistors can be any general-purpose transistors. If the sounder requires less than 20mA of current, you may connect it directly to the port pin.
After reset, the circuit starts the program and plays a melody one time. After that, it goes to power-down mode. Crystal frequencies may be chosen from 32768 to 10MHz. Firmware is written for 10MHz. If you use a different clock source, then reduce SoundTab coefficients in the source code and rebuild it.
Download Source code