Introduction
There's this pretty cool thing I went to called Candlelight Concerts where they have a bunch of fake candles all over the venue to make it real moody. I thought it looked really cool and you could buy the candles there but the thing I was fixated on was the fact that all of these candles had to be turned on individually.
There must have been over 2000 candles in the space and I feel like picking up each one, turning it off and then placing it back down. Presumably they would also need to replace the batteries so it might be even effort. Even just manually turning it off would require like 5 seconds each one multiplied by 1000 candles is 10000 seconds. 10000 seconds would be like 3 hours just turning off the switches. Add in replacing batteries preemptively and you'd probably spend like a work week just dealing with these candles.
This made me think whether or not I could make something similar. Probably not better than the effect these do because they're pretty good but just some fun light that will recharge when I place it on a charging spot. I have been doing pottery for a bit and thought it might be a good opportunity to combine that with a custom PCB and make something that I could use so with that, let's get into it.
Goals
I feel like in a lot of projects, the goals and requirements are often understated but it's a helpful exercise.
My goals are pretty straightforward:
- Make a custom PCB (that hopefully doesn't need more than 2 revisions and ideally, just try to ignore the design mistakes until the end)
- Make some pottery to use with it
- Use the ATTINY45 or equivalent ATTINY microcontroller (because it's the BEST MICROCONTROLLER EVER MADE)
Everything else is kind of secondary - if it looks bad then that's fine. If I make mistakes, that's fine too. Not everything needs to be perfect on the first shot. It's been a while since I made a custom PCB so I feel fine if I make mistakes.
Mode Overview
Now that we've decided on a microcontroller, let's go over how this thing is supposed to work:
- When the light is on the stand, we want it to charge
- When the light is off the stand, we want the light to turn on and simulate a candle flicker
- We want to know that it's actually on the stand and charging
- We want to know if there's an issue
Designing the Circuit
Now that we have defined the modes and we know we're going to use the ATTINY45, we can start with the schematic design.
High Level BOM List
- Two LEDs
- A microcontroller
- A rechargeable battery
- A charging circuit so that the battery will charge
- Some way to monitor whether the battery is low
- Some way to monitor whether we're on the charging stand
Making the PCB was relatively straightforward with all of that and I'll just note some specific sections.
OverviewI’ve split it into four-ish sections. In the purple section we have the battery charger/external power management. In the blue section we have the on/off switch to provide power to the circuit. In the green section we have a divider circuit so we can determine if external power is connected. In the red section we have a button to reset the ATTINY45 as well as two LEDs to create the candle flicker effect. Note that this is the second version of the design. The first one didn’t include the status led and I had flipped the resistor and switch, so I had to short it to keep the ATTINY45 on.
Monitoring if we have external powerMy thought is to use test points to transfer power from the docking station to the PCB - you can see this highlighted in blue. The initial plan was to have POGO pins on the docking station and then have a channel to transfer power to the candle, but I ran into some issues with pogo pin sizing, so I opted for just a standard header pin.
As you can see in purple, I have a voltage divider. +5V comes from the external power so EXT_V will take a divided portion of that which the microcontroller can read and determine whether we have something charging the battery.
So, there's a stat pin that’s specific for lighting up a little LED and telling the user that the device is charging or has charged. I didn’t have this in my first version but I added it to the ones in the files attached to this project.
This is the suggested configuration from the datasheet where the lithium ion battery just goes to a JST connector which I’m matching.
Because of my inspiration, I really wanted it to look like the candle was softly on. The first revision just uses one of the two LEDs to accomplish this because I wanted a “power too low” LED. The second version will use both LEDs with one being a yellow and the other being a orange (or a different yellow).
PCB DesignI knew that I wanted to put it in a pot that I threw and so only had like 2.25” diameter to work with. Because it’s thrown and I’m not an amazing potter or anything, I figured if I kept it to 2” that would be good enough.
I have two PCBs, the docking station and then the candle section. The candle one is the more complicated one so I’ll just quickly show the docking station:
It’s just header pins so I can connect 5V and GND to it and then there are terminal spots for pogo pins so that it can connect to the top.
For the candle section, I made a channel for the pogo pins to touch. I did this by drawing an arc and then making the thickness 1.5mm. I then used the Draw Filled Zones and set it to either 5V or GND so that it would tie that arc to that particular voltage.
I’ve used PCBWay in the past and they sponsored a project (not specifically this one but just thought I’d mention it). Their quality is pretty good. I haven’t seen a lot of people have issues with how they manufacture or anything. The current US tariffs are no fun for pricing but that won’t be resolved for a while. PCBWay is the only manufacturer that I’ve seen that has an official plugin for KiCAD. I know that JLCPCB is supposed to be pretty good but I couldn’t find an official plugin and I feel like a one click button is the right way for me. Here’s the link to the plugin - https://www.pcbway.com/blog/News/PCBWay_Plug_In_for_KiCad_3ea6219c.html
Once you’re done, press the button. It’ll open to PCBWay and then you do your selections and then save to shopping cart. They review it (normally takes like 12 hours) and then you can buy it.
Most of my designs have been 2 layers and relatively small and so the majority of the time, I pay more for shipping (and tariffs) than I do for the PCB itself.
AssemblyOnce you get the PCB, you can assemble the whole thing. I’ll just give you a picture of the completed one. There’s nothing special to worry about (outside JST header direction) but I added a header for the ATTINY45 because I needed to program it often. I would recommend doing the same thing.
The charging plate is just header pins and then pogo pins. On this one, I ended up just doing header pins. Really nothing to it.
For the candle side, I soldered everything to the top side – make sure the orientation works correctly for the JST connector. I 3D printed a stand to mount it to which has channels for the pins to provide power.
With all three layers stacked (candle PCB, 3D printed spacer and then blank bottom PCB), I placed the pot over it. This is how I will make the candle flush when it’s on the stand.
With that placed flat, I take my handy dandy, hot glue gun and I just kind of go to town on it avoiding the connectors.
This is how I make it so that it doesn’t move.
From here, I 3D printed a base stand for the docking station PCB to attach to. I just used a piece of blue tack to put it on here. I could have used the screws but I didn’t account for that height of the screw heads (future version I guess).
The program is real dumb. The difficult part is programming the ATTINY45. I followed this guy’s tutorial, and he did a great job with that video so follow that - https://www.youtube.com/watch?v=sycSdI49hlY
Final AssemblyWhen it’s off the stand, it has this nice, warm light. I need a smaller battery so it can be better hidden but overall, it gives off a very similar vibe to having a candle.
When it’s on the stand, it flashes one second of each color and then turns off the LEDs. It stays off for however long it gets power.
I liked this project. I think there are some definite improvements I could make for next time including the comments that I made throughout it but also making the bottom PCB not a complete circle so that I could make the 3D printed part have a lip for easier placement.
Comments