Your idea is safe; NDA signed before discussion
Raspberry PiCustom HATPCB DesignHardware EngineeringIoT Products

Custom Raspberry Pi HAT Design: A Practical Guide

From schematic to shipped product โ€” what we've learned designing custom HATs for production hardware.

DigitalMonk Hardware Team
DigitalMonk Hardware Team
Embedded Systems & Custom PCB Design ยท Jalandhar, IN ยท Alpine, CA ยท Coventry, UK

There's a moment in almost every Pi-based hardware project when the team looks up from the component catalog and realises: no existing HAT does exactly what they need. Maybe the required I/O combination doesn't exist commercially. Maybe the operating temperature spec rules out every consumer option. Maybe the form factor simply won't fit the enclosure.

At DigitalMonk, we've been through that moment on multiple projects โ€” and we've designed custom Raspberry Pi HATs to get past it. The process is more accessible than most teams expect, but it carries real decisions that don't show up in datasheets: component lifecycle management, EMC layout discipline, DFM trade-offs, and the perennial question of whether you're actually ready to leave the breadboard behind.

This guide covers the full picture โ€” what a custom HAT design actually involves, where most projects get surprised, what it costs, and when the honest answer is "off-the-shelf is fine." If you need a team with direct HAT experience to take this from schematic to prototypes, our hire Raspberry Pi developers who design custom HATs page has the specifics.

What is a Raspberry Pi HAT?

HAT stands for Hardware Attached on Top. The Raspberry Pi Foundation formalised the HAT specification in 2014 alongside the Model B+. A compliant HAT is a board that satisfies four requirements:

  • โ‘ 
    Connects via the Pi's 40-pin GPIO header
  • โ‘ก
    Follows the 65 mm ร— 56 mm PCB footprint with matching M2.5 mounting holes
  • โ‘ข
    Carries an ID EEPROM on I2C bus 0 (pins 27/28) for automatic device tree overlay loading
  • โ‘ฃ
    Uses a stackable or right-angle header so the Pi sits underneath

The ID EEPROM requirement is what separates a strict HAT from a "HAT-compatible" board. In practice, most custom hardware designed for the Pi skips the EEPROM entirely, especially for internal products. The Pi boots fine without it; the EEPROM is most useful for consumer-facing hardware that needs automatic driver loading on first connection.

The 40-pin GPIO header exposes UART, SPI, I2C, I2S, PWM, and general-purpose I/O โ€” enough for a wide range of sensor and control applications. Power comes from the 5V pins and the 3.3V regulated rail, both of which have practical current limits that any HAT design must budget against carefully.

A compatibility note worth making explicit: the 40-pin HAT spec works across Pi 2B through Pi 5 and Zero 2W without modification โ€” provided the GPIO functions used are consistent across models. The Pi 5 introduced peripheral changes via the RP1 I/O controller; verify GPIO assignments against the Pi 5 BCM2712 documentation if that model is in scope.

Custom Raspberry Pi HAT showing 40-pin GPIO header connecting to Raspberry Pi 4 Model B

Custom Raspberry Pi HAT showing 40-pin GPIO header connecting to Raspberry Pi 4 Model B

When Off-the-Shelf HATs Fall Short

Off-the-shelf HATs cover a lot of ground. ADC HATs, relay HATs, CAN bus HATs, LoRa HATs, display HATs โ€” for many applications, especially prototypes and internal tooling, an existing board gets you 90% of the way there faster than a custom design ever could. We say this honestly because we've seen teams go custom when they didn't need to, and the extra time always costs them.

That said, there are six scenarios where off-the-shelf genuinely falls short:

  • 1
    Specific I/O combinations that don't exist commercially

    Your product needs four isolated analog inputs, two relay outputs, and a CAN bus interface on a single board. That combination doesn't exist in any catalog. Stacking three separate HATs introduces mechanical instability, power management complexity, and an enclosure that's 30 mm too tall.

  • 2
    Industrial environmental requirements

    Commercial HATs are rated for 0โ€“70ยฐC. Industrial and outdoor deployments regularly see โˆ’20ยฐC to +80ยฐC. Extended-range components, conformal coating, and vibration-rated connectors don't come on a standard Pi HAT.

  • 3
    Form factor constraints

    If your enclosure has a specific cutout, or your stacked board needs to match a DIN rail module footprint, custom is the only path. The 65ร—56 mm spec is a standard for commercial boards โ€” not a constraint on custom designs.

  • 4
    Cost optimisation at volume

    Below roughly 500 units, off-the-shelf is almost always cheaper when you factor in engineering time. Above that threshold, the economics often flip. At 1,000 units, a custom board designed for your exact application can be significantly cheaper per unit than buying a commercial HAT โ€” especially once you strip out components you don't need.

  • 5
    Certification requirements

    EMC certification (CE, FCC), medical device compliance (IEC 60601), or industrial standards (IEC 61010) often require control over every component on the board. You can't certify around a HAT you didn't design.

  • 6
    Long-term supply chain control

    Commercial HATs get discontinued. If your product has a 5+ year lifecycle, owning your BOM โ€” choosing components with long availability commitments and identified second sources โ€” is the only way to guarantee continuity without a hardware redesign mid-production.

