I always wanted to make a Drone . So, when the right time came I got myself all the required hardware set along with KK Flight controller.The reasons for which I choose KK are:
1. It is cheapest compared to other stable versions.
2. Easy to use and setup (On Screen Display available).
3. Great Flight controller for beginners
Although it is really stable and fun to fly using kk flight controller, there is no altitude hold feature available, therefore it is tough to keep it maintained at a fixed height.
First I searched online for ways I could add this feature. Since I didn't get such video I decided to try it out on my own
Here, I have used a
1. kk flight controller,
2.An arduino nano and
3.An ultrasonic sensor
to add the feature of altitude hold using the concept of PID control system.
First challenge was to accurately read the radio receiver's pwm signal for which I referred to
1.Joop Brokking's channel (the ultimate source to make drones using arduino)
2. Electronoobs channel (arduino drone playlist)
Next, I tried using different sensors like a BMP180, BMP280 to read height....but ultimately ended up using an ultrasonic sensor which was the easiest to handle with reliable and accurate data.
That was all the extra hardware required to implement Altitude hold.I also used an extra channel(chn5) to toggle between normal mode and Altitude Hold mode.
I have made a tutorial in Two parts :
1. In part 1 I have showed the drone in action(Altitude hold mode) and also explained all the hardware connections.
2. In part 2 I have explained the code :
Link to download the code : https://github.com/htgdokania/Drone_altitude_hold-
I hope this helps out others and better version for the same is developed in future.