Arduino ProjectsDrone Projects

Build Obstacle Avoidance Drone Using Arduino

Introduction

In this reader, we will be discussing how to build an obstacle-avoidance drone using Arduino. This can be a useful skill to have if you are looking to get into the drone-building hobby, or if you simply want to create a drone that can avoid obstacles. This drone will use an ultrasonic sensor to detect obstacles in its path.

The trend of technological advancement has led to the development of some amazing devices and gadgets. The use of these devices and gadgets has made our lives easier and better. One such amazing device is the drone

Why NextPCB

  • Most Efficient, Economic, Inventive PCB Solutions
  • Higher Quality
  • Lower Price
  • Faster Delivery

Drones are unmanned aircraft that can be controlled remotely. They are mainly used for aerial photography and videography. However, they can also be used for other purposes such as surveillance, delivery, and search and rescue operations. Drones are becoming increasingly popular and are being used for various purposes. However, one of the main issues with drones is that they can sometimes collide with obstacles while in flight.

DJI drone png

This can damage the drone and also pose a danger to people and property. One way to avoid collisions is to use obstacle avoidance sensors. These sensors can detect obstacles in the path of the drone and send a signal to the drone to change its course. This would help to avoid collisions and make drones safer to use.

292439987 173030471844521 2973110908054908023 n.webp

In this project, we will be building a drone that can avoid obstacles using Arduino. We will be using infrared sensors to detect obstacles and a buzzer to indicate when an obstacle is present. The drone will be programmed to fly around an obstacle when it is detected. This project is perfect for beginners who are interested in learning about drones and programming. It is also a great project for those who want to build a drone that can be used for practical purposes. So, let’s get started!  The Ultimate Guide to How To Build a Drone At Home: Guide for Beginners 2022



Parts and Tools Required – Arduino Drone

Collect the Components Before you start, you’ll need to gather all of the components for this drone. We’ll be using the following: –

🌀 Parts Used :

  1. Arduino (AMAZON.COM)
  2. Sonar

You can find all components on amazon.com

🌀 Drone Kit ~ for Build a Drone

  1. Motors  https://amzn.to/36Zb8tK
  2. ESCs (Electronic Speed Controllers)  https://amzn.to/3jhDimd
  3. Frame  https://amzn.to/3jjJ6LJ
  4. Receiver https://amzn.to/3xbG9Fm
  5. Transmitter https://amzn.to/3xbG9Fm
  6. Flight Controller https://amzn.to/3DTNhaO
  7. Propellers  https://amzn.to/3jmAd4e
  8. Battery https://amzn.to/3DTNGdk

Here’s how it works:

The Ultrasonic sensor measures the distance between the sensor itself and the object and transmits it to the Arduino in the form of the analogue signal (value range: 0 to 1023). We should make a setpoint say 35cm from the Ultrasonic sensor so if the setpoint reaches below 35cm the PID algorithm in the Arduino will start its work by sending out the correction value to the stabilization board.

Most of you understand what PPM and PWM signals are and how it is used in the RC heavens and this is how it is used in our project.

Pulse width modulation (PWM) is a type of modulation where the width of the pulse is varied to encode information. The width of the pulse is proportional to the amplitude of the signal. Pulse width modulation is commonly used in control systems where it is used to control the speed of a motor or the brightness of a light.

RC Devices that use PWM Pulses:

  • Servos
  • Electronic Speed Controllers
  • R/C receivers
  • Data loggers
  • Autopilot/Stabilization systems
  • Servo Controller
PWM-signal
PWM-signal

Pulse position modulation (PPM) is a type of modulation where the position of the pulse is varied to encode information. The position of the pulse is proportional to the amplitude of the signal. Pulse position modulation is commonly used in communication systems where it is used to encode information in a signal. PWM and PPM Difference and Conversion

RC Devices that use PPM Pulses:

  • R/C transmitters
  • R/C receivers
  • Autopilot/Stabilization systems
  • PCTx
ppm-signal
PPM-signal



The Drone contains Five  basic components:

