Netduino.Foundation’s ServoCore just got an Upgrade
Servos were once the domain of remote control cars and airplanes, but today, they’re used in all kinds of IoT projects and have become an essential ingredient in robotics. In fact, many robots rely solely on servos for movement!
Netduino.Foundation’s ServoCore library just got a big upgrade! Originally based on Ardruino’s Servo library, we rewrote it from the ground up, making it much more powerful and easier to use.
Easy to Use
Simply create a new `Servo` object, pass it the PWM pin it’s hooked to, and a configuration that specifies the servo parameters, and you’re on your way:
servo = new Servo(N.PWMChannels.PWM_PIN_D9,
NamedServoConfigs.BlueBirdBMS120);
servo.RotateTo(_servo.Config.MaximumAngle);
And of course, like everything else Netduino.Foundation, it’s easy to add to your project via NuGet, and there’s great documentation.
Support for both Fixed-Range and Continuous Rotation Servos
As part of the upgrade, servo core now supports both fixed-range servos and continuous rotation servos. Fixed-range servos are the most common type of servos and their movement is constrained to a particular angle range. Continuous rotation servos are also known as winch servos (because of their original usage on remote control sailboats to provide sail winching) and can spin freely in either direction at varying speeds.
For instance, the following code rotates a winch servo counter-clockwise at 75% speed:
servo = new ContinuousRotationServo(N.PWMChannels.PWM_PIN_D9,
NamedServoConfigs.IdealContinuousRotationServo);
servo.Rotate(RotationDirection.CounterClockwise, 0.75f);
Named Servo Configurations
Servos are controlled via PWM signals and respond differently depending on the duration of pulse during the PWM duty cycle. Each servo has a particular pulse duration range that they operate under to set their angle, as in the case with fixed-range servos, or their rotation direction and speed, as the case with continuous rotation servos.
To simplify the use of the wide range of servos out there, we created a ServoConfig
class that allows you to specify the parameters of the servo in use, such as MinimumPulseDuration
and MaximumPulseDuration
. This allows you to use nearly any servo with the ServoCore framework.
Call for Submissions
We’ve also created a NamedServoConfigs
class that serves as a database of servo configurations, and we’d love your servo configuration submissions. So if you have a servo or two lying around, hook them up to ServoCore, add the configuration to the NamedServoConfigs source file and send us a pull request!