Arduino UNO Ultrasonic Radar Using PictoBlox
by vikasgovindrao in Circuits > Arduino
39 Views, 0 Favorites, 0 Comments
Arduino UNO Ultrasonic Radar Using PictoBlox
In this project, we will build a simple Ultrasonic Radar System using an Arduino UNO, an HC-SR04 ultrasonic sensor and an SG90 servo motor. The system scans its surroundings by rotating the ultrasonic sensor through a defined angle and measuring the distance of nearby objects.
The sensor readings are processed using PictoBlox, where a radar-style graphical interface displays detected objects as red markers against a semicircular radar background.
This project demonstrates the practical application of robotics, electronics, distance measurement and block-based programming.
How it works
- The Arduino UNO controls the servo motor.
- The servo rotates the ultrasonic sensor between 15° and 165°.
- The HC-SR04 measures the distance of objects at each position.
- PictoBlox reads the sensor measurements and checks whether an object is within the detection range.
- When an object is detected, the PictoBlox stage displays a red marker and can announce its distance.
Supplies
- Arduino UNO
- HC-SR04 ultrasonic sensor
- SG90 servo motor
- Breadboard
- Jumper wires
- USB cable
- Regulated external 5V supply for servo
- Computer with PictoBlox
Add Backdrop and Sprites
Add the scanner backdrop and add Tobi and red dot as sprite
Circuit Connections
In this step, we will connect the Arduino UNO, HC-SR04 ultrasonic sensor and SG90 servo motor to build the hardware circuit for our ultrasonic radar system.
The HC-SR04 sensor will measure the distance of objects, while the SG90 servo motor will rotate the sensor to scan different directions. The Arduino UNO will control the servo and collect distance measurements, which will later be used by PictoBlox to display objects on the radar screen.
Programming the Arduino Ultrasonic Radar Using PictoBlox
In this step, we will program the Arduino UNO using PictoBlox's block-based programming environment to control the servo motor, collect distance measurements from the HC-SR04 ultrasonic sensor and display detected objects on the radar interface.
The programming is divided into three main parts:
- Setting up Arduino UNO in PictoBlox.
- Programming the servo motor and ultrasonic sensor.
- Creating the radar visualization and object detection system.
Programming the servo motor and ultrasonic sensor
First, select the Tobi sprite. We will create a program that continuously rotates the servo motor and measures the distance using the HC-SR04 sensor.
Step 1: Initialize the servo motor
When the green flag is clicked:
- Set the servo motor connected to digital pin 9 to 15°.
- Start the continuous scanning process.
Step 2: Forward scanning (15° to 165°)
Create a repeat loop that runs 76 times.
Inside the loop:
- Set the servo motor angle using the angle variable.
- Wait for 0.08 seconds to allow the servo to reach its position.
- Read the ultrasonic sensor distance using TRIG pin 7 and ECHO pin 6.
- Store the reading in the distance variable.
- Check whether the measured distance is greater than 2 cm and less than 50 cm.
- If the condition is true, broadcast object detected and wait.
- Increase the angle by 2°.
Step 3: Reverse scanning (165° to 15°)
After completing the forward scan:
- Set angle to 165°.
- Create another repeat loop that runs 76 times.
- Set the servo motor to the current angle.
- Wait for 0.08 seconds.
- Read the ultrasonic distance.
- Check the same detection condition (2–50 cm).
- Broadcast object detected and wait if an object is detected.
- Decrease the angle by 2°.
Final Result
In this final step, we will observe the completed ultrasonic radar system and understand how all the hardware and software components work together.
After completing the circuit connections and programming in PictoBlox, your Arduino UNO-based radar system should be ready to scan its surroundings and detect nearby objects.