1x Arduino NanoIt is the brain of our drone and where the flight control software will run

1x Ultrasonic Sensor HC-SR04. HC-SR04 ultrasonic sensor to measure distances with a measurement error of less than 0.5cm aimed at estimating the flight altitude of our drone

1x Frame 450. It is the structure where we will mount all the hardware components of our drone. We are going to use a 450mm frame :

4x 1000kV motors and 4x  20Amp ESC .  One of the most important components of our drone is the motors and the 4 ESCs in charge of making them rotate. We will use 1000kV motors and ESC of at least 20 amps. Make sure that the pack you buy also includes the propellers.

1x Remote control and RC receiverWe will use it to control the drone and make it move as we please. There are countless models available, I leave you the one I use, whose characteristics are sufficient for this application. Make sure that the model you buy also includes the receiver.

1x 3S 5000mAh batteryDrone power source. We will use a 5000mAh 3S battery.

Assembly of the components

we’ll show you how to assemble a quadcopter using an Arduino flight controller. We’ll also go over how to program the Arduino to make the drone fly. It requires a good understanding of electronics and programming. We’ll be using the Arduino IDE to program the Arduino, so if you’ve never used Arduino before, check out our getting started guide.

Wiring Diagram – Obstacle Avoidance Drone

The wiring diagram is absolutely straightforward. You have to connect the Ultrasonic sensor module pins with Arduino pins as per the schematic diagram. The schematic diagram is shown below.

Build Obstacle Avoidance Drone Using Arduino
Build Obstacle Avoidance Drone Using Arduino

You may also follow the following pin mapping



Ultrasonic sensor->Arduino nano

1. Down Sensor
  • VCC -> VIN
  • GND -> GND
  • TRIG & ECHO -> A1
2. Up Sensor
  • VCC -> VIN
  • GND -> GND
  • TRIG & ECHO -> D6
3. Right Sensor
  • VCC -> VIN
  • GND -> GND
  • TRIG & ECHO -> D5
4. Left Sensor
  • VCC -> VIN
  • GND -> GND
  • TRIG & ECHO -> D4
5. Back Sensor
  • VCC -> VIN
  • GND -> GND
  • TRIG & ECHO -> D7
6. Front Sensor
  • VCC -> VIN
  • GND -> GND
  • TRIG & ECHO -> D2

PWM Receiver->Arduino nano

  • Ch1 -> D8
  • Ch2 -> D9
  • Ch3 -> D10
  • Ch4 ->
  • Ch5 ->
  • Ch6 -> A0

Flight Controller->Arduino nano

  • Ch1 -> D13
  • Ch2 -> D11
  • Ch3 -> D12
  • Ch4 ->
  • Ch5 ->
  • Ch6 ->  Not connected

Flight Controller-> PWM Receiver

  • Ch4 -> Ch4
  • Ch5 -> Ch5

RGB Neopixel->Arduino nano

  • GND -> GND
  • VCC -> 5V
  • OUT -> D3

Make the Circuit

292166490 747103036427356 7143922638820927521 n.webp

First, download the schematic diagram. The most important thing is any mistakes in the connection may damage the Arduino board. Connect the Sensors, Arduino, Flight controller and RC receiver. Check and double-check the connections.

Proceed to the next stage where we will be uploading the sketch to the Arduino.



Download the Code and Libraries

You can download the Arduino code and supporting libraries from the following links.

Arduino Code:

Libraries:

You can also download these libraries /Download this library by going to <Tools> & then <Manage Libraries>

Upload the Software

After installing all the libraries we can move to upload the code into the Arduino board. First, you have to Copy the code and then paste it onto Arduino IDE.

Now you are ready to upload the code, just hit the upload arrow button.



Testing

If you successfully uploaded the code to the Arduino board.

After this final check, you are ready to Fly.

Hope you find this useful. if yes, like it, share it, and comment with your doubt. For more such projects, follow me! Support my channel on YouTube.

Thank you!

SUBSCRIBE to My YOUTUBE Channel

Follow us on Facebook || and Instagram

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Ad
Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker