Artistic PCB Design for Terrified Beginners workshop
Hello and welcome to Artistic PCB Design for Terrified Beginners
If you're not familiar with some of those concepts:
- PCBs stands for Printed Circuit Boards, the things that electronic devices are build on
- Art means people creating wonderful (or awful) things for other people to enjoy
- A terrified beginner is someone who we all either are or have been at some point
I'm Kliment, and I'm doing this workshop to achieve one or more of the following things:
- Get art people to play with electronics
- Get electronics people to play with art
- Give the two groups above a common language so they can talk to each other
- Get people to build something cute and have fun
We're going to be making a so-called "Shitty addon". A shitty addon is a small circuit board that gets attached as a decorative or functional addition to one of the many badges that are so popular at hacker events. We're going to make one that doesn't do much (except light up). Except it won't be shitty! It will be pretty! So let's call it a pretty addon!
Workflow and prerequisites
What you're going to need to be able to follow along. Please make sure the following software is installed and working on your computer *BEFORE YOU START*.
- Kicad 5.1.6 ( https://kicad-pcb.org/ ) - an awesome free and open electronics CAD software package
- Inkscape (any version https://inkscape.org/ ) - an awesome free and open vector drawing software package
- Krita (any version https://krita.org ) - an awesome free and open art creation and image editing software package
I made an hour-long video where I explain a bit about what PCBs are and what they're made of and go through the process of converting graphics to PCBs. I'm sorry about the awful sound quality, and I had to speed it up and cut it quite a bit to get it to fit into one hour. This is like my second screencast ever, so sorry about that! Please watch it anyway!
It's at https://www.youtube.com/watch?v=Stp5BqUI48U and you can watch it right now, or during the workshop, up to you. If you watch it beforehand that's fine.
I've put some materials for you at: [todo add link]
Very broadly, here's what we're going to do:
- Create art
- Create PCB from art
- Generate manufacturing files from our PCB and optionally have it manufactured
- Enjoy your new superpowers
Step One: Create, borrow, or steal art
I can't help you a whole lot with this one, except the borrow/steal bit. I've put some pictures you can use in the workshop materials. Feel free to use those! Alternatively, bring your own photos, drawings, sketches, whatever. Scribble something on some paper and photograph it. Doesn't matter, as long as it's a picture you like. Make sure this is in one of two formats:
- Vector drawing that Inkscape can read (ideally svg) OR
- A raster image format like PNG or JPG or something else that Krita can read
Step Two: Create PCB from art The main thing to understand when converting art to a circuit board is that circuit board manufacturers and PCB design software doesn't think in art - it's designed for making circuit boards that meet their functional technical requirements. We do still care about functional requirements, but we mostly care about how it's going to look. So, we need to understand the PCB as the manufacturers and design software sees it, so we can adapt our art to that. So from now on, we're thinking in layers and manufacturing processes.
Here is what happens when a circuit board is made (very roughly):
- The manufacturer takes a big sheet of fiberglass with thin layers of copper either side. (note: fiberglass is beige-brown, translucent. Copper is metallic and opaque.)
- A bunch of holes are drilled into the sheet, and some nasty chemistry is applied to cover the inside walls of the holes with more copper
- The copper is printed over with an acid-resistant material in a pattern we provide (front and back copper layer)
- All the copper that is not part of the pattern is dissolved away
- The board is covered with a thin layer of paint in a specific color. This is called soldermask. The paint is removed in a pattern we provide (front and back mask layer). Note that any place that has the mask removed will expose either copper or fiberglass.
- The board gets printed with another ink, usually white (unless you have white soldermask, in which case it's black). This is called silkscreen and is printed in a pattern we provide (front and back silkscreen layer).
- The board gets a "surface treatment" to prevent corrosion of any exposed copper - this is normally either HASL or ENIG. HASL stands for Hot Air Solder Leveling - it's the cheapest process. The entire board gets dipped into molten solder, and then a blade of really hot air passes across the board and blows the molten solder away, leaving the surface mostly level. HASL surface finish is silver in color, and slightly uneven, giving you a moon-like surface of reflective metal. ENIG is a more expensive process that deposits a microscopically thin layer of nickel and then an even more microscopically thin layer of gold on top of the copper. This gives you a perfectly flat, slightly matte gold surface wherever you have exposed copper. You don't get to choose where the surface treatment goes - it gets applied to all exposed copper.
- The board gets some more holes drilled into it, and then it gets milled - a rotating blade that looks a lot like a drill bit goes around the shape of the board and cuts it from the sheet. The shape of the board is something we provide - however the milling bit is fairly large (about the size of the fat end of a sharpie) so we can't have any inside corners with sharp angles.
So here are the things that we need to provide the manufacturer:
- Board outline (what shape the board should be milled into)
- Copper layers (where they should leave the copper on)
- Mask layers (where they should take the soldermask off)
- Silkscreen layers (where they should print silkscreen)
- Drill file (where we want holes to go, and whether they should be filled with copper or not)
Luckily, our PCB design software can do most of the work for us, but we still need to tell it what we want on there. Now, PCB design software works with slightly different concepts. Here's what we have available:
- Component footprints - combination of holes and copper patterns and mask openings and silkscreen that are combined together and can be moved and placed as a whole
- Traces - lines in the copper that electrically connect various things
- Copper pours - shapes that get filled with copper, optionally connected electrically to something on the board
- Keepout areas - shapes that prevent copper pours and traces from entering them
- Mask and silkscreen lines and polygons - shapes that create openings in the mask layer, or add paint to the silkscreen layer
- Board outline - a bunch of lines that form a closed shape that defines the shape of the board
- Imported raster art - this goes on either the mask layer, creating an opening there, or on the silkscreen layer
Inkscape - vector drawings and board outlines
Before we get to the PCB design software, let's start with graphics software. First, I'll show you how to take an Inkscape vector drawing, export it for a mask opening or silkscreen, and make a matching board outline. Open up Inkscape and load up your image. Select your image, go to Export PNG Image in the area to the right of your image, and click "selection". Scale your image until it has the size you want (you can select mm or inch as units). Write down the dpi value you used (300 is fine). Click "export as" and put in a file name. Click "export".
(if you just want to stick your logo or drawing on an existing PCB, you're done, you can skip the next bit)
Now, use the "draw bezier curves and straight lines" tool
click around the shape you have, forming a rough outline, and make sure it's closed (the last click is on the first node):
Select your new path, go to "fill and stroke" and set the stroke color to something that is clearly different from your image.
Now, use the edit path tool
and drag on the segment between each node to create handles. Drag the nodes and handles until you have a nice shape.
Make sure there are no sharp inside corners - imagine you need to draw the shape with the fat end of a sharpie:
Next, select your base image and delete it, leaving just the path. Now, go to File->Save a Copy and select "Desktop Cutting Plotter (AutoCAD DXF R14)" as the format. Give the file a name ending in .dfx
Now you have exported an image at a particular size and a board outline. Great! Now what if you don't have a nice vector image but are starting with a photograph or a sketch?
Using Krita to convert a photo to soldermask or silkscreen graphics
An important thing to understand about imported raster art is that anything we import will be turned into a binary image - either black or white. We can't work with shades of grey - there's no way to manufacture those. There are several ways of converting shades of grey to black and white. We'll look at two methods - the threshold method and the halftone method. The threshold method turns every pixel that is darker than a particular value black and all the other pixels white. The halftone method creates circles of different size corresponding to the brightness of each area in the image. Thresholding is a better method for sharp lines and clearly defined features, halftone gives much better results for shades of grey and soft blurry areas.
Here is an example of the difference between thresholding and halftone:
Here's how to do this in Krita: Load up the image:
Use Filter->Adjust->Desaturate to turn the image to greyscale:
Now, use one of the following tools: Filter->Adjust->Threshold (adjust the threshold level to your liking):
or Filter->Artistic->Halftone (adjust the dot size and angle to your liking):
[TODO: add Krita board outline export]
[TODO: add import steps]
Working in KiCAD
Because we want our PCB to also have a function (in this case, it has two light-emitting diodes that light up) we are going to add some components and connect them together. To keep track of what is connected to what, we have a schematic. In our case, we won't be doing much with the schematic - you can leave it as-is.
Aside: wtf is a schematic? A schematic is a drawing, a bit like a flowchart, that tells you what parts are in an electronic thing and how they are connected to each other. Our schematic is extremely simple - it has a four-pin connector, two resistors and two LEDs. The connector plugs into one of many hacker event badges, and two of its pins provide power to our board. This power flows through the resistors, and through the LEDs. When our addon board is connected to a badge, the LEDs will light up, and their brightness will depend on the value of the resistors. Here is our schematic:
Each component on the schematic becomes a footprint on the PCB, and each line on the schematic becomes a trace on the PCB. I've already mapped the components to footprints for this, but if you want to use different parts instead feel free to do so. To make changes to the schematic, open kicad, open the project, and double-click on the schematic:
To change what parts are on your board, use this button:
But it's perfectly okay to stick with the parts that are already there - they're 0805-size LEDs and resistors, and they are big enough to solder by hand comfortably. When we're ready with the schematic, we can switch to the PCB. Use this button to do so:
So here we are in our PCB editor:
That's all we need from the electronics point of view. Now, we're going to add a board outline, some elements on the mask layer, and some elements on the silkscreen.