Introduction: Arduino Music Reactive Desktop Lamp
In this build, we will make a reactive LED desktop lamp using simple components and some basic Arduino programming. It makes an impressive effect where the light will dance to all sounds and music. I completed this project with a teammate.
What inspired me to do this? During one of the tutorial of my module, we were given the opportunity to learn how an Arduino works and I was since fascinated by the countless possibilities of it, coupled with the fact that it is an open source hardware. Having tasked to create and refine a Digital Artefact, I wanted to use computation as a tool and a medium for expressing Art and Culture through this physical Digital Artefact. Also, I have always had a thing towards object containing LEDs as I feel that LED strips govern a wide range of possibilities — from the way it is put together with the object, to the control of the colour. It could make a simple object look great and interactive. What better is if we could make it a wearable object. I am sure most of you will have known about the DJ marshmello and his iconic headgear. My original concept was to refine the wearable marshmello helmet, incorporate LED lights — powered by Arduino and accelerometer motion sensor, to it (will touch more on this in the final thoughts). However, due to budget (cost of LED is expensive..) and practical project considerations at the point of time, we altered the idea into this sound reactive marshmello LED lamp. It can definitely be seen as a medium that showcase pop culture, and being a sound reactive lamp, it appears to be a digital art.
This is our version of the project. All credits to the youtuber's "Natural Nerd", we followed based on what they had done and will like to thank them for providing us with details on how to do the project. (Natural Nerd)
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: MAIN SUPPLIES
First things first: these are the supplies we do need. They are largely optional — on basis that you can easily make your own improvisation and customisation to your project. Even so, some key items are needed if you want to follow this guide:
- Arduino Uno (or any equally small Arduino type)
- Sound Detector Module
- External power supply
- Individually Addressable LED strips 60 leds per meter
- Jumper wires
Depending on the look you want to achieve, you might want to arrange the strips differently or radiate the light in another way. For my approach, I used the following items:
- A recycled glass jar (or any other jar that fits your dimension)
- A black card paper
- Foam Board
- Spray paint (used to coat the jar)
All of the key items were bought from Continental Electronic (B1-25 Sim Lim Tower), the LED strips were by far the most expensive part that cost SGD 18 for 1 meter — we used 2 meter. The rest of the items were either recycled materials or bought from the neighbourhood convenience/ hardware store.
Step 2: POWERING THE COMPONENTS
I used an external power supply such as an AC to DC power source — the guy at the counter suggested for an external power supply as it would be better to power a 2 meter LED strip, and not burn the USB port. If you are using 1 meter or less, you do without the external power supply and just use the Arduino Uno's USB cable and directly plug it in to the pc.
The main component of the project is the sound detector module. It will provide an analog signal (input) to the Arduino, which is used to light the RGB lights (output). The external power supply will power all three components — Arduino, sound detector module, and LED lights. Wire the VIN (or 5V) on the Arduino and VCC on the sound detector board to the positive input. Then wire the GND on the Arduino and the detector to the negative. This is illustrated on the attached schematic. We also need to hook the 5V and GND input on the LED strip to the power source.
We used a breadboard as an intermediary for these connections. Power supply will go to the breadboard from the external power source, which will then power the three components as mentioned.
Note: our tutor suggested the use of a resistor for the connections between power and sound detector module, such that not all power will go to the module, allowing for better input.
Step 3: DETECTOR AND STRIPS
After connecting all three components to the power, we then need to connect them to each other.
The sound detector module will communicate with the Arduino over the analog input pins — I will be using pin A0.
The LED strips need a digital pulse to understand which LED to address. Thus, the digital output pin DI need to be connected to the Arduino. I will be using pin 6 on the Arduino. We got the shop where we purchased the electronics to solder all jumper wiring for the LED strip. Hence, there was no soldering job required for our own, saving the hassle of that. What left needed was just to hook a male-female cable on to it.
Similarly, you can just follow the schematic diagram provided to get an overview of the connections.
Step 4: UPLOADING THE CODE
This is arguably the most important part of the project. You can find source of the the code I used here (link) or my version of it (attached file). The main principle is to map the analog value attained from the sensor, to the number of LEDs to show.
To start off every time, we want to ensure that all lights are working as expected. We can do this by using the array function, which will let you to turn on all individual LEDs.
Then, we go on to the main function for visualising the sounds in the lamp. We can do this using the map function. This will let us display a certain number of LEDs given the quantifiable variable input. For my approach, I decided to pump up the number of LEDs in the set up (180 defined in the code as opposed to the 120 leds that I have). I tried various set up — including adjustment to the sensitivity on the sound detector module, variations of the microphone low and max value, etc. However, I could not achieve a desirable visualisation until having pumped up the number of LEDs. There is also a second layer of procedurality. The code will let for more advanced tracking of the sound intensity based on averages, to let the light change colours when the song enters a peak — 'HIGH mode'.
Depending on the look you want to achieve, you might want to make adjustments to the code used. This video (link) explains the codes in detail.
Step 5: PREPARING THE HOUSING
First, I rolled the black card paper to approximately the same circular and diameter as the opening of the glass jar. I did not have the proper measuring tools. Hence, I improvise by basically rolling the whole black card paper into the jar. After measuring the amount of length of black card paper I need to use, I cut it carefully by following the mark that I provided. I then taped the ends together to form a cylindrical tube. The length and height of the housing depends on dimension of your jar. You may use any length that you desire.
Next, I wrap the housing that I had done with the LED strip around it, masking the entire surface of the housing. This was done just with the adhesive on the back of the strip. I make sure that a small slit is cut out to allow for the excess wire length to be slide inside the housing for neater wire management, and not obstruct the flush surface.
Thirdly, The hollow cylindrical tube is used as an advantage by stuffing the electronics on the inside. For starters, I secured the wire connections on the Arduino and breadboard, using blue tack. Then, I taped the excess wire length down using the normal 3M tape. This step is a precautionary measure to prevent the wires from easily disconnecting in the process of assembly.
Fourthly, the assembled board is then ready to be inserted into the housing. Since the electronics is "hidden" inside the housing, the layout of the build must be one such that it allows the user to have easy access to the Arduino USB. Not only that, the sound detector module will also have to be faced down for the module ease of picking up the surrounding sound input. The assembled board is therefore being set up vertically to allow for that. Some of the foam board were used to hold the assembled board to the housing. During this step, the LED strip will be connected (with the red, orange, yellow jump wires) following the placement of the electronics. All connections are done up to this point, except the ones to the external power source — the red and black wire.
Step 6: THE CASING ITSELF
Since I am basing the desktop lamp to be a replica of marshmello's head, I had to coat the entire glass jar — except the eyes and mouth portion which had to be black, with the white spray paint. A stencil of the eyes and mouth is cut out and pasted on the jar before the spray work. The jar was left to dry before the placement of the eyes and mouth from inside the jar. This was done using the remaining black card paper (initially I thought of just painting it black). The effect turned out well as it looks like the eyes and mouth layer were actually being cut out.
The metal lid needed to have a central opening for the access to the Arduino USB, sound detector module, and power supply as mentioned. I managed to do the cutting at the workshop in school.
Step 7: FINISHING UP
It is now the final assembly of the build.
The LED strip is first checked to ensure that the lights are actually working, and all connections are proper. Having ensured that the components are working, you can go on to insert the housing into the jar casing you made. You can see by the hole (even after placement of the lid), and the placement of the electronic components, you can reach both the Arduino USB interface and the power input from underneath. The sound detector module is protruding slightly outwards as well, for better sound capture. For the legs, I used cubes cut out from the foam board, and painted it black. Ideally, you can use some nice wood stand for your desktop lamp.
Note: the paint work initially was badly done as seen from the watermarks in the first prototype, therefore, I had to scrap off the whole coating using thinner then, resprayed it. This definitely took some extra effort which you can look to avoid.
And finally, I completed the project. It definitely took repeated trial and errors — either to get the code going, or with regards to alteration of the assembly process, but I was happy with what was achieved.
Step 8: COMPLETE
This was a great project and I had a fun time doing it. Furthermore, it is especially great as it is so customisable and allow for any time update in the future. The code can be reworked at any point, and you basically get a 'new' lamp each time.
There is however, so much more improvement and/or variations that can be made to the build.
You can add various button inputs connected to the Arduino. With this, you can change the mode to implement a general lamp feature, with for instance general pulsing. This allows switching between the current sound reactive mode, and general gradient pulsing mode. Another button can be implemented for you to change the colour set of the radiating lights (set 1 — blue to yellow, set 2 — red to purple, etc). Or even more so, you can have 3 layers of procedurality where there is more modes to the advanced tracking of the sound intensity based on averages — 'LOW', 'NORMAL', 'HIGH'. That way, you will achieve a wider range of colour wave.
I also like to go back to my original concept, the wearable marshmello LED head. This will seem like a bolder build, which couples both the use of a sound detector module and accelerometer motion module. The sound detector module will general the pulse visualisation of the LED lights, whereas the accelerometer motion module will change the colour of the lights in accordance to the input it reads — degree of movement by the user.
Basically, the idea here is that the limitations are endless, and is one that is only restricted by your vision. Thanks for watching/reading and have a great time with your Arduino!