Introduction: Rocola Geek

Hola qué tal a todos, este es mi primer instructable y pues para comenzar hablar sobre este tengo que mencionar que fue un proyecto en pareja, todo parte de la clase de Manufactura Digital, una clase de la universidad. Con mi compañero de trabajo ambos estudiamos la carreta de ingenería Mecánica en la Universidad del Valla de Guatemala y somos de primer año.

Materiales utilizados:


* Un potenciometro

* Dos push boton

* Un led

* Una pantalla LCD 16x2

* Jumpers Mancho - Hembra

* 3 resistencia de 330 ohms

* Protoboard

* Un arduino, para nuestro proyecto utilizamos un arduino Mega pero pueden usar cualquiera ya sea nano o 1

* MDF para realizar la caja


Herramientas utilizadas:


* Un dremel

* Un barreno

* Lija

* Laser


Proceso:

1. Como primer paso lo que se hizo fue realizar un diagrama esquemático del circuito que íbamos a necesitar, del mismo modo la programación para que corriera el circuito creado. Esto lo hicimos en la plataforma de trabajo Tinkercad que tiene un simulador de circuitos para probar nuestro modelo antes de llevarlo a la vida, de está manera nos ahorramos gasto innecesarios de material al igual nos preparamos para evitar quemar alguno de los materiales al conectarlo e una manera incorrecta.

Código del Programa:

// Configurar LCD
#include

LiquidCrystal lcd (12, 11, 4, 5, 6, 7);

// Configurar botones const int btn_suma = 3; // Pin del boton que sumará const int btn_resta = 2; // Pin del boton que restará

// Declarar la variable del estado de los botones // volatile int btnsuma_state; // botón de suma // volatile int btnresta_state; // botón de resta volátil int ISRnumero = 0; // Contador

3136 #define NOTE_GS7 3322 #define NOTE_A7 3520 #define NOTE_AS7 3729 #define NOTE_B7 3951 #define NOTE_C8 4186 #define NOTE_CS8 4435 #define NOTE_D8 4699 #define NOTE_DS8 4978 #define melodyPin 9 MelodyPody int // Melodía de tema principal de la página de Mario , NOTE_E7, 0, NOTE_E7, 0, NOTE_C7, NOTE_E7, 0, NOTE_G7, 0, 0, 0, NOTE_G6, 0, 0, 0, NOTE_C7, 0, 0, NOTE_G6, 0, 0, NOTE_E6, 0, 0, NOTE_A6 , 0, NOTE_B6, 0, NOTE_AS6, NOTE_A6, 0, NOTE_G6, NOTE_E7, NOTE_G7, NOTE_A7, 0, NOTE_F7, NOTE_G7, 0, NOTE_E7, 0, NOTE_C7, NOTE_D7, NOTE_B6, 0, 0, NOTE_C7, 0, 0, NOTE_G6 , 0, 0, NOTE_E6, 0, 0, NOTE_A6, 0, NOTE_B6, 0, NOTE_AS6, NOTE_A6, 0, NOTE_G6, NOTE_E7, NOTE_G7, NOTE_A7, 0, NOTE_F7, NOTE_G7, 0, NOTE_E7, 0, NOTE_C7, NOTE_D7, NOTE_B6 , 0, 0}; // Mario main les tempo int tempo [] = {12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,}; // Underworld melody int underworld_melody [] = {NOTE_C4, NOTE_C5, NOTE_A3, NOTE_A4, NOTE_AS3, NOTE_AS4, 0, 0, NOTE_C4, NOTE_C5, NOTE_A3, NOTE_A4, NOTE_AS3, NOTE_AS4, 0, 0, NOTE_F3, NOTE_F4, NOTE_D, 4 NOTE_DS3, NOTE_DS4, 0, 0, NOTE_F3, NOTE_F4, NOTE_D3, NOTE_D4, NOTE_DS3, NOTE_DS4, 0, 0, NOTE_DS4, NOTE_CS4, NOTE_D4, NOTE_CS4, NOTE_DS4, NOTE_DS4, NOTE_GS3, NOTE_G3, NOTE_CS4, NOTE_, NOTA_4, NOTA_, NOTA_4, NOTA_4 NOTE_AS4, NOTE_A4, NOTE_GS4, NOTE_DS4, NOTE_B3, NOTE_AS3, NOTE_A3, NOTE_GS3, 0, 0, 0}; // Underwolrd tempo int underworld_tempo [] = {12, 12, 12, 12, 12, 12, 6, 3, 12, 12, 12, 12, 12, 12, 6, 3, 12, 12, 12, 12, 12, 12, 6, 3, 12, 12, 12, 12, 12, 12, 6, 6, 18, 18, 18, 6, 6, 6, 6, 6, 6, 18, 18, 18, 18, 18, 18, 10, 10, 10, 10, 10, 10, 3, 3, 3};

