Intro: Quadcopter Collision Avoidance Using Sharp IR Sensors
This is a moderately easy project which will help you to learn how to interface arduino and sensors with any multirotor flight controller.
Things you need:
- Sharp IR Sensors (GP2Y0A02YK0F) x4
- Arduino(Any) x1
- Jumper Wires
- A multirotor
Here’s how it works:
The IR sensor measures the distance between the sensor itself and the object and sends it to the arduino in the form of analog signal (value range: 0 to 1023). We should make a setpoint say 40cm from the IR sensor so if the setpoint reaches below 40cm the PID algorithm in the arduino will start its work by sending out the correction value to the stabilization board.
Most of you know what PPM and PWM signals are and how it is used in RC universe and this is how it is used in our project.
The normal range is 1000us to 2000us and 1500 us is the center or neutral value for roll pitch and yaw. We are going to use only range from 1200us to 1800us since we don’t want to flip the quad if the quad is a bit closer to the wall. You will be having the full control of the Quadcopter. So , When the quadcopter goes near any obstacle the arduino will takeover the controls and moves the quadcopter away from the obstacle .
Step 1: Step 1: Connecting the Arduino, Senors and the Flight Controller
Connect the Sensors, Arduino, Flight controller and RC receiver . Check and double check the connections.
Proceed to the next step where we will be uploading the sketch to the Arduino.
Step 2: Step 2: Uploading the Sketch
You need to add the RC library to your Arduino IDE . You can download the Library From HERE
Download the Code from HERE
After uploading the Sketch open the serial monitor and check if all the sensors readings and the RC values are present
After this final check you are ready to Fly.