Mini DJ Set
Mini DJ Set
What I wanted to learn, and why it interested me: [I wanted to create a interaction where I can control the sound of the speaker and play different songs. It interested me because I want to design products like speakers and headphones which by doing this exercise, I believe I can learn the basics of making them.
Final outcome: [I created a mini DJ set. I have 5 different push buttons that plays all different sounds when clicked. Through 1 to 4 push buttons they play a brief part of the song and the 5th button plays the entire song. The potentiometer controls the volume of the sound. So, with the mini DJ set, you can create your own sound experience!]
Images of final creative/exploratory output
[Video demonstration of Mini DJ Set: Clicking the push button will result in playing different sounds, responsive to the connected music files. The potentiometer controls the volume of the sound.
[The push buttons on the smaller breadboard plays brief parts of a song(harder better faster stronger by Daft Punk) and the other push button will result in playing the whole song when clicked.]
Process images from development towards creative/exploratory output
[Cutting the audio : Getting the music files for each parts, I used the audio editor that is default on mac to cut parts that I needed from the original song. ]
[Naming the music files and upload them on to SD card was crucial because it can sometimes create problems for DFPlayer to be confused when reading the files.]
Process and reflection:
[I started this project by experimenting with a simple speaker connected to the Arduino to see if I could produce sound at all. At first I was confused about how the Arduino would actually read music files from the SD card, but after some trial and error I realized that the SD card had to be inserted into the DFPlayer Mini, which handles the decoding of MP3 files. Once that became clear, I chose a song that felt right for my mini DJ set: Harder, Better, Faster, Stronger by Daft Punk. I extracted the sections I wanted into four separate files, and also kept a full version of the song as one additional file. After that, I wired the push buttons and potentiometer, programmed each button to trigger a different file, and used the potentiometer to control volume.
Through this process, I learned not just about wiring and libraries, but also about how modules like the DFPlayer simplify tasks that Arduino alone can’t do. I was surprised by how strict the SD card formatting and file naming rules were, since even small mistakes could stop playback. In the end, I feel proud because I ended up with a working “mini DJ set” that is fun and interactive, and it gave me confidence that I can combine hardware and software to make creative projects.]
Technical details
[Electrical schematic of Mini DJ Set
/*
60-223 Intro to Physical Computing, fall 2025
Domain-specific Skill Building exercise: Mini DJ Set with DFPlayer
This sketch connects an Arduino Uno to a DFPlayer Mini MP3 module,
five push buttons, a potentiometer, and a speaker. The potentiometer
controls volume, while each button plays a different MP3 file
stored on the SD card. The DFPlayer handles decoding and playback, and
the Arduino sends serial commands to start or stop songs depending on
the button pressed. Output is heard through a small speaker wired to the
DFPlayer's SPK1/SPK2 pins.
Pin mapping:
Arduino pin | role | details
-----------------------------------------------
A0 input potentiometer
7 input push button → plays 0001.mp3
8 input push button → plays 0002.mp3
9 input push button → plays 0003.mp3
10 input push button → plays 0004.mp3
11 input push button → plays 0005.mp3
2 software TX Arduino TX → DFPlayer RX (via ~1k resistor)
3 software RX Arduino RX ← DFPlayer TX
SPK1/SPK2 output speaker driven directly by DFPlayer
Released to the public domain by Russell Sang, October 2025, Codes from ChapGPT5
*/
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
// DFPlayer serial (UNO/Nano)
static const uint8_t PIN_MP3_TX = 2; // Arduino TX -> DFPlayer RX
static const uint8_t PIN_MP3_RX = 3; // Arduino RX <- DFPlayer TX
SoftwareSerial mp3Serial(PIN_MP3_RX, PIN_MP3_TX);
DFRobotDFPlayerMini player;
// I/O
const int POT_PIN = A0; // volume control
const uint8_t BTN_PINS[5] = {7, 8, 9, 10, 11}; // five buttons to GND
const uint8_t TRACKS[5] = {1, 2, 3, 4, 5}; // plays 0001–0005.mp3
// Debounce
int lastBtnReading[5];
int btnStableState[5];
unsigned long lastDebounceTime[5];
const unsigned long DEBOUNCE_MS = 35;
// Volume cache
int lastVol = -1;
void setup() {
pinMode(POT_PIN, INPUT);
for (int i = 0; i < 5; i++) {
pinMode(BTN_PINS[i], INPUT_PULLUP); // button wired to GND
lastBtnReading[i] = HIGH;
btnStableState[i] = HIGH;
lastDebounceTime[i] = 0;
}
Serial.begin(9600);
mp3Serial.begin(9600);
Serial.println(F("Init DFPlayer..."));
if (!player.begin(mp3Serial)) {
Serial.println(F("DFPlayer init FAILED. Check wiring & files (0001..0005.mp3 in root)."));
while (true) { delay(500); }
}
Serial.println(F("DFPlayer ready."));
delay(300);
// Set initial volume from pot
int vol = map(analogRead(POT_PIN), 0, 1023, 5, 28);
player.volume(vol);
lastVol = vol;
}
void loop() {
// --- Volume from potentiometer ---
int vol = map(analogRead(POT_PIN), 0, 1023, 5, 28);
if (vol != lastVol) {
player.volume(vol);
lastVol = vol;
}
// --- Buttons: play corresponding track on press ---
for (int i = 0; i < 5; i++) {
int reading = digitalRead(BTN_PINS[i]); // LOW when pressed
if (reading != lastBtnReading[i]) lastDebounceTime[i] = millis();
if (millis() - lastDebounceTime[i] > DEBOUNCE_MS) {
if (reading != btnStableState[i]) {
btnStableState[i] = reading;
if (btnStableState[i] == LOW) {
uint8_t trk = TRACKS[i];
player.stop();
delay(80); // give module a moment
player.play(trk);
Serial.print(F("Playing 00"));
Serial.print(trk);
Serial.println(F(".mp3"));
}
}
}
lastBtnReading[i] = reading;
}
// DFPlayer status feedback
if (player.available()) {
uint8_t type = player.readType();
int value = player.read();
// Uncomment for debugging:
// Serial.print("Evt "); Serial.print(type);
// Serial.print(" val "); Serial.println(value);
}
delay(5);
}