Quadcopter Obstacle avoidance system using arduino

by cyril.anthony777 | October 26, 2013 | (14) Posted in Projects

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.

Updates :

Update 1: you can find the code here 

Tested By Lee

Here are the things you need:

  1. Sharp IR Sensor or a Cheap Ultrasonic sensor x4
  2. An Arduino
  3. Jumper cables
  4. 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. 

 

 

COMMENTS

vk2dxn on November 1, 2013
Keep it coming my friend.
I am subscribed...
Log In to reply
cyril.anthony777 on November 1, 2013
Thanks. :)
Log In to reply
npor84 on November 16, 2016
Hi. I´m intending to install in my quadcopter. I´m bit confused tto understand the diagram red wire connected to the arduino UNO. Can you explain the connection? Thank you
Log In to reply
glasspony2010 on March 6, 2017
Can you explain to me what is the Exter channel on the transmitter for mode . What does it do it and what is it used for ? Can you please contact me at this email address I'm getting ready to build this and I'm going to need some help as I go through the process .thank you glasspony2010 pony1920@hotmail.com
Log In to reply
earthsciteach on November 1, 2013
Very interesting. I just bought an Arduino kit and am excited about taking my first steps into programming a controller.
Log In to reply
cyril.anthony777 on November 1, 2013
All the best :)
Log In to reply
Hameedullah Omari on February 4, 2015
Hello dear
I am glade to know that you have done a brilliant job. i am also working in such project in my bachelor thesis. the function which i have to do is object avoidance and auto land.
i have APM 2.6 flight controller board and Arduino Mega with HC-sr04 Ultrasonic sensors. if you kindly help me, how to connect arduino board with APM 2.6 and how to do object avoidance with sensors?
i have seen your design but it is not clear to me if you kindly make little bit more clear to that i should understand, and i have downloaded the PID_v1 library from the mentioned link but the examples are not working. it mentions error compiling...
Log In to reply
Johan on November 2, 2013
That is interesting! With this setup it is indeed very important the corrections have the right 'polarity' otherwise you'll have an obstacle attractor :-)
My tri sometimes behaves as a tree magnet :-)
Log In to reply
cyril.anthony777 on November 2, 2013
you are correct the polarity is very important. i will make a layout for the tricopter :)
Log In to reply
rslegge on November 4, 2013
Nice project, I am super interested in the altitude component coding. I am beginning to fly FPV with my tricopter and have problems judging height. It would be perfect to add an adruino and ultrasonic sensor sonar that would start beeping at the sensors max distance (like 2 - 3 meters) and increase the frequency the closer the tricopter gets to the ground. The only real technical issue would be different diffusion of the bounce signal by say grass or concrete.
Log In to reply
cyril.anthony777 on November 4, 2013
Hi i will write a tutorial on how to do that and meanwhile can you tell me what video rx and tx you are using so that i can try to mix the audio signal so that you can hear the beep in your fpv gear and also do you have an extra channel in your RC transmitter? so that we can enable or disable this feature .The surface is not a problem we can use a low-pass filter.Thanks :)
Log In to reply
KJ4CCH on November 13, 2013
Is it possible to comment the code? I am new to arduino and know some C, and this is REALLY COOL, so naturally i wanna play with the code and learn what i can and cant do....then write my own code hahaha. Many broken arms are in my future.


Log In to reply
carloz on December 3, 2013
links of code no work, can you post me, thanks
Log In to reply
cyril.anthony777 on December 3, 2013
Hi, I have updated the link .Thanks :) .
Log In to reply
carloz on December 17, 2013
Hi, I am interested in operating this project, the problem, that being new to the arduino, I've got all the libraries and codes, even with your examples, but I leave very many lines of error code when iverify.
Would it be possible that he should put a file with the arduino directory you use to cut and paste?
Thanks for your time and work
Log In to reply
cyril.anthony777 on December 17, 2013
Hi carloz,
get the PID library and the NewPing library paste it in your libraries folder . Please Refer arduino Website for the instructions for library installation .All the best :)

