In this tutorial, I will show you how you can play Money Heist Song Bella Ciao in any Arduino with the help of Piezoelectric buzzer. This cool project is dedicated to all Money Heist fans all over the world. So, Let's get started.
What is Arduino?Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.
Over the years Arduino has been the brain of thousands of projects, from everyday objects to complex scientific instruments. A worldwide community of makers - students, hobbyists, artists, programmers, and professionals - has gathered around this open-source platform, their contributions have added up to an incredible amount of accessible knowledge that can be of great help to novices and experts alike.
Arduino UNOThe Arduino UNO is the best board to get started with electronics and coding. If this is your first experience tinkering with the platform, the UNO is the most robust board you can start playing with. The UNO is the most used and documented board of the whole Arduino family.
Arduino Uno is a microcontroller board based on the ATmega328P (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.. You can tinker with your Uno without worrying too much about doing something wrong, worst case scenario you can replace the chip for a few dollars and start over again.
Piezoelectric BuzzerA piezo buzzer is a sound-producing device. The main working principle is based on the theory that, whenever an electric potential is applied across a piezoelectric material, a pressure variation is generated. A piezo buzzer consists of piezo crystals in between two conductors.
When a potential difference is applied across these crystals, they push one conductor and pull the other conductor by their internal property. The continuous pull and push action generates a sharp sound wave.
Piezo buzzers generate a loud & sharp sound. So, they are typically used as alarm circuits. Also, they are used to make an alert of an event, signal or sensor input. A special characteristics of the piezo buzzer is, the sound pitch or level is not depended on the voltage level that is, it works only in a specific voltage range.
Typically, a piezo buzzer can generate a sound in the range of 2 to 4 kHz.
How to play the Notes?First of we have to define the frequencies of the notes (pleasent to be heard) with the "int" function. Then define the value of BPM (You can modify it obviously) and according to that define the note values.
int rounda=0;
int roundp=0;
int white= 0;
int whitep=0;
int black=0;
int blackp=0;
int quaver=0;
int quaverp =0;
int semiquaver=0;
int semiquaverp=0;
I then defined the value of the BPM ( you can modify it obviously).
int bpm= 120;
According to the defined value of BPM define the note values.
black= 35000/bpm;
blackp=black*1.5;
white= black*2;
whitep=white*1.5;
rounda= black*4;
roundp= rounda*1.5;
quaver= black/2;
quaverp=quaver*1.5;
semiquaver= black/4;
semiquaverp=semiquaver*1.5;
With these defined values you can easily play a note with the command "tone" like this.
tone (pin, note, duration);
In this project, we are using the same method.
tone(BuzzerPin,Mi,black);
delay(black+50);
This way, I made the melody for the Bella Ciao Song. That's all about the code.
Try to write the code yourself. avoid copy pasting.
Let's upload the code to our Arduino board now.
Upload the code to ArduinoOpen the code in Arduino Software. Select the model of Board you are using. Here I will go with the Arduino Uno. To select the board, Go to "Tools > Boards".
Now, Select the Port where your Arduino is connected. to select the port, go to "Tools > PORT".
After selecting the correct ones, Click the Upload Button to upload the code to the Arduino.
We have successfully programmed our microcontroller to play the Bella ciao Notes. Now we have to connect the Piezo Buzzer to hear the music. So, Connect the Red wire of the Piezo Buzzer to the 11th Pin of Arduino Uno and the Black Wire to 'GND' as shown in the circuit diagram.
That's all. Follow us for more interesting projects.
Please Follow us on Instagram: https://www.instagram.com/pi_bots
Thank You.
Comments
Please log in or sign up to comment.