Servo Projects

Updated March 5, 2024

For some good general servo information check out the various FAQs you can find here:

https://www.servocity.com/servo-faqs/

Many animatronic control systems only output the standard PWM signal for RC servos. Sometimes you may want to control other devices that are no compatible with the RC servo signal. Here are a few controllers that let you use this RC servo signal for other things:

Servo Pixel Driver

RGB Pixel LEDs come in a huge range of packages and can be used in many areas in an animatronic prop ranging from eyes balls to general lighting.

This project lets you control a string (pretty much any number) of WS281x style pixels (any pixel supported by the FastLED library). It doesn`t support any sort of animation (all pixels will have the same color) but you can adjust brightness and color of the string as a whole. One servo channel controls the overall pixel brightness and another controls the overall pixel color. The circuit uses a Arduino NANO and is powered by +5V from the servo controller (which should be fine unless you are driving a huge amount of pixels). 

Servo_Pixel_CircuitThe circuit is extremely simple and just needs the NANO (should work on any Arduino variant). The code uses the pulseIn() function to determine the pulsewidth of the control signal and then adjusts the FastLED parameters accordingly. There are better ways to measure the pulse width (pulseIn() is a blocking function) but they need to use interrupts and FastLED doesn’t like such things. I do notice a bit of strobing at very low light levels but that wasn`t an issue for my project.

In the code you can adjust various configurations:

NUM_LED – The number of pixels you have connected

LED_PIN – The pin you have the Pixels connected to

LED_TYPE – Type of pixels (see FastLED docs for options)

COLOR_ORDER – Oder of pixel colors (see FastLED docs for options)

BRIGHTNESS_PIN – Servo input for brightness control

COLOR_PIN – Servo input for color control

MIN_PULSE – This is the minimum pulse width the code will respond to. Set this to the same as your servo controller is set for. 

MAX_PULSE – This is the maximum pulse width the code will respond to. Set this to the same as your servo controller is set for.

If you don`t adjust the MIN/MAX values to your expected control signal you may find the bottom and top ends of the control have no effect.

Here is the Arduino code for the project:

ServoPixel1.3

Here is a PDF of the wiring diagram for the project:

Servo_Pixel_Circuit

Servo Relay Driver

This project lets you control an inexpensive 2 channel relay module using two servo channels. If the servo pulse width is less than 1450 mS, the relay is not activated. If the servo pulse width is over 1550 mS, the relay is activated. The 100 mS hysteresis between the two points stops the relay from chattering and lets the center point stay neutral, allowing a toggling between the two positions using a typical centered joystick.

Servo_Relay_CircuitThe circuit is extremely simple and just needs the NANO (should work on any Arduino variant) and the relay module. The code uses the pulseIn() function to determine the pulsewidth of the control signal and then turns the relays on or off as required. It uses +5V power from the servo controller to power the relays.

In the code you can adjust various configurations:

PWM_IN_1 – Servo input for Relay 1 control

PWM_IN_2 – Servo input for Relay 2 control

PWM_LOW_SETPOINT – Pulse width value under which the relay is turned off

PWM_HIGH_SETPOINT – Pulse width value over which the relay is turned on

PWM_DISCONNECTED = Pulse width value over which the relay is turned off. This ensures the relay stays off if the PWM servo signal is removed.

Here is the Arduino code for this project:

ServoRelay1.3

Here is a PDF of the wiring diagram for the project:

Servo_Relay_Circuit

Here are some decent tutorial videos from the Bored Robot for using a RC PWM servo signal to control things: