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


  

Thursday 14 April 2016

Motion Detection Using Accelerometer

Motion Detection Using Accelerometer

Accelerometer is a sensor which can be used to detect motion of an object in either of the three directions (X-Y-Z) . Accelerometer can also be used to calculate velocity, acceleration but measurements won't be not as accurate as speedometer, 

Most of the sensors are Analog in nature so interfacing with micro controller requires (Analog to Digital) conversion.
Since Accelerometer has three orientaions. Three channels of ADC are required for interface
for instant conversion of three channels  burst mode of operation should be choosen for ADC




Download code for lpc1343 -here