Here I briefly document a very realistic candlelight effect you can build with very few components. It works best if the device is placed in a jar or behind a screen, where the Neopixel ring is not in direct sight.
You will find all the required information, schema and the firmware to build the device.
Features
- Realistic candlelight effect.
- Real-time clock to automatic turn the decoration on and off at defined hours.
- Real-time clock backup power using a supercapacitor.
- A USB power bank will run this decoration for weeks.
Video
The following video shows the effect if the device is placed behind a screen:
Required Components
- U1: Adafruit Trinket M0
(Microchip ATSAMD21E18 Cortex M0+, 48MHz, 256KB Flash, 32KB RAM) - U2: Adafruit Neopixel Ring RGBW
- IC1: DS3231M Real-Time Clock Chip
- D1, D2: 2x Schottky Diode (e.g. 1N5819)
- R1, R2: 2x 4.7kΩ Resistor. (e.g. TE CRF100J4K7)
- R3: 1x 82Ω Resistor (e.g. Yaego RSF200JB-73-82R)
- C1: 1x 0.1µF Capacitor (e.g. Vishay K104K15X7RF53H5)
- C2: 1x 0.47F Supercapacitor (e.g Eaton KR-5R5H474-R)
- Solder, Wire, PCB, etc.
Schema

Assembly
Assembly is simple and can be done in a very small area.

The shown board is approximately 5cm (2″) long and 2cm (0.8″) wide. Most of the wiring is done on the bottom side.

Connect all components as shown in the schema.
Firmware
The firmware for the shown device is available on GitHub:
You need the latest version of the Arduino IDE (Version 1.8.10) and have to install Adafruits SAMD board support. You also need the Adafruit NeoPixel and DotStar library. Install them from the library manager.
Set the Time for the Real-Time Clock
To fix this: uncomment line 201 in the firmware and write the current date and time values into the statement.
// Initialise the RTC driver. lr::DS3231::initialize(); // Uncomment this line and set the current date/time to set the RTC once. // Make sure to comment it out and re-upload the firmware after setting the RTC! lr::DS3231::setDateTime(lr::DateTime(2019,11,24,19,11,0)); // Check if the RTC is running and had no time issues. if (!lr::DS3231::isRunning()) {
- Upload this firmware to set the date and time.
- Comment line 201 to disable setting the clock at the start.
- Upload the firmware again.
Now, the device should start without any problems, until, for some reason, the RTC has lost the current time. The supercapacitor in the shown configuration will power the clock for one or two weeks without power.
Colour Adjustments
To adjust the colour of the effect, check line 225 of the firmware:
// Initialise the NeoPixels driver. gPixels.begin(); gPixels.clear(); gPixels.show(); // Set the colors for the random effect. setRandomBlendColors(Color(0xa048), Color(0x0024)); // Make the first time check after one second after start. gNextTimeCheck = millis() + 1000;
The first argument is the brightest value, the second argument the darkest value. The effect will blend randomly between these. The format for the value is 0xWBGR
. Therefore each digit in the 32bit value stands for one colour.
“Air Movement” Adjustments
The speed of the effect is controlled by the delay
statement in line 251:
// If the decoration is enabled, produce a random effect. if (gIsEnabled) { updateNeoPixels(); delay(50); const uint8_t oldPhase = gRandomPhase; gRandomPhase += gRandomSpeed; if (oldPhase > gRandomPhase) {
A delay of 20 will give an outdoor effect with some wind, and 50 is more like the effect you have indoors.
Ideas
- Add a white paper roll into the Neopixel ring to accentuate the effect.
- Use different Neopixel strips with any number of elements.
- Add an ambient light sensor, like the VEML7700 to the I2C bus. Now you can turn the decoration as soon as it gets dark.
- To save power:
- Add a P-Channel MOSFET in front of the Neopixel ring and just power it if it is in use.
- Connect the RTC interrupt to the MCU, so you can put it into sleep mode and wake it using an alarm from the clock.
- Add a TPL5111 timer which controls the power for the whole device, which is triggered by the RTC interrupt. This will reduce power while sleeping to the nA range.
Conclusion
I built this small device to replace several smaller electronic candles. It is a small weekend project and a very good start point for similar devices.
If you have questions, missed any information, or simply want to provide feedback, feel free to comment below or reach out to us through Twitter!
More Posts

Extreme Integers – Doom from Below
Read More

Logic Gates Puzzle 101
Read More

Rail Grid Alternatives and More Interesting Updates
Read More

Candlelight Emulation – Complexity with Layering
Read More

The Importance of Wall Profiles in 3D Printing
Read More

The Hinges and its Secrets for Perfect PETG Print
Read More
Hi, this is a really amazing project.
I am in the process of integrating it into a christmas crib. I removed the RTC though (HW and code as I have a switch on the crib) and now I’m running into issues with the Pixel Ring. Whenever I used crocodile clips to connect it, everything works fine, When I solder the wires directly to the board, the ring first doesn’t react at all and with a re-power within short time, it reacts strangely (showing the right colors but not cycling or showing weird colors).
I thought adding the 470 resistor on the data-pin would solve the issue (even though it should be there already), but it did not.
Have you ever run into the same issue?
Hi Oliver! Thank you very much! And, No, I never had such issues. If it works with crocodile clips, the problem must have happened while soldering the wires.
I suggest you ask in Adafruit Forums or Discord for help, this may be a known issue with the Neopixel ring.
Make sure you check the soldered wires with a multimeter first. Check for shorts and if the wiring is the same as with the crocodile clips. Also inspect the solder points, leftover resin may cause shorts and side effects. Hope this helps!