PDA

View Full Version : Altitude hold system esp. barometric pressure


vpatron
Aug 21, 2005, 12:28 PM
Recap: This thread is being split off from "Anyone flying in SoCal?"

Several ideas were discussed for holding the altitude of a UAV (e.g. straight flying autopilot so operator can focus on shooting pictures with pan/tilt/shutter control). The 1 second updates from GPS would probably be way too slow and another accompanying method is needed.

4 ideas for keeping the plane flying perfectly flat: 1) AOA (angle of attack)sensor like Darts (see the thread "AOA Sensor"), 2) Gyro with GPS calibration, 3) barometric pressure using accurate A/D conversion. This is also assuming that the plane is inherently stable (e.g. polyhedral wing or separate roll control) so that only pitch control is needed.

The barometric pressure sensor is examined here because it seems to be the simplest and easiest method: it requires no pitot tubes or special mounting.

vpatron
Aug 21, 2005, 12:35 PM
Originally Posted by vpatron
if I just want a system to hold the altitude (fly the plane flat so I can focus on picture taking), can I just use the PICs internal 10-bit A/D converter? My thought was to get the 14-bit or better accuracy cheaply by using a simple D/A converter (e.g. R2R ladder) to feed a variable reference voltage into the PIC's A/D block to set the conversion range (Vref- and Vref+). The PIC would simply seek the range that sets the A/D input about midrange.


Posted by LukeZ:
Vince, I think you certainly could do just that. In fact, one reason why my resolution is so poor is that I'm not amplifying my sensor output before I read it on the A/D converter. The reason is that I wanted to be able to use the full range up to 45,000 feet (mostly because it sounds cool, not that I think I'll be flying that high). Although I did mention an op-amp in my design, I use it only as a buffer so no amplification is taking place.

If you don't need to measure altitudes that high, you could amplify the sensor output so your A/D only sees a small portion of your sensor's voltage output range. For example, the MPX4115 puts out approximately 0.2 to 4.8 volts, from 15 kPa to around 110 kPa respectively (here, the higher the kPa and voltage, the lower the altitude). So let's say you amplify and shift the output so that the range of 90 to 110 kPa from the sensor is read as a full shift from 0 to 5 volts on your A/D. Then you'll have much higher resolution for that range.

I'm probably not explaining that very well, but perhaps you already know what I'm talking about.

The variable voltage into the PIC to set the A/D reference sounds like a pretty neat trick - you could use it to adjust the altitude at which the airplane would fly, as you point out. Alternatively, depending on what PIC you're using, you could just read a straight PWM feed from a channel on your R/C receiver. You could turn that into some numeric range by which you could scale your reference altitude. Say you used the throttle stick: full up stick would be read as the number +500 and full down stick as -500, and zero would be in the middle. Then, you could set up your PIC to default to holding steady at 500 feet altitude, plus or minus whatever your adjustment factor was from the RX reading. Moving your throttle stick up or down would move the aircraft to an altitude higher or lower than the default 500 feet. I'm mostly just thinking out loud - of course it would take some work to implement.

As for which of your three aproaches might be best for an altitude hold, I'd agree that the use of barometric pressure will probably be the easiest and I suspect the most effective. Others can feel free to chime in what they think...


Ha! Right now I use it to check the speedometer on my car.:D I'm nowhere near to having a flight-worthy UAV yet. When I do, airspeed is probably not going to be entirely critical - as far as the more interesting groundspeed, GPS is a better instrument. Still, airspeed could be useful in helping measure wind speed and direction, which I will want to know for landing. And I think it will be useful for the purpose of determining the most optimum glide angle (indirect AOA).
Luke

vpatron
Aug 21, 2005, 12:53 PM
LukeZ, yes, that's exactly what my idea is, except the range search would not be done manually with the throttle stick.

The PIC would do it by itself. The crudest algorithm would be to simply start at the lowest range, do an A/D conversion, if it's off scale, then go to the next range and continue until it finds a good reading. The absolute altitude is calculated from the 10-bits of the A/D conversion plus the 4 upper bits which is the conversion range setting (the reference voltage control).

Also, yes, like you I realized that the PWM block of the PIC could be used. I think it's 10 bits (and at least 8) so in theory we could create a 20-bit A/D converter and all we need to add is an RC filter and some fancy software! (Thought about patenting this but I'm sure lots of people have thought about this... :)

The A/D range control needs to be created to have overlap so that it doesn't have to jump between settings during autopilot. There could a dead zone between settings. This is easy to do by having the Vref- and Vref+ on a resistor string. The 2 ref voltages will probably have to be buffered since the PIC datasheet suggests no more than 250 Ohm source impedance due to sourcing and sinking currents during conversion.

