# UAV Autopilot project (embedded systems)

#### MSKhan

Joined Dec 6, 2015
4
Hello everyone,

I want to build an autopilot system for UAVs. Basically, turning big RC planes into autonomous flying machines. I'd need to have a ground control station too. I have a degree in Aerospace Engineering (MEng) and have been interested in learning more about electronics and programming ever since I did my final year project. There have been a lot of issues keeping me from pursuing this dream, long story short, I want to do it starting from now.

I figured that I'll need to learn about embedded systems/electronics and programming for this project. I don't need to have my Autopilot system ready by next month, so I am fine with learning and doing practical works to build up the skills needed. My target is to have at least the prototype of the system ready 3-5 years from now.

If you have the know hows, will you be willing to help/guide me? I am making a list of topics and things I have to study and work with. You can help me by telling me about things I should consider studying and if possible, link me to online resources (pdfs, books, forums, videos,etc) which will help me out.

Thanks

Fahim

#### Papabravo

Joined Feb 24, 2006
19,260
A complete 3-axis autopilot would be a challenging project. Would you like to discuss single axis control, one axis at a time? If so we can start with pitch. What control actions will change the pitch? Elevator is the primary pitch control. How can we measure pitch? Good question. What do we know? If the wings are level, throttle is constant, and the airspeed is constant, then we are flying straight and level, neither climbing or descending. If airspeed increases, it means we are descending and have pitched down. If airspeed decreases, it means we are climbing and have pitched up. Don't forget to take the phugoid oscillation into effect.

https://en.wikipedia.org/wiki/Aircraft_dynamic_modes
https://en.wikipedia.org/wiki/Phugoid

What does all this mean?

1. We need a way to measure pitch
2. We need a way to control the elevator
3. We need a way to convert changes in pitch to elevator control movements
What do you suggest for a way to do that?

#### MSKhan

Joined Dec 6, 2015
4
Hello Papabravo,

Thanks for the response.

I don't actually need much help with Flight dynamics. Not saying that I'd ever say no to suggestions and advice on that. I'm more interested in learning about the actual electronic hardware and software that will go on to making my autopilot. If I had to answer your questions right of the bat:

1. Gyro? Couldn't we use them to measure deviation of row/pitch/yaw?
2. Servo?
3. Couldn't we use feedback from gyro to adjust the elevator settings? Much like an actual pilot sitting in the cockpit, the autopilot could just use the reading from the gyro to try and keep adjusting the elevators until the aircraft stabilizes.

#### Papabravo

Joined Feb 24, 2006
19,260
Can you afford the weight and the expense of gyros? I was thinking this might be a low budget hobbyist type project. If not give me a link to your gyros and I'll see if I can suggest an interface to a processor.

You want to avoid constant control input to avoid PIO (Pilot Induced Oscillations) particularly in roll and yaw.

One more thing. Where did you plan to test this autopilot? In a wind tunnel I hope.

Last edited:

#### MSKhan

Joined Dec 6, 2015
4
I do not have a link to any gyros. I was talking "in theory". If being at hobbyist level was my goal, I wouldn't have bothered learning about embedded systems. I would just buy one of those ArduPilot things and saved 3-5 years of my effort. I'd really appreciate it if you share any knowledge on the subject that you have. I do not mind experimenting with and learning from low budget stuff though.

Initially, I planned on using X-plane to test my system. I don't know what to do about my wind tunnel test plans. I think that by the time my system will be ready for such tests, I will have access to a really kick-ass wind tunnel . If for some reason, I do not manage to do any kind of wind tunnel testing, I will take my chances and start doing flight tests.

#### Papabravo

Joined Feb 24, 2006
19,260
Well there is not much I can tell you about "in theory" without access to some real hardware. You kinda need to start with the available input data and it's format and the rate at which it is available and so forth. The same for the output data and it's format and how often you need to update it. The basic structure of an embedded program is just like an Arduino sketch.

C:
main()
{
initialize() ;
while(1)
{
gather_inputs() ;
calculate_outputs() ;
update_outputs() ;
} //end while()
} // end main

#### MSKhan

Joined Dec 6, 2015
4
My lack of knowledge of embedded systems is disturbing However, I am always willing to learn. Would you mind answering a few questions?

- If I will ultimately be playing around with embedded systems, should I heavily invest in embedded C?
- I get a little bit confused about certain thing. Isn't Arduino based on C too? Would embedded C help me in dealing with Arduino sketches then and if so, how much?
- Do you know any good online resources you could link me to so that I may learn about embedded systems full time? I should be able to invest a minimum average of 4 hours a day every day to learn.

#### Papabravo

Joined Feb 24, 2006
19,260
I'm not familiar with embedded C. All my projects going back several decades have used assembly language and plain old C. Get yourself a compiler and start writing and debugging code. You'll find out pretty quick if you have the aptitude for it. The electronics knowledge will be more difficult to come by. AFAIK most of the online resources are marginal at best. Poke around see what you find. This site has a lot of good introductory material on electronics, but it is a work in progress, and there are gaps.

You should also investigate MEMS gyroscopes, compases, and accelerometers.