How to panelize KiCAD designs for free

Check out this comment for some tweaks to this guide to support the latest version of the tools!

Panelization is the process of taking two or more PCB designs and combining them using tabs or v-scores that you would then separate into individual boards once they come back from manufacturing. It’s a way to get more than one design made in a single order.

There are a few forum posts or other snippets on how to accomplish this out there already, but not a real guide. For my own sake, this is how you can do this panelization using all free tools. Here are some photos of a board I had fabricated by OSH Park using this panelization method:

I implement this technique whenever I’m creating closely-related PCBs.

The design highlighted in this blog post is a transmitter/receiver pair, meaning that there would never be a transmitter without a receiver, or vice-versa.

Design is made simple by doing the layouts individually, and manufacturing is made simple by getting them made as a single board, not having to coordinate multiple orders. Let’s get started with the guide.

1. Download The Tools

You probably already have KiCAD. Next, make sure to download GerberPanelizer by This is not Rocket Science (site link) from GitHub. This guide uses the 2018-08-10 snapshot release.

2. Export your designs from KiCAD

Your designs have to be completely ready for production before starting this process. Components placed, tracks laid, zones poured etc. It is very “one-way” in that it is impossible to update an already panelized design once it has been exported.


Here’s one of the designs that will be added to the panel.

You’ll want to add a grid origin that is really close to your design. In KiCAD, select placegrid origin to do this. I am putting it in the top left hand corner of the board.


Grid origin placed

In pcbnew, select fileplot to adjust the gerber export settings.

  1. Make sure Output directory is set to an empty directory somewhere on your disk. In this example, it’s set to tx-gerbers.
  2. Check Use auxiliary axis as origin
  3. Check Use Protel filename extensions
  4. *Optional* Since I’m not using them in this design, I’ve unchecked F.Paste and B.Paste.

And then click Plot.

You should be greeted with a directory of files with dissimilar extensions:

Next, you need to export the .drlfiles.

Select filefabrication outputsDrill (.drl) File...

These settings will automatically be set to match the previous export, but make sure the output folder and the drill origin match the previous settings. Mine looked like this:

Here is my resulting output directory with all of the files:

3. Modify the exported files

This step is weird. You need to change the extension of all .gm1 files to .gko. For this example, flail-tx-kicad-Edge_Cuts.gm1 needs to be renamed to flail-tx-kicad-Edge_Cuts.gko as this is what GerberPanelizer expects. Here is my resulting directory:

Notice the .gko file

4. Load the designs into Gerber Panelizer

Open up GerberPanelizer, you will be greeted with this screen:

Select filenew to create a new project. Next, select board placementadd gerber folder and navigate to the output folder from KiCAD. In this example, it was tx-gerbers.

You should be seeing something like this:

Where is the board?! Select board placementautopack: native and your design will leap into view:

Now, re-do the guide up until this point for however many unique designs you want to add to this panel. If you want to duplicate your design multiple times in the same panel, you can add an instance by right clicking on the instance in the right hand view and then clicking add instance.

5. Arrange designs and add tabs

Since you’ve been hitting board placementautopack: native after each board add, your designs should be properly arranged at this point. You can manually move the designs by clicking and dragging them, but I’ve found that using the autopack works really really well. Here’s what my design looks like at this point:

To join the designs together, you need to add breaktabs.

Select breaktabsinsert breaktab, and a small red circle will appear in the top left hand corner of the workspace:

Click and drag the tab between the two designs. Make sure black dots appear on either edge of the design:

Continue to add tabs in the same manner until the text turns a bright green color, this lets you know that the boards will be secured.

There is no way to automatically add the proper tabs, so make sure you use your best judgement.

Now we’re ready to export!

6. Export the panelized design

It’s a good idea to first save the design in GerberPanelizer so you can edit the layout later without having to start from scratch. Once you export the final merged gerber files, they cannot be edited or re-arranged. Select filesave as to save the project.

Now to export the gerbers.

