Project tutorial

Arduino Jukebox for My Rock Band © CC BY

After 20 years, my underground school rock band reunited for a few concerts and I've decided to develop a small Arduino jukebox.

  • 3 views
  • 0 comments
  • 0 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)

About this project

My underground rock band reunited after 20 years and I've decided to create a small jukebox with some of our "hits" using Arduino Nano, a DFPlayer Mini, a speaker, three buttons, and a 16x2 LCD display.

For the case I've used Fusion 360. I'm attaching the STL file. The original idea was to create a jukebox like case but I didn't have time. Maybe someone can contribute with an improved case?

For the LCD display, get the I2C interface so only 2 signal cables, 5V and ground are required.

Like the project? Give us a follow in SoundCloud or Instagram.

Code

Jukebox Arduino CodeC/C++
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include "SoftwareSerial.h"

// Rock band Jukebox 
// by Roni Bandini @RoniBandini
// Buenos Aires, Argentina 
// September 2018


LiquidCrystal_I2C lcd(0x3F,16,2);  
SoftwareSerial mySerial(10, 11);

# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00  
# define ACTIVATED LOW

int button1 = 2;
int button2 = 3;
int button3 = 4;

void setup() {


  pinMode(button2, INPUT);
  digitalWrite(button2,HIGH);
  pinMode(button1, INPUT);
  digitalWrite(button1,HIGH);
  pinMode(button3, INPUT);
  digitalWrite(button3,HIGH);
  
  mySerial.begin (9600);

  Serial.begin(115200);
  
  Serial.println();
  Serial.println(F("Jukebox started"));
  
  
  lcd.init();    
  lcd.backlight();  
  lcd.print("RockBand Jukebox");
  lcd.setCursor(0, 1);
  lcd.print("by RoniBandini");

  playFirst();
  //isPlaying = true;
  delay (3000);

  lcd.print("RockBand Jukebox");
  lcd.setCursor(0, 1);
  lcd.print("Select song     ");
 
}

void loop () { 
  

 if (digitalRead(button1) == ACTIVATED)
  {
   

     Serial.println(F("Play 1..."));  
     lcd.print("RockBand Jukebox");
     lcd.setCursor(0, 1);
     lcd.print("Song 1          ");         
     //playNext();
     execute_CMD(0x0F,0x01,0x01); 
    
    
  }
  
 if (digitalRead(button2) == ACTIVATED)
  {

   Serial.println(F("Play 2..."));  
   lcd.print("RockBand Jukebox");
   lcd.setCursor(0, 1);
   lcd.print("Song 2           ");
   //playNext();
   execute_CMD(0x0F,0x01,0x002); 
  }




   if (digitalRead(button3) == ACTIVATED)
  {
  

   Serial.println(F("Play 3..."));  
   lcd.print("RockBand  Jukebox");
   lcd.setCursor(0, 1);
   lcd.print("Song 3           ");
   //playNext();
   execute_CMD(0x0F,0x01,0x03); 
  
  }
}

void playFirst()
{
  execute_CMD(0x3F, 0, 0);  
  delay(500);
  setVolume(25);
  delay(500);
  //execute_CMD(0x11,0,1);  
  //delay(500);
}

void pause()
{
  execute_CMD(0x0E,0,0);
  delay(500);
}

void play()
{
  execute_CMD(0x0D,0,1); 
  delay(500);
}

void playNext()
{
  execute_CMD(0x01,0,1);
  delay(500);
}

void playPrevious()
{
  execute_CMD(0x02,0,1);
  delay(500);
}

void setVolume(int volume)
{
  execute_CMD(0x06, 0, volume);  
  delay(2000);
}

void execute_CMD(byte CMD, byte Par1, byte Par2)
// Excecute the command and parameters
{
// Calculate the checksum (2 bytes)
word checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);
// Build the command line
byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge,
Par1, Par2, highByte(checksum), lowByte(checksum), End_Byte};
//Send the command line to the module
for (byte k=0; k<10; k++)
{
mySerial.write( Command_line[k]);
}
}


 
  

Custom parts and enclosures

Case front

Schematics

Circuits
Jukeboxcircuit 11crn1xqyu

Comments

Similar projects you might like

Arduino Bluetooth Basic Tutorial

by Mayoogh Girish

  • 455,654 views
  • 42 comments
  • 240 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 286,207 views
  • 95 comments
  • 672 respects

Security Access Using RFID Reader

by Aritro Mukherjee

  • 230,828 views
  • 38 comments
  • 241 respects

OpenCat

Project in progress by Team Petoi

  • 199,723 views
  • 155 comments
  • 1,391 respects
Add projectSign up / Login