One of the most fun parts of my MoodLight project was the creation of a matching circuit board. This is not how I originally started, but after playing a bit with my first moodlight, I realised it didn’t fulfil my requirements. Also, there were no complete construction sets which did exactly what I wanted.
My device had to have the following features:
- use USB for both power and data transmission
- provide several RGB LEDs
- fit into a reasonably small case – I decided on IKEA’s Solvinden lampions
The Micropendous development board already provides much of what I need (i.e. the USB part), so I used it as a basis for my first own circuit board.
KiCAD
KiCAD is a tool for designing schematics of electric circuits and printed circuit boards. It’s open source and available on most platforms. You should use a current version since the old ones have some bugs – you don’t want corrupt manufacturing files, do you? I used version 0.0.20100314-1 and had to update to 0.0.20110616-1 to get correct files.
Interaction is a bit unusual but once I got used to it, it was okay.
Draw a Schematic
First of all, you need a schematic (EESchema tool). To create it, you place the electrical components you need on the sheet. You can then move them around until you are pleased and place the wires as needed. Common error source: make sure the wires actually connect to the components (otherwise, there will be little squares).

Draw a schematic for your circuits.
On the left, you can see the microprocessor which is connected to the reset button, the programming button and the mini-USB port. On the right, there are the circuit parts needed for the LEDs.
I wanted to use hardware PWM, so I chose the pins which support it: 21, 25 and 23 for the red, blue, and green (in this order, since the RGB LEDs have it, too) signals. By looking at the schematic, it may seem that they are not connected to the rest. This is due to the labels, which are a nice way to avoid clutter: wires connected to the same label, e.g. LED_R are always connected.
In the prototype, I randomly used three consecutive pins, since the pin descriptions in KiCAD were incomplete. As my realised this pretty early, I drew additional wires for my MoodLight.
Lesson learned: It pays off to have a look at the microcontroller’s data sheet.
Before you proceed, you will have to generate a the netlist – this saves which pins are connected to which components etc. It is available in the toolbar. It also pays off to perform an electrical rule check (ERC), which is also available in the toolbar. Chances are it will find errors in the wiring (indicated by red arrows in the schematic).
You may also need to define your own components – depending on your KiCAD version, you find a button in the toolbar or a menu entry.
Select Matching Parts
In the next step, you need to select matching parts for your components (cvPCB tool). This is important since you want to have holes and soldering pads which correspond to your parts.
This is not as difficult as it sounds (as long as the components are available in the library): For the first row, C1 stands for capacitor 1, which has 0.1 uF (0u1) capacity. The part should be a 1206 SMD part, i,e. the size is 12 × 6 milli-inch (3.2 × 1.6 mm).
When you’re done, save the results – they will also be stored in the netlist file.

Select matching parts for each component from the list on the right.
Layout the Circuit Board
If you start the circuit board editor (PCBnew), you first have to read the netlist.
Now, all components are in the same place, and you will have to untangle them. There is probably more than one good strategy for this. I started with the microcontroller and sorted the parts into groups (one for each LED, one for the programming+reset buttons, one for USB, etc.
Once you have untangled your circuits, you should determine a circuit board shape. Since I use small lampions as a case, I decided to replace the frame they are usually held by with the circuit board. This also meant that I had plenty of space for the parts (I could have fit them on half as much space if I had wanted to) – and some text.
The next step is to place the components on the board (you can determine front and back if you’d like it to be two-sided). Once you are satisfied, you can start adding tracks (and vias to change from one side to the other). For now, ignore all GNDs (ground). All parts that want to be connected have a line between them which will disappear once you have added a track.
If tracks vanish upon finishing, it’s because you tried something that wouldn’t work, e.g. crossing tracks, tracks too close to each other (or a pad), or tracks too close to a via.
Most likely, if you are a novice like me, you’ll run into problems with the wiring. Then you’ll have to move components, remove tracks, and redo the whole wiring if needed. Twice or more, of course. This may sound horrible but if you end up with a nice-looking, functioning board, it’s totally worth it.

Arrange the components on the board and connect them with tracks.
Now that you’re satisfied with the layout and tracks, you want to take care of the GND. The most convenient way to do this is to draw a ground plane. This is done by placing a zone on the board. It can be as big as the board – and if you want a ground plane on both sides, you’ll have to draw it on both sides. Once you are finished, right-click on the ground plane border, (select front or back), and fill the ground plane.
As with the schematic, it’s recommendable to perform a design rules check (DRC), since it’s sometimes hard to see remaining straight lines between all those components and tracks. Especially when using a ground plane, some connections may not be made automatically and these will be indicated to you.
If you feel like it, and are willing to pay extra for print on the board (really really useful when soldering), you can also add some text, e.g. “MoodLightUSB”. Some manufacturers also ship the boards with complimentary print. Make sure you select a SilkP_Front/Back layer, and not Front/Back! (Also, if you print on the back, you should mirror the text).
Generate manufacturing files
Now, you need to plot the files. What you do now depends on the data type the manufacturer uses. I needed GERBER files, thus I selected Gerber as a plot format.
As layers you definitely want to have:
- Front/Back (tracks and ground plane)
- PCB_Edges (if your circuit board shape lies on this layer)
- Mask_Front/Back (solder masks – they make your life a lot easier!)
Optional, if you want to have print (silk screen), too, you add SilkP_Front and SilkP_Back. What you probably don’t want is SoldP_Front/Back, unless you want a stencil to put solder paste on the pads. If you have your stuff manufactured, don’t check “mirror y-axis”. If you etch it yourself, you need to check it though.
After plotting the files, you also need to generate a drill file. Make sure the units match the manufacturer’s requirements.
Now, you can have a look at the results. Since the built-in gerber viewer is a bit buggy, I used Gerbv. Check each individual layer for completeness, and compare if front and back match the drill holes. If everything looks reasonable, you’re good to go.

The Gerbv viewer. The colours are horrible but they do their job.
Order your board
Now, you can sent your files to a manufacturer. I used BatchPCB, mainly because they have reasonable prices for small quantities. Bonus 1: They tend to deliver a couple of more boards than ordered (I got 6 instead of 3, but I don’t think this scales ;)). Bonus 2: Solder masks and silk screen (print) are included. Malus: You don’t get to pick a colour, but that’s not that bad, is it?
There are a lot more manufacturers out there, of course.
Wait for the delivery
This may take a while. In the meantime you should order the parts you don’t have at home.
I instaloved my boards when I saw them. Shiny and green!

My freshly unpacked circuit boards - one is already in its future suit.
Next, they had to be soldered. This proved a bit difficult since the soldering paste I used was pretty cheap (it was worth a try). In the end, I had to fix some issues with regular solder – this was actually pretty easy. However, for the first try at SMD, I guess decent solder paste is nicer.

Front

Back
In the end, I had a working MoodLightUSB which only had to be programmed.

Finished and working.
Phew, that’s it. I’ve been meaning to write this for a while (I actually started it way back in September) and since I’m currently working on MoodLightUSB version 2, I decided to finish it.