Log In to reply
bernardino on December 17, 2013
Hi,

congratutations ..is a fantastic ideia ...can i use my crius as FC with arduino pro mini ?
try to acces the links but they where broken ...best regards
Log In to reply
cyril.anthony777 on December 17, 2013
Hi, it should work with all the flight controllers and i have tested it on APM,MultiWii,i86 and KKv2 and KK v5.5
as of now only the Sonar link is working (http://www.mediafire.com/view/nzcb6p8aur7jtqk/PIDObstacleSonarQuad.ino)
but the IR is under hold because my IR sensors are worn out and it is hard to find it here and i manage to find one it s pretty expensive here.
Thanks.
Log In to reply
bernardino on December 17, 2013
:) thats fantastic ..thanks alot for sharing ..

should i copy this
1.Arduino PID library by Brett
2.Arduino NewPing Library by Tim

to arduino library ,upload with your code and simply connect the sonars ?

best regards


Log In to reply
cyril.anthony777 on December 21, 2013
sorry for the late reply . Well that sounds right and please tune the PID parameters
according to your requirements .
All the best :)
Log In to reply
carloz on December 21, 2013
I have problems, I do not work, when I check the libraries separately with examples, does not give any error, but when I load the program and verify gives me very many lines of error, which I am not able to correct.
could help me?
Not like putting here all the error lines or a picture of the screen, so I could see what happens.
Thanks for your time and expertise
Log In to reply
cyril.anthony777 on December 21, 2013
Hi Carloz,
i have checked the code it is compiling correctly here are few common problems.
1.It doesn't work with ATMEGA8
2.Check all the brackets
3.Check all the semicolons
well thats about it . I suspect that the ending bracket might be missing or just send me a screenshot of the error :)
best regards
Log In to reply
motatob on December 22, 2013
Hi, would it be possible to re-upload the sketch file it appears to be a dead link.
Thanks! cyril.anthony777 for sharing.
Log In to reply
cyril.anthony777 on December 29, 2013
my IR sensors are broken due to a testing crash please wait for few more days it will be released after final testing when my new sensors arrive thanks.
Log In to reply
bernardino on January 15, 2014
Hello ,

All the upload process of firmware was done with success but when i go to the terminal monitor i cant see no action ...

Resume:
Downloaded the necessary libraries and copy to the library folders.
then downloaded the Pidobstaclesonar, put it to my arduino folder ..
open arduino upload with success but nothing happens ...apreciate help...

Thanks ,
Bernardino
Log In to reply
cyril.anthony777 on January 15, 2014
Hello,
I have updated the program and you can find it here http://www.mediafire.com/view/irm8lk505wa9mqf/PIDObstacleQuadv1.ino

i have also updated the link . please set your aux1 at maximum so the program will start its work

Thanks,
Cyril Anthony
Log In to reply
manhattan on August 31, 2014
why do you use the AUX1 values to trigger the auto correction?
an autonomous system shouldn't be triggered byt the proximity?

maybe i dont understand your code, but i feel the value of range say if range < 40cm, shoudl trigger the correction until range > 40cm... right?

Log In to reply
cyril.anthony777 on August 31, 2014
The aux values are used to shift from manual mode to autonomous mode.
You are correct about the working of the code.
A newer version of code and MaxSonars gave us pretty impressive results. check it out here https://www.youtube.com/watch?v=-wQjtATUWqI
Log In to reply
manhattan on September 1, 2014
i'm using now one MaxBotix LV-1 and your code works well at least on my table, no propellers yet. but i'm waiting for cheaper PING sonars (3$ each including case!) for testing... if everything will work well, then i can move to the more expensive MaxBotix.

I'm just wondering if the library you are using do factor in the speed of the quad: example... say I'm pushing the quad against a wall (eg. full pitch 1850 pwm), like a car crash test... how fast does it react? Should the sonars ping at least 5/10 meters max distance ( not just 2m) so you can calculate the speed (distance1 - distance 2 in a loop) and determining how much counter-speed it has to apply to the Pitch?
Log In to reply
manhattan on September 1, 2014
also, on your code I simply added a boolean + if/else based on distance, instead of using the manual switch aux1.