// Star wars cantina band int star_wars [] = {NOTE_A4, NOTE_D5, NOTE_A4, NOTE_D5, NOTE_A4, NOTE_D5, NOTE_A4, 0, NOTE_GS4, NOTE_A4, NOTE_A4, NOTE_GS4, NOTE_A4, NOTE_G4, 0, NOTE_FS4, NOTE_G4, NOTE_G, NOTA NOTE_D4, NOTE_A4, NOTE_D5, NOTE_A4, NOTE_D5, NOTE_A4, NOTE_D5, NOTE_A4, 0, NOTE_GS4, NOTE_A4, NOTE_G4, 0, NOTE_G4, NOTE_FS4, NOTE_G4, NOTE_C5, NOTE_AS4, NOTE_A4, NOTE_G4, NOTE_A4, NOTE_G4, NOTE_G4, NOTE_G4, NOTE_G4, NOTE_G4, NOTE_G4 NOTE_D5, NOTE_A4, 0, NOTE_GS4, NOTE_A4, NOTE_C5, 0, NOTE_C5, NOTE_A4, NOTE_G4, NOTE_F4, NOTE_D4, NOTE_D4, NOTE_F4, NOTE_A4, NOTE_C5, NOTE_DS5, NOTE_D5, NOTE_GS4, NOTE_A4, NOTE_A4, NOTE_A, 0

int star_tempo [] = {6, 6, 6, 6, 12, 6, 12, 12, 12, 6, 12, 12, 12, 12, 12, 12, 12, 12, 6, 2, 6, 6, 6, 6, 12, 6, 12, 12, 12, 6, 12, 12, 3, 12, 6, 12, 6, 6, 6, 6, 6, 6, 6, 12, 6, 12, 12, 12, 6, 12, 12, 3, 12, 6, 6, 2, 3, 3, 3, 3, 6, 6, 12, 6, 12, 3, 3,};

// Tema final de Zelda int melody_zelda [] = {NOTE_G6, NOTE_G5, NOTE_C6, NOTE_E6, NOTE_DS6, NOTE_G5, NOTE_B6, NOTE_B5, NOTE_A6, NOTE_C6, NOTE_E6, NOTE_A6, NOTE_G6, NOTE_C6, NOTE_D6, NOTE_E6, NOTE

NOTE_A6, NOTE_C6, NOTE_F6, NOTE_A6, NOTE_GS6, NOTE_C6, NOTE_D6, NOTE_F6, NOTE_E6, NOTE_G5, NOTE_C6, NOTE_E6, NOTE_D6, NOTE_A5, NOTE_B5, NOTE_D6,

}; // Zelda Ending Theme Tempo int tempo_zelda [] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,

3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,

};

// Zelda Fairy Fountain int fairy [] = {NOTE_A7, NOTE_D7, NOTE_AS6, NOTE_G6, NOTE_G7, NOTE_D7, NOTE_AS6, NOTE_G6, NOTE_FS7, NOTE_D7, NOTE_AS6, NOTE_G6, NOTE_G7, NOTE_D7, NOTE_AS6, NOTE_G6, NOTE__6, NOTE__6, NOTE__6, NOTE_7, NOTE__6 , NOTE_F7, NOTE_C7, NOTE_A6, NOTE_F6, NOTE_E7, NOTE_C7, NOTE_A6, NOTE_F6, NOTE_F7, NOTE_C7, NOTE_A6, NOTE_F6, NOTE_F7, NOTE_AS6, NOTE_G6, NOTE_E6, NOTE_E7, NOTE_AS6, NOTE_, NOTA, NOTA_, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA, NOTA. , NOTE_AS6, NOTE_G6, NOTE_E6, NOTE_E7, NOTE_A6, NOTE_F6, NOTE_D6, NOTE_D7, NOTE_A6, NOTE_F6, NOTE_D6, NOTE_CS7, NOTE_A6, NOTE_F6, NOTE_D6, NOTE_D7, NOTE_A6, NOTE_F6, NOTE_D7, NOTE_D7, NOTA_D7, NOTA_D7, NOTA_D7, NOTA_D7, NOTA_D7, NOTA_D7, NOTA_D7, NOTA_D6, NOTA_D7, NOTA_D7, NOTA_D7, NOTA_D7, NOTA_D6, NOTA_D7, NOTA_D7, NOTA_D7, NOTA_D7, NOTA_7, NOTA_D7, NOTA_D6 , NOTE_AS6, NOTE_G6, NOTE_F7, NOTE_D7, NOTE_AS6, NOTE_G6, NOTE_G7, NOTE_D7, NOTE_AS6, NOTE_G6,

