Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Play your favorite tune with a microcontroller

The tune of a song is made of various musical notes. Each note is played for a certain duration and there is a certain time gap between two successive notes. If the notes (frequencies) and the timing information are known, a microcontroller can be programmed to play the tune. This projects describes how to play the “Happy Birthday” tune with a PIC microcontroller. There are only two components used: a PIC12F683 microcontroller and a piezo buzzer. The microcontroller runs with a 4 MHz internal clock. Due to its high impedance the piezo buzzer can be driven directly from a PIC I/O pin. The author also provides the demo program written in MikroC which can be easily modified to play any other tunes. You can find the frequencies of various musical notes here. Continue reading