I’ve always wanted to design my own PCBs but had never found the time. This year bec of COVID-19 I’ve been able to work from home which has given me the opportunity to learn how to do this. It’s been a few months in the making but I wanted to share with you how I did it.
Choosing an EDA Package
EDA stands for Electronic design automation and it’s the suite of tools you use to create a PCB. Choosing the right software package was not as simple as I was expecting – each has its pros and cons. I knew there would be a steep learning curve with whatever software package I chose so I wanted to make sure I spent time with the right one. There are several popular choices for the hobbyist:
This guide nicely summarises each package and does a good comparison between them.
I initially started trying to use DipTrace as it’s also used by one of the blogs I follow by another person in the UK – Brian Dorey – but I struggled with finding guides and support for it so switched to EAGLE.
Make sure you download and install the free version of EAGLE not Fusion 360. I don’t think this is particularly clear on the AutoDesk website and I ended up installing the wrong program first and getting confused. To me it felt like I was being upsold something I didn’t want so hopefully you can avoid this.
SparkFun have a really good introductory guide to EAGLE. I recommend you read that through first before starting anything yourself. I chose not to install the SparkFun libraries and just relied on what’s pre-built into EAGLE.
If you want to create your own parts then I recommend KTOWN’s guide as it’s really clear and well written. You’ll need to do this eventually as not every component is available in the EAGLE libraries. It looks daunting at first but is incredibly easy once you’ve created your first few parts.
Raspberry Pi HAT Specifications
In order to create a PCB that will sit nicely on your Raspberry Pi you need to know the locations of the 40-way header as well as the locations of the mouting holes. All this information can be found on the Raspberry Pi GitHub repository about HATs.
What I didn’t realise until I started to read the specifications is that a board can only be called a HAT if the following requirements are met:
- It conforms to the basic add-on board requirements
- It has a valid ID EEPROM (including vendor info, GPIO map and valid device tree information).
- It has a full size 40W GPIO connector.
- It follows the HAT mechanical specification
- It uses a GPIO connector that spaces the HAT at least 8mm from the Pi (i.e. uses spacers 8mm or larger – also see note on PoE header below)
- If back powering via the GPIO connector the HAT must be able to supply a minimum of 1.3A continuously to the Pi (but ability to supply 2A continuously recommended).
This is why a lot of products design for use with the Raspberry Pi aren’t called HATs but Bonnets, pHATs etc because they don’t meet the full set of requirements above.
Not fully complying isn’t a problem and the specifications still provide you enough information to create something that will work nicely with your Raspberry Pi.
For simplicity’s sake I’m going to refer to my design as a uHAT for the remainder of this post even though is doesn’t meet all the requirements.
When I first set out on creating a PCB I only had a Raspberry Pi Zero W to hand so I’m using the micro-HAT (uHAT) specifications.
Selecting a Manufacturer
Now it might seem a little strange to already be deciding on a manufacturer at this point however it will save you a lot of rework in future. The reason for this is when you design a PCB you do it in layers; where each layer represents something different such as the copper traces, solder mask, silkscreeen etc. There’s a good explanation of the different EAGLE layers here but don’t get too hung up on it for now. In order to make your PCB the manufacturers need the information in an industry specific file format called the Gerber format. To convert your design into this format it is put through a CAM (Computer-Aided Manufacturing) processor supplied by the manufacturer which essentially converts the your design into the Gerber format. Each manufacturer’s processor does different things with the various information in your layers so it is important to understand what you need to put in each one.
I’m using JLCPCB to manufacture my PCB. They have a specific page on their website about generating the Gerber files from your design. Halfway down the page it explains how you need to define the outline for your PCB. If you don’t follow this then your PCB won’t come out correctly.
The board outline determines the physical profile of the board, and lots of orders from our customers have issues with outline (Like no outline layer at all or the outline is on the silkscreen layer).
A continuous watertight board outline must be drawn on Layer 20 Dimension (generally with 10 mil width lines).JLCPCB: How to Generate Gerber and Drill Files in Autodesk Eagle
So it’s important to pick a manufacturer first then understand how they need you to tweek the design of your PCB.
Drawing the schematic
Since this was my first PCB I just wanted to create a flashing LED or “blinky” (the hello world for microcontrollers). Following the guide on SparkFun the first thing I did was select the components and wire them together. One thing to note here is that it’s important to chose the right footprint for you component. For my first board I was designing a PCB based solely on through-hole components.
Laying out the PCB
Once the schematic was drawn it was time to layout the PCB. The first step was to create the outline of the board using the Dimension layer (#20). The board dimensions were taken from the mechanical drawings provided by Raspberry Pi team with the corners rounded using the Miter tool.
For the mounting holes I had two options – I could either use the Dimension layer again to draw circles for the holes or use the Hole tool – and went for the latter.
The final mechanical consideration for the uHAT is to place the 40-pin connector so that aligns with the header on the Raspberry Pi. Again the drawings show you exactly where this needs to go.
As I just had a resistor, transistor and LED to place there was plenty of space to put them anywhere I wanted. After this I routed the traces to connect everything together.
When you look at the the Raspberry Pi uHAT specifications you will see that for the mounting holes it states:
Mouting hole land should be min. 6.2mm and either isolated copper or bare board (open solder mask).Raspberry PI micro-hat board specification
I chose to go with the bare board option and to do this I used the Circle tool on the tStop (#29), bStop (#30), tRestrict (#41) and bRestrict (#42) layers. The tStop and bStop layers indicate where the solder mask should not be applied on the top and bottom sides of the PCB respectively. The tRestrict and bRestrict layers do the same for the copper. I made the tStop and bStop layers exactly 6.2mm in diameter but the tRestrict and bRestrict layers slightly larger so that the copper was covered by the solder mask at its edges.
This essentially completed the functional part of the PCB – I could have left it like this but I wanted to add some text to the silkscreen. I had to delete most of the Name and Value labels that came with the standard parts which weren’t necessary and only left a few to indicate what the components were. To finish it off I then used the Text tool to add the “Hello World” tag to the tPlace layer (#21) which is used for the silkscreen.
If you look at the top right corner of the PCB you will see the text indicating pin 40 of the connector goes beyond the edge of the board. This text was part of the footprint for the 40-pin connector and to get rid of it would mean I’d have to either edit the standard library or create a copy of the part to modify. To keep things simple on my first attempt I left it there where it will get cut-off when the board is made.
The last step was to add the copper pour for the ground plane on both the top and bottom layers. Again the SparkFun guide explains how to do this.
One thing to note is that the width of the Polygon tool which is used to create the boundaries for the copper pour determines how compliant the ground plane will be in the corners. I set the width to be the same as my traces and you can see in the image below the pour is rounded off in the space between the edge of the board and the mounting hole land. Making the width thinner reduces this rounding while making it thicker increases it.
Now the PCB has been designed its time to create the manufacturing files.
Creating the Gerber files
All manurfacturers need to receive files in the industry standard Gerber format. A pre-processor is needed to convert the design produced by the EDA software to the Gerber format. As EAGLE is such a popular tool most manufacturers have a file you can download which will do this for you – this is another one of the reasons I decided to use EAGLE.
JLCPCB has a page where you can download their pre-processor, explains how to install it and finally how you can inspect the Gerber files afterwards to make sure they have been generated correctly.
Once I had created my Gerber files I submitted them through the JLCPCB ordering portal and waited for delivery.
Assembling my PCB
A few weeks later my PCBs turned up. When I placed them next to my Raspberry Pi they looked pretty profession which I was very pleased about.
Taking a closer look – everything seemed to be as it should and in the top right corner you can see that the text showing pin 40 of the connector has been cut-off as expected.
I soldered the resistor, transistor and LED onto the board first and finished with the 40-pin connector which was a little bit tricky as the pins were quite close together. In hindsight I probably should have done this first.
Using some 10mm stand-offs from ABElectronics I assembled the uHAT on top of my Rapsberry Pi.
Firing everything up
I created a headless Raspberry Pi using this guide and then followed the installation instructions from GPIO Zero which would allow me to control the GPIO pins which controlled the transistor and LED.
Using one of the recipes provided in the GPIO Zero documentation I thrashed together a simple Python script and in a couple of clicks I had a working blinky!
Creating a PCB was much less daunting then I initially thought.
Having never done anything like this before I was quite apprehensive at first but once I’d done things a couple of times it became second nature quite quickly.
There was a lot of Googling involved and this post only gives some of the highlights but that’s one of the good things about EAGLE is that there is an active community out there to answer most of your questions.
This basic prototype took several months as it was dificult to find the time and a lot of mistakes were made but I’m glad I persisted and I’m pleased with the final result.
If I can do it so can you. Happy prototyping…