An electronic set of " trainer wheels " for your drone.

Hi

 I'm still pretty new to all this, so firstly, let me say thank you to all those that have helped me get my head around quads and setting up my X 525.

I have a quite frustrating problem..

I want to program what is effectively, " trainer wheels " for my drone in the form of an auto minimum altitude hold using  an Arduino board, and an Ultrasonic detector as a "sensor" that will work along with my KK board.

THEORY:

With the Ultrasonic facing downwards, and a sketch including at a pre-determined height ( above 4 feet for example ) there will be no ground detection.

The usual state will be a "low" and the Arduino would do nothing but loop through the sketch looking for this Ultrasonic trigger.

However, - when the ultrasonic DOES trigger, the Arduino should sense a "high state". - When this happens it should  ( fuzzy logic here  ok? ) be able to detect the CURRENT throttle setting via the radio receiver and prevent any throttle range below it. - ( and yes, this feature would be on a switch on the RC transmitter lol! ).

Obviously, if the Ultrasonic detection is not made, ( switched off ) then its full range as usual.

Where the Servo comes in, is that it will be my throttle servo currently linked to the KK board via the receiver.

Like I said, I'm new to Arduino programming, and I'm still getting my head around things like GOTO statements are not generally permitted.so I'm having a hard time figuring out the finer points of conditional statements, if then, gosub, ( etc )

If you have any ideas, please let me know.

I've only been learning Arduino programming foe a day so far but this is a little harder than making an LED blink.

P.S. - for the record, I DID manage to learn enough to make that LED blink S.O.S. in Morse. Code in a loop.

Views: 253

Reply to This

Replies to This Discussion

Your sonar is going to give you a range measurement.  It's not going to toggle a pin as you need the uC to send the pings and also to read the response.  Most ultrasonic sonar is going to give you a reading from a few cm to about 4 meters (13 feet), so a lot of the time you'll be in sonar range.

I'd check out the diydrones store, someone has probably already written a lot of the code.

-Jake

Thanks Jake! - any ideas on  WHAT  would be the best kind of sensor or indeed method  to achieve this?

I  feel I need to qualify my thoughts on this which were....

Using a sketch, when a condition ( in this case a number ) was returned from the Ultrasonic  the craft would follow an instruction. The " magical number " itself would be measured in feet - something like: 4 feet , or inches "48".

IF in > 48

IF in< or = 48  gosub ( to some other place in the script )

else loop

( from there it would jump to another line in the sketch and follow that preset instruction.

Above  that number  there would be no trigger. In saying that I figured it would work something like that  at least.

Thanks for  your help mate! - Cheers!

You can get ultrasonic sensor modules pretty cheap (~$7) from China.  suntekstore.ca for example sells them.

The diydrones store also has some.  There seems to be 3 and 4 pin versions.  Not really sure what the difference is.  I got a 3 pin version to play with.  There is some electronics in the ultrasonic module, so the reading method can be different.

With my module you send a pulse then wait for the return pulse.  It isn't the sound pulse directly, it is processed on the module.  The width (length) of the return pulse indicates the distance.

How you deal with reading this depends on your uC.  I think there's ardurino libraries for this sort of thing.  An internet search should find them.  If you have interrupts available that's probably what I'd use.

Wish I could be more help, but I haven't tried anything with my module yet.  I have no idea how well it would work for your application.  The ground sensing would probably work well, and if you get a ping back the distance is going to be accurate.  As far as avoiding objects YMMV.  I'm not sure what size object it would detect.  It would probably avoid a telephone pole at some distance, but I'd guess it wouldn't see a wire.

-Jake

Hi Jake,

 just thought Id let you know there has been a development on the software situation ( at least regarding calculations and getting things happening ).

I'm till looking for  something that will give me a decent range ahead to avoid objects, however! - I have managed to sort SOMETHING out.

After a LOAD of reading and messing about with  code, I have achieved the following:

If my quad is above 6 feet, it will hover if asked to under my control. However, drop to 5 feet, and the ultrasonic detects the earth below, at which point a chain of events starts....

1: 4 nose wheel landing gear ( one on the end of each arm of the quad ) starts to extend.

2: when the gear is fully extended a second check of he ultra sonic status is made to  conform the range is at 5 feet or or below.

3: at this point, the throttle starts to bleed off slowly.

4: when all 4 wheels are on the ground ( detected by micros witches one on the end of each wheel strut ) - all 4 motors stop.

While in the grand scheme of things it looks impressive - it is in fact pretty easy to achieve - whats STILL haunting me is some kind of device that will allow the quad to avoid objects ahead of it  from a range of about  100 meters.

I am currently exploring the idea of buying one of those smart vacuum cleaners ( you know the one's? ) - they can find their way around your home on their own and can put themselves back on their charging stations wen they need to.

To me, their most VALUABLE component is their laser scanning system if I can hack one of those  ( providing they have the range needed, then were taking a whole now ball-game.

your thoughts?

Cheers.

If you're talking about a Roomba... The one I have at least just bumps into things to detect obstacles.

RSS

© 2014   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service