Electronics: KiCad PCB fabrication and the cap-fun project
I’ve been meaning to look into PCB fabrication forever, and it’s time, baby.
What would I make for my first small PCB? I settled on designing an educational demo board for capacitors. I call it cap-fun
.
Capacitor demo boards are nothing new, but I’ve remixed things a little because the usual designs hide some nuances of capacitors that I think can be easily demonstrated.
A typical capacitor demo circuit looks something like this:

In the shown position the switch is letting the capacitor charge (and the LED is off). In the other switch position the capacitor discharges through the LED, lighting it. The LED fades as the cap runs down.
This demo circuit glosses over the fact that if a capacitor is disconnected from everything, it will just sit there and hold its charge.1
This circuit also skirts around the concept of a cap taking some appreciable time to charge; since there’s no charging resistor before the cap, it will charge pretty much instantly.
This ‘instant charging’ of the cap is potentially a circuit integrity issue. A toy circuit like this could potentially have a transient inrush current of 5 - 10A!
Usually you would notice nothing of this transient high current, but in theory it could stress mechanical parts like USB or battery connectors. There’s more analysis of this later.
We can address these points and make a more learnable capacitor demo if we use two momentary switches and add a charging resistor. Here’s the schematic for cap-fun
:

It works as follows:
- with neither switch pressed, the circuit does nothing. Any charge in the capacitor remains there
- with the
charge
switch pressed, LED is off and capacitor is charging for as long as the button is pressed - with the
discharge
switch pressed, the capacitor is discharging through the LED, lighting it up with brightness proportionally to the voltage across the cap (and the LED fades over time) - with both buttons pressed, the LED is on and its brightness moves towards a stable point where it stays (quite bright but not fully bright)2
The resistor and capacitor values are chosen so that the charge/discharge times are good for playing and teaching with the circuit: nothing happens too quickly or too slowly.3
Teaching notes: things to try with the cap-fun
- hold down
charge
for short time (brief press), thendischarge
: notice that the LED isn’t very bright - hold down
charge
for a longer time, thendischarge
: notice that the LED is brighter this time - hold down
charge
for a second, wait for one minute, then pressdischarge
: the cap held its charge during the wait - hold down
charge
for a second, then pressdischarge
briefly lots of times: you’ll see the LED brightness fading a bit each time. - you can mix presses of either button in any way you like, with different length presses, and they ‘top up’ and ‘withdraw’ from the capacitor’s charge in the way you’d expect
- hold down
discharge
until the LED goes out, then hold down both buttons until things stop changing. Now presscharge
for a few seconds. Now again hold down both buttons until things stop changing. What do you notice?4
Making a schematic and PCB using KiCad
Some folk seem to be snooty about KiCad, but I think it’s a great tool. You can use it to create both the circuit schematic and the PCB layout.
You’ve already seen the KiCad schematic for cap-fun
above.
Here’s the PCB layout that I made from the schematic (also in KiCad):

Stand-off holes are provided at the corners.5
Manually laying down copper tracks is very satisfying. I’m sure it’s more annoying once you get past toy projects.
KiCad has a cute 3D viewer and renderer for your board too:


The back side of the board:

This PCB is quite small: about 3.5cm across. I might em-biggen it once I see the printed PCB.
Of course, laying out PCBs for educational use is a different beast to just designing a PCB to do something. I’ve laid out the board above in a way that hopefully emphasizes the structure of the circuit: in effect it’s two loops – for charge and discharge – with a capacitor in common (hence the cap being in the centre rather than the LED; this is about capacitors, after all).
Fabrication
I’ve not yet had cap-fun
fabricated.6 Popular companies for this are PCBWay and JLCPCB; I’ll get my board made with one of them and post an update.
Honourable mention: KiKit
PCB manufacturers like to print large PCBs for efficiency reasons and so they offer options to get your PCB design(s) repeated across a sheet.
KiKit is a tool that can help you with this aspect by making tabs and cutouts etc. so that your individual PCBs are easier to handle and separate from the sheet, and you get a nicer result. I’m going to try it soon.

an unconnected cap will eventually leak off its charge, but it might take a while ↩︎
the stable point is a cap voltage corresponding to the cap gaining charge at the same rate as the LED+resistor is taking away charge. This works because the charge/discharge graph of a capacitor is a curve that levels off as time proceeds ↩︎
exercise for the bored: work out charge time for both the charging and discharging action (reminder: \( \tau = RC \) and charge/discharge time is assumed to be \( 5 \tau \). Don’t forget the 1.5V drop over the LED!) ↩︎
answer: it doesn’t matter how charged the cap is to begin with, holding both buttons takes you to the same stable brightness of LED (which relates to the amount of charge in capacitor) ↩︎
the standoff size is 2.2mm (M2 screws); this is smaller than the usual 3.2mm (M3) due to the tiny board size ↩︎
terminology: fabrication is manufacture of the PCB, whereas assembly is the placing of components on the board ↩︎