example: if the quad is far away at least 1m from any wall/objects you can fly with your own sticks. below 1m (or user preferences, or better dynamic value based on quad speed) the auto correction engages and take over the stick until the quad is far from any other object.
Log In to reply
Peatah_Andy on February 22, 2017
Hello manhattan, i am an undergraduate student currently working on “Surveillance UAV with Collision avoidance” as my final year project and would like you to guide me on how to connect the maxsonar sensors to the arduino, how to connect the arduino the to the pixhawk flight controller and also provide the required codes.
i will be using the 3DR iris+ as my UAV and also i am a complete newbie to UAVs still learning as much as i can. I would be very grateful if you can provide as much help as possible.Thank you.
Log In to reply
cyril.anthony777 on September 1, 2014
Hi manhattan,
The code which is given here is fully autonomous beyond the point of flicking the aux switch.You will have no control over the quadcopter until you flick the switch back .

The responsiveness of the quadcopter depends on the PID gains mentioned in the code.
we need to calculate the correction even before reaching the setpoint so limiting the ping distance wont make much difference . Instead we can implement adaptive tuning.

The example exhibits semi-autonomous behavior hence the pilot will lose control of the quadcopter for a short period of time.

All the best with the project i will be updating the code soon.

Thanks.


Log In to reply
manhattan on September 1, 2014
yes, the pilot will lose control for a very short amount of time, like a car anti-collision system brakes on your behalf, until you get far from the obstacle..then you get control back.
I think that's the point of the project, to have a smart quad, not a quad that float meaningless in the air right?

In your code i added a calculation of the speed and direction of the quad based on the sonar, so I can get a value that could be good to increase the Output limits of the PID for instance..
Log In to reply
kamielanseeuw on January 24, 2015
Hi manhattan,
Could you give me your code for the smart quad. This is exactly what I am looking for!
Thank you.
Log In to reply
cyril.anthony777 on September 2, 2014
Hi , This article is about making an autonomous quadcopter similar to one which is mentioned in the video at the beginning of this article . I can modify the code to exhibit the behavior which you have suggested with adaptive tuning and faster response time.

Thanks.
Log In to reply
EliteUAV on September 4, 2014
Can i use a pixhawk also for this project instead of the KK ???
Log In to reply
cyril.anthony777 on September 5, 2014
yes you can use it with any flight controller which uses PPM as input
Log In to reply
manhattan on September 7, 2014
i finally setup my 4 ping sensors... but man it's fucking unreliable... it's a death machine... maybe th ePING sensors suck (2$ each...).

my cose run the loop anytime, i have no switch, so by doing the test you said by pushing the throttle to 3% than try to move objects in fornt it get unresposnvie..


i feel the reaction of the sensor sis etiher too slow or the reaction is too aggressive...
Log In to reply
damefly on August 2, 2015
Hi manhattan,
Any progress?? could you please share your code?
Log In to reply
cyril.anthony777 on August 2, 2015
Hi Manhattan,
Sorry for the late reply HC-SR04 Support has been dropped due to the inconsistent data output now it works only with Maxsonar and Sharp IR sensors. Current code is still under testing.
Log In to reply
Dasun Dinujaya on March 11, 2016
How did you connect MaxBotix LV-1 with the Arduino ?
It is different from HC-SR04 right ?
It does not have Eco and Trig right ?
So ??
Log In to reply
nir on September 9, 2014
Hello,

i am trying to find the IR sensors sketch and i dont find it in your link...
can you help me with that?
Log In to reply
greg.contreras.77 on September 29, 2014
good morning , very good your project , I have a APM 2.5, which is what is needed in the code to function with APM 2.5 ?