Honest note: Many projects succeed with off-the-shelf HATs, and we'd rather tell you that upfront than steer you toward custom work you don't need. If your I/O requirements match something commercially available and your operating environment is benign, buy the existing board. Custom design makes sense when the constraints genuinely force it.

The Custom HAT Design Process

A custom HAT moves through four phases: schematic design, PCB layout, fabrication, and testing. Each phase has its own decision points and its own places where projects most commonly go sideways.

Schematic Design

Every custom HAT starts on paper โ€” or a whiteboard โ€” before EDA software opens. We map the full I/O requirements, power budget, and GPIO assignments against the Pi's pinout before placing a single component.

GPIO conflict avoidance is the first real design constraint. I2C is on pins 3/5, SPI on 19/21/23/24/26, UART on 8/10 โ€” shared resources that must be planned early. Multiple I2C devices mean address assignments are resolved at schematic stage, not at bringup. Two devices that both respond to 0x48 don't co-exist without a multiplexer, and discovering that at bringup adds a PCB revision.

Power budgeting matters just as much. The Pi's 3.3V rail is limited; the 5V rail depends on what's powering the Pi itself. HAT designs that load the 3.3V rail heavily under peak current draw can cause the Pi to brownout โ€” we've debugged this in production, and it's one of the harder problems to trace without a bench supply with current logging.

Component selection priorities: lifecycle first, then second sources. We've been caught out by ICs that were available at design time and obsolete six months into production. Every critical component on a production HAT should have at least one alternate source. A compliant HAT also includes an ID EEPROM โ€” a 24Cxx-series device on I2C_0 at under $0.30 โ€” which we include by default. This is also the stage where we validate the circuit concept following the breadboard-to-PCB prototyping workflow โ€” verifying the circuit on loose wiring before committing anything to a board.

PCB Layout

Layout is where most of the real work happens โ€” and where most first-time HAT designers get surprised by how much the physical decisions matter.

The 4-layer vs 2-layer decision is driven by signal integrity and EMC targets. For a simple ADC or relay HAT, 2-layer is often sufficient and roughly half the bare board cost. For anything with high-speed SPI, differential signals, or hard radiated emission limits, a 4-layer board with dedicated ground and power planes is worth the cost premium โ€” it's much cheaper to add the layers in layout than to fix EMC failures in a compliance chamber.

Thermal behaviour under a stacked board is easy to overlook. The HAT sits directly above the SoC on a Pi 4, absorbing heat from below. We've seen HATs run fine on Pi 3 and become thermally unstable on Pi 4 purely because of heat soak from the SoC underneath. Leave thermal relief around heat-generating components, and avoid placing temperature-sensitive parts directly in the SoC's shadow.

EMC layout discipline โ€” ground plane continuity, return path control, and proper decoupling at every IC โ€” determines whether the board passes pre-compliance scans. We use a KiCad footprint that models the Pi 4 as a mechanical reference layer to catch clearance errors before layout is finalised. Standoff heights, connector clearances, and the keepout zone around the Pi's USB and Ethernet ports are all checked before Gerbers go out.

Fabrication

For prototypes, we use domestic PCB fabs (5โ€“7 business days) rather than overseas options (3โ€“4 weeks), because iteration speed at prototype stage matters more than cost. For production quantities above 50 units, the economics shift to overseas assembly houses where PCBA costs are substantially lower.

DFM review happens before Gerbers go out โ€” minimum trace widths, via drill sizes, solder mask clearances, courtyard overlaps. Most EDA tools have DRC rule sets for common fabs. Run them every time. The rejection that turns a 5-day lead time into a 2-week lead time is almost always a clearance violation the DRC would have caught.

Component sourcing runs in parallel with board fabrication. On a first prototype, we order all parts the day Gerbers go out โ€” not the day boards arrive. For first-article quantities, 5โ€“10 boards is standard: enough for functional testing, one or two to stress-test, and a couple of spares for when the magic smoke inevitably escapes one unit.

Two custom Raspberry Pi HAT PCB designs showing different I/O configurations developed by DigitalMonk

