Raspberry Pi B+ Hat Template


I’ve just created a new template and submitted a pull request to add it to the default templates for the Raspberry Pi HAT. This includes the EEPROM and a few options for the power, including powering from the HAT to the Pi (and the required protection). It looks like the previously linked one is MIA. This current version does not have the cutouts for the Display and Camera ribbon connectors.

You can find the template here: Raspberry Pi HAT Template

The Raspberry Pi Foundation HAT design specs


And if you are looking for how to program the EEPROM:
Howto: Raspi HAT EEPROM and device-tree


Will this hat work with the newer Pi3B+?


Yes. The HAT connector is the same.


@jonbuford: Thank you!


Well… There are additional pins. But only if you are creating a hat to enable PoE. I honestly don’t know what if any documentation exists publicly for 3rd parties to make their own PoE hats (or incorporate PoE functions in parallel to the original intent of a hat) simply because I haven’t bothered to look.

But, yeah… the 40pin connector and ribbon cable pass-throughs are all in the same places.


@SembazuruCDE: Therefore, there exist no PoE hats for the Pi3B+? If there do exist, how were they built without access to documentation?


Raspberry Pi will be releasing a first-party PoE hat.


@ppelleti: Thank you. What if I want the hat to provide PoE capability and my own stuff? The hat you are referring to seems to come closed-source, so I won’t be able to add my own stuff. It looks nice, though, especially the fan.


It appears that the fan is just to blow down on the processor. Nice addition, but not necessarily needed.

I notice that none of the pictures actually show the circuitry except for the underside of that transformer. I wonder if they are gagged by that 802.3af PoE compliance. Or, maybe the design isn’t quite finalized yet, it is still a “coming soon” product.


I am trying to pull in jonbuford’s template, but I think I need to clone the whole https://github.com/jonbuford/kicad-library.git and after I do that an open the PiHat template, the only thing I see in the schematic and the pcb is a 13×2 connector and nothing else. No power supplies, no EPROM. If I refer to the link bobc mentions above (https://hackaday.io/project/8985-raspberry-pi-hat-template), in Jan. 2017, I can get the zip file on that URL, but the openfet site, where [julien], the maker of that template, posted the files, is for sale now!

Anyway, I downloaded the zipped archive from https://hackaday.io/project/8985-raspberry-pi-hat-template, and after a few warnings about missing logos and older stuff, I opened the schematic and the layout just fine. However, besides the extra components in Julien’s schematic (power supply, EPROM…) and the extra slot on the pcb, the connector Julien uses is 20×2 vs. jonbuford’s 13×2. So, is Julien’s older hat any good for the present Pi3B+?


The new 20x2 connector is good for all models of Raspberry Pi, except for the original Pi 1 Model A and Pi 1 Model B.

The old 13x2 connector will work on all models of Rasbperry Pi, but you have access to fewer signals, so you probably only want to use it if you want to be compatible with the Pi 1 Model A and Pi 1 Model B.

Technically, to be called a “HAT”, an add-on board must use the 20x2 connector. (In addition to meeting a few other requirements.) Boards that used the 13x2 connector were called “Pi Plates” or various other things, but not HATs.


@ppelleti: Thanks a lot for all these clarifications!

The dimensions (connector, slot, notch, unplated-through-holes, etc.) of the Pi Hat pcb mentioned in https://hackaday.io/project/8985-raspberry-pi-hat-template match the most recent ones of the Pi Foundation found on github here https://github.com/raspberrypi/hats/blob/master/hat-board-mechanical.pdf. I checked them carefully with FreeCAD. Now, the only thing I find missing from the official spec (and the template I compared against it) is the two-pin connector used for PoE.

Also note that the +5V backfeed protection implemented in Julien’s 2015 hat is radically different compared to the one shown in the docs of the Pi Foundation. He uses an N-MOSFET; the Pi Foundation uses an P-MOSFET. When I get some time, I will run simulations in LTSpice to make sure I understand how the scheme works.

The good thing is that dimensions of the board and the placement of the 2×20 connector in Julien’s hat are spot on, so that can save a lot of time. Also, Joan_Sparky’s kicad_mod file, above in this thread, seems to have the correct dimensions, but I have not run a thorough check on it.



