Looptime and Flight Controller

This article explains what FC looptime is and whether faster looptime is really better for your quadcopter. We’ll also talk about gyro update frequency and ESC refresh rate which is equally important.

With all the new technologies coming out every day in the FPV multirotor world, it can be hard to keep up. “Looptime”, “Gyro update frequency” and “ESC protocols” are one of the concepts being discussed a lot in the FPV community, with regards to the FC and ESC.

What is Looptime in flight controllers?

Generally there are 2 things you need to know about when talking about looptime:

  • Gyro sampling rate – how often gyro data is read
  • FC looptime – how often PID loop acts on the gyro data

You sometimes see people talking about 4K/2K or 8K/8K, the first number is Gyro update rate, while the latter is FC looptime.

FC looptime is basically the time it takes in a flight controller to complete a PID loop. For instance, when PID loop is running at 1KHz, the looptime would be 1ms (1000us).

  • 1000us = 1khz
  • 500us = 2khz
  • 250us = 4khz
  • 125us = 8khz

The Different Looptime in Firmware

Today, the four main flight controller firmware for mini quad’s are Betaflight, Cleanflight, Raceflight, and the KISS FC firmware. Each firmware might or might not allow FC to run at different looptimes.

For example KISS FC is forced to operate at 1kHz (1000us looptime), while the fastest Betaflight can run is 8kHz (125us looptime). Raceflight can even do that at 32kHz.

PID Looptime Isn’t Everything

The reason we want higher looptime is to reduce latency in the system. But there are so many other factors that can cause delay than just PID loops, for example:

  • Gyro Sensor Delay (such as the built-in Low-Pass filter and sampling rate)
  • FC PID Looptime
  • ESC Protocol (time for data to travel from FC to ESC) and motor refresh rate (how often ESC updates motor)
  • Motor/Propeller Physical Delay (aka, the reaction time or change of RPM)
  • Moment of inertia of a quadcopter (related to frame and weight distribution)
  • FPV camera/VTX delay in a FPV quadcopter
  • Radio transmission delay (TX to RX, RX to FC)

In this article we will focus on the first 3 things in this list, which are more related to FC looptime and can be improved in the software.

FC Looptime

Most F3 FC these days are capable of 8KHz looptime, while some F4 can even do 32KHz. However apart from processor speed, Gyro sampling rate also has an impact on how fast you can run your looptime.

Learn about the difference of F1, F3, F4 and F7 flight controllers.

Gyro Sampling Rate

PID looptime is limited by Gyro sampling rate, basically gyro sampling must be equal or faster than PID loop.

Gyro sampling rate is affected by 2 things: the type of Gyro and the connection protocols between processor and Gyro.

The most popular MPU6000 Gyro with SPI can only go up to 8KHz sampling rate (with i2C, 4KHz), while the ICM-20602 can reach 32KHz.

You should always run your Gyro at the fastest sampling rate whenever possible, because there is no downsides to running higher sampling rate. I.E. for Gyro with i2c protocol, use 4KHz, for SPI protocol use 8KHz.

Gyro Delay

Gyro has some physical delay when sampling data, but it’s so small we can normally ignore (some micro seconds). However they have built-in low pass filter that can cause much noticeable delay. They are designed to reduce the amount of noise that can get through above certain frequency. For example in Cleanflight, the default Gyro_LPF is 42Hz, which would introduce a 4.8ms delay. That’s nearly 5 times as much as the PID loop delay!!

It seems to be a no brainier to use higher Gyro LPF frequency right? But the downside is it might give you a noisier quad that is hard to tune. While gyro delay doesn’t impact looptime, it does introduce latency to your quad and make it less responsive.

Gyro LPF Delay
256Hz 0.98ms
188Hz 1.98ms
98Hz 2.8ms
42Hz 4.8ms
20Hz 8.3ms
10Hz 13.4ms
5Hz 18.6ms

ESC Protocol

ESC Protocol determines how fast the ESC signals are sent from the FC. Standard PWM has a delay of 2ms, and that’s twice of much delay as 1KHz looptime. Therefore by improving what ESC protocol you use would give a very noticeable improvement on your quad’s flight performance.

