Introduction: Sound Reactive (VU) Colour Changing Mason Jar Lamp
This is a simple yet elegant looking colour-changing frosted mason jar lamp that changes colour based on the surrounding music. The frostings on the mason jar diffuses the light from the RGB LED making it look very uniform and beautiful especially in the dark.
Step 1: Clean
Run a stream of hot water over the adhesive for about 3 to 5 minutes. The sticker should peel off very easily. The, scrub off the excess adhesive and let it dry on a piece of clothe.
Step 2: Spray
Lightly and evenly coat it with 3 layers of frosted spray paint. I have a more comprehensive guide on how to frost mason jars in this Instructable: https://www.instructables.com/id/How-to-Make-an-E...
Step 3: Solder
Solder the resistor onto the anode of the LED so it is more convenient to wire up. This also allows this project to go breadboard-less.
Step 4: Wiring
* Connect the ground pin of the RGB LED (the longest one) to the GND pin on the Arduino
* Connect the red LED pin of the RGB LED (the one at the edge right next to the longest one) to pin 5 on the Arduino.
* Connect the green LED pin of the RGB LED (the one at the centre next to the longest one) to pin 6 on the Arduino.
* Connect the blue LED of the RGB LED (the last one by process of elimination) to pin 9 on the Arduino.
Note that these pins numbers are very important as these are the PWM pins of the Arduino which is the only way we can control the individual brightness of each of these LEDs thus being able to light every colour in the visible spectrum.
Sound Detector
* Connect the VCC pin to 3.3V on the Arduino
* Connect the GND pin to the GND pin on the Arduino
* Connect the Envelope Pin to pin A0 on the Arduino.
Step 5: Code
//pin variables
const int redPin = 5; const int greenPin = 6; const int bluePin = 9; const int soundPin = 0;
//variables for storing raw sound and scaled value int sound; int scale;
void setup() { //start the serial port a@ 9600bps Serial.begin(9600); //set RGB pins to OUTPUT pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); }
void loop() { //read and store the audio from Envelope pin sound = analogRead(soundPin); //map sound which in a quiet room a clap is 300 //from 0 to 3 to be used with switch case scale = map(sound, 0, 300, 0, 3);
//print values over the serial port for debugging Serial.print(sound); Serial.print(" "); Serial.println(scale);
//switch case on scaled value switch (scale) { //if 0 RGB = Blue case 0: digitalWrite(redPin, LOW); digitalWrite(greenPin, LOW); digitalWrite(bluePin, HIGH); break; //if 1 RGB = Green case 1: digitalWrite(redPin, LOW); digitalWrite(greenPin, HIGH); digitalWrite(bluePin, LOW); break; //if 2 RGB = Yellow case 2: digitalWrite(redPin, HIGH); digitalWrite(greenPin, HIGH); digitalWrite(bluePin, LOW); break; //if 3 RGB = Red case 3: digitalWrite(redPin, HIGH); digitalWrite(greenPin, LOW); digitalWrite(bluePin, LOW); break; //default off default: digitalWrite(redPin, LOW); digitalWrite(greenPin, LOW); digitalWrite(bluePin, LOW); break; } }
Step 6: Enjoy!
Enjoy your pretty little sound reactive lamp!

Participated in the
Makerspace Contest 2017
2 Comments
5 years ago
This looks so much like 2 other posted rgb projects https://www.instructables.com/id/RGB-LED-Sound-Lev...
https://www.instructables.com/id/LED-Sound-Decibel...
1 pin was changed so what post is the one that was copied? either way Very nice job in a low key red-neck kind of way...I like it hell it actually was the 1 I seen first LOL...I made this as well LOL I have them all over my yard in the small 1/2 pint size jars they actually sell in Value Home Centers now Hahahaha.... If only I did it and patented it befor them I swear my dumb ass neighbor copied me and did it.... That's ok wait until this Christmas I have been building a major music to lights build to use outside I will be posted on the news this year.... I combined 3 of the instructables useing relays and I went 1 step father useing Presonus softwar...
Reply 5 years ago
PS I like STRAWBERRY Myself Hahaha.... Oh ya Farther not FATHER MY BAD FAT SAUSAGE FINGURES You should see me when I code I have replaced 9 keyboards already over anger from fat fingures....