-
Final result
01/04/2018 at 18:16 • 0 commentsIt is rather hard to catch the effect on a video, as the aim was to create a LED candle as quiet as a real candle could be.
-
Life-time
01/04/2018 at 18:15 • 0 commentsI don’t own yet a nice multimeter, so the current measurement I did with my actual (too) cheap one is rather approximate. I got around 12mA with the LEDs on, and around 4mA in sleep mode, drawn from the battery. Maybe the current of the sleep mode is still high due to the step-up circuit, which runs all the time…
However it stays on at least 3 consecutive days on a single AA Ni-MH rechargeable battery. I logged the battery voltage of one candle with my raspberry-pi logging station. It start with a fully charge single AA Ni-MH battery and I remove the sleeping mode:
Using the 'day sleep' it's approximately 5 days one ~2Ah battery.
-
Soldering and programming
01/04/2018 at 18:15 • 0 comments -
Less serious with the 3D shape
01/04/2018 at 18:14 • 0 commentsIt is time to think how to hold everything together. I applied for the free student Fusion360 licence. I have to say the program is very nice to handle and to learn.
The idea is to hold the battery on the PCB with the three part threads. Just screw them together and it should light-up. The only compromise is the ground wire that goes from the PCB to the bottom part along the battery body.
I also made a join part to be able to have some versions with two AA battery stacked, making it taller and with a longer battery life.
Then I removed the dust of my M3D micro printer, far from the best printer nowadays, but the cheapest when it went out.
-
Getting serious with a PCB
01/04/2018 at 18:14 • 0 commentsLet’s startup Kicad, do the schematics and play a bit with the PCB drawing. I have in mind a design for a 3D printed case, we’ll see that later.
Several times now I ordered PCB from OSHPark, and never been disappointed. I could use their manufacturing precision to down size the board area up to 17x17mm, giving $2.45 for 3. I let an option for a push button, we never know…
-
Code contraints and Prototyping
01/04/2018 at 18:13 • 0 commentsAfter some soldering I manage to put the components on a small development boards and start coding.
I used the Microchip IDE and their XC8 C compiler. The challenge here is that the compiler is in ‘free’ mode, so the compiled code is rather large. I didn’t want to use assembly mainly because I’m not quite confident to prototype with it. But I admit it is the preferable way to do something with only 256 bytes of program available. It’s perfectly legit to argue that an ATtiny10 would at least do the job better. I should invest time to the AVR side one day !
After many iteration to reduce the program size, I end up with only 4 free bytes. Wow. Some C operations give more compact program for the same function (for example initialisation to 0 or an arbitrary value).
The code uses the famous Linear feedback shift register as random generator. The flame position, the speed to go from one to the other position, the oscillations occurrence and their period number are random. The two LEDs are dimmed with the build in PWM, and the speed of change with the Timer0.
It is still open to more complex code as I can use the PIC10F322 with 512 bytes of program space (or even ATtiny10 which seems to be almost pin compatible).
I acquired the two LEDs PWM signal with my recently acquired DSLogic :
And plot them with a quick and dirty Java program:
You can notice the oscillation mode on the chart after 4th second, and the flame swing mode surrounding it. For the oscillations, the total brightness is changing while otherwise it stays constant at 50% (the sum of the two led brightness).
The PIC code is on this github repositoy : https://github.com/pierre-muth/another-candle/blob/master/candle01.X/main.c