NOTE_AS7, NOTE_DS7, NOTE_C7, NOTE_A6, NOTE_A7, NOTE_DS7, NOTE_C7, NOTE_A6, NOTE_GS7, NOTE_DS7, NOTE_C7, NOTE_A6, NOTE_A7, NOTE_DS7, NOTE_C7, NOTE_A6,

NOTE_C8, NOTE_D7, NOTE_AS6, NOTE_G6, NOTE_AS7, NOTE_D7, NOTE_AS6, NOTE_G6, NOTE_A7, NOTE_D7, NOTE_AS6, NOTE_G6, NOTE_AS7, NOTE_D7, NOTE_AS6, NOTE_G6,

NOTE_A7, NOTE_AS6, NOTE_G6, NOTE_E6, NOTE_G7, NOTE_AS6, NOTE_G6, NOTE_E6, NOTE_F7, NOTE_AS6, NOTE_G6, NOTE_E6, NOTE_E6, NOTE_AS6, NOTE_G6, NOTE_E6,}; // Fairy fountaint tempo int fairy_tempo [] = {12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 , 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 , 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,

12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,};

NOTE_F7, NOTE_E7, NOTE_E7, NOTE_F7, 0, NOTE_D7, NOTE_E7, 0, 0, 0, NOTE_E6,}; // Tempo de la canción de Saria int saria_tempo [] = {12, 12, 6, 12, 12, 6, 12, 12, 12, 12, 6, 12, 12, 12, 12, 3, 12, 12, 12, 12 , 2, 12, 12, 6, 12, 12, 6, 12, 12, 12, 12, 6, 12, 12, 12, 12, 3, 12, 12, 12, 12, 2, 12, 12, 6 , 12, 12, 6, 12, 12, 6, 12, 12, 12, 12, 12, 12, 6, 12, 12, 6, 12, 12, 2, 12, 12, 6, 12, 12, 6 , 12, 12, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 24, 24, 24 , 1, 6, 6, 6, 6,};

