Our Learning Path is an itinerary designed to teach all the foundaments and a little more about electronics, coding and robotics.
When you complete all the projects you will be able to develop almost any project you can imagine. In each chapter new concepts are introduced. You will learn by doing in a funny way.
Use our buzzer component to give sound to your creations. See how we use it and play nice melodies
Learn to make sounds, play with musical notes, make some noise or even a theremin!
• DIFFICULTY LEVEL: Beginner
• DURATION OF THE ACTIVITY: 40 min.
1 - Build&Code 4in1 board
1 - Buzzer
1 - Switch Button
1 - Rotatory Potentiometer
2 - Monochromatic Led light board
Battery holder, USB cable and wires.
The Buzzer is a module that puts out noise, also called Piezoelectric Speaker.It’s not like a regular speaker that you might think of. It changes shape when you apply electricity to it and bend the metal back and forth, which in turn creates noise.
The faster you bend the material, the higher the pitch of the noise that’s produced. This rate is called frequency.
What do you think we are talking about? Analog or Digital module?
Yes! it's a digital module! With 'high' output it makes noise. To vary tone we generate a square wave, and it will change according wave frequency
In next exercises we will use also many components seen in previous activities:
For first exercise you just need to connect buzzer and button modules. In next exercises you have to connect many more digital and analog devices. Find here the circuit with all connected.
Connect wires according colours from 4in1 board to components:
- A0 to Potentiometer module
- DIO4 to Button module
- DIO6 to Buzzer module
- DIO9 to Red LED module
There is a specific function we can use to make buzzer sound , tone in Arduino IDE or play with note block. With blocks we can directly define a musical note, in Arduino instead we have to put frequency for each note, using sintax tone(pin, frequency, duration)

int pulsador = 4; void setup(){ pinMode(pulsador, INPUT); } void loop(){ if (digitalRead(pulsador)){ noTone(10); }else{ tone(10, 452, 338); delay(200); tone(10, 65535, 338); delay(200); } }
Here we show you how to play the musical scale, so if you know some song partiture, you can make your favourit song later! No excuses!

#include <Arduino.h> #include <Wire.h> #include <SoftwareSerial.h> int light = 9; int buzzer = 10; void setup() { pinMode(light,INPUT); pinMode(buzzer,OUTPUT); } void loop() { if (digitalRead (4)) { tone(buzzer,2093,0.25*1000); delay (200); tone(buzzer,2349,0.25*1000); delay (200); tone(buzzer,2637,0.25*1000); delay (200); tone(buzzer,2794,0.25*1000); delay (200); tone(buzzer,3136,0.25*1000); delay (200); tone(buzzer,3520,0.25*1000); delay (200); tone(buzzer,3951,0.25*1000); delay (200); } else { noTone (10); } }
Yeah, if you are a bit bored just now, try to get the song "la cucaracha" or "happy birthday" , or any other you want to dance!!! You can find here notes and more documentation for playing melodies with Arduino IDE
We have played fixed notes defined in our programs, now we want to modify sound with an external device, a potentiometer, like a electronic synthesizer.

