Build a radar controlled by ESP32

ESP32 19-11-24
164 0

Tutorial plan

1- What is a radar ?

2- Operation of the radar controlled by ESP32:

3- Radar components

4- Radar mounting

5- Python Program

 

 

What is a radar ?

A radar (short for Radio Detection and Ranging) is a system that uses electromagnetic waves, specifically radio waves, to detect, locate, and track objects. It operates by transmitting radio waves and analyzing the signals that bounce back (echoes) after hitting an object. Here's a breakdown of its main components and functions:

Key Components

1- Transmitter: Generates radio waves and sends them into space.

2- Antenna:

Transmits the radio waves into a desired direction.

Receives the reflected waves (echoes) from objects.

3- Receiver: Processes the returned echoes to extract information.

4- Processor/Display Unit: Analyzes the data and displays it as images or signals for interpretation.

How Radar Works

1- Transmission: The radar emits a burst of radio waves.

2- Reflection: These waves travel through space, hit objects, and are reflected back toward the radar.

3- Reception: The radar antenna picks up the returning signals.

4- Processing: The time delay between transmission and reception, along with the strength of the reflected signal, helps calculate:

Distance to the object.

Speed of the object (using the Doppler effect).

Direction or bearing of the object.

Applications of Radar

Weather Monitoring: Detecting rain, storms, and other weather phenomena.

Air Traffic Control: Tracking and guiding aircraft.

Military: Detecting and tracking ships, planes, and missiles.

Maritime Navigation: Avoiding obstacles at sea.

Automotive: Advanced driver assistance systems like adaptive cruise control.

Space Exploration: Mapping surfaces of planets and moons.

 

Operation of the radar controlled by ESP32:

A radar system controlled by an ESP32 microcontroller, a servo motor, and an HC-SR04 ultrasonic sensor operates as a scanning or sweeping radar that maps its surroundings by detecting objects and measuring distances. Here's how it works:

1. Initialization:

The ESP32 initializes the servo motor and ultrasonic sensor.

It connects to the PC via USB or Wi-Fi, depending on the setup.

The PC runs visualization software (e.g., a Python script with libraries like Matplotlib or Processing for graphics).

2. Servo Scanning:

The ESP32 controls the servo motor to rotate the sensor incrementally over a specified range (e.g., 0° to 180°).

At each angle, the ESP32 pauses momentarily to allow the sensor to make an accurate distance measurement.

3. Distance Measurement:

- The HC-SR04 emits an ultrasonic pulse when triggered by the ESP32.

- It measures the time taken for the echo to return after bouncing off an object.

- The ESP32 calculates the object's distance.

4. Data Transmission:

The ESP32 sends the angle and measured distance to the PC in real time using serial communication (via USB or Wi-Fi).

5. Visualization:

- The PC software receives the data and plots it dynamically.

- A polar graph is typically used, where:

Angles represent the servo position.

Radii represent the measured distances.

- The screen updates continuously as the radar sweeps back and forth.

6. Continuous Scanning:

- Once the servo reaches its maximum angle (e.g., 180°), the ESP32 reverses the servo's direction for another sweep.

- The process repeats to create a continuous radar-like display.

Radar components

ESP32:

ESP32 card

Controls the radar system, collects data from the HC-SR04, and sends it to the PC for display.

Servo Motor:

Rotates the HC-SR04 sensor to enable scanning over a range of angles.

HC-SR04 Ultrasonic Sensor:

HC-SR04

Measures distance by emitting ultrasonic waves and calculating the time it takes for the echo to return after bouncing off an object.

PC:

Displays the radar's data as a visual map (e.g., polar plot) via a connected program (like Python or Processing).

 

Radar mounting

HC-SR04:

Connect the VCC and GND pins to the ESP32’s 3.3V and GND pins, respectively.

Connect the Trigger (TRIG) and Echo (ECHO) pins to GPIO22 et GPIO21  on the ESP32.

Servo Motor:

Connect the servo's power (usually red) to a 5V supply.

Connect the ground (black/brown) to the ESP32’s GND.

Connect the control (signal) wire (yellow/white) to GPIO23 pin on the ESP32.

 

Python Program

Here’s two  programs with Python to control a radar system using an ESP32, a servo motor, an HC-SR04 ultrasonic sensor, and a PC for visualization.

Programming the ESP32 board with Micropython

Note: you must use these two libraries: hcsr04 and servo.

Python program executed by the computer

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info