void setup () {// setup lcd lcd.begin (16, 2); lcd.home (); lcd.clear (); // configurar botones // Pin del arduino controles información al presionar el botón pinMode (btn_suma, INPUT_PULLUP); pinMode (btn_resta, INPUT_PULLUP); // Iniciar el puerto Serial Serial.begin (9600); // configurar el pinMode del zumbador (9, OUTPUT); // pinMode del zumbador (13, OUTPUT); // indicador led al cantar una nota // Configurar la interrupción attachInterrupt (digitalPinToInterrupt (btn_suma), blink1, FALLING); attachInterrupt (digitalPinToInterrupt (btn_resta), blink2, FALLING); }

bucle vacío () {sing (ISRnumero);

}

// Interrupción botón suma void blink1 () {estático sin signo largo last_interrupt_time = 0; unsigned long interrupt_time = millis (); if (interrupt_time - last_interrupt_time> 200) {if (ISRnumero <4) {// A la variable numero se le sumará un uno ISRnumero ++; // Imprimir el valor de número, que representa // la cantidad de veces que se presiona el botón Serial.println (ISRnumero); // canta las melodías}} last_interrupt_time = interrupt_time; }

// Interrupción botón resta void blink2 () {estático sin signo largo last_interrupt_time = 0; unsigned long interrupt_time = millis (); if (interrupt_time - last_interrupt_time> 200) {if (ISRnumero> 0) {// A la variable numero se le restará un uno ISRnumero--; // Imprimir el valor de número, que representa // la cantidad de veces que se presiona el botón Serial.println (ISRnumero); // sing (ISRnumero); }} last_interrupt_time = interrupt_time; }

void sing (int s) {// itera sobre las notas de la melodía: int song = s; if (canción == 0) {lcd.clear (); } if (canción == 1) {lcd.clear (); lcd.setCursor (0,0); lcd.print ("'Mario Theme'");

int size = sizeof (melodía) / sizeof (int); para (int thisNote = 0; thisNote <size; thisNote ++) {// para calcular la duración de la nota, tome un segundo // dividido por el tipo de nota. // por ejemplo, cuarto de nota = 1000/4, octava nota = 1000/8, etc. int noteDuration = 1000 / tempo [thisNote]; zumbido (melodyPin, melody [thisNote], noteDuration); // para distinguir las notas, establezca un tiempo mínimo entre ellas. // la duración de la nota + 30% parece funcionar bien: int pauseBetweenNotes = noteDuration * 1.30; retraso (pausa entre notas); // detiene la reproducción del tono: buzz (melodyPin, 0, noteDuration); if (ISRnumero! = 1) {break; cantar (ISRnumero); }}} más if (canción == 2) {lcd.clear (); lcd.setCursor (0,0); lcd.print ("' }}} más if (canción == 3) {lcd.clear (); lcd.setCursor (0,0); lcd.print ("'Hada genial"); lcd.setCursor (0,1); lcd.print ("Fuente"); int size = sizeof (hada) / sizeof (int); para (int thisNote = 0; thisNote <size; thisNote ++) {// para calcular la duración de la nota, tome un segundo // dividido por el tipo de nota. // por ejemplo, cuarto de nota = 1000/4, octava nota = 1000/8, etc. int noteDuration = 1000 / fairy_tempo [thisNote]; zumbido (melodyPin, hada [thisNote], noteDuration); // para distinguir las notas, establezca un tiempo mínimo entre ellas. // la duración de la nota + 30% parece funcionar bien: int pauseBetweenNotes = noteDuration * 1.30; retraso (pausa entre notas); // detiene la reproducción del tono: buzz (melodyPin, 0, nota Duración); if (ISRnumero! = 3) {break; cantar (ISRnumero); }}} más if (canción == 4) {lcd.clear (); lcd.setCursor (0,0); lcd.print ("'Canción de Saria'"); int size = sizeof (saria_song) / sizeof (int); para (int thisNote = 0; thisNote <size; thisNote ++) {// para calcular la duración de la nota, tome un segundo // dividido por el tipo de nota. // por ejemplo, cuarto de nota = 1000/4, octava nota = 1000/8, etc. int noteDuration = 1000 / saria_tempo [thisNote]; zumbido (melodyPin, saria_song [thisNote], noteDuration); // para distinguir las notas, establezca un tiempo mínimo entre ellas. // la duración de la nota + 30% parece funcionar bien: int pauseBetweenNotes = noteDuration * 1.30; retraso (pausa entre notas); // detiene la reproducción del tono: buzz (melodyPin, 0, noteDuration); if (ISRnumero! = 4) {break; cantar (ISRnumero); }}}}

zumbido vacío (int targetPin, frecuencia larga, longitud larga) {digitalWrite (13, HIGH); Long delayValue = 1000000 / frecuencia / 2; // calcular el valor de retraso entre las transiciones //// 1 segundo de microsegundos, dividido por la frecuencia, luego dividido por la mitad ya que //// hay dos fases en cada ciclo long numCycles = frecuencia * longitud / 1000; // calcule el número de ciclos para el momento adecuado //// multiplique la frecuencia, que es realmente ciclos por segundo, por el número de segundos para //// obtener el número total de ciclos para producir (largo i = 0; i <numCycles; i ++) {// para el período de tiempo calculado ... digitalWrite (targetPin, HIGH); // escribe el pin del zumbador alto para expulsar el diaphram delayMicroseconds (delayValue); // espera el valor de retraso calculado digitalWrite (targetPin, LOW); // escribe el pin del zumbador bajo para retirar el diafram delayMicroseconds (delayValue); // espera de nuevo o el valor de retraso calculado} digitalWrite (13, LOW); }


2. El segundo paso lo vamos a realizar luego de que en nuestro simulador todo haya ocurrido con normalidad y no haya existido ningún problema. Este paso sería pasar a la vida real y armar todo el circuito en nuestra protoboard y conectarlo al arduino. Recuerden que el ser ordenados al momento de trabajar ya que se pueden perder un poco al momento de cablear si no son limpios y ordenados en lo que hacer.

3. El tercer paso esta presentado por la parte final y la estética del trabajo, en donde se puede realizar la caja que resguardará nuestros componentes, tener presente que los componentes a utilizar deben de sobresalir de la caja así que realizar su respectivo agujero para que tengan cabida. Este procedimiento se realizó en la cortadora láser de la universidad, pero si no pueden cortar su caja con una sierra, el proceso estético en ese ya dependerá de cada individuo y como es que desee colocarlo. El grabado de las imágenes des mismo modo ser hizo con una cortadora láser, lo que se puede hacer sino se cuenta con esto es pegarle estampidas para que tenga otro aspecto visual.

4. Ya con todo lo anterior hecho, conectar el arduino a nuestra fuente de poder y observar el trabajo realizado.