Hi guys, greetings from India! :)
Ever since I saw this I wanted to make one but it is pretty difficult so I made one on my own and I wanted it to share it with you guys :) ; I know that it is ArduIMU Quadcopter which is the older version of APM but I’m unable to run it on my APM 2.5. but still according to me APM is pretty expensive for students like me.
Today I’m going to show you how to make your quadcopter to avoid obstacles in indoor flights and a step closer to automating it.
Update 1: you can find the code here
Tested By Lee
Here are the things you need:
- Sharp IR Sensor or a Cheap Ultrasonic sensor x4
- An Arduino
- Jumper cables
- An extra channel in your transmitter to switch Modes.
(Note: Ultrasonic sensor will slow down the reaction time of the system due to latency between transmitting and receiving ultrasonic waves.)
Here’s how it works:
Okay stay with me this a really simple concept :) . 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 signal is and how it is used in our RC universe and this is how it is used in our little project.
Okay so 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 having the full control of the throttle stick and the rudder stick.
We are going to manipulate the inputs of stabilization board using arduino.
Here’s the connection diagram:
Now that you have wired it all up we can upload the sketch to the arduino and tune it.
Get the sketch From HERE
I will also be posting the video of my quadcopter soon
Check it before the first flight:
Go to the Receiver test menu and check for the value when you put your hand in front of the sensor if everything goes according to plan then you are ready to fly :)
Using HC-SR04 Sonar for altitude hold and obstacle avoidance:(obsolete)
Here’s the connection diagram:
Sensor Layout :
The Sonar5 is attached anywhere under your quadcopter facing downwards .
Very Important: The Altitude hold is still work in progress and it has to be tuned before flight hence it has been commented out . The main obstacle avoidance PID loop has to be tuned so please use it under your own risk.
Usage: Please make sure the quadcopter is on the floor and increase the throttle to a minimum position where it cannot create any thrust . Now try to place any object near the sensor and check if the Quadcopter is trying to move away from the obstacle if it doesnt then reverse the channel in your kk board or edit the sketch
if the pitch has to be reversed in obstacle avoidance mode then change the sign befor Output1 to "-" and Output2 to "+"
same is applicable for roll change the signs before Output3 and Output4
a single line should not contain two plus or two minus
Sorry for the crappy HOW-TO this is my first time writing a one.
Some other projects of mine which are undergoing testing before release:
- Automatic take-off and landing for RC planes and multirotors
- Convert your old transmitter to connect with any module
- Altitude Hold using SR-04 Sonar for Multirotors
Thanks for reading till this :) please comment and tell me your views on this topic if you have any ideas you can share it here. I would like to thank flitetest without them I would be sitting home thinking that RC flying is difficult. Thanks a lot.