Thursday 21 April 2016

Interfacing Buzzer to Microcontroller

Interfacing Buzzer to Microcontroller

Buzzer is the most commonly used electronic component in several applications to generate alarm.If properly interfaced, buzzer can also be used to generate musical notes, In this project  i will show how to generate (Sa Re Ga Ma Pa Dha Ni Sa ) notes from buzzer. Buzzer operates at 5v so Microcontroller particularly at Cmos level cannot drive Buzzer directly, so driver circuit is required to drive buzzer. BJT in CE mode can be used as driver.

Buzzer is a Piezo-Electric device which converts Electrical energy to Mechanical energy(vibrations)
Vibrations generate sounds. Sounds can be noise, noise can be converted to music by properly exciting buzzer using timer.







Musical notes operate at unique frequency like sa-240Hz(shadja)   Re-270Hz(Rishabha)  Ga-300Hz(Gandhara) Ma-320Hz(Madyama) Pa-360Hz(Panchama) Dha-400Hz(Dhaivata) Ni-450Hhz(Nishada)  Sa-480Hz

For accurate  timing Systick Timer being the core peripheral of ARM Cortex-M3 can be properly configured to generate all these frequencies. 
1) Duration of play of each note should be properly calculated with respective fundamental frequency.
2) Find LCM of above mentioned frequencies and give sufficient time for each note since sa has less frequency its play time should be least of all notes and Sa has highest frquency it should have more play time.



Download code for LPC1343 Here


  

No comments:

Post a Comment