Again, in GerberPanelizer, select fileexport merged gerbers and choose an empty output directory. The directory has to be empty because you typically send a zip archive of all gerbers to the manufacturer to get made, and this zip archive should just include this export. You should see this window pop up:

The contents of the merged output directory should look like this:

The merged output directory will include several image renderings of your merged designs, this is a great first check to make sure that everything went well.

Looks good! However before you send any critical designs off for manufacturing it’s best practice to visually inspect the layers with a gerber viewer. Save the merged output directory as a .zip file.

7. Verify using GerbView

KiCAD ships with a program called GerbView to inspect gerber files. Open that gerbview and then open your zipped merged output directory with fileopen zip archive file.

There will be an error message which you can ignore.

You should see something like this:

There’s the design as we expect it, you can uncheck the different layers on the right pane just like in pcbnew to inspect them one by one. I’ve uploaded this design to oshpark (a domestic PCB fab service) to see if their preview also looks correct and again, there are no problems.

You’re now ready to send your panelized designs out for manufacturing. Congrats!

8. Wrap up

Thanks for reading! Did this guide work for you? Let me know in the comments below this post.

Note: This is confirmed to work with KiCAD 4 and 5.

Sources

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Play multiple sound files on multiple output devices with Python and sounddevice

Ever wanted to have multiple different sound files playing on different output devices attached to a host computer? Say you’re writing a DJing application where you want one mix for headphones and one for the speakers. Or you’re doing some sort of kiosk or art installation where you have many sets of speakers that need to all be playing their own sound file but the whole thing needs to be synchronized. This would even be cool for something like an escape room.

The ladder example is where I needed this bit of code. I’ve been working with interdisciplinary artist Sara Dittrich on a few projects recently and she asked if I could come up with a way to play 8 different mono sound files on 8 different loudspeakers. Here’s a video of the whole setup in action, and an explanation of the project:

I’ve wrapped up all of the code for the art installation project, and that can be found in a github repo here. It includes the startup functionality etc. If you’re interested in recreating the video above, that repo would be a good starting place. The following is a list of the parts used to make that build happen:

Multi-Audio Example

It is worth it to give a simple example of how to play multiple files on multiple audio devices using python. I couldn’t find an examples on how to do this online and had to spend some time experimenting to make it all come together. Hopefully this saves you the trouble.

To install sounddevice on my Raspberry Pi, I had to run the following commands:

For this example, let’s say there are 4 audio files in the same directory as multi.py , so the directory looks like this:

The code is based on the sounddevice library for python, whose documentation is pretty sparse. This script will find the audio files, and then play them on as many devices as there are attached. For example, if you have 3 sound devices it will play 1.wav, 2.wav and 3.wav on devices 1-3. If you have any questions, feel free to ask:

Here are some more photos of the build:

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

100% 3D Printed Desktop Microphone Stand

Here’s a video:

Here are some images:

This is a quick design I came up with rather than spend the $20 on amazon. You can get the STL files on thingiverse here.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

BlinkBox – A test tool for addressable LED development

This project got featured on the official arduino blog as well as hackaday! Thanks to everyone that shared!

I work with addressable LEDs a lot. For all that they’re great for, they’re kind of hard to debug when you have a lot of them connected up at once. This is especially apparent when you have many small single modules in hard to reach spaces.

Here’s my solution:

This lets me set the color and number of LEDs in a strip, and then displays a color pattern. This way I can tell if an LED has become disconnected in a strip, or if a channel  inside a particular has died.

Features

  • Select LED type with the type switch, 4 positions
  • Can test up to 400 LEDs at a time, if you can find a worthy power supply
  • 3 Test modes
    • RGB – 1 second red, 1 second green, 1 second blue
    • HUE – Lock strip at HSV (x, 255, 255) and x loops from 0-255
    • WHTE – Set the strip to RGB(255, 255, 255)
  • Count and Mode are saved into eeprom, so you don’t have to keep resetting the strip if it powers off
  • Wall mount fittings

Design Explanation

All of the raw code solidworks, and KiCAD have been posted on my github. You can look at the 3D models on thingiverse as well.