Greetings
Log In to reply
cyril.anthony777 on October 2, 2014
Hi , Sorry for the late reply. Yes , you can use it with APM 2.5.
thanks.
Log In to reply
greg.contreras.77 on October 4, 2014
hello, thank you .. I have a question, as is the connection diagram using a arduino mega and apm 2.5 ... Thanks
Log In to reply
cyril.anthony777 on October 4, 2014
you can follow the same pin numbers on arduino mega
Log In to reply
greg.contreras.77 on October 5, 2014
hello, I did, but when I try to start the engines, only get around on and off.

you'll have some idea?

Sorry for my bad English ...
Log In to reply
cyril.anthony777 on October 5, 2014
Hi , Please connect the throttle channel and rudder channel to your receiver and Aileron and elevator channel to arduino make sure you share a common ground with the arduino and flight controller . Thanks.
Log In to reply
greg.contreras.77 on October 5, 2014
hello , sorry so many questions, the aux 1 and aux 2 USAS What paragraph , I have only 4 Chanes of Rc
Log In to reply
colbak on October 14, 2014
hi i tried to put the code on arduino and when i verified it it gave me this error:
NewPing does not name a tipe
Can you help me plz?
Log In to reply
zarif.robot on October 18, 2014
hi! does it work with naza fc?
Log In to reply
cyril.anthony777 on December 27, 2014
Yes it does work use traditional type in RC tab
Log In to reply
ldren on January 22, 2018
excellent how is made ?
Log In to reply
electricpro2 on December 27, 2014
Get the sketch From HERE (Will be available on 27th due to testing and finalizing it for release)
your "HERE" link is broken.
Log In to reply
cyril.anthony777 on December 27, 2014
https://github.com/Cyrilanthony777/Obstacle_Avoidance_Multirotor

Git Hub repo :D
Log In to reply
electricpro2 on December 28, 2014
Thank you!
Log In to reply
AbarthGT on January 13, 2015
The link for the sketch does't work (Dead), Could you please send me an alternative link or re upload it. I'd like to see the code for testing it with Sharp IR Sensors. Thanks (Alpha Sketch)
Log In to reply
maanavhpatel on February 25, 2015
Hi,
Is sonar more responsive or IR
Log In to reply
Truttle on February 26, 2015
The connectios with ultrasonic sensors is exactly as shown in the diagram right?
Log In to reply
EliteUAV on March 20, 2015
Hi ,
Can I apply this project to an hexacopter ?

Log In to reply
EliteUAV on May 9, 2015
Hi cyril,
Can u please explain how you wire an APM to the arduino ?
Log In to reply
11me030 on May 16, 2015
hi,
kindly send me final code along with required sensor model and arduino code...
ca131@live.com
thanks
Log In to reply
Spilly1991 on July 10, 2015
Hey Cyril, I was wondering if this would work with a DJI Naza V2? I've got a pretty expensive (well at least by my budget!) quad and I do not have much space to fly, soooo obstacle avoidance safe guard would be very handy, any info / help would be much appreciated, Cheers!
Log In to reply
MINSEOK LEE on July 28, 2015
Hi, I was wondering about your source code.
There is for loop in the source code like for(i=0; i=10; i++);
Is that right source code? I think that It is right for(i=0; i<10; i++);
And If you have the latest source code, kindly send me arduino code..plz..
misule0423@gmail.com
thank you
Log In to reply
stefi on August 9, 2015
hi, just trying to make head or tail of the two diagrams, i presume the top one is for sharp ir sensors and the lower is standard arduino ultra sonic senors.

also are the inputs into the arduino, ch1,ch 2 and aux (on the top diagram) inputs from the receiver, and also ch 3,4,aux from the lower diagram

also, where do the ch 3,4 that are arowed as inputs on the kk2 board come in to this.

i believe that the other two wires on the sharp sensor are - + would this be right.

