Skip to the content
2 layers90 × 94 mmESP32 Radar System, the printed circuit board in 3D

A compact ESP32-based target detection and alarm system using an HC-SR04 ultrasonic sensor, an SG90 servo, an SSD1306 OLED display, a buzzer, and a red LED.

Size
90 × 94 mm
Copper layers
2
Thickness
1.6 mm
Parts
7
Nets
38
Pads
77
Tracks, vias
104, 1
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
16 Aug 2026
Updated
16 Aug 2026

Overview

ESP32 Radar System is an open-source printed circuit board by yagiz-bas, from the yagiz-bas/ESP32-Smart-Target-Detection-System repository on GitHub. It is a 2-layer board of 90 × 94 mm with 7 parts on 38 nets, routed with 104 tracks and 1 via.

It is built around the ESP32-WROOM-32 and HC-SR04. Its parts include 2 ICs, 1 resistor, 1 diode and 1 connector. It belongs with the ESP32 boards of this library.

Main components

2

README

README.md

ESP32 Smart Target Detection System

A compact ESP32-based target detection and alarm system using an HC-SR04 ultrasonic sensor, an SG90 servo, an SSD1306 OLED display, a buzzer, and a red LED.

The system continuously scans its surroundings by rotating the ultrasonic sensor with a servo. When an object enters the configured detection range, the system confirms the detection, locks the servo at the detected angle, activates visual and audible alarms, and displays the target distance and angle on the OLED. When the target disappears, the alarm is cleared and scanning resumes from the position where the target was lost.

Demo

Features

  • Servo-based horizontal scanning from 30° to 150°
  • HC-SR04 ultrasonic distance measurement
  • Three consecutive detections required for target confirmation
  • Target lock at the detected servo angle
  • Real-time distance and angle display on a 0.96" SSD1306 OLED
  • Red LED visual alarm
  • Passive buzzer audible alarm
  • Three consecutive lost readings required before unlocking
  • Automatic scan recovery after target disappearance
  • ESP32-based embedded control
  • KiCad schematic and PCB design
  • ERC-verified schematic
  • DRC-verified PCB layout
  • Gerber and drill files included

How It Works

1. Scanning

The SG90 servo rotates the HC-SR04 across the configured scan range.

The OLED displays the current:

  • Distance
  • Servo angle
  • System state

Example:

text
SCANNING

Distance: 82.4 cm
Angle: 72 deg

2. Target Detection

When the measured distance drops below the detection threshold, the system does not immediately trigger the alarm.

The target must be detected for three consecutive measurements.

This reduces false triggering caused by individual noisy readings.

3. Target Lock

After three consecutive detections:

  • The servo stops at the detected angle.
  • The red LED turns on.
  • The buzzer activates.
  • The OLED switches to TARGET LOCKED.
  • The measured distance and servo angle are displayed.

Example:

text
TARGET
LOCKED

DIST: 24.7 cm
ANGLE: 117 deg

4. Target Lost

While locked, the system continues measuring the target distance.

If the target remains beyond the loss threshold for three consecutive measurements:

  • The buzzer stops.
  • The red LED turns off.
  • The lock state is cleared.
  • Scanning resumes from the previous servo position.

The system therefore operates continuously:

text
SCAN
  ↓
TARGET DETECTED
  ↓
TARGET LOCKED
  ↓
ALARM
  ↓
TARGET LOST
  ↓
RESUME SCAN

Hardware

ComponentFunction
ESP32-WROOM-32Main microcontroller
HC-SR04Ultrasonic distance measurement
SG90 ServoRotates the ultrasonic sensor
0.96" SSD1306 OLEDDisplays state, distance and angle
Red LEDVisual alarm indicator
1 kΩ ResistorLED current limiting
Passive BuzzerAudible alarm

Pinout

ComponentESP32 GPIO
HC-SR04 TRIGGPIO 5
HC-SR04 ECHOGPIO 4
SG90 SignalGPIO 18
OLED SDAGPIO 21
OLED SCLGPIO 22
BuzzerGPIO 25
Red LEDGPIO 26

Power

  • OLED → 3.3 V
  • HC-SR04 → 5 V
  • SG90 → 5 V
  • Buzzer → GPIO 25 / GND
  • LED → GPIO 26 → 1 kΩ → LED → GND

Hardware note: The HC-SR04 ECHO output can exceed the ESP32's 3.3 V GPIO logic level. A proper voltage divider or level-shifting stage is recommended for a production-ready version.

Software

The firmware was developed using the Arduino framework for ESP32.

Libraries

text
ESP32Servo
Adafruit GFX Library
Adafruit SSD1306
Wire

Project Structure

text
ESP32-Smart-Target-Detection-System/
│
├── Firmware/
│   └── Target Lock Radar System.ino
│
├── Hardware/
│   ├── ESP32_Radar_System.kicad_pro
│   ├── ESP32_Radar_System.kicad_sch
│   └── ESP32_Radar_System.kicad_pcb
│
├── Images/
│   ├── schematic.png
│   ├── pcb-layout.png
│   └── pcb-3d.png
│
├── Media/
│   └── media.gif
│
├── gerbers/
│   ├── ESP32_Radar_System-F_Cu.gbr
│   ├── ESP32_Radar_System-B_Cu.gbr
│   ├── ESP32_Radar_System-F_Mask.gbr
│   ├── ESP32_Radar_System-B_Mask.gbr
│   ├── ESP32_Radar_System-F_Paste.gbr

PCB Design

