WaveLamp: a DIY Interactive Lamp That Reacts to Music
by PJ2000 in Circuits > Arduino
10104 Views, 124 Favorites, 0 Comments
WaveLamp: a DIY Interactive Lamp That Reacts to Music
WaveLamp is a music reactive lamp with individually addressable pixel rings. The basic idea was to create a music reactive lamp with multiple individually addressable/programmable light rings for a cool wave-like motion lights with the beats. Having individually addressable rings makes it possible to have a wide variety of colors and light movements.
The design has 15 assorted LEDs stacked between a sandwich of 3D printed 'Mid rings' and clear acrylic rings, which act as diffusers. I wanted to keep the design minimal with 5 independently addressable pixel rings. The interesting thing about the design is that each LED in the ring is individually addressable as well, making the lamp extremely versatile in terms of colors and light movements. The ability to individually control each LED and pixel ring makes the lamp appealing and we can play around with a lot of variables. The thought of mixing different colors to get a completely new color was super fascinating to me, so I went ahead with individual LEDs rather than using an RGB LED strip and it worked seamlessly.
I hope you have fun reading and making this!
Supplies
Here is the list of all components, tools and consumables used in this project:
2.1 Components
- Arduino UNO
- Analog Sound Sensor
- Assorted 5 mm LEDs (Red, Blue, Green, Yellow) x5 each
- Jumper wires
2.2 Tools
- 3D printer
- Laser-cutter
- Soldering Iron
- Heat gun
2.3 Consumables
- White PLA filament
- Heat shrinking tubes
- Solder wire
- Clear Acrylic sheet (3 mm thickness)
2.4 Software Packages
Design & 3D Printing
The basic idea was to create a music reactive lamp with multiple individually addressable/programmable light rings for a cool wave-like visual affect. Having individually addressable rings makes it possible to have a wide variety of colors and light movements. The design has 15 assorted LEDs stacked between a sandwich of 3D printed 'Mid rings' and clear acrylic rings, which act as diffusers. I wanted to keep the design minimal with 5 independently addressable pixel rings. The lamp was designed using SolidWorks 2022 and printed on an Ultimaker S3 FDM printer. The mainly consists of three 3D printed components, which are:
- The base
- Mid Rings (Need to print 5 of these)
- The top cover
The base has inbuilt mounts for Arduino and houses all the electronics. The mid rings are arranged in a stack like fashion with laser-cut acrylic rings sandwiched between successive mid rings. The STLs of all three components are attached here for 3D printing. The parts were printed with 20% infill and 0.2 mm layer thickness using white PLA filament.
Laser Cutting the Acrylic Diffuser Rings
To get a cool visual experience and diffuse light, I laser-cut rings from a 3 mm thick clear acrylic sheet. I salvaged these rings from some acrylic scrap which I had lying around. The .sldprt file which I used to laser cut the diffuser ring can found here. It can be exported as .DXF or any other file format your laser-cutter is compatible with.
Downloads
Creating the Pixel Rings
The next step is to create the individually programmable 'Pixel Rings'. Each of the 5 rings have 3 LEDs of different colors. The first three rings have red, blue & yellow LEDs, whereas the last two have red, blue and green LEDs, for added variety of colors. The interesting thing about the design is that each LED in the ring is individually addressable as well, making the lamp extremely versatile in terms of colors and light movements. The ability to individually control each LED and pixel rings makes the lamp really interesting and we can play around with a lot of variables. To create a pixel ring:
- I started off with placing the 5 mm LEDs in the mounts. You might have to super glue the LEDs to fix them in place.
- Once the glue dries up, solder all the negative terminals of the LEDs together. We will have one common ground for all LEDs.
- Split a male-male jumper wire in half and insert the heat shrink tube. Then solder a jumper wire individually to each of the LED and one jumper to the common ground.
- Use the heat gun to shrink the tubes and reinforce the solders.
- Glue on Acrylic diffuser ring to the top end of the mid-ring.
One pixel is ready! Repeat this four more time for the complete stack.
Assembling the Pixel Ring Stack
Before I start with this step, some advice. Do your future self a favor and test all LEDs before assembling the stack :)
After making 5 functional pixel rings, the next step is to assemble the Pixel ring stack. For that:
- Solder all common grounds together as per the schematic. Pass the ground wire of topmost pixel ring through the wire hole of the penultimate pixel ring and solder it to the ground of the penultimate ring.
- Repeat the process for all rings and you should end up with a single ground wire.
- Next, pass all the LED signal wires through the wire holes to the bottommost pixel ring. The assembly should resemble closely to image 1.
- Once everything is in place, glue it all up with Gorilla super glue and wait for it to dry.
Yay! The pixel ring stack is assembled. Time to test the stack! If all is good, we proceed to house the electronics and assemble the lamp.
- Mount the Arduino on the printed spacers and place the sound sensor close to the sound grill.
- Following the schematic connect the Pixel Stack and the sensor to the Arduino.
- Carefully place the Pixel stack on the base and seal with super glue.
The Code
WAVELAMP V1.0.0
Music Reactive lamp with individually addressable pixel rings.
This is the main frame code. Functions for different light movements and colors have been pre-programmed. Full list of functions () can be found in the readme file located in the git repository. You can create your own light designs by tweaking functions. Replace the '0' with 'val' to turn on a particular LED and vice-a-versa. Adjust the int time variable to set the speed of light motion. By default, it is set to 40 milliseconds.
************************************************************************************************
Arduino Library for Wave Lamp is under-development and will be released soon. This will eliminate the need of including all functions in the code. #Include the library and call the function.
***********************************************************************************************
/*
WAVELAMP
NOTE: this is not the full code. Download wavelamp.ino for all inbuilt functions
Created 9 Nov 2022
by Pranav Jhunjhunwala
*/
int val;
int time = 40; // Time delay of 40 milli-seconds between each beat
int r1 = 13; int b1 = 11; int y1 = 12;
int r2 = 10; int b2 = 9; int y2 = 8;
int r3 = 7; int b3 = 6; int y3 = 5;
int r4 = 4; int b4 = 3; int g4 = 2;
int b5 = A2; int g5 = A1; int r5 = 0;
void setup()
{
Serial.begin(9600); //Initializing the serial monitor at 9600 baud rate
}
void loop()
{
val=analogRead(A0); // Sound Sensor analog input
val=map(val, 0, 1023 , 0, 255); // Mapping the analog values to a 256 scale
Serial.println(val); // Print mapped sensor values in serial monitor
if(val >= 200){
collide_purple_blue(); // Function for wave like movement of purple and blue
}
else{
all_shut();
}
}
Downloads
The Future
WaveLamp is an open-source initiative that is constantly in development. It will be great if other builders contribute to the project. The next few steps that I have in mind are:
- Create and publish an Arduino Library, which make tinkering with lamp much easier and user friendly (Under development)
- Add a few more layers of pixel rings
- A few more LED colors in each ring
- Using ESP 8266 to control the lamp wirelessly using a mobile application.
Thanks for Reading!