A few years ago I caught the bug. It was like Pokemon for hackers. "Collect them all!" I am not a completist, and yet I was drawn to the artful little trinkets. Some were the #un1eet learning, some were 1337 expressing themselves. Some were development platforms, showcasing a chip or raw possibility. Some people wanted to blind cameras, some wanted to burn their image into your retinas for ever. Some were gameboys on a string. At first I only wanted to collect, then I wanted to support and encourage. Now I like to participate too.
When you look back at #badgelife artists and heroes start to emerge. Joe Grand's 2014 badge inspired some of us. Another inspiring moment for me personally was the 2016 DC DarkNet badge. It was like a little purple cellphone that taught many how to solder for the first time. They have had had several badges over the years that were simply stunning. Then, who can forget the beauty and presentation of the DC25 Crypto Privacy Village badge? (the story behind that badge is good too)
The last couple years has seen an explosion in the variety and sophistication of badges. The SAO standard gave many of us an 'in'. The tools continue to get better and those involved continue to share and mentor and now it is time for you to get involved too.
Deciding What to DoThe #badgelife hashtag helps fans find were to trade for the tiny pieces of art, and it is also used by people talking about their creation experiences.
For me the first challenge was to learn the tools specific to designing PCBs. I had played with various forms of arduino and Raspberry Pi to make things blink, transmit and move. I had learned to solder by building a racing quad. I would encourage you to experiment in these areas if you haven't and are interested.
Because of this my first project and the project I have chosen to share here uses a simple circuit and focuses on doing what I want with the PCB. After getting through the 'just do it once' phase I got a little more complex in the PCB designs (see DC 406 SAO). I will share some of those steps here too. If this particular process doesn't fit your style of learning, I will share some links below to other posts that might help.
Graphics? Not all of us are inclined to create graphics, or maybe we are just shy about sharing those sorts of things. No worries: 2019 is The Year of the Hashtag SAO™. So you can just build a SAO of a hash tag like I did. Therefore, one I have used in the past and seems appropriate for this project is #badgelove. To kick it up a notch I will go with a Super Hashtag design that you can customize with the included Inkscape SVG. I am not fantastic at art, so feel free to improve or experiment and share your creation.
The Art of PixelsBefore you move on, you should make sure you have Inkscape installed. Because extension installation is a manual process in Inkscape at the moment, the Windows Store version is a little harder to use (it is wrapped in an isolated container that can't access the file system directly). So use the installer that is appropriate.
Then follow the directions to install svg2shenzhen. I also find it useful to start with the supplied example SVG file.
An important part of the example svg to take note of is the layer names. These layers correspond to the layers you will be seeing later in KiCad.
When you look at the names of the layers, you will see how layers are kept from being exported by appending "-disabled". In fact the plugin is very particular about the names of the layers. Any layer that does not exactly match will not be exported. This allows you to delete, add and disable layers as you see fit. If you have any issues you can refer back to the example svg.
I have found using each tool for what it is intended for makes things cleaner. So I will be using Inkscape for drawing only. Circuit design will be in KiCad.
The way I like to start is to create a directory, make it a git repo and then save my new svg there. Then I delete all the existing art, save the graphic and do my first commit. I will suggest a couple points along the way that will be helpful to commit so you can go back to these points if you make a mistake. Using version control really lets you experiment because no matter what you do you can simply revert.
I will leave general learning to use Inkscape for you to figure out for now. I will limit to some specific pointers. Any text needs to be turned into vector using Path> Object to Path. You can tell your text is a path if you double click it with the select tool and it shows you nodes instead of highlighting the text and letting you edit it. Because this is a one way conversion, when I get my text the way I want it I duplicate it (CTRL+D) and move it off the page so I can edit it later, then convert the one left on the page to vector. Keep in mind if you do this any alterations you make to the vector you will have to repeat too, so the value may vary depending on what you decide to do.
I have found it best practice to have your final export be a single path per level, so if there are any parts you want to be able to edit later, you can duplicate them and pull them off the page, or do your whole drawing the save a copy with each layer being a single path.
There are some limitations on the the interaction of layers. For example, most fabs won't put silkscreen on exposed copper. For the most part, the way the layers interact will make sense. Just keep in mind, you may have to knock out multiple layers to make something show up correctly. The first iteration we will keep simple and the rendered preview will be our friend.
Colors do not translate during export. Each color and shade will be composed of the various layers. You may have been some exquisite usage of what is basically four color design. One way to think of it is that it is black and white that is kissed with metallic and shadow.
So I slapped together a hashtag diamond logo and added the hashtag. As you can see from the screenshot below, when you convert some text to a path, it creates a group of vectors. I have found it useful to break the group and make the word all one vector. You do this by selecting the whole text, then ungroup (CTRL+SHIFT+G), then select Path > Union from the menu. Now we can use this for knocking out the shape somewhere cool.
I want my hashtag to display on the lower right border of the diamond in copper layer. One way to accomplish this is to make the white part of the above graphic the silkscreen printed area. Then I take my hashtag, rotate it and place it where I want it. Now you need to right-click it and send it to the F.Mask layer.
Now for the part that was all important to me when I built my first shaped PCB: the shape of the PCB itself. To accomplish this I take the shape and make a solid copy of it. You can do this by deleting the inner nodes of the shape or drawing shapes to fill in the gaps with the Union command. Then I take that shape and grow it. This naturally rounds the corners of the shape. If it doesn't it is worth a little work to round the corners since this is key to your badge wearers not cutting or stabbing themselves as the corners can get quite sharp.
Once you have the shape and make sure it is on the Edge.Cuts layer you want to change the fill and stroke. You can open the window by selecting Object > Fill and Stroke. You want to set the stroke to solid. Then on the Stroke style tab you want to set the width something thin. I like to use about 0.47 mm. Then return to the fill tab and set no fill by clicking the 'X'.
Now you have your basic design and you can export your drawing. Choose Extensions > Svg2Shenzhen > 2. 'Export KiCad..'. If you started with the example the first two steps are already done for you. This opens the Export Kicad dialog.
The first thing it wants is a path to export to. I usually use something like './kicad/' so it is exported relative to the svg. To keep my options open I usually export all three formats under 'Export layers as...'. To do this, simply leave everything at it's default and click apply, then select the next export from the drop down and click apply again.
At this point I am usually getting anxious, so I view the board in the 3D renderer. So, open KiCad, select File > Open Project, and browse to the directory you specified in the export dialog. The primary kicad file is the.pro file. Once open you can double click the *_pcb file or click the button that looks like a PCB.
To render the file choose View > 3D Viewer
You can rotate by dragging with the mouse or using the buttons at the top.
As you can see I like to set my colors similar to the final product to get a feel for it. Colors are under Preferences > Choose Colors. You will notice that the text on the side is the color of the dielectric and not the copper layer. This is because we haven't done the copper fill yet. That will be done when we bring in our circuit to the layout.
You may have noticed, a badge needs a lanyard and there is nowhere to attach one. So here we get our first chance to modify the design and do a hole.
I like to do these sorts of modifications with the Path > Union and Path > Difference actions. Make sure you are on the Edge.Cuts layer. First I add a couple circles and a rectangle. Then align the tops and adjust the rectangle so it only spans the space in-between the circles. Then I use Union to make it a solid piece. I will try 20mm as the size Then I center it on the main shape and do a Union again. Then I like to use the rounded square as the hole and make it about 5mm or so. Sometimes I even get fancy and make it a bit of a round triangle shape.
Make sure to use your alignment tools so that it hangs straight. When you are satisfied, export it again and overwrite the other files.
The next thing to understand is that, while you may think of the 'front' of the PCB as being the art, the front is technically where the functional part of the electronics go. Because of this you will need to flip the hash graphic and the text hashtag. Then move them to the back side. You after flipping the graphic, it should move to the B.Silk layer. You will note that it is named with the "-disabled" suffix. You will want to remove that so that the plugin will export that layer. The same is true for the hashtag text. After you flip it, you will move it to the B.Mask layer and you will need to rename that layer also.
Early CleanupNow for a couple house cleaning tasks to neaten things up. Over in Pcbnew (the layout tool in KiCad where you view the *.kicad_pcb file) you may get some extra stuff in the middle of everything.
This is a minor annoyance, but I like to remove it from my files. It is relatively easy because the KiCad files are just structured text files. For this I use Visual Studio Code, but you can use whatever you normally use to edit text. There are several instances of "G***" and "LOGO" that are on the F.Silks layer and marked 'hide', but I like to remove them anyway. This should also be done to the kicad_mod files in the.pretty sub directory of your project.
Now I like to make sure that the whole thing is on the canvas correctly. Each of the layers that are exported are the same size. Because of this they have their layout relative to the same center. This means that you can move the silk layer (because it is easy to select and move) and put it where you want it on the canvas. Then right-click and select Properties. I like to make the X and Y Position values something round and easy to remember. In this case I go with 150x115. You can then drag and select the rest, right click, and select 'Move Exactly'. Again use 150 and 115 and this will restore the layout where you want it.
The end goal is the circuit below:
It is simply a battery connected to two LEDs via a switch and two resistors.
Open the Schematic layout editor. (say yes if it wants to create a file)
Click 'Place symbol' on the right hand side of the screen. It will bring up a dialog. type 'bat' or battery in the search box at the top and select the same one as pictured below.
Next to that, click again and search for LED. Use the first one, it should be the generic one pictured below. When placed, place another one.
It may be helpful to lay things out like pictured above too. Next you want to place a resistor. In the list it is simply called 'R'. After you select the resistor symbol and before you click to put it in place, you can rotate it by pressing the letter 'r' on your keyboard. This way you make it face in-line with the led. Next we need a switch. For this application we want to use a dual pole double throw switch. So open the Choose Symbol dialog and search for DPDT. and place that.
Now, lets place a couple ground symbols. Choose the 'Place power port' tool.
Then search for GND and use the following symbol:
Next we need to connect it all up. Now is a good time to do a save and a git commit so that you can come back to this point as you play with the wire tool. It takes some getting used to Select the place wire tool from the right.
To draw the connection, hover the crosshairs over the circle on a symbol and click.
End lines by double clicking them.
Once you have yours looking somewhat like the drawing above, you should only be missing the VCC labels. This label is called a net. This net will indicate the positive side of power from the battery to the rest of the circuit without drawing a direct line. Select the 'Place net label' tool and click near where you see VCC in the example diagram.
This will bring up a dialog. Simply put 'VCC' in the Text field and leave the rest of the options, and click OK. Then you want to click the end of each of the two wires. Click save! This would be another good point to commit.
Now, you want to number the symbols for the editor's sake. Click Annotate schematic symbols.
You can leave the defaults and click 'Annotate'. The dialog will disappear and the question marks will be replaced with numbers.
Now to go from schematic to layout, you need to assign footprints. Before we get to that juicy bit, you may want to add the Digi-Key foot print library. This helps you through the process of matching actual parts to the footprints.
Install Digi-Key Footprints (optional)The first step is to visit the Digi-Key KiCad Library GitHub page and use git to pull a local copy. (I skipped some detail there on purpose. There are plenty of tutorials on downloading from git, or you can download a zip)
Return to the 'PCB layout editor'. From the Preferences menu click 'Manage Footprint Libraries'. Near the bottom of the dialog click 'Append Library'. I gave mine a nickname of "DigiKey". The Library Path is the path to the digikey-footprints.pretty folder contents. I left plugin type to KiCad. Now you will have more footprints at your disposal.
Assign FootprintsFrom your Schematic layout editor (Eeschema) Click the assign 'PCB footprints to schematic symbols' button.
This is where things really started to click for me the first time. Sure you can design a schematic but translating that to the real world is what gets the juices flowing.
When the Assign Footprints dialog opens, there are three columns. The first is the Library. The middle is your symbols and the right column is the footprint for you to choose by double clicking. To make it easier to find footprints, you can select Filter footprint by library.
The first symbol in the list is the Battery. I like to use the CR2032 because they are cheap and everywhere. In the first column I click 'Battery', then BT1 in the second column. They are 20mm so I choose the Keystone 3034 footprint. When you double click it, it shows your choice in the center column.
For the LEDs, you can choose LED_THT in the first column for through hole. To make the LEDs interesting you can get the self-changing or blinking LEDs like the IL604. These are 5mm so we want to choose a footprint to match. You can use one labeled flattop but if you installed the DigiKey library, I prefer their LED_5mm_Radial footprint.
Finish your selections to match the following:
For the switch I use something like these two position switches. You just need a three prong through hole footprint that looks like:
Once you click ok on the dialog, you need to send the netlist from Eeschema to Pcbnew. From Eeschema click 'Generate netlist'.
In the next dialog simply click 'Generate Netlist' and accept the suggested file name.
Then, in Pcbnew, click the 'Read netlist' button.
In the resulting dialog click 'Read Current Netlist'. Then 'Yes' to make changes. Then click 'Close'.
You will then be able to click to place the rats nest of footprints (I think "rats nest" is a term the pros even use, or maybe it is "rats net"? lmk). You will want to put them off to the side of the main part of the drawing.
There are some aspects of the badge that are unique because it hangs. You want to make sure it hangs straight, so you want to place the battery low and centered. I will leave the location of everything up to you. The only thing that matters is that it all gets put within the edge cuts (yellow outline). Here is the way I did mine:
You can use the 3D viewer to see how everything looks.
Right now you see lines connecting the different pieces in your circuit. These indicate how things should be connected, and helps us with our layout. We will do that with a combination of traces and vias.
To start, make sure you have the Front Copper layer selected.
Then we will draw our first trace by selecting the Route tacks tool.
For now, lets not connect the battery, we will do that with vias later. To start drawing a trace, click one end of one of the lines followed by clicking where the other end of the line leads. In my case trace is shown while drawing with a red line outlined with grey. The outline tells you how close you can come to other copper.
Here is how mine looks till now:
Now we will play with filled zones and vias. A filled zone is a large field of copper that acts like a trace. (It can also be used for subtle art effects for extra credit later). Begin by drawing a trace from the ground pad on the battery toward the lower tip of the design without clicking to end the line. Now press 'V' on your keyboard and click to place a via, and again to end the trace.
The via will pass through the middle dielectric layer and connect the ground on the back. Next we will do the filling. Select the Add filled zones tool.
This tool will allow you to draw a border around where you want it to fill. When you first click it will ask you what net you want it to use. So click just inside one of the corners of the badge and when prompted, make sure you are on the F.Cu layer and select VCC.
Now continue to draw the shape just inside the outside edge of the badge, and double click to end the selection. Next we are going to do the back side of the PCB (the front side of the badge). Select the B.Cu layer.
Now repeat the shape you drew before using the Add filled zones tool. When you get done with this, make sure Show filled areas in zones is selected on the left side of the window.
Then you should see something like this:
Notice the space around the traces and pads, and the connections to the battery pads and the square switch pad. This connects the positive side, or VCC net of the circuit. To see how the ground side looks. Uncheck the F.Cu layer in the panel on the right.
Congratulations! You have built your first custom PCB. View it in the 3D viewer, snap a shot and share it on social media with the hashtag #badgeHappy (obviously).
Time to pull your design into reality. Maybe you have access to a makerspace or the tools to actually mill this yourself. The best results I have been able to get is to send the design to some like Oshpark.
Go to oshpark.com, click upload and browse to your kicad directory. Select the.kicad_pcb file and click ok. Your board will be rendered for you to see how it will be built. You can order three with the click of a button.
While you are waiting for your PCB creation to be fabbed, you can order the rest of the hardware. For ease and beauty you can use these self flashing LEDs that come with resistors, and some CR2032 batteries, a battery clip and a switch.
All that is left is to solder it all together. I made mine so that the LEDs go on the front (align the flat spots) and the other pieces to go on the back.
Midway ReferencesWe all have short attention spans and some times when we learn something new we want to take it and run. It is possible that my method of explaining it just isn't clicking for you. Here are some resources that helped me with PCBs and SAOs using a different medium.
Extra CreditSo now you've gone and made a simple badge. You feel like you cheated a little with the self blinking LEDs and you want to take that next step. At this point a person could go all kinds of different ways with this start. Feel free to start with my design and run wild with it. If you are the type of person who just wands to try and figure things out, you could try some of the following:
- Change the shape of the board
- Add some graphics to the front silk
- Embed some graphics to your filled zones
- Change your minimum trace and via values for more intricate design.
- Add more LEDs!!!
- Make a more complicated circuit like 555
- Replace the through hole parts in the design with SMD
Pop Circuits
If you take a look at the recent history of #badgelife you will see some trends. As mentioned earlier the DC Darknet badge of Defcon 25 used reverse LEDs. Since then you see that they used them in the DC26 official badge. So lets follow some hacker sub-culture trends and move our LEDs to the front from the graphics side of the board and make them shine through to light up our hashtag using reverse LEDs.
The obvious key to this working is removing any obstructions to the light passing through the PCB. This means making gaps in the top solder mask, the top copper and the bottom copper. Also, when you get the PCB manufactured, they wont like putting silk-screened graphics over where there are holes in the solder mask.
What we will have to do is knock out the shape of the hashtag text in the back copper layer. Because the LED light diffuses a little when passing through the PCB we will want to just remove front solder mask and copper over the sight where the LED will shine. This will keep the front side looking clean and maybe let the light bounce around before exiting the hashtag.
Gleaming the Circuit
UP to now, we have been simple with the circuit and explored some trendy PCB designs. So how about an ATTiny with 12 LEDs?
Hide the Hamster
Now that we have our LEDs on the back, you may notice that Reverse LEDs are not easy to find. We want to open up the possibility for easy mass producing later. At some point it would be fun to play a little pick-n-place. While doing this, lets look for another trend to follow.
At Defcon 26 the QueerCon 15 badge hid all the electronics. If you got the privilege of seeing it, so did the Toy Maker's badge and the CNS Summit 17 badge. They did it three layers. The active bottom board, the acrylic layer as a standoff and the passive top art PCB. I thought we could try it with just three layers of PCB. This will require some foot work to find a SMD LED that is less than 1.6 mm thick when attached. Fortunately those are easier to find. Alternately there are places to order laser cut acrylic that we could use. The fun of having three PCB layers is that we are doing PCB art here. You can also order thicker PCB it just seems to cost more once you get thicker than 1.6 mm.
With three PCBs, the first question you might have is how to hold them all together. There are many possible answers to this, but the one we can use for now is a header. I used the footprint for a Connector Pin Header 1x4. Later when you are putting it together you can solder them in and then remove the plastic so all three layers connect flush. You will align their position by setting the X/Y value in properties exactly the same in all three boards. You should do this with all the things you want to align especially the edge cuts.
Don't forget to make space for the resistors. I will keep the original layout as the 'active bottom board' but remove the silk and solder mask. We can do some art on the back of this board later to add our signature info and maybe a puzzle.
Where did you end up?
Did you put your own spin on things? This is a story that is never complete. I would love know. Show me what you did during the Hacker Flairgrounds meetup at DefCon 27! Never stop learning.
Comments