Engineering Build — B.Tech Final Year Project
Obstacle-Avoidance
UAV — Built from Scratch
Akash Bhat
Jain University · 2021–2022
Arduino C++ · AutoCAD · SolidWorks
Hardware + Software build
Successfully flight-tested
I designed, built, and flew a fully functioning obstacle-avoidance quadcopter drone from scratch as my final year B.Tech project. I wrote every line of the C++ obstacle avoidance algorithm, designed every mechanical component in AutoCAD and SolidWorks, assembled the full hardware stack, and successfully demonstrated real-time collision avoidance in all four directional axes during live testing.
01 · Project Overview
What I built
Most drones crash into obstacles because they rely on a human operator to avoid them. My project set out to solve this autonomously — designing a quadcopter that could sense obstacles in real-time across four directions and automatically manoeuvre away from them, without human input.
The project combined mechanical design, electronics assembly, embedded programming, and live flight testing — all done by me. The result was a working drone that successfully avoided obstacles in all four axes during testing.
Frame
F450 quadcopter frame — glass fibre and polyamide nylon
Motors
4 × 1000KV brushless DC motors
Controller
KK2.1.5 flight controller + Arduino UNO
Sensors
4 × HC-SR04 ultrasonic distance sensors
Power
LiPo 3-cell battery — 20 mins flight time
Total weight
~1.8 kg including battery · 0.5 kg payload
Detection range
Obstacles detected at 50 cm — avoidance at 30 cm
Coverage
Forward, backward, left, right — all 4 axes
Software
Arduino C++ with custom PID avoidance algorithm
02 · Hardware I Assembled
The physical build
I sourced, assembled, wired, and calibrated every component of this drone myself. Here is what went into it and why each part was chosen:
🚁
F450 Frame
High-quality 450mm quadcopter frame with glass fibre body and polyamide nylon arms. I chose this frame for its integrated PCB power distribution — eliminating the need for a separate power board and keeping the electronic layout clean. I designed reinforced arm mounts in SolidWorks before assembly.
⚡
1000KV Brushless Motors × 4
Four brushless DC motors, each rated at 1000KV. I performed motor thrust calculations manually — the drone required at least 2× its total mass in thrust to achieve stable flight and payload capacity. These motors provided 900g thrust each, giving a total of 3.6kg thrust against 1.8kg weight.
🎛️
KK2.1.5 Flight Controller
The flight controller reads gyroscope and accelerometer data to maintain stable flight. I configured the KK2.1.5 from scratch — setting motor layout, receiver type, ESC throttle limits, and PID tuning. The controller receives roll and pitch commands from my Arduino obstacle avoidance code via PWM signals.
🔌
Electronic Speed Controllers (ESCs) × 4
One ESC per motor — each converts PWM signals from the flight controller into the three-phase power required by the brushless motors. I soldered all four ESCs directly to the frame PCB and calibrated throttle limits before first flight.
📡
HC-SR04 Ultrasonic Sensors × 4
Ultrasonic sensors measure distance by emitting a 40kHz sound pulse and measuring the echo return time. I mounted one sensor facing each direction — forward, backward, left, right. Each sensor connects to the Arduino UNO via TRIG and ECHO pins, and can measure distances from 2cm to 200cm with 3mm accuracy.
🧠
Arduino UNO — The Brain
The Arduino UNO runs my obstacle avoidance algorithm in real-time. It reads distance from all four sensors simultaneously, compares them against threshold values, and modifies the roll and pitch PWM signals sent to the flight controller — causing the drone to automatically manoeuvre away from any detected obstacle.
03 · The Algorithm I Wrote
How the code works
I wrote the obstacle avoidance algorithm from scratch in Arduino C++. Here is the logic step by step:
01
Read distances
Every loop cycle, the Arduino reads distance values from all four HC-SR04 sensors simultaneously — Forward (d1), Backward (d2), Left (d3), Right (d4) — using the NewPing library
02
Read receiver channels
The current roll and pitch values from the radio transmitter receiver are read via pulseIn() — these represent what the pilot is commanding the drone to do
03
Check thresholds
If any sensor reads less than 30cm, an obstacle is within avoidance range. The algorithm calculates a corrective roll or pitch value proportional to the distance — the closer the obstacle, the stronger the correction
04
Override control signals
The modified roll/pitch values override the receiver signals and are sent to the KK2.1.5 flight controller via the Servo library — causing the drone to automatically move away from the obstacle
05
Resume normal flight
When no obstacle is within range, the original receiver signals pass through unmodified and the drone responds normally to pilot input
void loop() {
obstacle_forward = sonar[0].ping_cm();
obstacle_backward = sonar[1].ping_cm();
obstacle_left = sonar[2].ping_cm();
obstacle_right = sonar[3].ping_cm();
roll = pulseIn(ROLL_PIN, HIGH);
pitch = pulseIn(PITCH_PIN, HIGH);
if(obstacle_left < 50 && obstacle_left > 5) {
roll_to_kk = roll + int(1000 / obstacle_left);
}
if(obstacle_right < 50 && obstacle_right > 5) {
roll_to_kk = roll - int(1000 / obstacle_right);
}
if(obstacle_forward < 50 && obstacle_forward > 5) {
pitch_to_kk = pitch - int(1000 / obstacle_forward);
}
if(obstacle_backward < 50 && obstacle_backward > 5) {
pitch_to_kk = pitch + int(1000 / obstacle_backward);
}
out1.write(roll_to_kk);
out2.write(pitch_to_kk);
}
04 · Design Work
CAD drawings & 3D models
I designed all mechanical components in AutoCAD (2D engineering drawings) and SolidWorks (3D models) before physical assembly. Every part was dimensioned and validated in software first.
05 · Results
What I achieved
4
Directional axes with successful obstacle avoidance (forward, backward, left, right)
30cm
Detection and avoidance threshold — drone automatically corrects at this range
1.8kg
Total drone weight including battery — met all design targets
9 min
Flight endurance in obstacle avoidance mode during hardware testing
During the first flight test, the propellers sustained minor damage on landing but the sensor module and avoidance system remained fully operational. The drone successfully detected and avoided obstacles in all four directions during testing — the core objective of the project was met.
06 · What I Learned
Skills this project built
✓
Real-time embedded systems programming in C++ — writing algorithms that must execute in microseconds with hardware timing constraints
✓
Hardware-software integration — understanding how code decisions translate to physical behaviour in a moving system
✓
Systems thinking — the drone only works if all subsystems (power, sensors, flight controller, algorithm) function correctly together. Failure in any one stops everything.
✓
Engineering documentation — producing precise 2D and 3D technical drawings to engineering standards using AutoCAD and SolidWorks
✓
Methodical debugging — isolating which of many interconnected components was causing unexpected behaviour during testing
✓
How this applies to cybersecurity — the mindset of understanding how a system behaves under attack (or stress), finding the weak points, and building defences is the same whether you are designing a drone or investigating a SIEM alert
07 · Conclusion
Why this matters
This project proved that I can take a complex technical problem — autonomous obstacle avoidance — and solve it end to end: from concept, through mechanical design, electronics assembly, algorithm development, testing, and documentation. I did not follow a tutorial. I read datasheets, ran calculations, made mistakes, debugged them, and arrived at a working solution.
That same discipline — understanding systems deeply, finding failure points, and building reliable solutions — is exactly what a SOC analyst does every day when investigating alerts, and what a systems administrator or cloud engineer does when designing secure, resilient infrastructure.
Project by: Akash Bhat · B.Tech Aeronautical Engineering · Jain University · 2021–2022