Skip to content

Wiring — Raspberry Pi Zero W

The Zero W build is a Pi Zero W, the InnoMaker amplifier HAT, two speakers and the ESP32 that drives the light strip. The Wi-Fi bedside button needs no wiring to the Pi.

The HAT sits on the Zero’s header (same 40 pins and numbering as the Pi 3). Pin numbers are physical pin numbers. Odd pins on the left (inner row), even pins on the right (outer row, nearest the board edge); pin 1 is the square pad.

odd pins · inner roweven pins · outer row13V325 V · HAT, → ESP32 VIN3SDA · amp 0x2045 V from HAT5SCL · amp 0x206GND → ESP327GPIO48TXD → ESP329GND10RXD ← ESP3211GPIO17 · booster12I²S clock13GPIO2714GND15GPIO2216GPIO23 · amp error173V318GPIO2419GPIO10 MOSI20GND21GPIO9 MISO22GPIO2523GPIO11 SCLK24GPIO8 CE025GND26GPIO7 CE127ID_SD28ID_SC29GPIO530GND31GPIO632GPIO1233GPIO1334GND35I²S frame36GPIO1637GPIO2638GPIO20 PCM DIN39GND40I²S data out
Power (+)I²CGroundUARTSignalI²S audio
Pins taken by the HAT (I²C, I²S, booster, error) and by the ESP32 UART. Pins 8 and 10 are the UART, not the amplifier's enable/mute: see section 2.

Finding the pins when the HAT hides the names

Section titled “Finding the pins when the HAT hides the names”

With the amplifier fitted, the names printed on the Pi are covered. Find a pin by position, not by name:

  1. Turn the board so the SD card slot is on your left and the 40-pin header runs along the top edge.
  2. The header has two rows of 20 pins. The top row (nearest the board edge) is the even pins 2, 4, 6 … 40; the bottom row is the odd pins 1, 3, 5 … 39.
  3. Count from the left end: pin 1 is the first of the bottom row, pin 2 the first of the top row. Pin n is the ⌈n ÷ 2⌉-th pin of its row.
◀ SD card slot sidefar end ▶125 V → ESP32 VIN3SDA (HAT)45SCL (HAT)6GND → ESP3278TXD → ESP32910RXD ← ESP321112I²S clk (HAT)1314151617181920212223242526272829303132333435I²S frame (HAT)3637383940I²S data (HAT)top row = even pins (outer row, nearest the board edge) · bottom row = odd pins
Power (+)I²CGroundUARTI²S audio
Positions only: this is where to land each wire, whatever is printed on the board.
Pin Row Count from the left Function here
2 top 1st 5 V → ESP32 VIN
6 top 3rd GND → ESP32
8 top 4th TXD → ESP32 D18
10 top 5th RXD ← ESP32 TX2

Check you are on the right pin with a continuity tester, everything unpowered: pin 6 must beep with pins 9, 14, 20, 25, 30, 34 and 39 (all ground), and pin 2 must beep with pin 4 (both 5 V) and with nothing else. If not, you are one position off, or on the wrong row: pin 1 right next to pin 2 is 3.3 V, and wiring that to VIN would starve the ESP32.

The other highlighted pins belong to the HAT (I²C, I²S): no wire of yours goes there.

1. Audio — InnoMaker HiFi AMP Pro Mini (MA12070P)

Section titled “1. Audio — InnoMaker HiFi AMP Pro Mini (MA12070P)”

You need: Pi Zero W, the InnoMaker HAT, a regulated 19–20 V DC supply, 4 A or more, with a 5.5 mm jack (see Power tolerances below), two passive 4–8 Ω speakers.