thanks
Log In to reply
cyril.anthony777 on October 7, 2015
Hi, the channel 3 and 4 are connected directly from the receiver to the kk 2.0 only the channel 1 and 2 passes via arduino
sorry for the late reply
mail me if you want further clarification
Thanks.
Log In to reply
hexrotor_dude on October 1, 2015
Hi Cyril, I am currently working on a Hex-rotor to enable obstacle detection and collision avoidance. APM 2.5 and Pixhawk are being used. I have only been able to come up with a code to detect an obstacle but I am required to store that obstacle in a GPS map on a latitude and longitude scale. I do not know how to do this. The sensor I am using is MB1200 XL-MaxSonar-EZ0. Kindly help if you have any ideas. Thank you very much.
Log In to reply
cyril.anthony777 on October 1, 2015
Hi, you have two options either you can use an I2C EEPROM to log the data on board and retrieve it later or you can use another telemetry module and send the data to your ground station and plot it there. To get the GPS data from the flight controller you need to hook up a spare telemetry port of your flight controller to the UART port of your arduino and use MAVlink library to read the latitude and longitude. You can also connect a spare GPS directly to arduino.
Log In to reply
gio1993 on October 21, 2015
Hi guys and a big bless for Cyril Anthony.

I'm working on this type of algorithm for my University.
I'm trying to connect my APM 1.6 to the Arduino Mega (It's not the original one, it's the DROFLY V3) and the problem is that I can't find out the pinout scheme. The bigger problem is that i can't understand your connections scheme between the Arduino and the autopilot.
Hope you can help me.

Regards

(sorry for my bad english)
Log In to reply
Mpetko on October 21, 2015
Hi guys, is the spare 5th channel on transmitter essential? Does it cause huge troubles I only switch on/off the mode manually by connecting/disconnecting 5V constant voltage to pin D4 with a HW switch? Would I be able to take-off? What consequences/troubles do you see?
Log In to reply
cyril.anthony777 on October 22, 2015
Hi new code and schematic available at http://teamrecon.in/collisionavoidance/
Log In to reply
Angela101 on November 17, 2015
Hi. I am trying to make an Autonomous quadcopter using Arduino Uno and IR sharp sensors that you have listed above. I am looking to have this stay at a stable altitude and obstacle avoidance. I was wondering if you have a modern code for achieving that. My big problem is thatbigger problem is that i can't totally understand your connections between the Arduino and the autopilot (mainly the Aux wiring). All help would be appreciated.
Log In to reply
cyril.anthony777 on November 23, 2015
Hi, Sorry for the very late reply . Can you be more specific ? like which flight controller you are using. I will be updating this article soon . If you need further help contact me through email cyril.anthony777@yahoo.com
Log In to reply
machaalany on November 23, 2015
hey Cyril,
i am using 'sharp IR sensors'
for the arduino code, do i use link 1 or link 2 ?

link 1- https://github.com/Cyrilanthony777/Obstacle_Avoidance_Multirotor#sthash.Dyxp11kK.dpuf
or
link 2- http://teamrecon.in/collisionavoidance/

because those codes are a little different ..
thanks in advance
Log In to reply
Star4ce on December 22, 2015
Is it possible to use it with a pixhawk ?
Log In to reply
Efbro on January 6, 2016
it should work with any flightcontroller
Log In to reply
mmimadi on January 7, 2016
Dear,
Please help me!
This is such a fantastic idea and I am going to build it. But your link to the schematics and code is broken! Please please I'm begging you, please let me have the code and schematic!
thank you so much!
Log In to reply
mmimadi on January 7, 2016
How would I wire the motors to this? Do I need esc's?

Also, none of your links are working
Log In to reply
cyril.anthony777 on January 7, 2016
You need a complete quadcopter with motors , frame, esc , RC transmitter /receiver, flight controller, propellers and battery. Which sensor you are going to use ?
for IR you can see the connection diagram on this page . for sonar follow the link on the end of the article.
Log In to reply
mmimadi on January 8, 2016
I am using sonar sensors. Which one should I follow? I see two different links and the bottom one says obsolete and the sonar sensors do not match my sonar sensors. do you have the links or the first sketch? It does not load, only the second one.

thanks
Log In to reply
PALANIMURUGAN on January 9, 2016
i couldn't able download sketch . it shows database error . please help me
Log In to reply
donR on January 10, 2016
Hi is it possible to implement this Obstacle Avoidance System using a CC3D board? If it is, then how? Please let me know. Thanks!
Log In to reply
Dasun Dinujaya on March 10, 2016
Hello I am Dasun here..

