Skip to the content
2 layers65 × 56 mmHAT RP, the printed circuit board in 3D

A custom Raspberry Pi 4 Model B HAT designed for image capture, processing, and display using an ArduCAM OV2640 camera, ST7735 TFT display, and an LM2596S-3.3 based switching power supply.

Size
65 × 56 mm
Copper layers
2
Thickness
1.6 mm
Parts
20
Nets
35
Pads
93
Tracks, vias
73, 9
Pours
7
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
1 Oct 2026
Updated
1 Oct 2026

Overview

HAT RP is an open-source printed circuit board by senadurarslan, from the senadurarslan/Raspberry-Pi-Image-Processing-HAT repository on GitHub. It is a 2-layer board of 65 × 56 mm with 20 parts on 35 nets, routed with 73 tracks and 9 vias.

It is built around the LM2596S-3.3 and SS34. Its parts include 4 capacitors, 4 resistors, 3 diodes, 3 connectors and 1 IC.

Main components

2

README

README.md

Raspberry Pi Image Processing HAT

A custom Raspberry Pi 4 Model B HAT designed for image capture, processing, and display using an ArduCAM OV2640 camera, ST7735 TFT display, and an LM2596S-3.3 based switching power supply.

Raspberry Pi Image Processing HAT

Project Overview

This project focuses on the design and implementation of a custom Hardware Attached on Top (HAT) board for the Raspberry Pi 4 Model B.

The system captures images using an ArduCAM OV2640 camera, processes the image data on the Raspberry Pi, and displays the resulting output on an ST7735 TFT display.

A custom PCB was designed to integrate the camera, display, Raspberry Pi GPIO interface, and power management circuitry into a compact embedded vision platform.

The main hardware blocks are:

  • Processing Unit: Raspberry Pi 4 Model B
  • Image Capture: ArduCAM Mini OV2640
  • Display: ST7735 TFT
  • Power Management: LM2596S-3.3 based SMPS
  • Custom Hardware: Raspberry Pi HAT PCB

System Architecture

The Raspberry Pi acts as the main processing and control unit.

The ArduCAM OV2640 communicates with the Raspberry Pi using:

  • I²C for camera sensor configuration
  • SPI for image data transfer

The ST7735 TFT display uses:

  • SPI for command and pixel data transfer
  • GPIO signals for display control and reset

The overall image processing flow is:

text
        ArduCAM OV2640
              │
       ┌──────┴──────┐
       │             │
      I²C           SPI
Configuration    Image Data
       │             │
       └──────┬──────┘
              ▼
       Raspberry Pi 4
              │
       JPEG Acquisition
              │
       Buffer Processing
              │
        JPEG Decoding
              │
       RGB565 Conversion
              │
              ▼
       ST7735 TFT Display

Hardware Design

The custom HAT PCB was designed using KiCad EDA.

The hardware design includes:

  • Raspberry Pi 40-pin GPIO interface
  • ArduCAM OV2640 camera connector
  • ST7735 TFT display connector
  • LM2596S-3.3 switching regulator
  • SPI communication lines
  • I²C communication lines
  • Dedicated chip-select signals
  • Power distribution circuitry
  • Ground plane for improved signal integrity
  • SMD and THT components

The PCB was designed as a two-layer board and manufactured using the generated Gerber files.

After production, the components were assembled and the board was mounted directly onto the Raspberry Pi for functional testing.


Power Management

An LM2596S-3.3 based switching power supply (SMPS) was integrated into the HAT design.

The power stage converts the available supply voltage to the required 3.3 V rail for the peripheral hardware.

A switching regulator was preferred to provide:

  • Higher energy efficiency
  • Reduced thermal losses
  • Stable output voltage
  • Better performance under varying current loads
  • Improved suitability for embedded applications

Software Architecture

The software was developed using C and C++ on Raspberry Pi OS.

The implementation includes:

  • ArduChip communication
  • OV2640 sensor initialization
  • I²C communication
  • SPI communication
  • JPEG image acquisition
  • JPEG file storage
  • JPEG decoding
  • RGB565 image conversion
  • ST7735 TFT display control
  • Camera and display integration
  • Hardware test programs

Main Source Files

text
arduchip.c
arduchip.h

ov2640.c
ov2640.h
ov2640_regs.c
ov2640_regs.h

spi_linux.c
spi_linux.h

i2c_linux.c
i2c_linux.h

jpeg_to_rgb565.c
jpeg_to_rgb565.h

capture_to_file.c
capture_to_screen.cpp
decode_test.c

