feat: PCM1808+PCM5102 I2S HAT design files

Custom I2S HAT for Pi Multi-FX Pedal — full hardware package:

- KiCad project: schematic (kicad_sch), PCB layout (kicad_pcb), project file
- Custom DT overlay: pcm1808-pcm5102-overlay.dts (no upstream overlay exists for PCM1808)
- docs/hardware-bom.md: BOM (9.25 HAT + 1.75 with enclosure), wiring diagram, PCB design notes
- docs/config-audio.md: DT overlay build, ALSA config, JACK integration, troubleshooting
- scripts/install_hat.sh: One-command install + test suite (6 tests)
- hardware/gerber/: JLCPCB fab instructions and assembly notes

Circuit: Guitar input → TL072 preamp (gain ~20dB) → PCM1808 ADC → RPi I2S
  → PCM5102 DAC → RC filter → output jack
I2S: BCLK/GPIO18, LRCLK/GPIO19, DIN/GPIO20, DOUT/GPIO21
Stacking header passes all 40 GPIO pins for footswitches/LEDs/display
This commit is contained in:
2026-06-07 23:52:13 -04:00
parent 0e77adb4c3
commit 0ae2ca6e8e
8 changed files with 1269 additions and 0 deletions
+219
View File
@@ -0,0 +1,219 @@
# PCM1808+PCM5102 I2S HAT — Bill of Materials + Wiring Diagram
> **Project:** Pi Multi-FX Pedal
> **HAT:** Custom PCM1808 ADC + PCM5102 DAC I2S audio HAT
> **Board:** 65×56mm 2-layer PCB (1590B compatible)
> **Revision:** 1.0 — 2026-06-07
---
## Bill of Materials
### Audio ICs
| Ref | Part | Description | Package | Qty | Est. Cost | Source |
|-----|------|-------------|---------|:---:|:---------:|--------|
| U3 | **PCM1808** | 24-bit stereo ADC, I2S output | TSSOP-14 | 1 | $3.50 | Mouser/Digikey |
| U4 | **PCM5102A** | 32-bit stereo DAC, I2S input | TSSOP-20 | 1 | $3.00 | Mouser/Digikey |
| U2 | **TL072CN** | Dual JFET op-amp (preamp + buffer) | DIP-8 | 1 | $1.50 | Mouser/Digikey |
### Power Regulation
| Ref | Part | Description | Package | Qty | Est. Cost | Source |
|-----|------|-------------|---------|:---:|:---------:|--------|
| U1 | **AMS1117-3.3** | 3.3V LDO regulator, 1A | SOT-223 | 1 | $0.50 | Mouser/Digikey |
| C1 | 10µF electrolytic | Input decoupling (5V rail) | 5mm radial | 1 | $0.15 | — |
| C2 | 100nF ceramic | Input decoupling (5V rail) | 0805 | 1 | $0.05 | — |
| C3 | 10µF electrolytic | Output decoupling (3.3V rail) | 5mm radial | 1 | $0.15 | — |
| C4 | 100nF ceramic | Output decoupling (3.3V rail) | 0805 | 1 | $0.05 | — |
### Preamp Stage (Guitar Input → PCM1808)
| Ref | Part | Description | Package | Qty | Est. Cost | Source |
|-----|------|-------------|---------|:---:|:---------:|--------|
| J2 | 6.35mm TS jack | Guitar input jack, switched (NC contact for bypass) | Panel-mount | 1 | $2.00 | Switchcraft/Neutrik |
| R1 | **1MΩ** | Input pulldown (prevents floating input noise) | 1/4W axial | 1 | $0.05 | — |
| R2 | **10kΩ** | Series resistor to op-amp non-inverting input | 1/4W axial | 1 | $0.05 | — |
| R3 | **100kΩ** | Feedback resistor (gain = 1 + R3/R4) | 1/4W axial | 1 | $0.05 | — |
| R4 | **10kΩ** | Ground reference for feedback divider | 1/4W axial | 1 | $0.05 | — |
| C5 | 10µF electrolytic | DC-blocking cap after op-amp output | 5mm radial | 1 | $0.15 | — |
### ADC Decoupling + Configuration
| Ref | Part | Description | Package | Qty | Est. Cost | Source |
|-----|------|-------------|---------|:---:|:---------:|--------|
| C6 | 100nF ceramic | PCM1808 VCC decoupling | 0805 | 1 | $0.05 | — |
| C7 | 10µF electrolytic | PCM1808 VCC bulk decoupling | 5mm radial | 1 | $0.15 | — |
### DAC + Output Stage (+ config resistor)
| Ref | Part | Description | Package | Qty | Est. Cost | Source |
|-----|------|-------------|---------|:---:|:---------:|--------|
| J3 | 6.35mm TS jack | Audio output jack | Panel-mount | 1 | $2.00 | Switchcraft/Neutrik |
| C8 | 100nF ceramic | PCM5102 VCC decoupling | 0805 | 1 | $0.05 | — |
| C9 | 10µF electrolytic | PCM5102 VCC bulk decoupling | 5mm radial | 1 | $0.15 | — |
| C10 | 10µF electrolytic | DC-blocking cap on DAC output (before output jack) | 5mm radial | 1 | $0.15 | — |
| R5 | **330Ω** | Output series resistor (PCM5102 hiss reduction filter) | 1/4W axial | 1 | $0.05 | — |
| R6 | **10kΩ** | Output stage resistor (output buffer feedback) | 1/4W axial | 1 | $0.05 | — |
### Connectors
| Ref | Part | Description | Qty | Est. Cost | Source |
|-----|------|-------------|:---:|:---------:|--------|
| J1 | 2×20 female header | RPi 40-pin GPIO stacking header, 8.5mm height | 1 | $2.50 | Adafruit/Amazon |
| — | 2×20 male pin strip | Breakaway header for HAT-to-PCB mount | 1 | $1.00 | — |
### Hardware
| Part | Description | Qty | Est. Cost | Source |
|------|-------------|:---:|:---------:|--------|
| M2.5 standoffs | Brass, 12mm female-female, for RPi mounting | 4 | $2.00 | Amazon |
| M2.5 screws | Pan head, 6mm, for RPi + HAT sandwich | 8 | $1.50 | — |
| Pedal enclosure | 1590B diecast aluminum (112×60×31mm) | 1 | $8.00 | Hammond/Amazon |
| Rubber feet | adhesive, 10mm diameter | 4 | $1.00 | — |
---
## Cost Summary
| Section | Est. Cost |
|---------|:---------:|
| Audio ICs (PCM1808 + PCM5102 + TL072) | $8.00 |
| Power regulation | $0.90 |
| Preamp passives | $2.40 |
| ADC/DAC decoupling + output | $2.45 |
| Connectors + stacking header | $3.50 |
| Hardware (standoffs, screws, enclosure) | $12.50 |
| **Total HAT (board + component)** | **~$29.25** |
| + Enclosure + hardware | **~$41.75** |
Compare to AudioInjector Stereo HAT at $35-40 (no preamp, no enclosure) — the custom build costs about the same but is purpose-designed for a stompbox.
---
## Wiring Diagram
```
RPi 4B 40-pin Header (J1)
┌─────────────────────────────────────────┐
│ ● ● ● ● ● ● ● ● ● ● ● ● ● │ Pins 1-20
│ ● ● ● ● ● ● ● ● ● ● ● ● ● │ Pins 21-40
└─────────────────────────────────────────┘
│ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼
┌─────────────────────────────────────────┐
│ P1 P9 P17 P25 P33 | P2 P10 ... │ HAT PCB (top view)
│ GND 3V3 5V BCLK LRCLK │
│ │
│ ┌─────┐ ┌─────┐ ┌──────────────┐ │
│ │ U3 │ │ U4 │ │ U2 │ │
│ │PCM1808│ │PCM5102│ │ TL072 │ │
│ │ ADC │ │ DAC │ │ dual op-amp │ │
│ └──┬──┘ └──┬──┘ └──────┬───────┘ │
│ │ │ │ │
│ └────┬────┘ │ │
│ │ (I2S bus) │ │
│ │ ├── J2 │
│ ┌────┴────┐ │ Guitar In│
│ │ U1 │ │ │
│ │AMS1117 │ └──────────│
│ │ 3.3V │ │
│ └────────┘ │
│ 5V → 3.3V │
│ │
│ ┌───────┐ │
│ J3 ──│ C10 │ │
│ Output ───────│ 10µF │ │
│ └───────┘ │
└─────────────────────────────────────────┘
```
### Detailed I2S Connections
```
GPIO18 (BCLK) ───── PCM1808 pin 8 (BCK) ───── PCM5102 pin 14 (BCK)
GPIO19 (LRCLK) ───── PCM1808 pin 7 (LRCK) ───── PCM5102 pin 13 (LRCK)
GPIO20 (DIN) ────────────────────────────────→ PCM5102 pin 12 (DIN)
GPIO21 (DOUT) ←──── PCM1808 pin 9 (DOUT)
```
### PCM1808 Configuration Pins
| Pin | Name | Connection | Function |
|-----|------|-----------|----------|
| 12 | FMT | GND | I2S format (24-bit left-justified) |
| 13 | MD1 | 3.3V | 48kHz sampling rate |
| 14 | MD0 | GND | Standby disabled (always active) |
### PCM5102 Configuration Pins
| Pin | Name | Connection | Function |
|-----|------|-----------|----------|
| 15 | FLT | GND | Normal operation, low-latency filter |
| 16 | DEMP | GND | No de-emphasis |
| 17 | XSMT | 3.3V | Unmuted (always active) |
### Preamp Stage Circuit
```
Guitar → J2 (TS jack)
├── R1 (1MΩ) → GND (input pulldown)
└── R2 (10kΩ) ──┬── TL072 (non-inverting input, pin 3)
│ TL072 (pin 6, output)
│ │
└── R3 (100kΩ) ──┐
TL072 (inverting input, pin 2)
R4 (10kΩ) → GND
```
Non-inverting gain = 1 + R3/R4 = 1 + 100k/10k = **11 (~20.8dB)**
For high-output humbuckers, this is sufficient to bring ~200mV pickup output to ~2.2V (near line level). Single-coils may need a second gain stage; omit R4 and R3 becomes a 470kΩ feedback resistor for gain of 2 (~6dB).
### Power Distribution
```
RPi 5V (pin 2/4)
├── U1 (AMS1117-3.3) → 3.3V
│ ├── C1 (10µF) + C2 (100nF) ← input decoupling
│ ├── C3 (10µF) + C4 (100nF) ← output decoupling
│ │
│ ├── U3 (PCM1808) — VCC pin 11
│ │ └── C6 (100nF) + C7 (10µF) ← local decoupling
│ │
│ ├── U4 (PCM5102) — Vin pin 1
│ │ └── C8 (100nF) + C9 (10µF) ← local decoupling
│ │
│ ├── U2 (TL072) — VCC+ pin 8
│ └── PCM1808 MD1 (pin 13) — pull to 3.3V for 48kHz
└── PCM5102 XSMT (pin 17) — pull to 3.3V for unmuted
```
### Ground Strategy
- **Star ground** at the RPi GND pin: all audio circuit grounds return to a single point
- Separate analog and digital ground traces on PCB
- Tie analog/digital ground planes together at the star point only
- Keep I2S digital lines separate from analog audio traces
- Input jack ground: connect to star via 10Ω + 100nF for ground loop isolation
---
## PCB Design Notes
- **2-layer board**, 65×56mm, 1.6mm FR4, HASL finish
- **Trace width:** 0.254mm signal, 0.5mm power
- **Clearance:** 0.2mm min, 0.3mm for audio traces
- **Via:** 0.6mm/0.3mm (outer/inner diameter)
- **Copper pour:** GND flood fill on both layers
- Keep I2S traces (BCLK, LRCLK, DIN, DOUT) equal length ±2mm
- Place decoupling caps within 5mm of IC power pins
- Separate analog audio section (left side of board) from digital I2S (right side)