altitude hold using sr-04 + PID for my quad copter

HI,
i have been building multirotors for quiet some time and i wanted to make a simple altitude hold mechanism for my quadcopter and im new to the PID library . the idea is to manipulate the throttle pin of my kk2 using arduino's servo library and pid library. i have edited the PID_Basic
input is the output from the ultrasonic sensor ( in centimeter )
Setpoint = 55cm
Output is in PPM (using servo library)

will it work?
i have no idea ... please help me thanks in advance. :slight_smile:

You seem to be describing holding it at a specific altitude and not altitude dampening, correct?

Without reading the current throttle signal it seems like you haven't planned out how to get it to land.

Chagrin:
You seem to be describing holding it at a specific altitude and not altitude dampening, correct?

Without reading the current throttle signal it seems like you haven't planned out how to get it to land.

hi thanks for your reply i plan on switching altitude hold on and off using an aux channel so landing is not a problem i can do it manually . i will be using an rc receiver anyway to take off and land it will be connected to the arduino and then the arduino pwm pins will be connected to the kk2 board . and can you explain it by pid block diagram ? thanks.

http://forum.arduino.cc/index.php?topic=257823.msg1829641#msg1829641

you wil like this :astonished:

It could work. I did the the same thing. Here is the source: :slight_smile: