How to Make a Jukebox With an Arduino UNO/Como Hacer Una Rockola Con Un Arduino UNO

In this tutorial we want to show you how to make a Jukebox with an Arduino UNO, it´s really simple and fun to make.

En este tutorial queremos mostrarte cómo hacer una Rockola con un Arduino UNO, es bastante simple y divertido de hacer.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials/Materiales

We used / Utilizamos:

1 Arduino UNO

2 Protoboards

Jumpers MxF

Jumpers MxM

3 330kOhms Resistors / Resistencias de 330k ohms

1 Pasive buzzer / Buzzer pasivo

1 10K Potentiometes / Potenciómetros de 10k

1 Red LED / LED roja

1 Pencil type soldering iron / Cautín para soldar tipo lápiz

Tin / Estaño

1 LCD 16x2

1 Strip of MxM header pins / Tira de pins header tipo MxM

MDF

Laser Cutter / Cortadora Láser

Step 2: Connectig the Main Components/Conectando Los Componentes Principales

Connect the Buzzer, led and the buttons to the protoboard.

The buzzer and the buttons have one side positive and one side negative, before connecting you have to be sure to wich side you are connecting the voltage because you can burn your components. If you want a lower volume on the buzzer you can put a resistor on it as shown on the picture. In this case we didn´t add one. The buttons are used to change the songs the arduino has in its memory. In our project we added a red LED that changes its shine with the music that the buzzer is playing.

Conectar el Buzzer, led y los botones al protoboard.

El buzzer y los botones tienen un lado positivo y un lado negativo, antes de conectar los componentes verifica a que lado estas conectando el voltaje ya que si los conectas mal podrías llegar a quemar tus componentes. Sí quieres bajar el volumen del buzzer puedes añadirle una resistencia como se muestra en la foto. En nuestro caso no añadimos. Los botones los utilizamos para cambiar cada canción que esta almacenada en la memoria del arduino. En nuestro proyecto añadimos una LED roja que cambia su brillo por la música que el buzzer este reproduciendo.

Step 3: Connecting the LCD/Conectando La LCD

The liquid Crystal Displays are very delicated so you have to be sure of what you´re doing. First of everything the LCD that we bought doesn´t have an integrated module so you will need to weld some MxM header pins to it then you´ll have to connect 12 of the 16 pins available. You will have to be very careful when connecting the LCD to power because if you do it wrong you can burn the LCD. Programming this commponents it´s easy and you can find many examples at the arduino app. Before you try the lcd you have to take off the protector plastic on the screen because if you leave it in there the screen won´t show any character.

Las pantallas LCD son bastante delicadas, necesitas estar seguro de lo que estes haciendo. Primero que todo la LCD que nosotros compramos no tiene un modulo integrado entonces tuvimos que soldarle una tira de pines MxM, luego de hacer esto debemos conectar 12 de 16 pines disponibles. Tienes que ser bastante cuidadoso cuando conectes la pantalla al voltaje ya que si lo haces mal puedes quemar tu pantalla. Programar los componentes es fácil y puedes encontrar varios ejemplos en la aplicación de arduino. Antes de probar la pantalla debes retirar el plástico protector de ella ya que sí no lo haces, la pantalla no mostrará ningún carácter.

Step 4: Programming/Programando

//First we have to #define every note that we are going to use on the songs or we 

can use the library 

#include "pitches.h". 

//Including this libray it´s easier than defining every
note for the songs.

Second. //We define the pin of the buzzer 

#define melodyPin 9

Third. //We tell arduino wich notes and wich tempo we are using for each diferent song
int melody[] = { NOTE_ E5,NOTE_ E5,NOTE_ E5,<br>		
		NOTE_ E5,NOTE_ E5,NOTE_ E5,
		NOTE_ E5,NOTE_ E5,NOTE_ E5,<br>		
		NOTE_ E5,
		NOTE_ E5,NOTE_ E5,NOTE_ E5}
int tempo[] = { 8, 8, 4,
		8, 8, 4,
		8, 8, 4,
		8,
		8, 8, 4}

//We do the same for each song we want the buzzer to play.<br>

Fourth. //Save entire numbers for the buttons that we´re going to use.
 int switchOne = 0;

//This will depend on how many buttons we´re going to use

Fifth. //Include the LCD library on the code and tell arduino with ports
are we using to connect it.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Sixth. //Start the setup, here we define wich ports are inputs or output;
one pin is for the buzzer, another for the led and the rest are for the buttons.
void setup(void) {
pinMode(6, OUTPUT);
pinMode(13, OUTPUT);
//This 2 are for the buzzer and the led.
pinMode(10, INPUT);
//This one is for the button.
}

Seventh. //Starting the void loop; here we define wich ports are we using for the buttons
and what happens if the button is high or low, if we push one button one song will start playing.
<p>void loop() {</p><p>SwitchOne = digitalRead(10);</p><p>if (SwitchOne == HIGH) {</p><p>sing(1);}</p><p>}</p><p>int song = 0</p><p>Eight. //Start the vid sing</p><p>void sing (int s) {</p><p>song = s;</p><p>if(song == 3){</p><p>lcd.begin(16, 2);</p><p>lcd.home();</p><p>lcd.print("//include the name of the song so it will appear on the screen.");</p><p>int size = sizeof (//int melody) / sizeof(int);</p><p>for (int thisNote = 0; thisNote < size; thisNote++) {</p><p>int noteDuration = 1000 / //int tempo[thisNote];</p><p>buzz(melodyPin, //int melody[thisNote], noteDuration);</p><p>int pauseBetweenNotes = noteDuration * 1.30;</p><p>delay(pauseBetweenNotes);</p><p>buzz(melodyPin, 0, noteDuration);</p><p>}}</p><p>Ninth. //Start the void buzz</p><p>void buzz(int targetPin, long frequency, long lenght) {</p><p>digitalWrite(13, HIGH); //This is the pin for the LED.</p><p>long delayValue = 1000000 / frequency / 2;</p><p>long numCycles = frequency * lenght / 1000;</p><p>for (long i = 0; i < numCycles; i++){</p><p>digitalWrite(targetPin, HIGH);</p><p>delayMicroseconds(delayValue);</p><p>digitalWrite(targetPin, LOW);</p><p>delayMicroseconds(delayValue);</p><p>}</p><p>digitalWrite(13, LOW);</p><p>}</p><p>//With this void buzz we change the brightness of the LED so it can change with the music.</p>


Step 5: Exterior Design/Diseño Exterior

We measured our components connected and then we designed some pieces on AutoDesk Inventor, then we cut the parts on the laser cutter. Each part assemblies perfectly to the other one, in the front we left a hole for the led and a hole for the buzzer so we can hear the music, in the back we left a hole for the power cable.

Medimos todos los componentes ya conectados y diseñamos algunas piezas en AutoDesk Inventor, luego cortamos las partes en la cortadora láser. Cada parte encaja perfectamente con la otra, en el frente cortamos un agujero para la led y uno para que podamos escuchar la música del buzzer, en la parte de atrás cortamos un agujero para el cable de corriente.

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    Discussions