Mechanical

Here are a couple of quick renders of the assembly design:

The screw mount behind the pushbuttons is extended to be able to support the pressure without flexing:
I added a ridge so you can grab onto something as you interact with the switches / buttons.

Electronics

Here’s the circuit:

There really isn’t a lot going on here, the parts are probably the coolest part of the project. The 5V jack is a 6mm DC barrel jack, the pushbuttons are illuminated 16mm pushbuttons from adafruit,  the on/off switch is a locking toggle switch, and the 4 position rotary switch can be found here.

I wired up the circuit on a spare piece of perfboard.

Software

My code is available on my github.

The LED driving part of the code is based on FastLED, a beautiful library for driving these types of addressable LEDs.

The rest of the code is mostly just a hardware UI problem, and isn’t all that interesting. LED count “ramps” as you hold the button down. The longer you hold the button, the faster the

Wrap up

That’s pretty much it! I’ve already gotten some use out of this tool and have found great satisfaction in taking the time to make it look nice as it will be a permanent addition to my lab.

I’ll post any updates I make to this project as edits to the top of this post.

Thanks for reading, and here are a few more photos:

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Wall-Mounted Drybox for 3D Printing with Nylon

It’s well known that nylon based 3D printer filaments need to be dried out before they’re used. What happens though when you have a 30+ hour print? The spool can take on a lot of moisture in that amount of time and compromise the print.

Many people have solved this problem by making filament dryboxes, somewhat airtight containers that contain a desiccant to dry out the air inside of the chamber.

I have to print several large parts from nylon for client, and I was having trouble in the last hours of the print due to the spool taking on water from the air. I decided to build one of these chambers but with a twist:

 

Mine is wall mounted! Space in my lab is a premium and the walls are free real estate.

The parts for this build is are available on my Thingiverse page. Oh and if you’re curious, I’m using a wall-outlet-rechargeable desiccant pack from Amazon which I got for $15.

The bolts are M3x10mm, and the nuts are M3 nuts, both from McMaster Carr.

Thanks for reading!

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Why you should use Processes instead of Threads to isolate loads in Python

Key Learning

Python uses a Global Interpreter Lock to make sure that  memory shared between threads isn’t corrupted. This is a design choice of the language that has it’s pros and cons. One of these cons is that in multi-threaded applications where at least one  thread applies a large load to the CPU, all other threads will slow down as well.

For multi-threaded Python applications that are at least somewhat time-sensitive, you should use Processes over Threads.

Experiment

I wrote a simple python script to show this phenomenon. Let’s take a look.

The core is this increment function. It takes in a Value and then sets it over and over, increment each loop, until the running_flag is set to false. The value of count_value is what is graphed later on, and is the measure of how fast things are going.

The other important bit is the load function:

Like incrementload is the target of a thread or process. The z variable quickly becomes large and computing the loop becomes difficult quickly.

The rest of the code is just a way to have different combinations of increment and load running at the same time for varying amounts of time.

Result

The graph really tells the story. Without the load thread running, the process and thread versions of increment run at essentially the same rate. When the load thread is running, increment  in a thread grinds to a halt compared to the process which is unaffected.

That’s all! I’ve pasted the full source below so you can try the experiment yourself.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Multiple Frequency Counter for Arduino

Ever wanted to measure the frequency of a square wave using an Arduino? There are a couple of good solutions out of there to do this, but not all of them had the capacity to do multiple inputs. I couldn’t find this quickly so here is my solution.

Here’s the link to the code if you want to skip ahead. The code uses interrupts and doesn’t use any kind of delaying so it’s good for giant state-machine applications. My application for this is measuring signals from 10Hz-100Hz in which this can measure within 1% error. The absolute limits of the code are 1Hz-50KHz.

This project is on GitHub if you want to send a pull request to make improvements.

Setup

For testing, I wrote a simple function generator and uploaded it to a separate arduino. It outputs a pulse train with periods of 10ms (100Hz) and 5ms (200Hz) on pins 2 and 3. I attached LEDs and their resistors for debugging.

