rmcgeown
Posts: 22
Joined: Wed Jan 11, 2012 7:42 pm

Re: qudrocopter UAV drone

Thu Feb 02, 2012 3:02 pm

I have recently been looking into using a PIC to control a UAV quadrocopter drone and initial investigations showed it would be possible but the speed of a PIC could prove too slow to make adjustments for stable flight.

I was wondering if and how i could use a stripped back R-Pi to control either PIC for PWM and I/O from ultrasonic, gyro and accelerometer sensors.

Is it possible for the R-Pi to accept inputs from the sensors and output PWM or output signal to seperate motor controllers?

By stripped back i mean removing the audio jack, ethernet socket etc to remove unwanted weight.

User avatar
scep
Posts: 1062
Joined: Sun Nov 20, 2011 8:53 am

Re: qudrocopter UAV drone

Thu Feb 02, 2012 3:42 pm

rmcgeown said:


By stripped back i mean removing the audio jack, ethernet socket etc to remove unwanted weight.


You'll want a Model A, which has no ethernet socket. Dunno about the other questions!

Allan
Posts: 15
Joined: Thu Dec 22, 2011 12:16 pm

Re: qudrocopter UAV drone

Thu Feb 02, 2012 4:21 pm

I would have thought that a PIC, programmed in assembler, without all the overhead of on OS would probably be faster than the RasPi in a control application.

My choice (and I am interested in this application!) would be to use a PIC for the basic control loops needed to keep the aircraft in stable flight and have the RasPi do the (GPS?) navigation and control, talking to the PIC using its SPI bus.

PaulBuxton
Posts: 57
Joined: Tue Jan 10, 2012 11:38 am

Re: qudrocopter UAV drone

Thu Feb 02, 2012 4:34 pm

There are a number of similar systems available I would have a look into those and see if you can borrow some of their experience.

Arducopter looks very promising.

http://code.google.com/p/arducopter/

rmcgeown
Posts: 22
Joined: Wed Jan 11, 2012 7:42 pm

Re: qudrocopter UAV drone

Thu Feb 02, 2012 4:35 pm

Would it be possible to have the kernel load just a C program with the control loops? Initially i want the drone to be programmed pre flight via gui with a specific set of variables to maintain, e.g altitude (height from ground based on ultrasonic sensor), pitch and yaw as well as ramp up motor speeds for gentle take-off and landing.

From this basic stable setup I would then look to develop GPS based navigation etc.

In PIC specific forums there were doubts that a PIC could compute all the sensory info fast enough to produce even a stable hover.

I presume the R-Pi would give me a programming interface to the PIC without the need for a programmer/debug circuit?

rmcgeown
Posts: 22
Joined: Wed Jan 11, 2012 7:42 pm

Re: qudrocopter UAV drone

Thu Feb 02, 2012 4:38 pm

Hi Paul,

Thanks for the reply, i must have just missed it while writing my reply! I have seen the Arducopter, but for me the cost is a big issue however i am certain there is alot to take from that for this project.

As posted above i would love just to get a stable hover, everything else is a plus!

rmcgeown
Posts: 22
Joined: Wed Jan 11, 2012 7:42 pm

Re: qudrocopter UAV drone

Thu Feb 02, 2012 4:43 pm

I should add this would be for indoor use only initially.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: qudrocopter UAV drone

Thu Feb 02, 2012 4:55 pm

rmcgeown said:


I presume the R-Pi would give me a programming interface to the PIC without the need for a programmer/debug circuit?


The basic RPi board will not be able to generate the voltages needed to put a PIC into programming mode.

This is a safety feature to prevent accidental reprogramming of a circuit in a standard 5v or 3.3v board.

Therefore, you will need a voltage converter circuit to generate the required voltage. For an example of the circuit diagram, see page 28 of the PICKit1 User Guide http://ww1.microchip.com/downl.....40051D.pdf

Allan
Posts: 15
Joined: Thu Dec 22, 2011 12:16 pm

Re: qudrocopter UAV drone

Thu Feb 02, 2012 5:25 pm

I thought that most PIC devices these days have a low voltage programming mode selected by setting a bit in one of the configuration words?

Works for me!

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26875
Joined: Sat Jul 30, 2011 7:41 pm

Re: qudrocopter UAV drone

Thu Feb 02, 2012 6:13 pm

I would have thought a 700Mhz Arm running RT Linux or similar would be able to run control loops fast enough to control stable flight on a quadcopter.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

PaulBuxton
Posts: 57
Joined: Tue Jan 10, 2012 11:38 am

Re: qudrocopter UAV drone

Thu Feb 02, 2012 8:20 pm

Hi Paul,

Thanks for the reply, i must have just missed it while writing my reply! I have seen the Arducopter, but for me the cost is a big issue however i am certain there is alot to take from that for this project.

As posted above i would love just to get a stable hover, everything else is a plus!

What I mean is to have a look at the source, and talk to the people involved. There is a whole bunch of stuff in there for talking to gyros etc.
I also noticed that someone in the forum here mentioned they do a lot of stuff with gyros.

