Make a simple electronic candle using Arduino Uno and LEDs
Source: InternetPublisher:D先生 Keywords: led development board Arduino Updated: 2024/03/26
For beginners in microcontroller development, how to use the Arduino Uno development board to make an electronic candle? Electronic or flameless candles are an alternative to traditional wick candles and are a ubiquitous thing in life. These lamps are mostly used for home decoration, so you don’t have to worry about catching fire because they don’t emit open flames, but LEDs.
In this article, engineers show how to make a simple electronic candle using an Arduino Uno board and three LEDs. You can increase the number of LEDs as needed.
Circuit and working principle
The circuit diagram of the electronic candle is shown in the figure below. It is built around an Arduino Uno board (BOARD1), three LEDs (LED1 to LED3) and three resistors (R1 to R3).
The technology used in this electronic candle is based on Pulse Width Modulation (PWM). LEDs are diodes that only operate in the forward direction. If you reduce the voltage, you can easily dim it by PWM or reducing the forward current. Simply put, the LED receives DC cycles with different duty cycles (on-cycles) as shown in the image below.
Arduino IDE is used to compile the source code (candle.ino) and upload it to the development board. Select the correct Board and COM port from the Arduino IDE's Board Tools menu and upload the program via a standard USB port in your computer.
In the source code void setup(), the pin mode is defined. That is, pins 9, 10 and 11 are defined as output pins. In void loop(), analogWrite(pinNumber,Intensity) function is used for PWM. Strength can vary from 0 to 255 in the source code. "
"random(vary)+fix" function is used to get a random value between 0 and 195 and then add 60 to 255. Additionally, you can also change the random number in the code as needed, such as random(160)+90.
How to build a circuit?
Take three LEDs, one red and two yellow (can be blue or other colors) to create the illusion of candles. Use external jumper wires to connect it with the Arduino Uno. This is done because the Arduino Uno will be powered via USB. Cover the LED with an opaque box, making it look like a real candle by leaving the top slightly open to let the light out.
- Share an oil sump/fill pump controller circuit
- Mobile phone interference circuit sharing
- DIY an electromagnetic glove
- Build an Automatic Candy Vending Machine
- Share a project that controls the mouse pointer by moving the index finger
- Automatic recovery electronic fuse with soft start function
- Infrared detection type electronic rodent killer circuit
- A novel resonance demonstration device
- Production of wake-up device
- High power laser constant current drive circuit
- LT3755 driver LED application circuit diagram
- LED fluorescent lamp principle circuit diagram
- Driving circuit diagram of a low-power LED bulb
- BA6104 five-digit LED level meter driver integrated circuit
- heartbeat sensor
- High battery life LED circuit based on GEC8310
- LT3755 driver LED application circuit diagram
- Five-digit LED level indication driver integrated circuit typical circuit
- LED billboard decorative light circuit
- Basic structure of light-emitting diode (LED) display drive circuit