Two custom Raspberry Pi HAT PCB designs showing different I/O configurations developed by DigitalMonk

Testing & Validation

First power-on is always with a current-limited bench supply โ€” no Pi attached. Verify voltages at every test point before anything else. We've caught reverse-biased diodes and wrong-value pull-ups this way that would have destroyed a Pi board without the current limit.

After power-on verification, we test each subsystem independently before running integrated tests. I2C devices get scanned with i2cdetect. SPI peripherals get loopback tests. ADC channels get known reference inputs. Only after all subsystems pass individually do we run functional tests with the full software stack.

EMC pre-compliance scanning โ€” a near-field probe pass before committing to a full anechoic chamber test โ€” catches layout problems early. It's not a substitute for formal certification, but it's a roughly $500 investment that can prevent $5,000 in failed chamber runs. We follow up with thermal imaging under load, then 72-hour burn-in for any board heading into production. Infant mortality on PCBAs is real; burn-in catches solder joint failures before the boards leave the lab.

Custom HAT mounted on Raspberry Pi 4 during functional testing at DigitalMonk lab

Custom HAT mounted on Raspberry Pi 4 during functional testing at DigitalMonk lab

5โ€“10First-article prototype boards
72 hrBurn-in before production release
8โ€“16 wkKickoff to verified prototypes
2+Prototype iterations to budget

Real-World Examples from Our Work

The principles above aren't theoretical. Here are two condensed examples from DigitalMonk deployments, framed generically to protect client confidentiality.

๐Ÿ”’

Industrial Locker Management System

Custom Pi hardware interfacing with electromechanical locks, RS-485 RFID readers, and status sensors across a deployed fleet of smart locker units.

๐ŸŒก๏ธ

Building HVAC Monitoring Gateway

Custom sensor interface board consolidating temperature, pressure, and flow inputs from multiple zones into a Pi-based monitoring gateway.

Industrial Locker System โ€” What We Learned

Off-the-shelf HATs failed this project on two counts: the required I/O combination โ€” isolated RS-485 multi-drop, eight relay outputs, and sixteen digital inputs โ€” didn't exist on any single commercial board, and the โˆ’10ยฐC to +60ยฐC operating temperature spec ruled out most consumer options. We designed a custom 4-layer HAT that consolidated all interfaces on one board. The biggest lesson from this project: in an industrial product, connector choice is as consequential as circuit design. The wrong connector family cost us two prototype iterations and three weeks we hadn't budgeted.

HVAC Monitoring Deployment โ€” What We Learned

The circuit itself โ€” 4โ€“20 mA current loop inputs โ€” is well-understood. The challenge was power isolation. Sensors in industrial environments pick up ground loops from three-phase power equipment in the same building. We added per-channel isolation that wasn't in the original scope, which is why it didn't make it into prototype 1. It's the reason we now discuss the full electrical environment before the first schematic line goes down on any industrial project. If you're building similar systems, hire Raspberry Pi developers who design custom HATs with experience across the full hardware stack from day one โ€” not after the first prototype.

๐Ÿ”ง

Raspberry Pi Hardware Development โ€” DigitalMonk

From custom HAT design through production validation โ€” our hardware team has shipped Pi-based systems across industrial, IoT, and monitoring deployments.

โ†’

What a Custom HAT Actually Costs

The short version: cheaper at scale than most teams expect; more expensive at low volumes than most teams want. Here are honest estimates based on real projects.

Cost CategoryTypical RangeNotes
NRE / Engineering design$4,000 โ€“ $15,000Simple 2-layer ADC or relay HAT at the low end; 4-layer board with power isolation, multiple comms interfaces, and certification preparation at the high end
Prototype build (5 units)$500 โ€“ $2,500PCB fabrication plus PCBA. Fine-pitch packages and high component counts push toward the upper end; 0402 passives and SOIC packages stay near the lower
Production unit cost (1K+ units)$15 โ€“ $80Commodity relays and ADC inputs at the low end; industrial-grade isolated ICs, precision ADCs, or RF components at the high end
Certification (if required)$5,000 โ€“ $50,000+CE or FCC for a simple IoT product: $5Kโ€“$15K. Medical (IEC 60601) or automotive compliance: $30Kโ€“$50K+, before any product-specific engineering
Timeline8 โ€“ 16 weeksKickoff to verified prototypes. Industrial certification paths, custom enclosures, or additional prototype iterations extend this materially
The framing that matters: NRE is a one-time investment. Amortised across 1,000 units, a $10,000 design cost adds $10 per unit. Compare that to the margin gained by removing $15โ€“$25 of unnecessary components that came on the off-the-shelf board. At volume, custom almost always wins on total cost. Below 100 units, it almost never does.

