snaphat-pcb
PublicLoading 3D model… large boards can take a moment.
🌻 SnapHAT - PCB design
SnapHAT is an addon for RaspberryPi Zero 2 W serving as a handheld photo camera device.
This repository contains KiCad 9 design files for the PCBs of the SnapHAT device (rev.1.1). The boards' layout is prepared to be compatible with JLCPCB standard 2-layer PCB quote.
[!WARNING] This repository is work in progress — core features are functional, but the PCB for this device is still evolving and some parts of the design are not yet behaving as I hoped. To avoid unnecessary hardware headaches, check Troubleshooting and required reworks section!
[!TIP] Python-based app for this camera can be found in this repository.
Table of contents:
- Features
- Repository structure
- Bill of Materials
- Wire harnesses
- RaspberryPi header connection map
- Troubleshooting and required reworks
Features
- 40-pin Raspberry Pi GPIO header for integration with RaspberryPi Zero 2 W
- 8-pin PH connector and mounting support for 320x240 Waveshare 18366 2.4" LCD TFT display
- Usable with ZeroCam OV5647 5MPx wide-angled 120° camera modules or same form-factor alternatives
1200mAh Li-Po battery support (30x40mm cell footprint, 2 pin PH connector), on-board battery charging (MCP73871) and power monitoring (INA219)- USB-C charging and OTG connector for RaspberryPi SD card access (USB 2.0)
- USB OTG pogo-pin breakout board as Raspberry Pi HAT, accessing USB singals through pogo-pins, connected to main board via 4pin FFC cable
- 8 tactile user interface buttons (navigation and shutter)
- LIS2DW12 motion sensor for providing image orientation metadata
- passive buzzer for audio feedback
- exposed debug UART pins
- flower testpads, because joy and whimsy is in demand
Repository structure
.
├─ main_board/
│ ├─ docs/
│ ├─ *.kicad_pro, *.kicad_sch, *.kicad_pcb
│ └─ README.md
├─ usb_hat/
│ ├─ docs/
│ ├─ *.kicad_pro, *.kicad_sch, *.kicad_pcb
│ └─ README.md
├─ img/
└─README.md
This repository contains two KiCad projects for each board:
- main_board - SnapHAT main board with RaspberryPi socket connector and all camera device peripherals
- USB HAT - USB OTG pogo-pin breakout board
Each board directory contains:
*.kicad_pro,*.kicad_sch,*.kicad_pcb- KiCad 9 design filesdocs/- documentation outputs generated from the KiCad files - you will find BOM in CSV format and schematic PDF in there
In the root directory:
img/- rendered previews of the boards and other images used by READMEs
Bill of Materials
You can find BOMs for each board as CSV file in their respective docs/ directories.
BOMs list PCB components, wire harness components, fasteners as well as OTS modules required to assemble the whole device.
While designing SnapHAT, Farnell and TME were mostly taken into consideration as part vendors, however some parts need to be sourced from elsewhere (this applies mostly to OTS modules).
Estimated component cost of the whole device is approximately 114 USD.
Wire harnesses
Display wire harness
To connect the Waveshare 18366 2.4" LCD TFT Display, use an 8-pin JST-PH (2.0 mm pitch) wire harness. This is not a straight-through cable — pin numbering is reversed between connectors.
Part numbers for building the harness are listed in the main board's BOM and appear in its KiCad schematics as well.
Pin mapping:
| SnapHAT J1 | Signal | LCD PH connector |
|---|---|---|
| 1 | 3V3 (VCC) | 8 |
| 2 | GND | 7 |
| 3 | MOSI (DIN) | 6 |
| 4 | SCLK (CLK) | 5 |
| 5 | SPI_CS | 4 |
| 6 | DC | 3 |
| 7 | RST | 2 |
| 8 | BL | 1 |
USB HAT FFC cable
To connect SnapHAT's USB HAT, use 4 core (1.0 mm pitch) >50 mm FFC cable, with opposite sided contacts. Proposed part number for this cable is listed in the USB HAT's BOM and appear in its KiCad schematics as well.
SnapHAT and USB HAT both include FFC connectors with top-side contacts (SnapHAT: J6, USB HAT: J1). When plugged in, FFC stiffener should face the PCB on both ends.
Pin mapping:
| SnapHAT J6 | Signal | USB HAT J1 |
|---|---|---|
| 1 | VBUS | 1 |
| 2 | USBC_DATA_N | 2 |
| 3 | USBC_DATA_P | 3 |
| 4 | GND | 4 |
RaspberryPi header connection map
Below table describes connected RaspberryPi GPIO pins and their intended function.
| Pin function | Signal name | GPIO (BCM) | Pin | Pin | GPIO (BCM) | Signal name | Pin function |
|---|---|---|---|---|---|---|---|
| 3.3V power rail | +3V3 | - | 1 | 2 | - | +5V0 | 5V power rail |
| I2C data | I2C_SDA | 2 | 3 | 4 | - | +5V0 | 5V power rail |
| I2C clock | I2C_SCL | 3 | 5 | 6 | - | GND | Ground |
| Not connected | - | 4 | 7 | 8 | 14 | RPI_UART_TX | Debug UART Transmit |
| Ground | GND | - | 9 | 10 | 15 | RPI_UART_RX | Debug UART Receive |
| Menu button | BTN_MENU | 17 | 11 | 12 | 18 | BUZZER_SIGNAL | Buzzer PWM |
| A button | BTN_A | 27 | 13 | 14 | - | GND | Ground |
| B button | BTN_B | 22 | 15 | 16 | 23 | - | Not connected |
| 3.3V power rail | +3V3 | - | 17 | 18 | 24 | DISPLAY_RST | Display reset |
| Display SPI MOSI | DISPLAY_MOSI | 10 | 19 | 20 | - | GND | Ground |
| Not connected | - | 9 | 21 | 22 | 25 | DISPLAY_DC | Display Data/Command |
| Display SPI serial clock | DISPLAY_SPI_SCLK | 11 | 23 | 24 | 8 | DISPLAY_SPI_CS | Display SPI chip select |
| Ground | GND | - | 25 | 26 | 7 | - | Not connected |
| Down button | BTN_D | 0 | 27 | 28 | 1 | - | Not connected |
| Left button | BTN_L | 5 | 29 | 30 | - | GND | Ground |
| Right button | BTN_R | 6 | 31 | 32 | 12 | DISPLAY_BL | Display backlight PWM |
| Up button | BTN_U | 13 | 33 | 34 | - | GND | Ground |
| Low battery indicator LED | LED_LBO | 19 | 35 | 36 | 16 | LED_SHUTTER | Shutter activity LED indicator |
| Shutter button | BTN_SHUTTER | 26 | 37 | 38 | 20 | ACCEL_INT1 | Motion sensor interrupt 1 |
| Ground | GND | - | 39 | 40 | 21 | ACCEL_INT2 | Motion sensor interrupt 2 |
Troubleshooting and required reworks
This revision's battery circuit (protection, charger and 5V boost) is still botched. Aside from this, SnapHAT is operational if powered by an external stable 5V supply like PC USB port or powerbank.
To make SnapHAT work in this case, simply connect VBUS to 5V0 (you can solder a wire between corresponding testpads). Keep the SW9 switch off to disable the battery charger circuit and prevent charging indicators flickering.
If you wish to dwell deeper into what's currently wrong with this design, here are symptoms observed during bringup:
- no power sourced from battery:
- battery protection dual MOSFET have wrong topology, skip populating battery protection components entirely and populate R22 and R23 0R resistors instead to connect battery directly to the rest of the circuit. Make sure you use battery with a PCM in this case!
- RaspberryPi stuck in boot loop when powering from battery or weaker USB port:
- battery charging/boost regulator circuit is still wrong in this iteration, for the time being, connect VBUS testpad with the 5V0 one
- SnapHAT gets powered from connected USB-C connector when USB HAT is installed, despite turning SW9 in off position:
- cut the VBUS trace going to J6 pin 1
No comments yet. Be the first to ask about this board.