Power supplyregulated · ≥ 4 A · not 24 VInnoMaker AMP Pro MiniMA12070P · on the Zero headerSpeakers2 × passive, 4–8 Ω+ (centre)− (sleeve)DC IN +DC IN −LEFT +LEFT −RIGHT +RIGHT −L +L −R +R −+19–20 V DCGNDL +L −R +R −Follow the polarity printed on the HAT's terminals.
Power (+)GroundSpeaker
The HAT plugs onto the Zero's header and feeds the Zero with 5 V through it.
  1. Fit the HAT on the Zero’s header, all 40 pins seated (solder the header on the Zero first if it has none).
  2. Connect both speakers, respecting polarity. Do not join the two “−” wires.
  3. Leave the Zero’s PWR micro-USB empty.
  4. Connect the supply last, then switch it on. The HAT is expected to feed the Zero with its 5 V (as the bench notes found); if the Zero stays dark, switch off and check that the header is fully seated before trying anything else.
What Value Source
Amplifier chip (MA12070P) supply, recommended 4 – 26 V Infineon datasheet, table 6-1
Amplifier chip, absolute maximum 27.5 V (damage above) datasheet, table 5-1
HAT DC input (5.5 mm jack or green terminal) 9 – 24 V InnoMaker AMP Pro page (the Mini has the same power inputs)
Jack and green terminal together forbidden — one source only InnoMaker
Speaker load 4 – 8 Ω per channel; never below 3.2 Ω datasheet table 6-1 (bridged output)
Supply power to provide 1.1 – 1.3 × the combined speaker power InnoMaker
Ratings 2 × 30 W continuous (8 Ω, 22 V) · 2 × 80 W peak (4 Ω, 26 V) InnoMaker / Infineon
Hot-plugging the supply not allowed (inrush, sparks) InnoMaker

What it means for this build:

  • Use a regulated 19 or 20 V adapter (a laptop-style brick). That sits inside the HAT’s 9–24 V window and the chip’s 26 V limit with margin: even +5 % is 21 V.
  • Do not use a “24 V” adapter. InnoMaker warns that some surge to 30 V or more at switch-on, above the chip’s 27.5 V absolute maximum. Avoid unregulated supplies for the same reason.
  • Current: for the full 2 × 30 W, 1.3 × 60 W ≈ 78 W, so 20 V and about 4 A. InnoMaker’s example is 20 V / 5–6 A. A 3 A supply is enough only if the volume stays moderate; the project’s rule is 25 % margin over the measured peak, so measure it first (3 A is fine if the peak is under 2.4 A).
  • Never put two speakers in parallel on one channel unless the result stays at or above 4 Ω: two 8 Ω speakers in parallel make 4 Ω, two 4 Ω make 2 Ω, which is below the chip’s limit.
  • Only one 5 V source for the Zero. The HAT powers it through the header (InnoMaker: “the HAT will provide power to the Raspberry Pi”) and warns that extra 5 V into the Pi may damage it. So: nothing in the PWR micro-USB, and a computer cable on the data port must be data-only.
  • Order: plug the supply into the HAT first, and only then switch the adapter on. Never hot-plug the DC jack.
  • Unknown: the current the HAT’s 5 V rail can deliver to the Pi is not documented. A Zero W needs roughly 0.1 – 0.35 A; if it reboots while the amp plays loud, measure the 5 V at header pin 2 under load.
  • Speaker terminals (Mini): InnoMaker states the right speaker is on PIN-3 (+) and PIN-4 (−) of the speaker connector; the left speaker is then presumably on PIN-1 and PIN-2 (not stated). Read the silkscreen: the Mini is wired differently from the full-size AMP Pro.

Sources: Infineon MA12070 datasheet (V1.0, 2018-07-17) and InnoMaker AMP-Pro.

The ESP32 and the strip are wired exactly as on the Pi 3 (see Wiring — current setup). Two things differ on the Zero: the UART pins are shared with the amplifier HAT, and the Zero has no free USB port, so the ESP32 takes its 5 V from the header.

