Page 1 of 1

Digital LED Candle

Posted: Sat Dec 14, 2019 5:14 pm
by parkview
I have always wanted to make my own digital LED candle. Since I am currently in Shenzhen, China - the

capital of the world for electronics, I thought it could make a quick simple project to do here. No

real pre-project specs, just that it must have multiple LEDs and use side-lit fibre optical cable.

The seven story HQB LED building has a store that sells optical fibre up on the 6th floor, so I popped

in and purchased a few different thicknesses of side-lit fibre. Also picked up three different

coloured 5730 size (1/2 Watt), LEDs to test.

Due to the high current that might be needed to light up the LEDs to full brightness, I decided to use

some common AO3400 NPN MOSFETs to buffer the Arduino and switch the LEDs on/off.

I wanted to see what the LED's looked like when they where coupled to the side-lit fibre, so I

purchased some two part epoxy glue form the local tiny hardware store (called AB Glue here):
led-fibre_sml.jpg (166.84 KiB) Viewed 446 times
The initial circuit ended up with a MOSFET pin error, as KiCAD doesn't have a AO3400 MOSFET in it's

native library. I fixed one MOSFET by cutting it's PCB traces and re-wiring it the correct way around:
Digital Candle V1.0_sml.jpg
Digital Candle V1.0_sml.jpg (244.99 KiB) Viewed 446 times
It didn't take long to fix the errors in KiCAD and add on a six pin T1.25 SMD socket onto the PCB and

version 1.1 was off to for production. It takes around four days to

produce a cheap board. You can pay extra to have one manufactured in 24 hours, but I wasn't in a rush.
It didn't take long to hand solder the components into place:
Digital Candle V1.1_sml.jpg
Digital Candle V1.1_sml.jpg (198.26 KiB) Viewed 446 times

Re: Digital LED Candle

Posted: Sat Dec 28, 2019 1:04 pm
by parkview
So the PCB Version 1.1 was a success and I quickly had the LEDs blinking via an Arduino Nano. While it works well, I didn't really want to have to insert a Nano, battery AND my LED PCB into our lanterns. I have been meaning to learn the STM32 platform of MCU's, so this felt like a perfect time to have a play. Thus, a version 1.2 PCB was rolled out:
LED Candle PCB V1.2.jpg
LED Candle PCB V1.2.jpg (40.52 KiB) Viewed 426 times
This one used an integrated STM32F042F6 TSSO-20 chip to control the LEDs. To save time, I just removed the J1 socket and added all the other components at the end. It could have been a bit squarer, but it didn't take long before it was uploaded to JLCPCB to be manufactured.

While I waited for the PCB to arrive, I dug out a STM32F103 based Blue Pill board, installed Visual Studio Code editor with VIM and integrated in PlatformIO. Might as well learn this as well. I had a play around using MBED framework and it seemed to work ok and I am happy with it for the moment. I loved being able to put it into Debug mode and step through my program and watch the variables. Haven't seen this since my Delphi 4 (Pascal) days.

Four days later the PCB was delivered to Steamheads door and it didn't take long to put down some solder paste and components and hot plate it all into place:
LED_Candle_V1.2_sml.jpg (43.48 KiB) Viewed 426 times
There where a few bugs. One major one I had figured out before the PCB arrived. One of the LEDs wasn't on a PWM pin. That was fixed with a short trace cut and some fine AWG30 wire to PB1 on pin 14.

I have really been enjoying KiCAD 5. I am getting a handle on it's libraries and am cleaning up my Ver. 4 mess that I had made while trying to learn how to create my own. I also like the Ver. 5 PCB viewer mode <ALT + 3>. It really helps to get a big picture overview of how things are going to look and helps with label placement etc There is even a Raytracing mode!

Re: Digital LED Candle

Posted: Sat Dec 28, 2019 1:26 pm
by parkview
So a quick trace re-route fixed the PCB layout fault:
LED_Candle_V1.2_PCB-fix.jpg (51.13 KiB) Viewed 426 times
However, it was still rather long, so for Version 1.3 I re-sized the resistors down to 0603 and found that the STM32 SWD programming port didn't need 6 wires, so I replaced the socket with a smaller 4 pin socket. With a bit of a re-shuffle of components, I managed to shave 7.4mm off the width of the board :D
LED Candle PCB V1.3-3D_sml.jpg
LED Candle PCB V1.3-3D_sml.jpg (32.91 KiB) Viewed 426 times
Now that I am back in Australia, I will have a much longer wait for the PCB's to arrive back from JLCPCB :cry:

Re: Digital LED Candle

Posted: Tue Dec 31, 2019 11:45 am
by seaton
well done Paul, good to see the move to Kicad 5, maybe you like to run an updated Kicad refresher with the new version?

Re: Digital LED Candle

Posted: Fri Jan 24, 2020 4:45 pm
by parkview
The PCB arrived back from JLCPCB, Shenzhen the other day. Four days in production and 17 days in transit and according to the tracking, most of that was in Australia!

I like to gather all the components together and lay them out neatly, ready for placement:
component-layout.jpg (54.51 KiB) Viewed 318 times

I experimented with a few laser speeds and powers so as to make a relatively clean stencil. This sheet of plastic is a bit thicker that normal, 0.17mm:
stencil.jpg (23.84 KiB) Viewed 318 times

As you can see it was pretty heavy on with the solder paste:
solder-paste.jpg (37.92 KiB) Viewed 318 times
It took around 10 minutes for the hotplate to warm up, but it was ready by the time I had placed all the components onto the PCB. It took maybe 45-60 seconds to reflow the PCB on the new hotplate:
PCB-hotplate.jpg (65.42 KiB) Viewed 318 times

It was still a good batch of four year old paste that was opened once before in July 2019, but it flowed well, and the surface tension drew the paste back onto the pads (the paste had been kept in the fridge). Only the STM32 TSSOP-20 needed three pins cleaned up:
solder-paste.1.jpg (72.77 KiB) Viewed 318 times

I was impressed that the test program loaded first time and moments later I was treated to randomly blinking very bright LED's. Yes, the switch wiring will be fixed if I do another one. I think I could knock at least another 5mm off the length of the PCB if I migrated the 4-pin plug to 4 x 1.27mm pin holes and program the STM32 via pogo pins.