Introduction: Money Heist BELLA CIAO Song in Arduino Uno
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.
Supplies
Hardware
- Arduino Uno
- Piezoelectric Buzzer
- USB A to B Cable
Software
- Arduino IDE
Code and the Circuit
- Download the Code from our GitHub Repository
Step 1: 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.
Step 2: Arduino UNO
The 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.
Step 3: Piezoelectric Buzzer
A 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.
Step 4: 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.
Step 5: Upload the Code to Arduino
Open 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.
Step 6: Connecting the Buzzer With 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 11 th Pin of Arduino Uno and the Black Wire to 'GND' as shown in the circuit diagram.
Step 7: How to Make This Project in Tinkercad Circuits?
We all are in Lockdown due to COVID19. So don't worry if you don't have the actual components. You can simulate this project in tinkercad circuits and understand the working.
Head over to the Tinkercad Website from here. Click on the "JOIN NOW" Button if you don't have an acoount yet. I will sign in with my previously made account. Once you are in the Tinker cad Dashboard, Click on the 'Circuits' shown at the left side of the screen. Click on the Create New Circuit Button. Now your new project is created. Now search for Arduino UNO and drag it to the main screen from the right side Bar. Now, search for Buzzer and drag the buzzer on to the main screen. Now make the connection as in the Diagram.
Click on the "Code" Section to program your Arduino. Delete the Pre-made blocks and change the window from block mode to Text Mode. Paste in the code by replacing the previous blank code. Now Click on the Start Simulation Button to see your project in Action.
You can replicate my project by clicking here.
Step 8: Arduino Code
/*<br> * * Created by Pi BOTS MakerHub * * Email: pibotsmakerhub@gmail.com * * Github: <a href="https://github.com/pibotsmakerhub"> https://github.com/pibotsmakerhub </a> * * Copyright (c) 2020 Pi BOTS MakerHub * * WhatsApp: +91 9400 7010 88 * */ int BuzzerPin = 11; // Connect Buzzer to Arduino pin 11 int Si2 =1975; int LaS2=1864; int La2= 1760; int SolS2=1661; int Sol2=1567; int FaS2=1479; int Fa2= 1396; int Mi2= 1318; int ReS2=1244; int Re2= 1174; int DoS2=1108; int Do2= 1046; // Low Octave int Si = 987; int LaS= 932; int La = 880; int SolS=830; int Sol= 783; int FaS= 739; int Fa= 698; int Mi= 659; int ReS= 622; int Re = 587; int DoS =554; int Do = 523; // define the notes 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; int bpm= 120; void setup(){ pinMode(BuzzerPin,OUTPUT); 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; } void loop(){ tone(BuzzerPin,Mi,black); delay(black+50); tone(BuzzerPin,La,black); delay(black+50); tone(BuzzerPin,Si,black); delay(black+50); tone(BuzzerPin,Do2,black); delay(black+50); tone(BuzzerPin,La,black); delay(2*white+50); tone(BuzzerPin,Mi,black); delay(black+50); tone(BuzzerPin,La,black); delay(black+50); tone(BuzzerPin,Si,black); delay(black+50); tone(BuzzerPin,Do2,black); delay(black+50); tone(BuzzerPin,La,black); delay(2*white+50); tone(BuzzerPin,Mi,black); delay(black+50); tone(BuzzerPin,La,black); delay(black+50); tone(BuzzerPin,Si,black); delay(black+50); tone(BuzzerPin,Do2,white*1.3); delay(2*black+50); tone(BuzzerPin,Si,black); delay(black+50); tone(BuzzerPin,La,black); delay(black+50); tone(BuzzerPin,Do2,white*1.3); delay(2*black+50); tone(BuzzerPin,Si,black); delay(black+50); tone(BuzzerPin,La,black); delay(black+50); tone(BuzzerPin,Mi2,black); delay(white+50); tone(BuzzerPin,Mi2,black); delay(white+100); tone(BuzzerPin,Mi2,black); delay(white+50); tone(BuzzerPin,Re2,black); delay(black+50); tone(BuzzerPin,Mi2,black); delay(black+50); tone(BuzzerPin,Fa2,black); delay(black+50); tone(BuzzerPin,Fa2,white*1.3); delay(rounda+100); tone(BuzzerPin,Fa2,black); delay(black+50); tone(BuzzerPin,Mi2,black); delay(black+50); tone(BuzzerPin,Re2,black); delay(black+50); tone(BuzzerPin,Fa2,black); delay(black+50); tone(BuzzerPin,Mi2,white*1.3); delay(rounda+100); tone(BuzzerPin,Mi2,black); delay(black+50); tone(BuzzerPin,Re2,black); delay(black+50); tone(BuzzerPin,Do2,black); delay(black+50); tone(BuzzerPin,Si,white*1.3); delay(white+50); tone(BuzzerPin,Mi2,white*1.3); delay(white+50); tone(BuzzerPin,Si,white*1.3); delay(white+50); tone(BuzzerPin,Do2,white*1.3); delay(white+50); tone(BuzzerPin,La,rounda*1.3); delay(rounda+50); }
Step 9: Watch Our Youtube Video
That's all. Follow us for more interesting projects.
Please Follow us on Instagram: https://www.instagram.com/pi_bots
Thank You.