LED candles are very common these days. It’s easy to see the attraction — there’s no fire danger and they never need to be replaced (just batteries). But there’s such a wide variation in price and quality that it’s hard to know what to purchase. Some store-bought candles flicker very realistically, others just seem to blink. Some use plain white LEDs, some look like real flames.
In this lesson, we’ll show you how to use sound sensor, light sensor and LED with OSOYOO UNO to build an electronic candle.
You connect the components as shown in the diagram below. Connect the LED to pin 9 of the Arduino. The 200 ohm resistor is current limiting resistor. One lead of the photo resistor is connected to 5V, the other to one lead of the 10k ohm resistor. The other lead of the 10k ohm resistor is connected to ground. This forms a voltage divider, whose output is connected to pin A0 of the Arduino. Use the A1 as the analog pin to connect with the sound sensor’s A0 pin.
As the light impinging on the photoresistor gets stronger, the resistance decreases, and the voltage output of the divider increase. The reverse happens, when the impinging light gets weaker.
After above operations are completed, connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.Open the Graphical Programming software Mixly and follow the next operations:
Click Save aftogramming is done, then upload the code to the UNO board.
When the brightness is dark, the candle “lights up”, the flame flashes, and the sound of blowing the candle, the candle extinguishes.
You must be logged in to post a comment
About the Author