The PCB was designed in KiCad using a complete schematic-to-PCB workflow:

  1. Schematic design
  2. ERC verification
  3. Footprint assignment
  4. Component placement
  5. PCB routing
  6. GND copper zone
  7. DRC verification
  8. Gerber generation
  9. Drill file generation

Schematic

Schematic

PCB Layout

PCB Layout

3D PCB View

3D PCB

Detection Parameters

Current firmware parameters:

text
Scan range:              30° – 150°
Detection threshold:     35 cm
Target loss threshold:   45 cm
Detection confirmation:  3 consecutive readings
Loss confirmation:       3 consecutive readings
Scan step:               3°

These parameters can be modified directly in the Arduino firmware.

Getting Started

Hardware

Connect the components according to the KiCad schematic:

text
Hardware/ESP32_Radar_System.kicad_sch

Firmware

Open the Arduino sketch from:

text
Firmware/Target Lock Radar System.ino

Install the required libraries, select the appropriate ESP32 board, and upload the firmware.

OLED

The firmware uses an SSD1306 I²C OLED with the default I²C address:

text
0x3C

After startup, the system begins scanning automatically.

Gerber Files

Production Gerber and drill files generated from the KiCad PCB are available in:

text
gerbers/

The folder contains the required copper, solder-mask, silkscreen, board-outline, and drilling data for PCB fabrication.

Design Notes

This project uses a single-axis ultrasonic scanning architecture.

The HC-SR04 measures distance along the direction in which it is currently pointing. The system performs target detection and angular lock, but it does not perform camera-based object classification or continuous visual tracking.

The project was built to demonstrate practical embedded-system concepts including:

  • GPIO control
  • Ultrasonic distance measurement
  • Servo control
  • I²C communication
  • OLED interfacing
  • Event detection
  • State-machine logic
  • Alarm control
  • PCB schematic design
  • PCB routing
  • ERC and DRC verification
  • Gerber generation

Future Improvements

Possible extensions include:

  • Two-axis pan/tilt scanning
  • Camera-based object tracking
  • PC-based real-time visualization
  • Wireless telemetry
  • Event logging
  • Distance history graphs
  • Additional sensing technologies
  • Proper HC-SR04 ECHO level shifting
  • Improved power distribution

License

This project is released under the MIT License.

See LICENSE for the full license text.

Author

Developed as an ESP32 embedded-systems and PCB-design project.


ESP32 + HC-SR04 + SG90 + SSD1306 + Buzzer + LED

A compact prototype for ultrasonic target detection, angular locking, visual indication, audible alarm, and automatic scan recovery.

Parts

7
QtyValueFootprintReferences
11kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR1
1BuzzerConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalBZ1
1ER_OLEDM0.91_1x-I2CDisplay:ER_OLEDM0.91_1x-I2CU2
1ESP32-WROOM-32RF_Module:ESP32-WROOM-32U1
1HC-SR04Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ1
1LEDLED_THT:LED_D5.0mmD1
1Motor_ServoConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalM1

Similar boards

  • 2 layers111.5 × 102 mmWall e, the printed circuit board in 3D

    Wall e

    c-lydia/ESP-ROS2

    A tiny robot with IMU (MPU5060) and an ultrasonic sensor (HC-SR04), running on micro-ROS, communicating over UDP.

    12 parts2Apache-2.0
  • 2 layers109.2 × 86.4 mmÖntözőberendezés, the printed circuit board in 3D

    Öntözőberendezés

    CITROMOSEPER/4-zone-irrigation-system-2026-TDK-Project

    Négyzónás, ESP32-alapú adatvezérelt öntözőrendszer: érzékelők és időjárás-előrejelzés alapján dönt a vízadagról, három üzemmóddal, telefonos webes felülettel és biztonsági réteggel. TDK-projekt, Óbudai Egyetem, 2026.

    59 parts1MIT
  • 2 layersSensor fusion module, the printed circuit board in 3D

    Sensor fusion module

    Faizul6/sensor-fusion-module

    A miniaturized multi-sensor module that combines distance, motion, vibration, and light sensing into a single environment-awareness output — designed and documented like a real inspection-robot sensor module…

    6 parts
  • 2 layers80 × 60 mmEnvMonitor, the printed circuit board in 3D

    EnvMonitor

    kennySzhucheng/EnvMonitor

    🌡️ 智能环境监测站 | STM32F103C8T6 + FreeRTOS + ESP8266 | 温湿度/光照/测距/OLED菜单/ThingSpeak上云 | 从裸机到RTOS到KiCad PCB全流程

    27 parts10
  • 2 layers120.7 × 184.1 mmBeachRover circuit, the printed circuit board in 3D

    BeachRover circuit

    wizardofrobots/roverCode

    Jetson Nano powered Arduino Rover

    11 parts10
  • 2 layers110 × 80 mmNoko 2, the printed circuit board in 3D

    Noko 2

    NikolaiRadke/Noko_2

    The do-it-yourself Arduino-based Noko monster. Version 2 with PCB and 3D printed casing.

    51 parts3Apache-2.0

Questions

How big is the ESP32 Radar System PCB?

It measures 90 × 94 mm and has 2 copper layers, 1.6 mm thick.

What parts does the ESP32 Radar System use?

7 parts, built around the ESP32-WROOM-32 and HC-SR04. 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 ESP32 Radar System KiCad files?

From the yagiz-bas/ESP32-Smart-Target-Detection-System repository on GitHub, at the commit this page was made from: the board is Hardware/ESP32_Radar_System.kicad_pcb and its schematic Hardware/ESP32_Radar_System.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the ESP32 Radar System design in my own project?

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