I realized that the 2×20 connector in Julien’s 2015 hat is wrong; it is male and it should be female. I now think that only the EEPROM and the overall dimensions and the positioning, pitch, and holes of the 2×20 connector are useful in Julien’s hat.


You might want to have another look at that.


What @1.21Gigawatts refers to is this…

The run-of-the-mill PTH mount, female connection headers look like this:

Which also explains why they can use the same footprint as the male variety.

Now, there are exceptions to that rule (and I’ve used them on a RPi hat):

They are SMD and if you put a hole into the PCB you can connect with male pin headers from the other side to this… but also from the side this female terminal is connectd (no hole needed, back of PCB will not have PTH visible) - those really need different footprints.

There are also SMD male pin headers:

That’s why earlier in this thread I suggested to treat the RPi interface as a module you add to your project and not a template you build your project from.
The latter always has the problem of running into misalignment problems if one is not super careful, especially if you intend to modify/exchange the footprint.
The former has one caveat - one physical connector for the interface is no problem - Arduino like multi connector interfaces need extra care on the schematic/BOM side of things, as a symbol as of now only supports a single connector in the BOM/footprint. This means there you have to add additional symbols/footprints, which is something one needs to be aware of.
A couple years down the road though (it’s 2018 now) KiCAD will support this.


@Joan_Sparky: Thank you for all this information.

It is not clear to me how I can use a whole board with a connector as a module. Doesn’t that mean that I will have to co-locate several modules (the pcb module and whatever I add to the pcb)?

Yes, alignment can become critical, but it is not impossible to do in KiCAD. KiCAD and FreeCAD have been essentially married with scripts like StepUP. The pcb (populated or not) can be imported into FreeCAD, where its center or some other reference point can be determined with construction lines. The position of the center of the connector with respect to the established reference point can be determined with the FreeCAD tools. The pcb plus construction lines can be pushed KiCAD. Then the reference point of KiCAD can be aligned with the reference point established in FreeCAD; this requires some eyeballing because it involves intersection of lines. If the reference point is established in KiCAD successfully, then the connector (or whatever other component needs to be accurately placed) can be moved to the correct location with a CTRL-M.


Hehe, nice try.
The whole alignment can be done in KiCAD and relies on the original mechanical data from the foundation.
You just need to know your way around the tools and how the coordinate readout in KiCAD works.
No eyeballing required.

Raspberry-Pi-B-Plus-V1.2-Mechanical-Drawing-1.pdf (42.5 KB)

How do you add a GPS, 4G, Wifi or Bluetooth module to your board?
You add a symbol in the schematic and then have a footprint associated, right?
The only difference between an add-on board and a solder-on module is the type of mounting.
This means, the footprint for the add-on module will actually need to contain the footprint for the interface connector + mounting holes if any (just scroll up to see how this looks like for the RPi boards).
With KiCAD you will run into trouble if your add-on module contains more than one interface connector though (Arduino), if you want the BOM to reflect this (and the automation pos file), as this means 2+ footprints, which KiCAD can’t represent from one symbol in the schematic as of right now. For this you would need as many symbols as there are connectors, with one of them containing the placement information of the other connectors…
For hobby use this would be no problem at all (single symbol & footprint), you just need to keep track of the additional connectors yourself (ordering).

Anyhow, templates work as well, IMHO just with less freedom from my POV and some chance to screw up alignment without recognizing it (unless you check your work meticulously before having it made).


@Joan_Sparky: The Raspberry Pi Foundation has released a document specifially for Pi hats. Here’s the pertinent URL: https://github.com/raspberrypi/hats/blob/master/hat-board-mechanical.pdf, as I mentioned above.

Regarding the eyeballing I mentioned above, I try to make centers, etc. show up as intersection of lines which after importing the DXF file are relegated to the drawing layer. To properly place the origin of the drill and footprint files at a point which is determined as intersection of lines, some careful eyeballing is required as KiCAD lacks the snapping tools of a mechanical CAD (so I cannot tell KiCAD to snap the origin at the intersection of this and that line). I guess I can import a DXF file at (0,0), which is the upper left corner of the layout page, but then the drafting page lines that come from KiCAD, appearing within the pcb, will be a distraction. KiCAD insists on using a drafting page for layout, unfortunately.