Interactive Speaker

Brandt Li

Overview

A side view of the Interactive Speaker. The Interactive Speaker is a black box with a curved rhombus shape; on top of it is a white fan-like shape. The box's material is transparent, and therefore, the insides can be seen, most obviously a breadboard with plenty of LEDs.

The interactive speaker lights up according to the music's rhythm (sound level). The light increases in brightness level according to the volume of the rhythm.

A top view of the Interactive Speaker.
Another side view of the Interactive Speaker.
A close-up view of the Interactive Speaker.
Brandt_Li_Video.Mp4

Hi, my name is Brandt Li, and I created an interactive speaker for my project. This Interactive Speaker is an assistive device I made that could simplify my morning routine by playing music and emitting light simultaneously. I like to have music in the morning to start my day, and my room is relatively dark. Therefore, I created a speaker that would emit light according to the rhythm (sound level) of the music it played. As shown in the video, the light's brightness level follows the volume of the rhythms. To clarify, the  LEDs in the speaker get brighter with louder volumes, and the LEDs in the speaker get dimmer with lower volumes. 

I used an MP3 player, speaker, sound detector, and LED in this project to create my interactive speaker. Through the MP3 player, the speaker emits the music stored within the player. The sound detector detects the volume of the rhythms the speaker is emitting. The volume of the rhythm, sensed by the sound detector,  determines how bright the LEDs would blink, as explained above.

Process

An image with an Arduino Uno on the left, a black circular speaker at the bottom, and a breadboard with an MP3 player and wires attached.

The initial prototype process of attempting to have the MP3 player and speaker work together. Surprisingly, having the two work alongside was a struggle because many online tutorials would not function for me. In the end, I had to use the specific speaker seen in the image, but there were also issues with it, as there seemed to be a lot of faulty speakers (potentially), and I had to keep switching until one emitted music. I also had to solder the speaker, which was a delicate process. The music playing was also very muffled and kept changing volumes, but just playing around with the connections resolved the issue.

An image with a breadboard with plentiful wires. A handful of LEDs on the breadboard on the right can be seen glowing. Behind is a sound detector, and on the right is the MP3 player, and further back is a speaker.

The working prototype of my speaker before our in-class demonstration. Everything from an outside perspective functioned adequately. However, the sound detector and the lights would not work alongside the MP3 player and the speaker within the same code. I had to upload the code twice, once to have the speaker start playing music and a second time to have the sound detector detect the music and for the lights to blink according to the volume. The code line to play the track blocks the sound decor and lights. Additionally, the MP3 player would only play one track stored on the device.

An Arduino Uno on the bottom left is connected to a breadboard with an MP3 player, speaker, and sound detector, which is connected to another breadboard with a transistor and a glowing LED. There are plenty of wires going around.

The new setup now included a transistor for the LEDs. However, having the transistor for some unknown reason prevented the sound detector from working accordingly to having the lights brighten up according to the detected volume. At this point, I attempted to sample the voltage being pushed out to the speaker to control the LED instead of using the sound detectors, which did not work. A grander problem was that the speaker would refrain from playing randomized music from the MP3 and only play one track. What's a speaker that only plays one track of music? It took forever to find a solution to solve the randomized track function and for the speaker to continuously play randomized music.

A breadboard on the bottom right with an MP3 player, speaker, and sound detector is connected to another breadboard with a transistor and a row of glowing LEDs. There are plenty of wires going around.

This was the setup after solving the randomized music issue. However, the voltage sampling would not work (in controlling the brightness of the LED). After hours of attempted debugging, it wouldn't work no matter what was tried; the serial monitor did not detect the voltage output. Before The IDeATe Lending Office closed at the last minute, I ran to the counter to borrow the sound detector again. I wish the issue were solved by bringing back the sound detector, but it didn't seem to work alongside the transistor. Some serious debugging occurred for a few hours, and finally, my interactive speaker worked. The amount of adjustment code and wiring needed to get every factor to work seamlessly together was troubling.

Discussion

During the class critique, I received positive feedback regarding the concept. One of the major concerns was regarding the functionality of the design. I completely agree that the design of the overall box ended up being too chunky, and the four corners of the box were too sharp and spikey; in addition, the features of controlling and powering the speaker could have been better executed and considered. The points mentioned were 100% valid, and I had thoughts about them while constructing the project itself. The primary issue that prevented me from acting upon these areas during the project development was that I ran into an error at each step of the project, as explained in my process above. It took so much time until the very last day of the project to get the basis functioning that I couldn't think about polishing other elements. I appreciate that everyone liked the overall design of the box, besides its functionality, and thought that it had some retro and vintage aesthetics, which made me very happy.

