360-Degree Radar System With Three Synchronized Ultrasonic Sensors

by medayamed17 in Circuits > Arduino

305 Views, 6 Favorites, 0 Comments

360-Degree Radar System With Three Synchronized Ultrasonic Sensors

WhatsApp Image 2024-07-19 at 15.16.10_c1af95f3.jpg

In robotics, accurately measuring distances is crucial for obstacle avoidance and navigation. To address this need, I have developed a 360-degree radar system that utilizes three synchronized ultrasonic sensors. This system provides comprehensive distance measurements, ensuring that the robot can detect obstacles from all directions.

The design features three ultrasonic sensors placed 120 degrees apart, collectively covering a full 360-degree field of view. These sensors are mounted on a rotating platform driven by a DC motor, which is precisely controlled using a PID controller. This setup allows the platform to rotate by 8.57 degrees every 200 milliseconds.

As the platform rotates, each sensor covers a 120-degree segment. The rotation process involves increasing the angle from 0 to 120 degrees in 14 increments, each of 8.57 degrees. Once the angle reaches 120 degrees, it decreases back to 0 degrees in another 14 steps, completing a full scanning cycle.

Downloads

Supplies

Screenshot 2024-07-20 024634.png
Screenshot 2024-07-20 024909.png
Screenshot 2024-07-20 025054.png
Screenshot 2024-07-20 025221.png
Screenshot 2024-07-20 025414.png

HC-SR04 Ultrasonic Sensors (x3) - For distance measurement.

Arduino Uno R3 - For controlling the sensors and motor.

ESP32 WROOM - For wireless communication and data processing.

L298N Motor Driver - For driving the DC motor.

DC Motor - For rotating the sensor platform.

Wires - For electrical connections.

Controlling a DC Motor With PID Control

Screenshot 2024-07-20 023102.png

I am using an Arduino to control the motor for accurate angle positioning. The Arduino allows me to precisely adjust the motor's rotation, ensuring that the platform moves by specific angles as needed for my 360-degree radar system. This precise control is essential for the system to function correctly, as it ensures that each ultrasonic sensor covers its designated segment accurately. The Arduino's ability to execute control algorithms and handle real-time adjustments makes it the ideal choice for this task.


arduino code :


Downloads

Synchronization of Three Ultrasonic Sensors

Screenshot 2024-07-20 024230.png

all three ultrasonic sensors share a common VCC and GND, and their trigger pins are activated simultaneously to initiate distance measurements. The interrupt pin is used to calculate the distance for each sensor. This setup ensures that all sensors are synchronized and their distance readings are accurately captured and processed.

esp32 code :


Downloads

Connecting ESP32 and Arduino

The final step involves establishing communication between the Arduino and the ESP32. This is achieved by connecting pin 13 of the Arduino to pin 13 of the ESP32, allowing the two devices to relay data and coordinate their operations effectively.

Visualizing Sensor Data in Python

WhatsApp Image 2024-07-20 at 05.09.19_6bd0ad11.jpg

The provided Python code visualizes radar data transmitted from an ESP32 using OpenCV. The program starts by opening a serial connection to the ESP32 and reads incoming data, which is expected to be in the format: distance1,distance2,distance3,angle.

A blank image is created with OpenCV, where radar lines and concentric circles represent the radar's scanning area. As new data is received, the radar lines are updated according to the distance measurements from the three ultrasonic sensors and the current radar angle. The radar visualization includes dots plotted at the measured distances.

The image is updated in real-time, with the display refreshing every 100 milliseconds to simulate live data. The visualization window continues to update until the user presses the 'q' key, at which point the program exits and the window closes.

Downloads