SkillAgentSearch skills...

ServoEasing

Arduino library to enable smooth servo movement.

Install / Use

/learn @ArminJo/ServoEasing

README

<div align = center>

ServoEasing

A library for smooth servo movements.<br/> It uses the standard Arduino Servo library and therefore has its restrictions regarding pins and platform support.

Badge License: GPLv3     Badge Version     Badge Commits since latest     Badge Build Status     Badge Hit Counter <br/> <br/> Stand With Ukraine

Available as Arduino library "ServoEasing".<br/> Contains the RobotArmControl and the QuadrupedControl example.

Button Install     Button API     Button Changelog

</div>

If you find this library useful, please give it a star.

🌎 Google Translate

<br/>

YouTube video of ServoEasing in action

Demonstration of different servo easings

Table of contents

<br/>

Servo easing library for Arduino

Its purpose is to interpolate the movement between two servo positions set by software.<br/> If your servo control data is e.g. generated by an joystick or other "slow" changing inputs and therefore does not change suddenly or does not jump, you most likely do not need this library!, you may consider to use a digital low pass or simple EMA filters to smooth your values used to control the servos.<br/> ServoEasing works with the Arduino Servo library as well as with PCA9685 servo expanders. The expander in turn requires the Arduino Wire library or a compatible one and is bound to their restrictions.<br/> For ESP32 you need to install the Arduino ESP32Servo library.<br/> <br/> If you require only one or two servos, you may want to use the included LightweightServo library which is like the Adafruit TiCoServo library, but more lightweight and currently only for Uno, Nano, instead of the Arduino Servo library. The LightweightServo library uses the internal Timer1 with no software overhead and therefore has no problems with servo twitching or interrupt blocking libraries like SoftwareSerial, Adafruit_NeoPixel and DmxSimple.<br/> For instructions how to enable these alternatives, see Compile options / macros.

<br/>

Features

  • Linear and 9 other ease movements are provided.
  • All servos can move synchronized or independently.
  • Non blocking movements are implemented by the startEaseTo* functions by using a timer. This functions are not available for all platforms.
  • A degree value of 400 or more is taken as a microsecond value for the servo pulse, which allows for fine-grained control.
  • Float angels are supported to allow fine-grained servo control comparable to using microseconds.
  • User-specified callback function at "servo arrived" enables movement control independent of main loop.
  • Stop and resume of servo movement.
  • Detach and reattach. No servo signal is generated for a detached servo / the output is constant LOW. Therefore, it is not blocked and can be moved manually.
  • A trim value can be set for any servo. Its value is internally added to each requested position.
  • Reverse operation of servo is possible e.g. if it is mounted head down.
  • Constraints for minimum and maximum servo degree can be specified. Trim and reverse are applied after constraint processing.
  • Allow to specify an arbitrary mapping between degrees and microseconds by attach(int aPin, int aInitialDegreeOrMicrosecond, int aMicrosecondsForServoLowDegree, int aMicrosecondsForServoHighDegree, int aServoLowDegree, int aServoHighDegree).
  • Servo speed can be specified in degree per second or milliseconds for the complete move.
  • Multiple servo handling by *ForAllServos() functions like setIntegerDegreeForAllServos(3, 135, 135, 135).
  • All ServoEasing objects are accessible by using the ServoEasing::ServoEasingArray[].
  • Easy implementation of a move list - see ConsecutiveEasingsWithCallback example.

List of easing functions

View on GitHub
GitHub Stars368
CategoryDevelopment
Updated2d ago
Forks50

Languages

C++

Security Score

100/100

Audited on Mar 22, 2026

No findings