#include <Arduino.h> #include <Wire.h> #include <SoftwareSerial.h> float valor = A0+0; int light = 9; int buzzer = 6; void setup() { // call the pin here pinMode(buzzer, OUTPUT); pinMode(light, OUTPUT); pinMode(valor, INPUT); } void loop(){ valor = analogRead(A0+0); for(int count = 0; count < 1; count++){ if(valor < 0 && valor > 128) { digitalWrite(light, 0); noTone(buzzer); delay(200); } if(valor < 256 && valor > 128) { digitalWrite(light, 1); tone(buzzer, 65, 0.5 * 1000); delay(200); } if(valor < 384 && valor > 256) { digitalWrite(light, 1); tone(buzzer, 147, 0.5 * 1000); delay(200); } if(valor < 512 && valor > 384) { digitalWrite(light, 1); tone(buzzer, 330, 0.5 * 1000); delay(200); } if(valor < 640 && valor > 512) { digitalWrite(light, 1); tone(buzzer, 698, 0.5 * 1000); delay(200); } if(valor > 768 && valor < 640) { digitalWrite(light, 1); tone(buzzer, 1568, 0.5 * 1000); delay(200); } if(valor < 896 && valor > 768) { digitalWrite(light, 1); tone(buzzer, 3951, 0.5 * 1000); delay(200); } } }
Here we defined a function dedicated to read the analog input (potentiometer) and according his value, assign a scale note.
Try another analog sensor you can use instead of potentiometer to get a working theremin!! We suggest to use the map function to get it working nicely.
Now combine sound & light!! You can make a complete emergeny sound and light system.
We need to blink two leds consecutevely while playing two tones.
#include <Arduino.h> #include <Wire.h> #include <SoftwareSerial.h> int buzzer = 6; int bottom = 4; int light = 9; void setup() { // podiendo los pines pinMode(buzzer, INPUT); pinMode(bottom, INPUT); pinMode(light, OUTPUT); } void loop() { if(digitalRead(4)){ for(int count = 0; count < 3; count++) { digitalWrite(light, HIGH); tone(6, 523, 0.5 * 1000); delay(300); digitalWrite(light, LOW); tone(6, 3136, 0.5 * 1000); delay(300); } } }
As a bonus track, you can find melody for "la cucaracha" song in next slide. If you prefer it in your "emergency" vehicle you just need to update your code.
Use code below to hear "la cucaracha" song. If you do some searches in the web, you will find many melodies you can use you vehicle!
int light = 9; int buzzer = 6; int bottom = 4; void setup() { // put your setup code here, to run once: pinMode(light, OUTPUT); pinMode(buzzer, OUTPUT); pinMode(bottom, INPUT); } void loop() { // put your main code here, to run repeatedly: if(digitalRead(bottom)) { for(int count=0;count<1;count++) { tone(buzzer,2093,500); delay(200); tone(buzzer,2093,500); delay(200); tone(buzzer,2093,500); delay(200); tone(buzzer,2794,500); delay(200); tone(buzzer,3520,500); delay(500); tone(buzzer,2093,500); delay(200); tone(buzzer,2093,500); delay(200); tone(buzzer,2093,500); delay(200); tone(buzzer,2794,500); delay(200); tone(buzzer,3520,500); delay(500); tone(buzzer,2794,500); delay(200); tone(buzzer,2794,500); delay(200); tone(buzzer,2637,500); delay(200); tone(buzzer,2637,500); delay(200); tone(buzzer,2349,500); delay(200); tone(buzzer,2349,500); delay(200); tone(buzzer,2093,500); delay(1000); tone(buzzer,2093,500); delay(200); tone(buzzer,2093,500); delay(200); tone(buzzer,2093,500); delay(200); tone(buzzer,2637,500); delay(200); tone(buzzer,3136,500); delay(500); tone(buzzer,2093,500); delay(200); tone(buzzer,2093,500); delay(200); tone(buzzer,2093,500); delay(200); tone(buzzer,2637,500); delay(200); tone(buzzer,3136,500); delay(500); tone(buzzer,2093,500); delay(200); tone(buzzer,2349,500); delay(200); tone(buzzer,2093,500); delay(200); tone(buzzer,3951,500); delay(200); tone(buzzer,3520,500); delay(200); tone(buzzer,3136,500); delay(200); tone(buzzer,2794,500); delay(200); } } else { digitalWrite(light,HIGH); delay(200); digitalWrite(light,LOW); delay(200); } }
Now you can build this nice Marshall style amplifier and make some noise!! Download cardboard template.
float encendido = 0; float potenciometro = 0; void setup() { pinMode(A0,INPUT); pinMode(2,INPUT); pinMode(4,OUTPUT); pinMode(3,INPUT); } void loop() { potenciometro = analogRead(A0+0) / 4; if(digitalRead(2)){ if(encendido == 0.000000){ encendido = 1; digitalWrite(4,1); }else{ encendido = 0; digitalWrite(4,0); } delay(700); } if(encendido == 1.000000){ if(potenciometro < 35){ tone(3,65,0.5*1000); } if((potenciometro > 35) && (potenciometro < 70)){ tone(3,73,0.5*1000); } if((potenciometro > 70) && (potenciometro < 105)){ tone(3,82,0.5*1000); } if((potenciometro > 105) && (potenciometro < 140)){ tone(3,87,0.5*1000); } if((potenciometro > 140) && (potenciometro < 175)){ tone(3,98,0.5*1000); } if((potenciometro > 175) && (potenciometro < 210)){ tone(3,110,0.5*1000); } if((potenciometro > 210) && (potenciometro < 245)){ tone(3,123,0.5*1000); } } }
The Mega Maker Kit fits perfectly with the Learning Path, you can build all projects with it, but if you have other kits, you can also follow the entire itinerary and finish some projects, or buy the missing components. You can check in our Learning Path page.