Balancing Robot Servo: The Delay Budget Comes First

A balancing robot falls in about a quarter of a second. Everything the control loop does has to happen inside that.

Most builds spend the money on the servo and lose the race to a 100 Hz control period.

The order matters. Get the milliseconds into the right places, and a modest frame balances fine.

Balancing robot servo mounted at the wheel axle of a two-wheel chassis
The robot falls on a 160 ms clock; the loop has 21 ms.

Balancing Robot Servo: The Delay Budget Comes First

Torque is the easy part here. A 2 kg robot on 40 mm wheels needs about 0.2 N·m at the axle, and almost any frame covers that.

A balancing robot servo rated at 5.7 N·m therefore carries twenty-eight times the load. You are not buying force on this machine. You are buying the command path.

What separates a build that balances from one that oscillates is the time between the angle being true and the wheel moving.

The Plant Sets the Budget

Take a robot whose centre of mass sits 250 mm above the axle. That single length sets the clock for everything else.

One Length Gives You the Clock

The unstable pole is √(g/L), so √(9.81 / 0.250) = 6.26 rad/s. In time terms, the error grows by a factor of e every 160 ms.

Battery pack sitting high in a balancing robot chassis above the axle
Centre of mass at 250 mm sets the pole at 6.26 rad/s.

A loop that acts twice as fast as the pole, at 12.5 rad/s, is a reasonable crossover target.

Notice that mass does not appear in that number. Because g/L sets the pole, a heavier robot on the same height has the same clock and the same budget.

Ten Milliseconds Is Seven Degrees

Delay costs phase, and phase costs margin. At 12.5 rad/s a 10 ms delay is 12.5 × 0.010 = 0.125 rad, which is 7.2°.

From a 45° phase margin, allow 15° for delay and the whole chain has about 21 ms to spend.

That is the budget. Every component now competes for a share of it.

Where the Milliseconds Go

Four Terms, One Sum

The sensor read is 2 ms. A control period at 100 Hz is 10 ms. A two-node Modbus exchange at 115200 baud is about 3 ms.

The servo’s own response is the rest, near 6 ms for the small corrections a balancing loop actually sends.

Because those four add to 21 ms, the budget is already spent before anything is tuned. Raising the loop to 200 Hz takes the total to 16 ms.

Bus servo daisy-chained across both wheels of a balancing robot
One bus line, two nodes, about 3 ms of turnaround.

Two of those four terms are software. That matters, because a software term costs a settings change while a hardware term costs money and lead time.

The Servo Is Not the Bottleneck

Slew Is Not Latency

0.14 s per 60° is a slew rate. It says nothing about how long a command takes to start, and at 2.3 ms per degree a one-degree correction takes 2.3 ms.

The dead band is 0.25° on a 12-bit output, so a command smaller than that moves nothing. Below the dead band, the loop simply waits.

Both figures are small. The 10 ms control period sitting in front of them is five times larger, and it costs nothing to halve.

There is a second reason a faster frame rarely fixes a slow loop. If the controller samples every 10 ms, the wheel can finish its move and sit idle for most of that window.

Faster motion then buys nothing, because the next correction cannot arrive until the next sample. The loop rate is the gate, and the servo is behind it.

The Cheapest Millisecond

Raise the Loop Rate First

Doubling the loop to 200 Hz needs a timer setting and nothing else. It removes 5 ms, which is most of the delay headroom.

Shortening the bus frame comes next. Two nodes at 115200 baud spend 3 ms per cycle, and half of that is turnaround between request and reply.

The estimator is the third place to look. A complementary filter with a slow accelerometer term adds group delay that never appears on any datasheet.

Only then does a faster frame pay. A 0.03 s/60° unit saves about 1.5 ms on a one-degree correction, which is a third of what the timer gave you.

How to Measure It on the Bench

Command a one-degree step and log the encoder for 100 ms. The gap between the command and the first count is the drive’s latency.

Do the same for the sensor, with the robot held still and a tap on the frame. Subtract both from the total and the control period is what remains.

Logic analyser probe clipped to an RS485 pair on a test bench
Trigger on the first byte, then time the reply.

If a scope is available, trigger on the first byte of the bus frame and watch the reply. That measures the whole exchange, including the turnaround a datasheet leaves out.

Check the sum against the 21 ms budget. If a balancing robot servo shows up as the largest term, the loop is probably logging later than it thinks.

Write the balancing robot servo figure beside the loop rate on the machine. The next builder will otherwise guess at both.

Put the numbers in the safety file as well. ISO 13849-1 treats response time as part of a safety function, and ISO 12100 is where the risk of a robot that falls gets recorded.

Frequently Asked Questions

How fast does a balancing robot servo need to be?

Fast enough that its share of a 21 ms budget stays small, which is about 6 ms for the corrections a balancing loop sends. A balancing robot servo with 0.25° resolution is fine on that count. Slew rate matters less than the delay before motion starts.

Why does a 10 ms delay matter on a slow robot?

Because the plant is not slow. A 250 mm centre of mass gives a 6.26 rad/s unstable pole, so the loop crosses over near 12.5 rad/s and 10 ms there is 7.2° of phase.

Should I buy a faster servo or raise the loop rate?

Raise the loop rate first. Going from 100 Hz to 200 Hz removes 5 ms for the price of a timer setting, while a 0.03 s/60° frame saves about 1.5 ms.

Does the servo dead band cause the oscillation?

It can, if the band is wider than the correction the loop needs. A 0.25° dead band on a 12-bit output suits this plant. A wider band parks the wheel until the error grows past it, and that reads as oscillation.

How do I measure the total loop delay?

Log a one-degree step against the encoder, then do the same for the sensor with the robot held still. Subtract both from the total, and the control period is the remainder.

Conclusion

The robot falls on a 160 ms clock. The servo spends a few milliseconds of it, and the loop spends the rest.

That is why a balancing robot servo is the last component to upgrade. Measure the four terms first, because the cheapest millisecond is almost never the one you can buy.

Send the centre-of-mass height, the loop rate and the bus baud to the engineering team, and they will price the delay rather than the torque.

The smart serial bus range carries telemetry for exactly this kind of measurement, and the RS460 is the frame the numbers above assume.

Joint actuators for robot and manipulator axes

Torque-dense frames with metal gear trains, low backlash and a bus interface for multi-axis scheduling.

48 kg·cm (4.7 N·m), 8.4 V, RS-485, 73 g.
48 kg·cm (4.7 N·m), 8.4 V, CAN bus, 73 g.
75 kg·cm (7.4 N·m), 8.4 V, RS-485, 88 g.

Leave a Comment

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

Scroll to Top