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.
- The difference between lithium-ion batteries and dry batteries, which one is better
- IoT-based weather data logger
- How to Unlock Your Windows Laptop Using an RFID Tag
- DIY a simple weather station
- Satellite TV Set Top Box Remote Controller
- Experiment on making a demonstration device for mobile phone electromagnetic radiation
- Ultrasonic dog chaser made by NE555
- How to build an internet-connected traffic meter
- How to Design a Wireless Remote Controlled Two-Wheeled Robotic Rover Using ESP8266 and Arduino Uno
- Driving Large TFT-LCD Displays with Space-Saving Triple-Output Regulator
- MAX8630Y/ MAX8630Z driving white LED circuit diagram
- LED driver circuit diagram powered by solar cells
- Dark activated LED flash circuit
- High battery life LED circuit based on GEC8310
- Three-phase phase loss alarm light circuit
- Five-digit LED level indication driver integrated circuit typical circuit
- 3W high power LED drive circuit diagram
- The equipment runs through Chengdu display circuit
- Power outage sound and light alarm circuit
- Household electric blanket power saving circuit