I am proud and satisfied with the overall final results of the project. It worked the way I wanted, with the significant components and basis of the speaker function. It was a rough process; therefore, getting the project working on the final demonstration was very fulfilling. I learned a lot about the coding and debugging process because, once again, each step of the project did not cooperate with me in any way, and only with commitment and time to resolve these steps allowed my project to function. Of course, this was a complex process, but at the same time, I did grow through this project with my knowledge. I'm glad I dedicated my time to this project and began early, but I should have spent even more time with it to flush it out. My advice to my past self would not give up because only through time did it seem as if my project would slowly develop and work. The result was very fulfilling; knowing I could build such a product was an accomplishment. I would do it all again; no regrets!

I do plan to build another iteration of the project. A significant change in component would be to use an Arduino Nano so that I could scale down the speaker and bring it around. I would also include an actual battery so it wouldn't have to be connected to my laptop. So, I would flush out some elements of the current product, including aspects from the feedback given to me through the critique. 

Overall, I am proud of my interactive speaker and would love to flesh out the concept as a final product I will use daily.

Technical Information

A block diagram of the Interactive Speaker, connecting the Arduino, MP3 player, speaker, sound detector, and LEDs, separating the input and outputs.
A schematic of the Interactive Speaker detailing the actual physical connections between the Arduino, MP3 player, speaker, sound detector, and LEDs.

/*


Interactive Speaker

Brandt Li


 Interactive Speaker uses an MP3 player, a speaker, a sound detector, and LEDs to create a speaker that emits light according to the rhythm (sound level) of the music it plays.

The light's brightness level follows the volume of the rhythms. To clarify, the  LEDs in the speaker get brighter with louder volumes, and the LEDs in the speaker get dimmer with lower volumes.

The project is created to simplify my morning routine by playing music and emitting light simultaneously. I like to have music in the morning to start my day, and my room is relatively dark.


PIN MAPPING:

 pin   |  mode   | description

 --------- MP3 Player ---------

 11    |  INPUT  | RX

 10    |  INPUT  | TX

 ------- Sound Detector -------

 A0    |  INPUT  | Envelope

 ---------------- LED ----------------

 9     |  OUTPUT | All LEDs


Credit for MP3 Player's Code: https://www.youtube.com/watch?v=PBdqgHj_AkU


*/


#include "mp3tf16p.h"


//MP3 Player & Speaker


MP3Player mp3(10, 11);

int randomTrack;

int numTracks;

int audioVolume;


// Sound Detector & LEDs


int soundPinReading;

const int soundPin = A0;

const int ledPin = 9


// Set up of the MP3, Sound Sensor, and the LEDs


void setup() {

 Serial.begin(9600);

 mp3.initialize();

 numTracks = 7;

 Serial.print("numTracks = ");

 Serial.println(numTracks);


 pinMode(ledPin, OUTPUT);

}


void loop() {

  int soundValue = analogRead(soundPin); // Read sound level (0-1023)

 Serial.println(soundValue);


 // Mapping sound value to LED brightness, getting the LED to brighten or dim in accordance with the volume detection


 int scaledsoundValue = map(soundValue, 0, 1023, 0, 50); //Sound - Sound

 int ledBrightness = map(scaledsoundValue, 0, 50, 0, 255) + 110; //Sound - Light


   if (1 <= scaledsoundValue && scaledsoundValue < 17) {

   ledBrightness = 130;

 } else if (18 <= scaledsoundValue && scaledsoundValue < 33) {

   ledBrightness = 185;

 } else if (34 <= scaledsoundValue && scaledsoundValue <= 50) {

   ledBrightness = 255;

 }


 // LED brightness


 analogWrite(ledPin, ledBrightness);

 delay(45);


 // To begin the playing of randomized tracks from the MP3 to the speaker


 randomTrack = random(1,7);

 Serial.print("randomTrack = ");

 Serial.println(randomTrack);


 audioVolume = 25;

 mp3.playTrackNumber(randomTrack, audioVolume);


 delay(100)

}