test_arduchip.c
test_hal.c

Build System

The project includes a Makefile for compiling and running the camera, image processing, and TFT applications.

Compilers

The project uses:

text
gcc
g++

The full camera-to-display application is compiled using:

text
-std=gnu++20

Libraries

The TFT application uses:

text
rpidisplaygl
lgpio
librt

with:

text
/usr/local/include
/usr/local/lib

Build & Run

Show Available Commands

bash
make

The default target displays the available build and run commands.

Clean Build Files

bash
make clean

This removes generated object files, executables, and temporary image files such as:

text
frame.jpg
frame.rgb565

ArduChip SPI Test

Compile:

bash
make test_arduchip

Run:

bash
make run_test_arduchip

This test verifies communication with the ArduChip interface.


OV2640 Initialization Test

Compile:

bash
make test_hal

Run:

bash
make run_test_hal

This test verifies OV2640 initialization and communication through the hardware abstraction layer.


Capture JPEG Image

Compile:

bash
make capture_app

Run:

bash
make run_capture_app

The application captures an image from the OV2640 camera and stores the acquired JPEG data.


JPEG to RGB565 Conversion

Compile:

bash
make decode_test

Run:

bash
make run_decode_test

This application tests the conversion of captured JPEG image data into the RGB565 pixel format used by the TFT display.


Full Camera-to-TFT Pipeline

Compile:

bash
make capture_screen

Run:

bash
make run_capture_screen

This application combines the complete image pipeline:

text
Camera
  ↓
JPEG Capture
  ↓
Image Processing
  ↓
RGB565 Conversion
  ↓
ST7735 TFT

Project Gallery

Final Integrated HAT System

The final implementation combines the custom HAT PCB, ArduCAM OV2640 camera, ST7735 TFT display, onboard power stage, and Raspberry Pi into a single integrated system.

Final Raspberry Pi HAT System


Camera Capture Test

The OV2640 camera was configured and tested on the Raspberry Pi.

Image data captured from the camera was transferred to the Raspberry Pi and successfully stored as a JPEG image.

OV2640 Camera Capture Test

The terminal output verifies the camera communication and image acquisition process, including:

text
ArduChip SPI test OK
OV2640 init OK
Starting capture...
Capture done
Saved JPEG to frame.jpg

Camera-to-TFT Integration Test

The image captured by the OV2640 camera was processed by the Raspberry Pi and displayed on the ST7735 TFT.

Camera to TFT Integration Test

This test demonstrates the complete image pipeline from camera acquisition to TFT visualization.


Testing

The system was tested incrementally before full integration.

The main test stages included:

  • ArduChip SPI communication test
  • OV2640 initialization test
  • I²C sensor configuration
  • SPI image data transfer
  • JPEG image capture
  • JPEG file storage
  • JPEG decoding
  • RGB565 conversion
  • ST7735 graphical tests
  • PCB electrical tests
  • Camera and display integration
  • Full system functional test

The final system successfully captured image data from the OV2640 camera, processed the image on the Raspberry Pi, and displayed the resulting image on the ST7735 TFT.


PCB Development

The PCB development process consisted of:

text
System Requirements
        ↓
Component Selection
        ↓
Schematic Design
        ↓
PCB Layout
        ↓
Gerber Generation
        ↓
PCB Manufacturing
        ↓
Component Assembly
        ↓
Electrical Testing
        ↓
Raspberry Pi Integration
        ↓
Functional Testing

The PCB design files and manufacturing outputs are included in the repository.


Technologies & Tools

Hardware

  • Raspberry Pi 4 Model B
  • ArduCAM OV2640
  • ST7735 TFT
  • LM2596S-3.3
  • Custom Raspberry Pi HAT PCB

Communication

  • SPI
  • I²C
  • GPIO

Software

  • C
  • C++
  • GNU Make
  • Raspberry Pi OS

PCB Design

  • KiCad EDA
  • Gerber
  • Two-layer PCB design

Repository Contents

The repository contains:

text
Raspberry-Pi-Image-Processing-HAT/
│
├── images/
│   ├── final_hat_system.jpg
│   ├── camera_capture_test.jpeg
│   └── camera_tft_test.jpeg
│
├── KiCad/
│   └── PCB and schematic design files
│
├── mühtas_1_project/
│   ├── Camera drivers
│   ├── SPI / I²C drivers
│   ├── Image processing files
│   ├── TFT application
│   └── Makefile
│
├── rapor/
│   └── Project documentation and reports
│
└── README.md

Documentation

