Candlelight Flashlight with a nanjg

7 posts / 0 new
Last post
Werner's picture
Last seen: 1 year 11 months ago
Joined: 10/19/2012 - 15:00
Posts: 3679
Location: Germany
Candlelight Flashlight with a nanjg

The season of candlelights and lanterns is coming, I felt the need of a flashlight which has a artificial candle flickering.
A short google search shows a lot of guys already did this so less work for me Smile

This guy used a photodiode to sample a flickering candle and gave some basic instructions on how to simulate that:
This guy implemented a very simple version for a tiny13

I stole the project from github and tried it, worked like I wanted it to be so I changed it to use the standard nanjg outputpin and flashed it on a nanjg ak47.

Here is the code I used:
I just flashed it on a standard nanjg with standard fuses FD and 75. It runs on 9Mz which is probably to fast for the small voltage but it seems to work well I will try it out when I find more time. I also have the compiled hex in the project folder so you simply can flash it like every other firmware. This has no modes or battery protection or anything else it is just a in my eyes good working flickering code. For indoor use it is a bit nervous to look at the “flame” but in a lantern/box it works like a candle in the wind

I just put it in a ultrafire S6 which I got long ago but never used because time has changed in budgethostquality…

I used a XML2 S6 so it has nice CRI
current consumption maxes out at a bit more than 1A and it gives around 100-200lm which makes it a nice and bright candle with hopefully long runtime.

I just wanted to share this before I shutdown my computer and close all tabs, maybe someone finds it helpful…

Edited by: Werner on 10/29/2014 - 12:21
Ledsmoke's picture
Last seen: 1 year 2 months ago
Joined: 08/08/2011 - 16:05
Posts: 1995
Location: Denmark

Thank you for sharing. Interesting "mode" for sure.

~ Ledsmoke ~

Dutch humor:


 I do not think that the BLF-community ben

ToyKeeper's picture
Last seen: 9 min 6 sec ago
Joined: 01/12/2013 - 14:40
Posts: 10727
Location: (469219) 2016 HO3

Looks interesting. I’d like to include it in my collection (and it also reminds me I should add my lightning storm firmware).

Why is the clock doubled? Doesn’t seem like there’s anything which requires the extra computing power. It’s not a problem; just requires a different avrdude command line than most other firmwares.

Werner's picture
Last seen: 1 year 11 months ago
Joined: 10/19/2012 - 15:00
Posts: 3679
Location: Germany

I just made a short video demonstration of a illuminated pumpkin, easily the brightest in town…

Here or here

Don’t know if that works, I never uploaded a video before…

MRsDNF's picture
Last seen: 1 month 1 week ago
Joined: 12/22/2011 - 21:18
Posts: 13473
Location: A light beam away from the missus in the land of Aus.

You have burnt it Werner. You cant cook pumpkins at 600 degrees. Wink


djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.


Cereal_killer's picture
Last seen: 1 year 8 months ago
Joined: 07/22/2013 - 13:10
Posts: 4005
Location: Ohio

Obviously you’re using AVR so it makes it more doable by the masses here, plus you don’t need any custom hardware but did you see my LED candle?

It can run an individual LED if you dont have spare $15 XML-C’s to waste.

I’m also using this code in a house light I’m building my wife for her bday. The lower globe will allow any color on solid or a continuous spectrum fade, the top will be either fire / candle mode (red/green flicker) or white.

 RIP  SPC Joey Riley, KIA 11/24/14. Now I am become death, the destroyer of worlds.

Werner's picture
Last seen: 1 year 11 months ago
Joined: 10/19/2012 - 15:00
Posts: 3679
Location: Germany

I used my candle light today for my pumpkin lantern, works like intended. I always smile when I see some lanterns powered with the normal ledcandles or even real candles.
My pumpkin glows entirely, the structures of the skin gives it a cool look.

Bad pictures proudly presented from apples iPad Wink

Here is a short video showing it.