Pi Zero Wheader, under the HATESP32 DevKit30-pin · runs pi_lightWS2812B strip60 LED5 V supplystrip onlyGPIO14 TXD · pin 8GPIO15 RXD · pin 10GND · pin 65 V · pin 2D18 (GPIO18) RXTX2 (GPIO17) TXGNDVIN (5 V)D13 (GPIO13)GNDDINGND+5 V+5 VGNDTXD → RXRXD ← TXGND5 V from HATvia 330 Ωcommon GNDUART2 · 115 200 baud · 8N1 · 3.3 V: straight wires. TX goes to RX.
UARTGroundPower (+)Signal
The ESP32 takes its 5 V from header pin 2 (the Zero's USB port is taken by usb0). All grounds are joined.
  1. Pass the continuity check above.
  2. Join all grounds: Pi pin 6, ESP32 GND, strip GND, 5 V supply GND.
  3. Wire the UART: Pi pin 8 → ESP32 D18, Pi pin 10 ← ESP32 TX2.
  4. 330 Ω in series on the data line, close to the strip’s DIN; the strip’s +5V/GND come from the 5 V supply, not from the ESP32 or the Pi.
  5. Power the ESP32 from the HAT’s 5 V: header pin 2 (or 4) → ESP32 VIN. pi_light runs without Wi-Fi, so it draws about 50–80 mA; the strip has its own supply. The HAT’s 5 V budget is not documented, so measure pin 2 under load if the Zero resets.
  6. Flash the ESP32 from your computer over its USB-C cable; on the Pi 3 it is flashed through the Pi, which is not set up on the Zero. Unplug the VIN wire first, and never leave USB-C and VIN powered at the same time: many DevKits have no diode between them and the 5 V can back-feed.
  7. From the web interface, start a sunrise or the reading light.

The Wi-Fi button calls the clock over Wi-Fi: no wire goes to the Zero, so it does not conflict with the HAT. See Wiring — Wi-Fi bedside button. The LoRa button receiver (SPI on pins 19/21/23/24) is not available on the Zero with this HAT: chip select GPIO8 is claimed by the amplifier overlay.

The Zero W has no Ethernet. The firmware turns its micro-USB data port (the one nearer the middle of the board, labelled USB) into an Ethernet gadget (usb0).

Your computerPi Zero Wmicro-USB, data portUSB-AUSB (data)data-only cable
USB
Use a data-only cable (no 5 V wire), or unplug the amplifier supply while it is connected.

Two 5 V sources (the computer’s USB and the HAT) feeding the Zero at once is the risk to avoid. Once Wi-Fi is configured (ROBINE_WIFI_SSID / ROBINE_WIFI_PASSPHRASE in .env at build time) the cable is no longer needed.

  1. Unpowered, with a continuity tester: pin 16 goes to the amplifier chip’s error output and pin 11 to its booster control (pins 8 and 10: see the continuity check in section 2). If not, the overlay does not match your board.
  2. Power the HAT alone (not on the Zero) and measure the header: pin 1 should be 3.3 V or nothing, SDA and SCL (pins 3 and 5) 0 V or 3.3 V — never 5 V.
  3. Fit it on the Zero, power up at low volume, and play a manual test sound from the web interface.
  4. The firmware’s volume curve was tuned on the HiFiBerry; the MA12070P master volume starts from −144 dB. Raise the level in small steps.

If the card does not appear (no sound, snd_rpi_merus_amp absent), the HAT does not answer on I²C address 0x20, or the overlay does not fit it.

Function Pin GPIO Note
I²C data / clock 3 / 5 2 / 3 amplifier control, address 0x20
I²S clock 12 18 bit clock
I²S frame 35 19 left/right clock
I²S data out 40 21 audio to the amplifier
ESP32 UART TXD / RXD 8 / 10 14 / 15 ttyS0; not the amplifier enable/mute (overlay merus-amp-uart)
Booster 11 17 overlay booster_gp
Amplifier error 16 23 overlay error_gp
5 V out of the HAT 2, 4 — powers the Zero

The audio chain is limited to 48 kHz by the Linux driver: music and alarms play normally at 44.1 or 48 kHz.