*IMPROVED* Smart LED Candle: Reactive to Sound and Aesthetically Pleasing

2,031

28

3

I'm a Game Art student at the HKU University of the Arts Utrecht, in the Netherlands

Intro: *IMPROVED* Smart LED Candle: Reactive to Sound and Aesthetically Pleasing

Remember the "smart" LED candle from a few months ago?

Well, the idea was nice, but the overall execution lacked some oomph. Technologically and aesthetically speaking there was a lot to improve.

First off, as an artist, I wanted the container for the candle to look amazing. Or at least better than the old cardboard box I wrapped for the old project. At that time, I got encouraged at school to look into the art of lasercutting.

In this tutorial I am not going to cover the steps of how I made the box however, because that would be a full-on instructable in itself.

I would recommend to be creative and think outside of the box (har har) when making an aesthetically pleasing container for your own project.

It is a very rewarding experience when you are pushed outside of your comfort zone and to have learned a new skill in the end.

Step 1: Requirements

- Arduino Uno

- 4x LED lights (I used 2 red and 2 blue LEDs, but you can choose whatever colors you like)

- LDR / Photo resistor

- 4x 220 Ohm resistors

- 1x 10k Ohm resistor

- Arduino Compatible Microphone Sound Sensor Module (I used Velleman's VMA309)

- Jumper wires, male to male and female to male

- Container of choice with 2 compartments; one to hide the electronics in and one to put your light in (I highly suggest making one yourself)

Step 2: Make a Fabulous Container for Your Project

When it comes to choosing what type of container you want to make, the options are endless.

As long as one of the containers is open on at least one side (for the LEDs to be visible from the outside) and the other one closed (for the Arduino and all the wires to be invisible from the outside), you could go for any material, size or shape.

In my case I went for a wooden box with a laser cut design of geometrical shapes.

TIP: You can easily make a laser cutter ready plan for boxes like these in any size and even incorporate holes for wires and such with MakerCase. You can then load your plan into Adobe Illustrator and create your own design.

Step 3: Arduino: Breadboard & Schematics

For visibility purposes the parts in the breadboard schematic are shown a little differently from the actual breadboard in the next steps, but don't worry! The way everything is connected is the same.

- Red wires are + and go to the 5V pin

- Black wires are - and go to the GND pin

- Colored wires are to communicate with the Arduino; yellow for the LDR, green for the sound sensor and blue for the lights

Step 4: Assembling on Your Breadboard Part One: LDR

Start by sticking an LED light in your breadboard.

Connect the long leg (+) with a red jumper wire to digital pin 13 in the Arduino.

Connect the short leg (-) with a 220 Ohm resistor to the - side of your breadboard.

Insert the LDR in the breadboard and connect one leg to the 5V pin with a red wire.

Connect the other leg with a 10k Ohm resistor to the - side of your breadboard.

With a colored wire connect both the one resistor leg and 10k Ohm resistor to the A0 pin in the Arduino.

Lastly, connect the - of the breadboard with a black wire to the GND of the Arduino.

With the following code you should be able to turn the light on and off by exposing the LDR to brightness or darkness:

const int ledPin = 12;
const int ldrPin = A0; void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); pinMode(ldrPin, INPUT); void loop() { int ldrStatus = analogRead(ldrPin); if (ldrStatus <300) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } }

Step 5: Assembling on Your Breadboard Part Two: Sound Sensor

Stick the sound sensor in your breadboard.

Connect a red wire to the + of the sensor and put it in the breadboard's +.

Connect a black wire to the GND of the sensor and put it in the breadboard's -.

Connect a colored wire to the D0 of the sensor and put that in pin 7 of the Arduino.

Disconnect your LDR's red wire from the 5V pin and put it in the breadboard's +.

Now connect the breadboard's - to the GND pin with a black wire and connect the breadboard's + to the 5V pin with a red wire.

Put in the new code:

const int ledPin = 12;
const int ldrPin = A0;
const int micPin = 7;
int val = 0;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(ldrPin, INPUT);
  pinMode(micPin, INPUT);

void loop() {
  int ldrStatus = analogRead(ldrPin);
  val = digitalRead(micPin);
  if ((ldrStatus <300)&&(val == HIGH)) 
  {
    digitalWrite(ledPin, HIGH);
  }
  else
  {
    digitalWrite(ledPin, LOW);
  }
}

Step 6: Add More LEDs and Tweak Them Individually With Code!

Make a parallel circuit to add as much more LEDs as you would like. I removed the one LED on pin 12 and added 4 on pins 2 -5.

Because you connect every light to a digital pin in the Arduino, you are able to control each and every LED on its own. A cool idea could be to make different colored lights react to different frequencies or intensities of sound.

You can also adjust the sensitivity of the sound sensor by turning the on board potentiometer with a screw driver.

All you need to do now is put in the final code:

const int ledPin1 = 2;
const int ledPin2 = 3; const int ledPin3 = 4; const int ledPin4 = 5; const int ldrPin = A0; const int micPin = 7; int val = 0; void setup() { Serial.begin(9600); pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(ledPin3, OUTPUT); pinMode(ledPin4, OUTPUT); pinMode(ldrPin, INPUT); pinMode(micPin, INPUT); void loop() { int ldrStatus = analogRead(ldrPin); val = digitalRead(micPin); if ((ldrStatus <300)&&(val == HIGH)) { digitalWrite(ledPin1, HIGH); digitalWrite(ledPin2, HIGH); digitalWrite(ledPin3, HIGH); digitalWrite(ledPin4, HIGH); } else { digitalWrite(ledPin1, LOW); digitalWrite(ledPin2, LOW); digitalWrite(ledPin3, LOW); digitalWrite(ledPin4, LOW); } }

Step 7: Bring Your Container and Arduino Together

It is time to solder and glue your entire project together!

Make sure you have every part of the lamp in position before you secure them in place.

Also, position the LDR sensor on the outside of the container.

Step 8: Enjoy

Plug your home made lamp into your laptop or other energy source, make it nice and dark, put on some music and enjoy the audiovisual spectacle you've created!

TIP: See how you can make the light diffuse more beautifully by experimenting with different kinds of "filters" (or just use different kinds of small glasses and candleholders and put them upside down on the LED lights)

Share

    Recommendations

    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge
    • Audio Contest 2018

      Audio Contest 2018
    • Optics Contest

      Optics Contest

    3 Discussions

    0
    None
    MicahKV

    2 months ago

    Awesome! I really like the box but see how any kind of ornate casing can potentially work. Can it only respond to volume levels in general, or would it be possible to plug in a couple different color lights so that one could correspond with the bass and another with the treble?