

Need help with PID tuning on my custom ESP8266 + MPU6050 drone flight controller
Hi everyone, I am an electronics student currently building a custom quadcopter flight controller from scratch using an ESP8266 and MPU6050 (via I2C).
I am having a hard time getting the right PID values to stabilize the drone. It either oscillates too violently (shakes) or reacts too slowly and drifts away.
Here is my current setup and codebase:
Microcontroller: ESP8266 (programmed via Arduino IDE)
IMU: MPU6050
My GitHub Repo (for the full code): https://github.com/exstain/Custom-Drone-Flight-Controller
The Problem:
Whenever I increase the P (Proportional) gain, the drone shakes violently. But if I lower it, it doesn't correct itself fast enough. Since ESP8266 is a single-core processor, I am also worried that my loop time/cycle time might be affecting the PID calculations.
Any advice on how to properly tune the PID values or optimize the loop time for an ESP8266 drone would be highly appreciated. Thank you so much!