Frequently Asked Questions

What's the difference between a HAT and a pHAT?
A HAT follows the formal Raspberry Pi Foundation spec: 65ร—56 mm, 40-pin connector, four M2.5 mounting holes, ID EEPROM. A pHAT ("partial HAT") is an informal, smaller form factor โ€” no fixed dimensions, no ID EEPROM requirement. Pimoroni popularised the pHAT format for their compact accessory boards. For production hardware, we design to the full HAT spec unless enclosure constraints force a different footprint.
Do I need a custom HAT or can I prototype on a breadboard first?
Always prototype on a breadboard or with a breakout board before committing to PCB layout. The breadboard stage validates the circuit concept, catches GPIO conflicts, and surfaces power budget issues before they're locked into a board. We've never regretted the extra week on a breadboard. We've occasionally regretted skipping it.
How long does it take to design a custom Raspberry Pi HAT?
8โ€“16 weeks from kickoff to verified prototypes is a realistic baseline. Schematic design takes 1โ€“3 weeks. PCB layout another 2โ€“3 weeks. Fabrication and assembly 3โ€“5 weeks (domestic fab). Testing and rework 2โ€“4 weeks. Projects requiring industrial certification, custom enclosures, or multiple prototype iterations run longer.
Can a custom HAT be certified for medical or industrial use?
Yes โ€” but the certification requirements must shape the design from day one. Medical compliance (IEC 60601) requires specific creepage and clearance distances, isolation voltages, and PCB materials that must be specified in the schematic, not retrofitted later. Industrial certifications (CE, UL, cULus) add similar constraints. Starting a design without the target certifications in scope typically results in a costly redesign before the certification audit.
What happens when a HAT component goes end-of-life?
This is one of the strongest arguments for owning your BOM. When you design the board, you choose components with long-term availability in mind โ€” parts with multi-year lifecycle commitments from the manufacturer, multi-sourced components, and good substitutes already identified in the BOM. When a commercial HAT's key component goes EOL, you're waiting on the vendor. With a custom design, you control the substitution.
Should the HAT include its own MCU or rely entirely on the Pi?
It depends on real-time requirements. The Pi's Linux kernel isn't a real-time OS โ€” if your application needs hard real-time response (motor control, timing-critical sensor acquisition under 1 ms), a small co-processor MCU on the HAT (RP2040, STM32, or an AVR) handles the deterministic work while the Pi manages higher-level logic and connectivity. If your application can tolerate Linux scheduling latency, a co-processor adds cost and complexity you don't need.
Are HATs compatible across all Raspberry Pi models?
A 40-pin HAT is mechanically and electrically compatible with any Pi using the 40-pin header: Pi 2B through Pi 5, and Zero 2W. The Pi 5 introduced peripheral changes via the RP1 I/O controller and different default GPIO states โ€” verify against the Pi 5 documentation before assuming full compatibility. The Zero 2W's smaller board can create mechanical clearance issues with tall components placed near the GPIO header.
How many prototype iterations should I budget for?
Budget for two. One to verify basic functionality and shake out design errors; a second to incorporate fixes and add anything the first prototype revealed as necessary. In our experience, production-quality Pi HATs almost never ship from prototype one. The teams that push straight to production after a single prototype are the teams that call us six months later with field problems that could have been caught in the lab at a fraction of the cost.

Conclusion

A well-designed custom HAT is invisible in the final product โ€” the hardware does exactly what the application needs, fits the enclosure, survives the environment, and ships with a BOM you control. A poorly designed one means field failures traced back to a connector spec nobody checked, a ground loop that breadboard testing would have surfaced, or a component obsolescence that forces a mid-production redesign.

The patterns in this guide โ€” GPIO planning before layout opens, power budgeting in the schematic, DFM review before Gerbers go out, burn-in before production ships โ€” aren't theoretical. They come from the locker system that had to work at โˆ’10ยฐC, the HVAC gateway that had to survive ground loops from three-phase equipment, and the first HAT prototype that taught us never to skip the smoke test.

If you're planning a custom HAT and want a team that has already made the expensive mistakes so you don't have to, take a look at what we do at DigitalMonk's Raspberry Pi hardware practice. We work on fixed-scope hardware engagements โ€” schematic through validated prototypes โ€” across the US, UK, and India.

Considering a Custom HAT for Your Product?

Our embedded team has shipped custom Pi hardware across industrial, IoT, and monitoring deployments. Tell us about your I/O requirements, environment, and volume โ€” we'll tell you honestly whether custom is the right call and what it actually takes to get there.

Talk to our Raspberry Pi team โ†’
Get a Free Project Estimate