Oneshot125 (250us delay at 100%) and Oneshot42 are invented later on to reduce the latency. Then Multishot are implemented which can reduce delay further down to 25us. And more recently, D-Shot was introduced which is even faster (with DShot1200) and more reliable than Multishot!

ESC Protocols vs FC Looptime

There are limitation on what max looptime you can use when using different ESC protocols.

As mentioned, delay of Oneshot125 protocol is between 250us and 125us depending on throttle level. Likewise, Oneshot42 is between 84us and 42us and Multishot is between 25us and 5us.

It makes perfect sense to have your ESC protocol running faster than FC looptime, otherwise your ESC will get behind in its data and can overload the ESC.

This is why Oneshot125 does not work with 8kHz FC looptime which is way too high. It can cause the ESC’s to get behind if the ESCs are picking up the signal at the 250us trailing edge of the PWM signal (see below diagram).


Likewise, if the multirotor is at full throttle, there won’t be any gap in the PWM signal between the leading and trailing edges so the throttle would be a straight line which will cause issues with reading and writing the PWM data.

Therefore when running Oneshot125, you shouldn’t run anything above 3.8kHz looptime on your flight controller. This ensures a small gap in the PWM signal can be created to allow the ESC’s to identify the signal properly. Otherwise invalid signal can cause ESC to shut-down.

Oneshot42 is capable of managing 8KHz looptime, while for 32KHz looptime you will have to use Multishot.

Benefits of Faster Looptime

There are benefits to running faster looptime and gyro sampling rate, but there are also some negative impacts with it.

Nyquist Frequency tells us that frequencies can be measured accurately that are lower than half of the sampling frequency. That means by setting looptime at 1KHz, we can accurately measure frequencies below 500Hz.

The problem is when there is vibration with frequency higher than the Nyquist Frequency (which is 500Hz in our example), they will not be ignored due to Aliasing, but show up at different and lower frequencies in the system. For example if there is a signal of 510Hz it could appear as 10Hz, while 1010Hz could also appear as 10Hz. As you can see, this could cause confusion to our flight controller.

That’s why we have digital low pass filter (LPF) in the Gyro to cut off noise above certain frequency. However you need to understand it only reduces the noise and doesn’t eliminate them completely, stronger noise could still get through due to Aliasing.

Running a higher sampling  frequency increases the Nyquist limit, and higher frequencies can be measured more accurately. It also reduces the aliasing at lower frequencies. Not to mention the less latency in control loop can make the copter react faster.

Faster Looptime In Practice – Noise

Most experienced pilots would agree it makes a significant difference to flight performance by running higher looptime and use faster ESC protocol. Just think about back in the days when we were running 1KHz looptime with Oneshot125, and now 8KHz with DShot. :)

By making looptime faster, you are also raising the noise floor as it’s now open to a broader spectrum of frequency. It’s also known as the “D-Term” vibration in blackbox data, making your quad harder to tune and causing hot motors. Some quadcopters actually run better at slower looptime because it gets so noisy and has so much vibration at faster looptime.

And therefore additional filtering will be required when running fast looptime, and it will eat up any latency advantage with the phase delay. And even then there are some issues that even the increased filtering can’t handle.

A good example would be the Raceflight Revolt. Currently for Gyros that are doing 32KHz sampling rate are quite noisy, flight controllers like it need soft mounting.

Setting faster looptime isn’t going to make you a better pilot overnight. Only practice and tuning is going to do that. I have flown the KISS flight controller which runs at 1kHz, and with the tune I had the quad feels as locked in as I want it to be. I have also tried 8kHz on the Betaflight F3 and despite the quad flies very responsively, I had to soft mount the motors to reduce oscillations.

Unsynced Motor Update Speed

Not long ago, “unsynced motor update speed” was made possible, to allow motor update faster than Gyro/Looptime up to 32KHz.

When motor update rate is faster than looptime, we can expect the same value to be written to the motors repeatedly. Some argue this is useless work and doesn’t bring any benefit.

There is no exhaustive data to support if this is of any advantage to running faster motor update rate. However here is one of the reasons why I think it can be beneficial doing so. Because of the analog signal protocols we use in our FC/ESC (such as Multishot), noise can get into the system and affect the inaccuracy of values sent to the motors. By writing to the motors faster, we might be able to increase the accuracy of the value  we want to write to the motors.

This shouldn’t matter to DShot and that’s why motor update rate was removed in the Betaflight configurator when using DShot.

