DIY : Mood Lamp, Under The Hood – Sai Akhil Pulikam – Medium

Schematic

It was sophomore year of college and two other students (John Mera &Ryan Smock) and I were responsible for designing a digitally coded and electrically wired group project for an engineering class. We had 2 months to design and build the project; we decided to create a mood lamp that changes color based on both frequency and amplitude of the sounds it picks up on. We were entirely on our own to pick the right tools, materials, and parts for the project. We debated the best type of electrical design for the job, and we began writing down the different pieces we would need for this carefully-coded puzzle. We eventually programmed the musical mood lamp in C++

Before we could start coding, though, we needed a conduit through which our program could flow. The system we used was fairly simple, and consisted of: An Arduino, microcontroller; RGB LED lights; a microphone; a light-dependent resistor; a regular resistor; a Breadboard (for circuits); some jumper cables; and finally, some paper to act as a lampshade. We also used wires to tie it all together.

We achieved various brightness levels for the LEDs without using a variable resistor. We used software to adjust the brightness of standard fixed brightness RGB LEDs. We achieved this using Pulse Width Modulation. Over a short duration of time, if we turn off the LED for 50% of the time and turn it on for the other 50% of the time, to the human eye it appears to be 50% bright. The key hear is “short amount of time”, the time period has to be short enough such that we should not be able to see it blink. In this case the LED’s duty cycle is 50%. If we turn off the led (using software) for 70% of the time and turn it on for 30% of the time, the LED will be 30% bright and it’s duty cycle is 30%.

The microphone receives the sound and converts it to an electrical signal. In our code, we correlated amplitude of the electric signal with intensity (brightness) of the LED’s, and the frequency of the electric signals with wavelength (color) of the light. It took us a while to tune it and get it right, so that we could have the brightest reds for high frequency and high amplitude sounds i.e., when the beat drops. If you would like to learn more about mood lamps, read my previous article in the musical mood lamp series.

LEAVE A REPLY

Please enter your comment!
Please enter your name here