I read all of the article as well as the comments.. I already download the libraries and codes and compiled through the Arduino IDE and there is no error so far and I must say it is a good work and thank you very much for sharing cyril.anthony777.

But in one comment you were saying HC-SR04 isn't suitable..I didn't quit get that one. So you were saying it is not working ? or ?

Anyway I am using Arduino Uno.
Log In to reply
cyril.anthony777 on March 11, 2016
Hi Dasun, HC-SR04 is pretty slow compared to Maxsonar and sharp ir sensor.The reliability of the readings are not quite good so it was dropped.
Log In to reply
Dasun Dinujaya on March 11, 2016
Thank you very much for the details. I already made a quadcopter using APM 2.6 as my flight controller. however I am trying to add obstacle avoidance to it. So if I use Maxsonar instead of HC-SR04, it has GND, +5V, TX, AN, PW (pins) which is completely different from HC-SR04. According to your Sonar circuit diagram, it only connect with Eco and Trig. So how can I connect them if I use 4 Maxsonar modules with Arduino ? and what will be the modified Arduino cord?

However lets say if I go for sharp ir sensors, will there be a difference in action. Also you removed the Arduino sketch. Can you please share it ?
Log In to reply
Barbosa on March 12, 2016
Hi Cyril, I'm trying build your collision avoidance system with Sharp IR sensors, but the code link is broken, can you post a new link for code download? Thanks , and congratulations for your project!
Log In to reply
gedStar on March 15, 2016
Hello, Cyril,
Many thanks for sharing your code. I have managed to get everything functioning, including normal RC control apart from when the obstacle avoidance code is running, but I cannot increase the distance at which the code takes over. It is only about 200mm and far too close to the props. I am using IR sensors. Can you help? You mention the setpoint but no matter how I change this same result. Great idea using the RC receiver!
Log In to reply
Dasun Dinujaya on March 19, 2016
Hey GedStar..
can you share the code please..
my email : dasunrco@outlook.com
Log In to reply
Barbosa on March 31, 2016
Hi, I am build the avoidance system to, do you have use the source code avaible in the link? https://github.com/Cyrilanthony777/Obstacle_Avoidance_Multirotor#sthash.wjnixojH.dpuf
And you have used the connection diagram above? Thanks

Log In to reply
giorgosfl on April 6, 2016
Hello,
I am trying to follow the guide and I need to access the source code, but unfortunately the links you provided are not working.
Can I have the source code please.
My email is giorgosflorou@gmail.com .
Log In to reply
cyril.anthony777 on June 20, 2016
the Code is in Github Repo
Log In to reply
bluepow on April 7, 2016
Hi mate,

I'm working on a similiar project, but i'm building a blimp with obstacle avoidance. Would you mind sharing me the arduino code that you have developed so that I can make a reference please.

My email: muhd.wasil@hotmail,com
Thanks a lot
Log In to reply
cyril.anthony777 on June 20, 2016
the Code is in Github Repo
Log In to reply
gdebu on May 5, 2016
what is the code for Ir sensor?
Log In to reply
cyril.anthony777 on June 20, 2016
the Code is in Github Repo
Log In to reply
tibo on May 18, 2016
Hi.
can you share the code please..
my email : tibozen@msn.com
best regards
tibo
Log In to reply
cyril.anthony777 on June 20, 2016
the Code is in Github Repo
Log In to reply
Steven on May 25, 2016
Hi,

I am really interrested in the project, but your links to the code doesn’t work any more, is there any way you can send the code trough mail to me please. My mail-adres is vandenberghe1994@hotmail.com

Thank you very much in advance,