The sensor data will need to be averaged because of the tiny voltages involved there will be noise to be filtered. Not a problem since a PIC A/D is fast enough.

Also, there will be thermal drift especially if the ref voltage has to be buffered, but will not be a problem since we get GPS update once per second that we can use to software recalibrate the system.

Anyway, I think this will work quite well. The hardware is fairly easy to design, the software development will take the most work.

Comments, ideas?

-Vince

vpatron
Aug 21, 2005, 12:55 PM
As an aside, I'm working on the pan/tilt/shutter camera mount to be finished next week. Start on electric glider airplane after that. I'll start the altitude hold design at same time.

My goal is to have a very good AP plane with altitude hold to take on vacation in Hawaii by October! Then add GPS autopilot for full UAV after.

LukeZ
Aug 21, 2005, 02:28 PM
Vince, how are you going to actually implement the altitude hold - just have a switch on the TX that you flip, and the plane then attempts to remain at the elevation it's currently at?

It sounds like you have the theory pretty much worked out. I can't remember if I posted this already but I think what you're proposing is exactly what Bill (william541) recommended to me in this thread (http://www.rcgroups.com/forums/showthread.php?t=372869) (bottom of first page and then all of the second). He had a way of explaining it pretty well, and there's also a schematic he posted that you might find useful. At the time I was just getting started in PICs so the code seemed too daunting. Now that I have a little more experience I'd like to give this approach a try - I just need to find the time.

Keep us posted on your progress for sure. I think I'd like to work towards an inexpensive altitude hold kit that a novice user could use, just plug it into their RX.


Luke

CaptRon
Aug 21, 2005, 06:16 PM
If you could make it so you just pug it in to the receiver and assign it to a separate channel I would by one in a minute at ( say $99.00) and just because other people may have the idea doesn’t mean anyone took the time to patent it. If you think your idea is workable and worthy of a patent apply for one. Millionaires have been made on ideas just like yours. (just look at the zlog altimeter) everyone I know owns one.


CaptRon

LukeZ
Aug 21, 2005, 11:04 PM
Hmm.... I see $$$ floating before my eyes. ;)

Guess I better get to work before Vince beats me to it, huh? :D

Luke

ElectroLawndart
Aug 22, 2005, 12:36 AM
The PIC would do it by itself. The crudest algorithm would be to simply start at the lowest range, do an A/D conversion, if it's off scale, then go to the next range and continue until it finds a good reading. The absolute altitude is calculated from the 10-bits of the A/D conversion plus the 4 upper bits which is the conversion range setting (the reference voltage control).

Also, yes, like you I realized that the PWM block of the PIC could be used. I think it's 10 bits (and at least 8) so in theory we could create a 20-bit A/D converter and all we need to add is an RC filter and some fancy software! (Thought about patenting this but I'm sure lots of people have thought about this... :)


-Vince

Vince

Take a look at the Honeywell ASDX DO series of pressure sensors. Serial Data Out with 12 bit accuracy. Might be interesting.

Dart

ALtitudeap
Aug 22, 2005, 11:12 PM
ELDART,
Those look like very nice devices. i havent seen prices yet. It looks like that is the perfect match for what i am looking for. thanks for the discovery.

vpatron
Aug 22, 2005, 11:51 PM
LukeZ, it would be fairly easy to implement two methods of activation: 1) separate RX channel, or 2) idle elevator near center position for say 3 seconds activates altitude hold, moving control from center deactivates. Dude, I actually would like it if I can work on the device with someone who can write decent firmware (not spaghetti code). There's tons of stuff to do and I want a mini-UAV ready for commercial work by next year. I can design the HW, and give you the firmware algorithm to implement.

CaptRon, I don't see why I couldn't sell it for $99 (prob less) with simplified HW described above. As we all know, SW development costs once, HW costs on every unit. If there's a lot of interest from UAV and aerial photo folks, I'll work on a $99 altitude hold and hopefully include bearing hold (via a gyro) since I need such a gizmo anyway.

Darts, sounds cool. I'll look it up when I get home. But I think I can do it cheaper because of the simpler constraints. Also, instead of just serial out, I'd rather use the micro's serial port for a simple "token ring" type of network between modules so it can be used for both data and control.

Regards,

-Vince

vpatron
Aug 23, 2005, 04:24 AM
CaptRon, I just looked up the cost of the sensor. Sheesh, they're not cheap. $5 or $10 with integrated amp. Ok, maybe $99 for altitude only or $199 with bearing hold gyro... :)

Still cheaper than www.u-nav.com which is $250 for altitude hold.

-Vince