This is third part of Cleanflight PID tuning tutorial with Blackbox. Previously I’ve showed examples of:
This time it is time for something slightly different: not enough P gain. Usually this problem can be identified without any log analysis. Symptoms are quite visible: multirotor is sluggish during maneuvers, has a tendency to change attitude on its own, constant course corrections are required. In worse cases, it is unflyable. But how does it look like on Blackbox logs.
First of all, symptoms are not so clearly visible. There are no huge oscillations for example. Zoomed out log might event look good on a first glance. For example like this:
Continue reading Detecting Cleanflight PID tuning issues with Blackbox: not enough P
Welcome to second part of Blackbox PID tuning tutorial. Last time I have showed few examples how excess P gain might look like. Today I will write few words about next common PID tuning problem: too much D. Derivative (future) part of PID controller is very useful, since it allows to smoothen control loop output when it is reaching the target. So, at the end of move (roll, pitch, yaw, anything else) multicopter will start to “slow down” before target is reached. It’s just like accelerator pedal in a car. When you want to reach 50 you start to release it before you reach 50, and not in the exact moment you reached target speed. If you would, you would have to use brake to slow down to 50. Derivative part helps not to overshoot. Without it, movement would be shaky, not smooth.
Unfortunately, D is tricky. Like everything that tries to see the future, it is unreliable and can introduce noise. We do not like noise. Not enough D = shaky, mechanical, movement and overshooting. Too much D = extra noise, vibrations, damped response.
How excess D would look like in Blackbox logs? Like this:
Continue reading Detecting Cleanflight PID tuning issues with Blackbox: excess D gain
I think all popular computerized DIY devices like Arduino, Raspberry Pi or any other microprocessor/microcontroller based boards has one common drawback: low output current. Few miliamps per pin. While this is enough to light a single LED or provide input to other electronics device, it is far from enough to run a motor or power a LED strip. It’s all about current.
Good thing this problem can be solved with two additional devices: resistor and bipolar transistor. Together they can act as a switch. Idea is simple: low current (and voltage if you wish) applied to transistor base causes bigger current (and voltage) to be passed between collector and emmiter. We have two choices: NPN or PNP bipolar transistor. Switch that uses NPN transistor is open/enabled when positive voltage is applied to base. In other words, base is connected to plus.
Continue reading Using transistors as switches
Almost all quadcopter PID tuning tutorials can be summarized into one sentence: “Increase P until you see oscillations, then lower it”. Plus some thoughts about I and very vague advices about D and that is all. When I got into the hobby, I’ve read all of those tutorials. And I did know more about PID tuning than before that. I even had more questions than before. How to recognize high frequency oscillations, how to recognize low frequency oscillations. Lower P? OK, but how much? And D? How to tune this bloody D? As a result, every time I tried, I ended up with very snappy but shaky quadcopter that maybe responded very quickly to commands, but was very shaky and was making strange noises.
And then came Cleanflight and Blackbox. Live became simpler. What I’ve learned from Blackbox logs is that I wanted high P so much, I had too much of it in the end. Actual oscillations begins before we see or hear them and excess D introduces jello. Blackbox simplified things, but still, logs analysis is something like an art. You have to know what to look for. Continue reading Detecting Cleanflight PID tuning issues with Blackbox: excess P gain
FrSky X9D Plus Taranis or cheaper FrSky Taranis Q X7 or even more expensive X10S Horus, are incredible radios. But also can be intimidation when migrating from simpler radios. A great example is mixing multiple switches into 1 channel to pass flight mode to the flight controller. Yes, you can do it, but it can be a pain in the ass on a Mixer level. I've lost a lot of time trying to understand the logic behind mixer weight and offset only to discover possibility to replace channel value, not add. And everything was simple again. So, here what I wanted, and what I did.
What I wanted
When I fly bigger FPV quadcopter, I want to use 7 different flight modes:
- Angle without Altitude Hold (no BARO),
- Horizon without Altitude Hold (no BARO),
- Acro/Rate without Altitude Hold,
- Angle with Altitude Hold (BARO),
- Horizon with Altitude Hold (BARO),
- Position Hold with Altitude Hold (BARO),
- Return To Home with Altitude Hold (BARO)
And I've figured out, that 3 switches should be used to enable all the flight modes: SC, SD, and SG. SC toggles Angle/Horizon/Acro. SD switches PosHold and RTH (as well as BARO and overrides SC and SG). SG enables Altitude Hold but only when SC is in up or middle position. 3 switches, 7 modes. I could do it with 3 radio channels, but that would have few flaws: would use 3 channels instead of one, and would allow for mistakes like no BARO with POSHOLD. So, advanced mixes and logical switches that is. Continue reading Multiple flight modes for Cleanflight with Taranis
Multicopter is an unstable machine. It requires constant corrections to keep is stable in the air. This is done with PID control loop. When quadcopter does not fly like you hoped, you will hear: “Tune your PIDs“. Nice. But what exactly is PID? If you did not studied control theory, and you do not want to start, you read internet. And internet tries to explain PID in various ways. Some are better, some are worse, and there is always room for a new one. So here we go.
Officially, PID goes for Proportional, Integral, Derivative. Wikipedia provides enough of long and boring theory. If it’s TL;DR, here is a short summary:
- PID controller measures error of current output and desired output,
- This error is processed separately by P, I and D modules,
- Then, output of each module is multiplied by it’s coefficient (Kp, Ki, Kd) and added all together as an controllers output,
- Controller can be tuned by changing Kp, Ki and Kd values,
- In a multicopter, there is separate controller for each axis (roll, pitch, yaw) working based on rotation speed provided by gyros. This is called and “inner loop”.
- Some flight modes adds “outer loop” with separate PID controller that is translating user input into values used by “inner loop”. Outer loop is much less important than inner loop and usually there is not need to tune it,
- Flight modes like Attitude, Angle, Horizon (all with self leveling) are using both outer and inner loop,
- Flight modes like Rate, Acro and using only inner loop,
- When speaking on PID tuning, in 99% of cases we will be talking about tuning the “inner loop”,
- Inner loop tuning should be done only in Rate/Acro flight modes (no self leveling) and avoid complex outer-inner loop interactions.
Continue reading What is PID controller?
FrSky X9D is an excellent radio. There is a variety of receivers that can work with it. And each of receivers is a small computer itself. With its own firmware that can be changed. Why? For example to enable CPPM mode, or allow receiver to bind with EU or non-EU Taranis (I will write on both topic in different posts). FsSky is selling cables to flash different modules, but Taranis is cool enough to flash S.Port receiver modules by iself. Cool, right? How to do it? Simple:
- You will need OpenTX 2.1 Taranis software or never. If you are using older one, upgrade with Companion app,
- You will need S.Port cable. Different receivers might have different plugs, so you will need right type. Luckily receivers usually comes with proper cable (checked with X4R and X4RSB), and X8R bundled with Taranis has standard servo pulg for S.Port,
- Taranis has “hidden” connector that allows for flash S.Port modules. It is behind JR module cover.
Continue reading Flash firmare to S.Port FrSky receivers with X9D Taranis
While playing with newly arrived Micro MinimOSD and attempting to flash it with latest MW OSD software, I’ve discovered that offical tutorial, as well as many other are missing one tiny detail that makes whole process much harder than expected. In theory, MinimOSD just Arduino Pro Mini with additional hardware. So, in theory, you plug in your FTDI USB adapter and upload a sketch. But if you never worked with Arduino Pro Mini (like me, it was always Uno, Pro Micro, or barebone Atmega328) you might not know one detail. Yesterday it took me more than 30 minutes to figure out firmware upload is not working, while it should. So, another tutorial will be written.
To flash MW OSD to Micro MinimOSD we will need:
Continue reading How to flash MW OSD to Micro MinimOSD
SimonK is most widely recognized ESC firmware in multicopter world. But there is a second option, in many ways much better than SimonK firmware. It is called BLHeli. It supports many different ESC, including both Atmel and SiLabs based. Plus, it has a cool software that allows you to configure you ESC without programming card. Just connect your ESC via serial-to-USB interface and you are ready to go.
AfroESC were supposed to be state of the art controllers, SimonK out of the box, easy to flash thank to special USB interface/programmer. And ready to accept different software, BLHeli included. There is only one huge “but”. You can buy them, you can buy Afro USB Linker (Turnigy USB Linker is exactly the same), but nobody will tell you how to do it. Number of articles is very limited, and the only useful I’ve found is this one. So, here we go, now there will be a second one!
How to flash BLHeli to AfroESC
What you will need:
- AfroESC (obvious)
- Afro USB Linker / Programmer
- Windows machine with drivers (keep reading)
- LiPo battery, the same you use on your drone
Continue reading Flash BLHeli to Afro ESC