Steven.
Log In to reply
cyril.anthony777 on June 20, 2016
the Code is in Github Repo
Log In to reply
coooooool on June 7, 2016
Hi.
can you share the code please
Because I don't have the code.
my email : Vijaysharma579@gmail.com
best regard
Vijay
Log In to reply
cyril.anthony777 on June 20, 2016
the Code is in Github Repo
Log In to reply
karan.uta on June 16, 2016
Hi, can you please share the code please email me on karan.uta@gmail.com
Can i use APM with Arduino Uno and sharp sensors?
Thx
Karan
Log In to reply
cyril.anthony777 on June 20, 2016
the Code is in Github Repo
Log In to reply
stefi on June 20, 2016
wired it all up, uploaded the sketch, hooked up to quad,, NOTHING HAPPENED! (was all wired as per diagrame and even programmed an aux switch just in case)
Log In to reply
cyril.anthony777 on June 20, 2016
Which sensor you are using ?
Log In to reply
stefi on June 21, 2016
im using the sharp IR sensors as sugested, i tried the code from github, uploaded to the arduino no problem, tried 2 diferent arduinos just in case but when conected to the quad i could still controll the motors, but when i placed an object ie, our house wall, nothing happened, the contaoller board is an APM and the rx is a frsky-d8r-plus-2
Log In to reply
aav514 on June 27, 2016
Thank you for sharing~!!
I have some question.
How to connect this system to pixhawk which use S-BUS receiver?

Log In to reply
cyril.anthony777 on June 28, 2016
Hi, This system doesn't support SBUS but in a moth or two i will be adding support for it.
Log In to reply
aav514 on June 28, 2016
Thank you for your reply. I'll wait your advance.
and Do you have any plan to support I2C sonar or I2C IR system?

Log In to reply
iaapple on January 16, 2017
Have you managed to connect this system to pixhawk using S-BUS ?
Log In to reply
aav514 on June 28, 2016
I heard I2C sonar is strong against noise than analog system.
and I2C IR is not common in market, but I found this ADC-I2C converter for SHARP analog IR.
http://www.bot-thoughts.com/2013/02/avc-2013-sharp-ir-i2c.html
Log In to reply
chong012 on June 28, 2016
Hi cyril.anthony777,

Based on your wiring connection for IR sensor, I notice that your channel 1 and 2 (Aileron and elevator) goes to digital 2 and 3 of Arduino Uno. But the code as posted in Github Repo doesn't says anything regards to the 2 pins (digital 2 and 3) but only pin 9 and 10. I understand that pin 9 and 10 is to send a certain value of microseconds to the flight controller when the arduino uno detects a preset radiometric value (too close to target) so to avoid an collision. I am rather confused where do the signals go to and end up in when they entered pin 2 and 3. So how am I suppose to control the aileron and elevator controls of the quadcopter during manual mode?
Log In to reply
cyril.anthony777 on June 28, 2016
Hi Chong, I have tested and updated the code. Reading the RC Receiver will add 50ms to execute one loop. This updated code allows you to retain full control and once any object is detected the collision avoidance will kick in but you can still override it .
Log In to reply
aav514 on July 2, 2016
How do you think about this?
sensors connect to arduino. arduino connect to pixhawk's telemetry.
let them communicate by mavlink protocol
and override manual control for obstacle avoidance.

Log In to reply
cyril.anthony777 on July 5, 2016
Hi, It can be done . What is your name? I will add it in the credits list once the code is done.
Log In to reply
aav514 on July 6, 2016
Really? I'm really honored. Call me just Lee. : )

Log In to reply
karan.uta on August 8, 2016
Guys, whats the SHARP IR sensor model number
Thanks