Paul

rmcgeown
Posts: 22
Joined: Wed Jan 11, 2012 7:42 pm

Re: qudrocopter UAV drone

Thu Feb 02, 2012 9:19 pm

Definately, will be tralling for as much info as  i can

stormy1
Posts: 60
Joined: Fri Jan 06, 2012 3:44 am

Re: qudrocopter UAV drone

Fri Feb 03, 2012 2:22 am

gps would be useless indoors unless you have a huge building.

What someone I occasionally talk to does is put an ultrasonic transmitter in each corner of the flight area on different frequencies and uses receivers in the blimp to get location.

He uses a blimp for safety reasons, demos in schools and stuff.

Less likely to kill someone if it hits them.

Insurance is outrageously expensive and most places require $10 million general liability.

rmcgeown
Posts: 22
Joined: Wed Jan 11, 2012 7:42 pm

Re: qudrocopter UAV drone

Fri Feb 03, 2012 9:00 am

Blimp is a good idea! I had thought about it too, but theres something about the quadrocopter that fascinates me!

Whichever way I do this, PIC or R-Pi,  I will start with a breadboard, SRF05 ultrasonic sensor, and 4 LED's to learn how to control PWM based on sensor reading.

SHould be a lot of fun!

PaulBuxton
Posts: 57
Joined: Tue Jan 10, 2012 11:38 am

Re: qudrocopter UAV drone

Fri Feb 03, 2012 9:14 am

and if you need any more inspiration check this out!

http://www.patexia.com/feed/vi.....upenn-2492

rmcgeown
Posts: 22
Joined: Wed Jan 11, 2012 7:42 pm

Re: qudrocopter UAV drone

Fri Feb 03, 2012 10:43 am

quite amazing.

100th of the level of control and i will be a very happy man.

rmcgeown
Posts: 22
Joined: Wed Jan 11, 2012 7:42 pm

Re: qudrocopter UAV drone

Sat Feb 04, 2012 10:04 pm

Just as a quick update, and kind of a question. I am giong to purchase one of these:

http://www.hobbyking.com/hobby.....8_PA_.html

I hope to be able to simulate the RX using PWM from a small IC. Unless Im mistaken all it would need to do is give the commands needed for the flight pattern wanted, which to start would be a simple take off and landing. I would use an ultrasonic distance sensor along with the IC to help with landing and ramping up/down the PWM to the control board. Im presuming the control board receives signal from the RX as PWM, as a servo would?

timn
Posts: 17
Joined: Mon Jan 09, 2012 4:38 pm

Re: qudrocopter UAV drone

Sat Feb 04, 2012 11:31 pm

This stuff isn't as easy as it looks, and I suggest you spend some time looking in to it before spending your money. I spent lots of time looking and eventually decided that it was too expensive to make one of these things. You'll need to include cost of a transmitter capable of switching the autopilot on/off and be capable of flying it manually.

The main problem is that the quadcopter is inherently unstable and needs constant corrections - which is where the gyros come in to play, but the hardware/software to do this is not trivial.

Google Quadcopter, and Tricopter.

A lot of people seem to be using Arduino variants. There are also some quadcopters that are pre-made, and also the control boards pre-made.

For insurance join the BMFA, http://www.bmfa.org/, which will give you plenty of third party insurance for £31 for hobby flying.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: qudrocopter UAV drone

Mon Feb 06, 2012 6:38 pm

The KK King board lies between the radio control (Receiver) unit and the ESC"s (Electronic Speed Controllers) you will need four ESC"s for a quadcopter. Do you plan on putting the RasPi between the receiver and the gyro unit? I would put it above the Receiver so you ha no interruption of direct control (manual). Remember that computers are not really great at real time stuff. That ATMega328 is a pretty powerful processor. It should be able to handle some sensors besides the controls. I would study up on programming the ATMega before you make any decisions.

The prior post is right that you need more than 5v to program but that only is switched to one pin during programming to put it high. You might steal this from the motor battery.

Programming the ATMega in flight is going to interrupt the gyro control for a brief time. More than enough time for a crash. I flew RC for several years. This is definitely going to take some research to accomplish
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

jonititan
Posts: 30
Joined: Sat Aug 06, 2011 2:05 pm
Contact: Website

Re: qudrocopter UAV drone

Sat Feb 11, 2012 7:40 pm

I"ve no doubt the Pi can do the control but you might struggle to do anything else and keep the stability.
Honestly quadcopters don"t generally have much excess lift to spare and you pay for the extra in battery life.
Why not consider building an autogyro?
They are a useful middle ground between fixed wing aircraft and helicopters.
Generally they have very low stall speed, are interently stable and survive power loss much better than a quadropter. Their rotor is always in the correct attitude to autorotate.

chris1nielsen
Posts: 1
Joined: Mon Feb 13, 2012 5:05 am

Re: qudrocopter UAV drone

Mon Feb 13, 2012 6:40 am

