A Servo Tester is a useful addition to any Maker’s toolbox, especially if they need to work with servos. I have always ‘made do’ when setting up servos by setting up an Arduino and modifying the standard examples to do what I needed at the time (setting the mid point, calibrating for servo swing, etc).
I finally decided that I needed a more permanent tool and made my own.
A servo takes control signals and positions a motor to based on the signal received. The servomotor has a rotating shaft and potentiometer that detects it position, with some control electronics to maintain the setpoint position.
Servos are controlled by a series of electrical pulses from a computer or radio receiver. Each control signal is a series of transitions from low to high voltage – “low” is ground or 0 volts and “high” is the battery voltage between 4.5 to 6 volts (nominally 5V) – sent every 20 milliseconds (50Hz PWM signal).
The duration of the high voltage pulse width gives the servo position. The pulse varies from about 1000 microseconds (or 1 millisecond) to 2000 us (2 ms) for a 90 degree sweep of the servo motor. Many servos can be overdriven using a range 500-2500 us to give a 180 degree sweep.
A servo plug has 3 wires – power supply, ground and control signal – ending in a duPont 3 pin socket. Most servos follow one of a few color conventions established by the original device manufacturers.
|Pin||Signal Name||Futaba Colors||JR Colors||Hitec Colors|
|2||Power||Red||Red||Red or Brown|
|3||Signal||White||Orange||Yellow or White|
What does a Servo Tester do?
Very inexpensive (just a few dollars) testers are available that basically work from a LM555 IC to generate the PWM signal for the servo. The circuits for DIY versions of these testers are easily found online using a search engine.
Most servo testers perform three functions:
- Simultaneously control all the connected servos, each operating identically, manually by moving a control dial.
- Return all servos to the mid point of travel. This is useful for setting up the control horns and calibration.
- Automatically wipe all the servos across the full range of motion, like a car windscreen wiper.
The OTT Tester Hardware
OTT Tester is made up of a few basic Arduino components as shown in the block diagram below.
The processor used is an Arduino Pro Mini, but any Arduino compatible processor should work. This is connected to a 16 character 2 line (1602) LCD display with an IIC backpack. The user interacts using a rotary encoder with built in switch, and an additional tact switch.
5V power for the device is supplied externally through a 3 pin header. This header also provides the input from the radio receiver (more on this later). I connected a small buck converter inline with a LiPo battery, shown below, as a portable power source. In radio control application and Electronic Speed Control (ESC) with a BEC power output would also be suitable.
The tester outputs control is to up to six servos, but this is easily changed as a compile time constant to as many as required, limited only by physical I/O available.
The photo below shows the OTT Servo Tester prototype used for software development. 5V power in this case is supplied by the Arduino Uno.
The OTT Tester Software
As the tester has a microprocessor, all the functionality is provided in software. All the code and other files for this project are available from my code repository, found here.
Each of the Servo outputs (labelled Output A through F) is associated with a servo profile. Up to 3 servo profiles can be configured, defining
- the minimum and maximum values for the servo sweep (in microseconds)
- the percentage of range to set as the ‘mid-point’ or ‘home’ value
- the type of sweep testing (Linear, Sine or Square patterns)
- the sweep duration
- the pause between sweeps
By default the three profiles are created with range 1000 – 2000 us and ‘home’ values at 50%, 0% and 100% of full range for profiles 1, 2 and 3 respectively. If an output is not assigned to a profile, then it is considered disabled and will not receive any control signals during testing.
The application stores all its configuration information in EEPROM so that it is retained between processor resets. The Menu System (see below) is used to access and modify parameters.
On power up, the display shows a splash screen for a short time, configurable from the UI Setup menu.
The user interface (UI) is implemented using the rotary encoder and a separate tact switch (Run switch).
The navigation and menu system are captured in the diagram below.
In general the UI navigation operates as follows:
- Cycle between operational modes by double pressing the encoder switch.
- The Run Switch is used to start or stop execution within the active mode, if applicable. For convenience, a long press of the Run Switch will put the application immediately back in Manual mode.
- The Configuration Menu only uses the encoder and is accessed from Manual mode using a long press of the encoder switch.
- The top line of the display is the menu/submenu name or the value being edited.
- Below the title, available Menu Selections are displayed inside angled brackets (‘<‘ and ‘>’). Editable values are displayed inside square brackets (‘[‘ and ‘]’).
- Menu options are scrolled by turning the encoder and selected by pressing the encoder switch.
- Menu values are changed up/down by turning the encoder switch and confirmed by pressing the encoder switch.
- Aborting the current menu level (menu selection or value editing) is done using a long press.
The device operates in one of three modes, accessed in sequence through a double press of the encoder switch. The default mode is Manual Mode, which is initiated on power up immediately after the splash screen.
Manual Mode: Manual mode is shown by ‘Man’ in the top right of the display. In this mode, moving the encoder moves all the servos in unison. A single press of the Run switch in this mode resets all the servos to their home position.
The manual mode display shows output (A-F) and which profile (‘-‘ or 1-3) is associated with it, the current value in microseconds and percentage of range for the output.
At any time a single press of the encoder switch will cycle the display to the next page of outputs (ie, AB, CD, EF, AB, etc). If Autopaging is enable, the display will automatically cycle to the next pair every 2 seconds.
Sweep Mode: In this mode the servos are swept between their associated profile start and end positions using the defined sweep profile (Linear, Sine or Square) and timing parameters. The sweep is toggled on/off by a single press of the Run switch.
The Sweep mode display shows the same information as the Manual mode display, with ‘Swp’ in the top right. Paging between outputs displayed also works like in Manual mode.
Receiver Check: Receiver check mode is accessed through a double press of the encoder switch from Sweep mode. This mode shows the real time parameters for the PWM signal received at the device input.
The ‘H’ line is the time in microseconds that the signal is high, giving the control set point for the servo. The ‘L’ line shown the duration of the low signal and the calculated update PWM frequency (1000000/[H+L]).
ESC Setup: Most Electronic Speed Controllers (ESC) used in Radio Control models can be set up from the radio transmitter by toggling the throttle channel between max and min values. This mode allows the same functionality by connecting directly to the ESC and toggling the ESC input using the Run Switch. The process is the same and the ESC connected to the motor will run though the audible menu as it would when configuring from the receiver.
The output (A-F) for the ESC is selected by rotating the encoder and the ESC signal is toggled high or low using the Run Switch.
Making it Permanent
As this is going to be a permanent addition to my tool box, and in keeping with the OTT nature of this project, it needs a 3D printed enclosure of its own. This was designed using Fusion 360.
Once the box was printed, the parts were installed and wiring completed.