Pins 2 and 3 on the function generator to pins 2 and 3 on the frequency counter.

setup

The code for this simple function generator is here:

Frequency Counter

This code will work fine in a stateless application, because there are no delay statements (which some other frequency counters I’ve seen online use). It’s a little bit complicated, send me a pull request if you can refactor it to be cleaner.

Here’s the sketch:

I’ve written most of the important notes as comments in the source, but a couple more details:

  • The important data is stored in period_averages_ms and frequency_averages_hz. You address them using the indices defined at the top of the file. Make sure you call compute_counts()  before using this data. Keep it somewhere in main().
  • You could easily add more frequencies, you just have to NUMSIGS, make a specific ISR, and another attachInterrupt line in setup()
  • It uses interrupts which might not be right for your proejct, but normally shouldn’t get in the way of too much stuff.
  • If the ISR hasn’t seen a new edge in 1000000us, both period_averages_ms[p_index] and frequency_averages_hz[p_index] will be set to zero! This means that slowest frequency that this code can detect is 1Hz!

If you have any questions on how to add more signals, leave a comment!

Results

Here’s the output in the serial monitor attached to my function generator from earlier:

result

That’s like less than 1% error! Pretty good!

I also tested the code with a real function generator. Things worked really well until around 50KHz, so I would say that this code can’t be trusted past 50KHz.

10 Hz

50 KHz

Thanks for reading!

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

#goodprints – Episode #1

Here’s a video:

For a while I’ve been logging my favorite prints here but some of them are two small to warrant a post. So introducing: #goodprints! At first I’m going to shoot for monthly installments, but as I print more, I’ll post more.

This time we’ve got 3 prints in the above video. Here are the details:

Raspberry Pi Wire Shelf Mount – Everyone knows that wire shelves are the best. Now you can securely mount a Raspberry Pi to one. Thingiverse Link

Here is the drawing for mating with the shelf:

Wallet, Keys & Leatherman Wall Mount – I’m constantly loosing these things in my lab, now they’re not going anywhere. Thingiverse Link


Wall Hook – This is for mounting stuff like filament spools, wire, and tape to the wall. It accepts 3/4 inch dowels. There are two version, one 85mm long and one 150mm long (designed to fit hatchbox 1kg filament spools). Thingiverse Link

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Forcing a screen resolution of an Ubuntu guest OS in VirtualBox

I figured that doing this would be nontrivial but turns out it took a little work:

I’m trying to emulate an official 7″ Raspberry Pi Touch Display in a VM, so for this post the target resolution is 800 x 480. If you want to change it to another resolution swap in yours for the rest of this guide.

First, make sure Auto-resize Guest Display is deselected in Virtualbox:

Run the following command in your terminal:

The output should look something the the following, starting with Modeline

Copy the text after Modeline so in this case it would be

And paste it after the following command:

NOTE! You may want to change the 800x480_60.00 to something without an underscore in it, it was causing problems on my system. I changed it to pidisplay. The resulting command for this example is:

You should be able to run the above command without error. Next, run:

You’ll be greeted with output similar to this. Note the name of the display device, in this case VGA-1.

With that output name, enter the following two commands:

After running that second command, the window should jump to it’s new resolution! You’re done!

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

#codehell 2 – THERMAL RUNAWAY Errors on Prusa i3 MK2 3D Printer

This time we’re trying to work through a hardware bug!

Without warning, my printer would stop it’s current print and display “THERMAL RUNAWAY” on the display screen:

This would happen once every couple of prints or so.

According Prusa’s Docs a common cause of this is problems with the thermistor connection. They show a graph that has very erratic readings from the sensor:

 This seemed like a good place to start so I re-seated the connector and used octoprint to generate my own graph:

No erratic readings, the temp would drop off and then start heating back up.

The problem ended up being the connection between the terminal lug and the wire on the heater in the hotend. To fix this, I cut off the crimp lug and stripped away some insulation. I put this into the screw terminal block. I’ve done a couple of prints and had no issues after making this modification.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.