I've read through all of the posts and I see heaps of great ideas and some practicality and would also like to contribute my experience with real time control systems (haven't designed a quad/tri-copter before, I'm involved in position control, force-feedback, balancing, etc systems). With my basic experience and otherwise obviously, the faster you can complete a loop of:


reading transducers
calculating feedback
readjusting motor speed

The more reliable the control, obviously there are limitations to how fast you can read the transducers. These limits are based on precision of ADC (10bit, 12bit, etc) and obviously speed of ADC (100Msps, etc). And also there are also limits to how slow the loop can be based on heaps of factors (the trick is to find this).

You also need to look at what the control is capable of recovering from, things like speed of UAV rotation and the maximum force output of the rotors. And many more we'd have to write a list. This would obviously benefit from a faster control loop.

From experience I find that a u-controller using its assembler language or a very lightweight boot-loader (Arduino or various flavors) is a better option than a personal computer with a full operating system (heaps of background stuff happens and may interfere with time critical operations). I guess there are some extremely light OS's for control purposes out there or someone could make one especially for the raspberry-pi.

I recon the best solution would be to use the raspberry Pi to display small amounts of information wirelessly from a u-Controller and send flight path information periodically back (I've got some decent comms protocols sitting around somewhere). This would ensure minimum added weight to the UAV (u-controller package is much lighter than a raspberry pi). Also I haven't looked at the numbers but I'm sure a u-controller would use less power than the raspberry pi (not as critical the motors would probably use a much greater proportion of power).

How it could be done (software and brains).


We could use a small arduino (teensy or whatever) and use the code that is already out there to minimize time. or as was pointed out earlier that HobbyKing Multi-Rotor Control Board, just had a glace but it looks like a full package.
May have to use a higher resolution ADC chip, have to do calculations or research)
A wireless interface, could use xbee to simplify or there are many other cheap options out there that don't require much thought.
Use a full fledged operating system on the raspberry pi and use another u-controller on usb to interface with whatever cheap wireless module is used. this way we could have a fancy piece of software to make new routes and monitor various things.


(Hardware and interconnect).


Find out what motors, rotors and frames everyone else is using and use those.
We will need some kind of amplifier for controlling the motor speed from the DAC on the u-controller (i wouldn't think that the UAV would need to descend faster than gravity and resistance would allow or roll faster for that matter. so we wouldn't need H-Bridges. Just simple switching amplification). This in my view wouldn't need to be more than a FET to meet the ratings of the motor and the u-controller (we'd look into this of course).
Batteries: find out how much the UAV will use and then draw a graph showing flight time versus weight and battery capacity and choose an optimal value.

This all seems extremely doable and would be great for teaching control systems to a university class.
I'll definitely be a part of this when i finish other projects that i am working on.
It'd even be worthwhile doing up a simulation of a quad-copter (I'm in the process of writing an openGL program to help with simulating any physical system to test out different timing and feedback calculations).

hzrnbgy
Posts: 106
Joined: Mon Dec 26, 2011 10:55 pm

Re: qudrocopter UAV drone

Mon Feb 13, 2012 7:34 am

I wouldn't suggest using an RPi for a UAV primarily due to its weight, size and power requirement. As far as performance goes, it may have the grunt to do all sorts of computation but for a control system, latency and response is more critical than brute force.

An arduino mini/pro should be good enough as it has enough I/O for your ADC and PWM needs and it weighs 20 times less and uses less power than an RPi

Rudd
Posts: 2
Joined: Sat Mar 03, 2012 11:10 pm

Re: qudrocopter UAV drone

Sun Mar 04, 2012 12:29 am

An article followers of such UAV threads might find interesting:

http://www.newscientist.com/ar.....akeup.html

it's about proposed law changes to civilian and commercial operation of UAV.

MarkT
Posts: 1
Joined: Tue Mar 06, 2012 5:36 pm

Re: qudrocopter UAV drone

Tue Mar 06, 2012 9:58 pm

hzrnbgy said:


I wouldn't suggest using an RPi for a UAV primarily due to its weight, size and power requirement. As far as performance goes, it may have the grunt to do all sorts of computation but for a control system, latency and response is more critical than brute force.

An arduino mini/pro should be good enough as it has enough I/O for your ADC and PWM needs and it weighs 20 times less and uses less power than an RPi



Power hungriness is not a problem, RC multicopter systems are running at 100's of W, and typically provide 2A at 5V aux power _per motor_.  Also quadcopters are good at lifting, they have 4 motors to share the weight, so I don't think the weight or power are big factors unless its a tiny craft.

kkman20xx
Posts: 14
Joined: Mon Mar 05, 2012 3:47 pm

Re: qudrocopter UAV drone

Wed Mar 07, 2012 1:35 am

Go to http://diydrones.com/ they already has all the software you need to do that. RPi is not great for something like this.  However, I can think of with the RPi onboard, you can have video overlay of flight information, or running a image recognition software on RPi to perform various tasks.  Facial recognition or number plate recognition using OpenCV.

The current FPV overlay systems are a lot more expensive than the RPi so it is a good option, and a lot more posibilities.

Return to “Other projects”