Log In to reply
alainleduc on August 13, 2016
thank you . can some one show it in you tube as video step by step . please. and the file that you put it for download witch software can read it? i am so dummy but i am trying to learn a new things
Log In to reply
mmimadi on September 13, 2016
Is this compatable with a naze 32?
How do I connect this circut to the flight controller?
Thanks
Log In to reply
mmimadi on September 21, 2016
Hi, please help. I have it all wired up (using sonar but will upgrade to ir later) and i have the correct pins (channel 1,2,3 hooked up to d 6,7,8 and then d 11,12,13 runningfrom the arduino to my flight controller.

I cannot get my quad to recognize the signal. Please help me!!

Log In to reply
karan.uta on October 2, 2016
Hi, can anyone tell me difference between
Update Collision_avoidance_IR_v2.ino
AND
Update obstr_p_IR.ino

I have sharp GP2Y0A21YK Sensors
I am using APM 2.6 and cannot connect to mission planner using this set up ( replaced KK with APM 2.6)


Log In to reply
brunorbm on October 13, 2016
fantastic project! Can I use arduino nano instead of arduino uno?
Log In to reply
cyril.anthony777 on October 13, 2016
Yes you can.
Log In to reply
karan.uta on October 14, 2016
Hi Cyril, whats the difference between your codes
Update Collision_avoidance_IR_v2.ino
AND
Update obstr_p_IR.ino
Log In to reply
cyril.anthony777 on October 14, 2016
Collision_avoidance_IR_v2.ino uses RC library to read and write PPM signals
obstr_p_IR.ino uses arduino Servo library to write PPM signals
Log In to reply
andrgior on October 27, 2016
Hi Cyril, great work. I do not reach the schematics and the codes can you send me correct links?
bombicche@gmail.com.
Many thanks.
Log In to reply
mavitts on November 26, 2016
is there a way to use both the plus and the x configuration using 8 sensors? i am not great with programing but i can read a diagram i have an arduino mega2560 r3 i would love to see it work in a greater fasion.
mikeandpamavitts@yahoo.com many thanks

Log In to reply
Pandian on January 8, 2017
Hello cyril, am interested to do this project.but I have doubt what can I prefer either sonar hcsr04 or sharp ir. Please reply quick
Log In to reply
Peatah_Andy on February 22, 2017
Hello Cyril, i am an undergraduate student currently working on “Surveillance UAV with Collision avoidance” as my final year project and would like you to guide me on how to connect the maxsonar sensors to the arduino, how to connect the arduino the to the pixhawk flight controller and also provide the required codes.

i will be using the 3DR iris+ as my UAV and also i am a complete newbie to UAVs still learning as much as i can. I would be very grateful if you can provide as much help as possible.Thank you.
Log In to reply
willians on May 1, 2017
Hello, cyril.anthony777, congratulations on your work.
I build a drone with an apm board, but I can not put your sonar project in it, do you have a more detailed schematic of the connection? Would you send me? Topografar@gmail.com.
thank you.
Log In to reply
reednoel4u on June 3, 2017
Dear ranthony777
I see so many sketch in this post, could you please give me last code with sonar.
I try contact with you via facebook but not respond.
Regard
Reed Noel
Log In to reply
al.satyr on August 22, 2017
Hello Cyril. I hope you still looked this old-but-gold thread.
I'm trying to implement your code on my custom build quad and actually got no background using Arduino.
I interested with IR based and after took look on your github, I got confused because there were 2 files on IR Based (obstr_p_IR.ino and Collision_avoidance_IR_v2.ino).
Tried your code on obstr_p_IR.ino, verifying was success. But I saw more complexity on Collision_avoidance_IR_v2.ino but when I tried to compile, it wasn't success. Error code was found on ServoIn.h which not available.
Could you help me, please?
Log In to reply
al.satyr on August 22, 2017
I got the answer. It is library problem. Already completing the needed library. But still there was problem on compiling. It was redefiniition of init setpoint on line 6: int setpoint=60,Kp=3;
Can someone give me the hint?
Log In to reply
nico2512 on December 2, 2017
Hello,
super project!
I use a DJI Naza M lite flight controller and a Frsky X8R receiver.
Do you think this system with arduino can be wired on instead of the KK card?
thank you in advance and congratulations for the realization.
Log In to reply
Aditya28 on August 20, 2018
Hi,
I am trying to make Obstacle avoiding quadcopter using IR module, but i did not get the output.
Please help me to find the problem.
( Is it compulsory to use Sharp IR sensor )
Log In to reply

You need to log-in to comment on articles.


Quadcopter Obstacle avoidance system using arduino