Arduino Based buzzer projects
Components Required: 1. Arduino Board
2. One crystal 27c 313
The buzzers so called crystal buzzers to are fascinating in a sense they can be used in various projects like the projects having the requirement of sound system, like say some alarm system or so. Since I m a so called maverick in my approach I wanted to do my first experiment on buzzer with some out of the box techniques. So I happen to pick up one of the buzzer I bought from Guwahati during the last diwali holidays and I started to look into the possibilities of using it with my arduino duemilanove. Interestingly in arduino's standard library we can access some functions which are meant to be used for speakers. Cool enough you can set the frequencies of yopur choice while using it. So it came to my mind why cant we use it to play the notes of classical Indian music, Sa Re Ga Ma Pa Dha Ni Sa (as Do Re Mi Fa So La Ti in English).
Well, guys, I m not so good in music though. While I was in 2nd grade, my mom tried her best to teach me tabla, an indian instrument which you can associate with Ustad Zakir Hussain. I screwed it up badly. Well, so I guess if my mom gonna see this post I m quite sure she will go goosebumps for the first time.
Well, so what I did, is I googled about the frequencies of the notes mentioned about. As the seniors of our college taught me, that google is your best friend. Use it to advantage. And indeed here, for this project itself, google quintessentially acted like my best friend. Just google "sa re ga ma frequencies" and in the first page of the search result you will get the frequencies of the notes So what was left was just to use in it my code. So here I m.
And as you can see that I have used the arduino's serial monitor to feed my command and play sa re ga ma pa. But if you have an eight key keypad, you can make a personalised piano with it. So guys just check out the code below and make your own pianos.
int buzzer = 8;
char tune;
void setup()
{
Serial.begin(9600); // Setting up baud rate. We keeep the standard to be 9600
pinMode(buzzer, OUTPUT);
}
void loop()
{
if(Serial.available() > 0) // Checking for the buffer for input value
{
tune = Serial.read(); // Reading one character command from the buffer
if(tune == 'a') // here is the play. All the note of Sa re ga ma has some frequencies
{ // I have used some of them after some search in google
tone(buzzer,240); // Sa: 240 hz
delay(1000);
noTone(buzzer);
}
if(tune == 's') // Re: 270 Hz
{
tone(buzzer,270);
delay(1000);
noTone(buzzer);
}
if(tune == 'd') // Ga; 300Hz
{
tone(buzzer,300);
delay(1000);
noTone(buzzer);
}
if(tune == 'f') // Ma: 320 Hz
{
tone(buzzer,320);
delay(1000);
noTone(buzzer);
}
if(tune == 'g') // Pa: 360 Hz
{
tone(buzzer,360);
delay(1000);
noTone(buzzer);
}
if(tune == 'h') // Dha: 400 Hz
{
tone(buzzer,400);
delay(1000);
noTone(buzzer);
}
if(tune == 'j') // Ni: 450 Hz
{
tone(buzzer,450);
delay(1000);
noTone(buzzer);
}
if(tune == 'k')
{
tone(buzzer,240);
delay(1000);
noTone(buzzer);
}
Serial.print(tune); // printing command
Serial.print(" ");
}
}
Well, guys, I m not so good in music though. While I was in 2nd grade, my mom tried her best to teach me tabla, an indian instrument which you can associate with Ustad Zakir Hussain. I screwed it up badly. Well, so I guess if my mom gonna see this post I m quite sure she will go goosebumps for the first time.
Well, so what I did, is I googled about the frequencies of the notes mentioned about. As the seniors of our college taught me, that google is your best friend. Use it to advantage. And indeed here, for this project itself, google quintessentially acted like my best friend. Just google "sa re ga ma frequencies" and in the first page of the search result you will get the frequencies of the notes So what was left was just to use in it my code. So here I m.
And as you can see that I have used the arduino's serial monitor to feed my command and play sa re ga ma pa. But if you have an eight key keypad, you can make a personalised piano with it. So guys just check out the code below and make your own pianos.
int buzzer = 8;
char tune;
void setup()
{
Serial.begin(9600); // Setting up baud rate. We keeep the standard to be 9600
pinMode(buzzer, OUTPUT);
}
void loop()
{
if(Serial.available() > 0) // Checking for the buffer for input value
{
tune = Serial.read(); // Reading one character command from the buffer
if(tune == 'a') // here is the play. All the note of Sa re ga ma has some frequencies
{ // I have used some of them after some search in google
tone(buzzer,240); // Sa: 240 hz
delay(1000);
noTone(buzzer);
}
if(tune == 's') // Re: 270 Hz
{
tone(buzzer,270);
delay(1000);
noTone(buzzer);
}
if(tune == 'd') // Ga; 300Hz
{
tone(buzzer,300);
delay(1000);
noTone(buzzer);
}
if(tune == 'f') // Ma: 320 Hz
{
tone(buzzer,320);
delay(1000);
noTone(buzzer);
}
if(tune == 'g') // Pa: 360 Hz
{
tone(buzzer,360);
delay(1000);
noTone(buzzer);
}
if(tune == 'h') // Dha: 400 Hz
{
tone(buzzer,400);
delay(1000);
noTone(buzzer);
}
if(tune == 'j') // Ni: 450 Hz
{
tone(buzzer,450);
delay(1000);
noTone(buzzer);
}
if(tune == 'k')
{
tone(buzzer,240);
delay(1000);
noTone(buzzer);
}
Serial.print(tune); // printing command
Serial.print(" ");
}
}
And guys it will be totally unjustified if I don't mention here that I didn't make these videos. My friend Prashant Maroti, who not only gives me his valuable suggestions and ideas to proceed with my work but also helps me with my projects, has made this videos of the buzzer systems I have designed. An amazing personality he is.