What it shows
Turning an ultrasonic sensor on a servo and sending angle and distance to a laptop builds a polar map of the objects around, like a radar sweep. It combines timing, servo control and serial communication.
The science
The servo sets the angle and the ultrasonic sensor measures distance at that angle from the echo time (centimetres = microseconds divided by 58). Sending the pair as text, such as 45,120 per line, lets the laptop draw a point at distance 120 in the direction 45 degrees: x = d cos(angle), y = d sin(angle). Sweeping from 15 to 165 degrees and back builds a picture of the objects in front.
Materials
Cost: under Rs 1,500. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.
- An Arduino Uno or compatible board
- An SG90 micro servo
- An HC-SR04 ultrasonic sensor
- A bracket or card to mount the sensor on the servo
- A 4 x AA battery holder (6 V) or a power bank for the servo
- A laptop with the Processing app (free)
- A breadboard and jumper wires
Safety
For this project: USB and low voltage only. Do not turn the servo by hand when it is powered. Keep the sensor cable loose enough not to snag.
Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.
All the safety rulesStep by step
8 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.
Fix the ultrasonic sensor on the servo horn so it points along the servo arm.
Connect the servo signal to pin 3, the servo power to the separate 6 V pack and its ground to Arduino GND.
Connect the sensor to 5 V, GND, TRIG on pin 9 and ECHO on pin 10.
Write a sketch that moves the servo in 2 degree steps from 15 to 165 and back, waiting 40 ms at each step.
At each step, measure the distance (use the median of three readings) and print angle and distance separated by a comma.
Open the Serial Monitor to check that the readings look sensible, then close it.
In Processing, read the serial port, split each line, and draw a green point and fading sweep line using polar to Cartesian conversion.
Place a book 40 cm away at the left and a wall far away and watch the object appear on the screen.
What you should see
The laptop screen shows a half-circle radar picture with a bright mark where each object stands, matching the real room layout.
Viva questions
A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.
1How does the radar know the direction?
The Arduino sends the servo angle with each distance reading.
2Why use a separate battery for the servo?
The servo draws a surge of current that can reset the Arduino if powered from it.
3What limits the angle accuracy?
The beam of the sensor is wide, about 15 degrees, so objects look wider than they are.
4How is a polar reading turned into x and y?
x = d cos θ and y = d sin θ.
Take it further
Add a second servo to tilt the sensor and make a rough 3D scan of a small box.
Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.
