Trent "ripred" Wyatt's TomServo Library Delivers Big Power Efficiency Gains for Multi-Servo Projects
Latest library release includes new features for chaining timed movements and support for the NXP PCA9685 driver.
Embedded developer Trent "ripred" Wyatt has released a new version of his TomServo library — designed to deliver measurable power efficiency gains in multi-servo projects.
"Most hobby servos will happily hold position because of gearbox friction even when no valid PWM [Pulse-Width Modulation] signal is present," Wyatt explains of how a simple software change can improve power efficiency. "As long as they keep seeing servo frames, the control electronics continue to drive the motor and burn current, even when 'not moving.' TomServo leans into that. It attaches only when a move is in progress. It detaches when a move is complete (if enabled), so the servo sees no valid frames. The servo holds by friction, current draw drops dramatically, and battery runtime improves."
By only sending control signals to the servos when they're being moved from position to position, TomServo can save a considerable amount of power — particularly for multi-servo projects where not all servos are in continuous motion. In its latest release, the library goes even further: there's now support for similar power savings when using the NXP PCA9685 driver, complete with example sketches, and completion callbacks to allow for simple motion chaining whereby moves are only triggered on completion of a prior move.
"It also supports timed motion (write(target, duration_us) + update())," Wyatt adds, "so you can coordinate multiple servos cleanly — including moving different distances over the same duration so they arrive together (great for fluid/organic animatronics)."
The code is available on GitHub under a public domain license; additional information is available in Wyatt's Reddit post.