Detailed project documentation, design reports, system requirements, and test procedures are available in the repository.

The project documentation covers:

  • System architecture
  • Hardware design
  • Power management
  • Camera communication
  • TFT communication
  • PCB design
  • Manufacturing
  • Software development
  • Integration
  • Functional testing

Project Context

This project was developed as part of the MÜHTAS-1 Engineering Design Project in the Department of Electronics and Communication Engineering at Kocaeli University.

The project combines embedded software development, digital communication interfaces, PCB design, power electronics, and image processing into a complete embedded vision system.


Author

Sena Sümeyye Durarslan

Electronics and Communication Engineering
Kocaeli University

Parts

20
QtyValueFootprintReferences
4MountingHole_2.7mm_M2.5MountingHole:MountingHole_2.7mm_M2.5MH1, MH2, MH3, MH4
2100nFCapacitor_SMD:C_0805_2012MetricC2, C5
21kResistor_SMD:R_0805_2012MetricR3, R4
2330uFCapacitor_SMD:CP_Elec_8x10C3, C4
24.7KResistor_SMD:R_0805_2012MetricR1, R2
2Conn_01x08_SocketConnector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ2, J3
2LEDLED_SMD:LED_0805_2012MetricD1, D2
133uHInductor_SMD:L_12x12mm_H8mmL1
1GPIOConnector_PinSocket_2.54mm:PinSocket_2x20_P2.54mm_VerticalJ1
1LM2596S-3.3Package_TO_SOT_SMD:TO-263-4U3
1SS34Diode_SMD:D_SMAD3

Similar boards

  • 2 layers100 × 80 mmMeganecan gw, the printed circuit board in 3D

    Meganecan gw

    Barbedx/MeganeCAN

    ESP32-based CAN-bus companion for Renault Megane 2 infotainment displays.

    68 parts3
  • 2 layers175 × 90 mmController, the printed circuit board in 3D

    Controller

    Circuit-Digest/machine-vision-robotic-assembly-system

    A machine vision-based robotic assembly system using the MechArm 270, NVIDIA Jetson Nano, and a custom ESP32 controller board for automated pick-and-place and miniature car assembly.

    95 parts1MIT
  • 4 layers89 × 51 mmPCBusiness card, the printed circuit board in 3D

    PCBusiness card

    Aryan-G4/PCBusiness_card

    A pocket sized multimedia macropad, memory storage device, sd card reader, nRF devkit and bluetooth transceiver all in the size of a business card

    104 parts
  • 2 layers49 × 110.5 mmPcb suiveur, the printed circuit board in 3D

    Pcb suiveur

    bejaouihamza/CUSTOM_ROBOT_PCB_WITH_ESP32

    Key Features 🚀 Core Components ESP32-C3-WROOM-2 – RISC-V-based MCU with WiFi 4 & Bluetooth 5 (BLE)

    60 parts
  • 2 layers114.2 × 97.5 mmPlantMonitor v102, the printed circuit board in 3D

    PlantMonitor v102

    MathewNhari/KiCad

    Schematics for the plant monitoring systems

    51 parts
  • 2 layers180.3 × 63.5 mmPower Systems, the printed circuit board in 3D

    Power Systems

    nick19curtin/PowerSystemsPL-BMS

    138 parts
  • 2 layers52 × 56 mmGimbal driver board, the printed circuit board in 3D

    Gimbal driver board

    PA-33/gopro-control-station

    Two-axis motorised GoPro mount with physical buttons, BLE camera control, and a built-in HTTPS web UI for live HDMI preview and gallery access. ESP32-S3 / SimpleFOC.

    71 partsMIT
  • 2 layers84.5 × 94.5 mmLandyGauge, the printed circuit board in 3D

    LandyGauge

    paulrbarnard/LandyGauge

    Open-source ESP32-S3 vehicle instrument gauge

    129 parts

Questions

How big is the HAT RP PCB?

It measures 65 × 56 mm and has 2 copper layers, 1.6 mm thick.

What parts does the HAT RP use?

20 parts, built around the LM2596S-3.3 and SS34. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the HAT RP KiCad files?

From the senadurarslan/Raspberry-Pi-Image-Processing-HAT repository on GitHub, at the commit this page was made from: the board is KiCad/HAT_tas/HAT_RP/HAT_RP.kicad_pcb and its schematic KiCad/HAT_tas/HAT_RP/HAT_RP.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the HAT RP design in my own project?

Its repository states no licence, so its author keeps all rights: ask senadurarslan before reusing the design.