For Betaflight: PID Looptime and Gyro Sampling Rate

Here is what we recommend for Betaflight which I am also currently running:

Oneshot125 Oneshot42 Multishot DShot Examples
F1 with I2C 2K/2K 2K/2K 2K/2K 2K/2K Naze32
F1 with SPI 4K/2K 4K/2K 4K/2K 4K/2K CC3D
F3/F4 with I2C 4K/2K 4K/4K 4K/4K 4K/(2K)(4K) XRacer V2
F3/F4/F7 with SPI 8K/2K 8K/4K 8K/8K 8K/(2K)(4K)(8K) Betaflight F3

To free up resources for higher looptime, you might have to disable some of the features, such as accelerometer and soft-serial.

After setting your looptime, make sure to check your CPU load (CPU usage) is within 30% or 35% for stable performance.

Hope you find this article informative.

29 thoughts on “Looptime and Flight Controller

  1. Joshua

    Yeah I have a question, I have the Flycolor Raptor w/ F390 Tower 30A 4 in 1 ESC

    ESC: BLHeli firmware, support Oneshot125/42,Multishot,Damped Light

    I Tried setting it to 4K/4K and multishot and it would not arm or even ONESHOT42 and it still would not arm. The only way I can get it to arm is by putting it on ONESHOT125.

    CPU LOAD was only at 29%

    Do you know what that would happen? I tried asking the Amazon seller but they did not answer me.

  2. seth gunter

    i have switched to beta flight on an 250 size quad..with naze32 and older 16amp opto RW.RC blheli esc..the quad arms but once i take off it goes out of control totally.. i know i has something to do with the both loop times i just dont want to mess around for ever to figure it out..so what is the origanal loop time on cleanflight to match beta flight..cleanflight worked fine..i am not haveing so much luck with beta flight being a easy switch..even my newly built 180 tyrant with new escs and things needed work to get flying again..

  3. Jim

    “If there is a signal of 510Hz it could appear as 10Hz, while 1010Hz could also appear as 10Hz.”

    All 510 hz signal sampled at 50hz will alias to 490 hz.

  4. Bhargav

    hello ! I am making a quadrotor at stm32 microcontroller and using the traditional ESC running at 50 Hz. I am using the PID to control the copter but I don’t know at what frequency should i run the PID loop. Please guide me.

  5. xhitm3n

    Hi, i have a questionar related to the how beneficial is running higher refresh rate on motors than kids? You mentioned inaccuracy because of noise, but this happens in analog signal, but with dshot, there isn’t any benefit at all? Since digital signals are precise and almost lossless? An example, running kiss at 1khz as it runs, andd running dshot600 which is around 37khz, so multiple unnecessary written signals to the motors? Is this theory right?

  6. moosestang

    Betaflight now breaks looptime down into gyro looptime and pid looptime, so which is this article talking about? It’s my understanding that you want to run gyro as fast as the FC/gyro can handle.

    1. Oscar Post author

      yes you are right, betaflight has advanced since this article was written. “Looptime” in this article was referred to PID looptime.

      1. Yao Wei

        Hi guys, based on what was said and Betaflight’s documentation. So on ESCs with Oneshot125 I run PID Loop Freq at 4kHz. Now I have an X-racer SPI which supposedly runs up to 8kHz, so if I change Gyro Update Freq to 8kHz it automatically changes PID Loop Freq to 8kHz as well. Is that an inherent dummy code that tells users if you are running 8k on gyro update you should also run 8k on pid loop ?

    2. John Holmes

      The PID loop is what processes the gyro data, so there is no point in running the PID loop at a different speed than the gyro update rate. For example, If you have the gyro update rate at 8k, and the PID loop at 4K, only every other gyro read will be processed by the PID controller. Same thing the other way around, if you have your PID loop running at 8k and your gyro update rate at 4k, the PID loop will run twice with the same data. The whole point of these faster refresh rates, is to have the freshest data possible, for the PID loop to process, and the more times you update your data in a given period of time, the more precise and less drastic the FC can be in its corrections, IE smoother flight.

  7. Luke Q

    I’m running some afro 12amp escs with the naze32. Hobbykings website says the afros run at 1khz so what would be the best looptime to run on the naze. I have flashed the escs with blheli (originally simonk).

    1. Anthony Aery

      After flashing your ESC’s with the BLHeli firmware, use the BLHeli suite to configure your ESC’s to ensure Oneshot125 is on. As the author of the article mentioned the Loop time for the ESC using Oneshot125 is between 250us or 4Khz and 125us or 8Khz. The author also recommend not running your FCU any faster than 250us or 4Khz, as this gives the ESC’s the best opportunity to identify the signal properly.

      In short run your ESC’s with Oneshot125 enabled, and run your FCU(Naze32) 4Khz or 250us.
      Hope it helps.

    2. Oscar Post author

      with their original firmware (old simonK), i think Looptime 2000 should do a pretty good job :)

  8. Adam

    Hi all
    Just checking to see if I got this article right…
    I’m using littlebee’s 30a ESC’s which uses the SiLabs 390 48 MHz processor + SPRacing F3 FC on a HMB-230 frame (which is considered to be very rigid).
    Please correct if I’m wrong but with RaceFlight and BLheli can I run multishot over this setup?

    1. Reuben Horner

      Pretty sure you need a modified version of blheli that supports multishot. But yea, those components are good to go

      1. kubais

        And how about LB30A running multishot but with F1 board – Naze rev6 (ACC disabled). I have at the moment 2,6K looptime, which is what Boris said is safe margin for F1 with ACC disabled and I have no clue what motor_PWM_rate I should set it to? Have it same as looptime or go with unsynced rate at 32K? Or is there even any sense to run multishot when my PID loop time is just 375us and article stays that multishot is for looptimes 25us and lower.

  9. Pie

    I would love to see you do a writeup on dRonin and test it out. :) Thinking about testing it out. The autotuning stuff sounds really nice and a lot of people have been talking warmly about it lately.

  10. Jocelyn Da Prato

    Maybe you can help ?
    I have blHeli SN20A oneshot (they said oneshot 123 ? ) And Naze clone, which is Flip32. If I don’t want my cf to be “faster” than my ESCs, I have to set looptime around 125us to 250us in cleanflight ?

    THx :)

    1. Oscar Post author

      You mean oneshot125? LOL I think for your setup, setting looptime to 2Khz is probably the highest you can go with your setup…

  11. Some Dude

    On Raceflight my looptime is at 125 which is 8KHz and my Motor PWM Rate is at 16KHz… The gyro is not synced with the ESCs.

  12. Benjamin

    “Therefore, with lower looptime your quad can also be “noisier”, and the flight controller isn’t always reading the best data as the noise can interfere with the values going through the PID control loop. ”

    That actually depends on the implementation of the filter. If the filter is very simple and only processes a fixed number of values, it’s true – but that would also be a crappy filter design. If the filter works on an actual frequency level, the opposite holds. In this case, higher loop times will allow you to correctly sample and then filter noise of higher frequencies. This improves your sensor data quality and makes the FC less sensitive to noise.

    In my experience with betaflight on a noisy mini-quad, higher loop-times lead to cleaner logs and higher stability in flight. This leads me to believe that betaflight uses frequency-based filters in the right places. I may be wrong about betaflight, but maybe you could explain both possibilities (good filter/crappy filter) in the post. Just in case.

    1. Adriel Perkins

      I may be mistaken as I haven’t kept up with the newer versions of Betaflight since I’ve been flying KISS. However, my understanding was that the LPF is turned off in Betaflight as soon as you go above 1khz because the filter can’t handle anything faster.

      Very interesting point you bring out using your black box logs though.

  13. Alex

    “Therefore, with higher looptime your quad can also be “noisier”, ”
    are you sure? maybe “lower looptime” (and higher refresh rate)?

    1. Oscar Post author

      Sorry, yes you are right i think the article meant to say lower looptime :) thanks for pointing that out.

    2. Benjamin

      You’re right, I mixed it up all over my comment.

      Lower loop time -> higher acquisition frequency, less aliasing, higher quality sensor data. In case of betaflight: Lower loop time -> cleaner logs and better flight behaviour.


Leave a Reply

Your email address will not be published. Required fields are marked *

Are you Robot? *

I only check blog comments once or twice a week, if you want a quick reply you can post your question on this forum IntoFPV.com... You might get a faster response from me there (multirotor related only).