Servo Interface

Giacomo Guidi and Mauro Marinoni

Introduction

The Servo Interface is a flexible support for servo motors added to shark 1.22 or higher version. The interface is the union of a specific software library and a circuit board, connected by the standard serial port (RS232) to a S.Ha.R.K. machine. As result, a Real-Time control system for servo motors can be easily built and put in action. All these hardware/software components will be described inside this page.

Look at Software Interface webpage for the library description.

Supported Digital Servo Motors

Futaba/JR/Hitec/Multiplex/Airtronics
or compatible

The Interface Circuit

The interface circuit can translate the servo commands, sent through serial connection, to the servo control signal. Using a microcontroller (Microchip PIC) to elaborate these signals, we built an interface circuit that can support 8/16 servos simultaneously. The 8 servos version (SER8) uses a PIC16F876 (28 pins) microcontroller, the 16 servos version (SER16) uses a PIC16F877 (40 pins). (PIC16F873/4/6/7 Pdf Datasheet)
These kind of servos are driven by digital signals with usually 20 ms period. Anyway we added the possibility to change this value.

The HIGH_TIME is the control value. The servo library is projected to make this parameters invisible, and send command to a servo usign directly angle or velocity values (look at Software Interface).

The schematic of interface circuits (Download Eagle file ser8.sch ser6.sch). <

Circuit Description

Inside the SER8 circuit, the output connector is a 9x2 pin header. 8 of them are the signals and 1 is GND. For the SER16 circuit there are two connectors (bank 0 and bank 1) to 16 servos support. The same package is used for the analog input connector, but inside SER8 there are only 5 analog inputs instead of 8, due to microcontroller limitations. An auxiliary serial and i2c port are present.

SER8
SER16
SERVO OUTPUT
8
16
ANALOG INPUT
5
8
AUX. SERIAL PORT
YES
YES
AUX. I2C PORT
YES
NO

PINS BANK 0PINS BANK 1PINS ANALOGPINS SERIALPINS I2C
01,02 - GND01,02 - GND01,02 - GND01,02 - GND01,02 - GND
03,04 - SERVO 0003,04 - SERVO 0803,04 - INPUT 0003,04 - RX03,04 - SDI
05,06 - SERVO 0105,06 - SERVO 0905,06 - INPUT 0105,06 - TX05,06 - SCK
07,08 - SERVO 0207,08 - SERVO 1007,08 - INPUT 02
09,10 - SERVO 0309,10 - SERVO 1109,10 - INPUT 03
11,12 - SERVO 0411,12 - SERVO 1211,12 - INPUT 04
13,14 - SERVO 0513,14 - SERVO 1313,14 - INPUT 05
15,16 - SERVO 0615,16 - SERVO 1415,16 - INPUT 06
17,18 - SERVO 0717,18 - SERVO 1517,18 - INPUT 07

The analog input is very useful for a feedback line,which carries information about the servo current consumption. Thw feedback line will be described inside the Power Circuit Section. The analog input is directly connected to A/D input PIC pins, the Software Interface has a specific function to read the sampled value of each input line. A LM7805 chip provides a stable voltage (+5 V), so the input voltage can be between 7 - 16 Volts. The control connectors are directly attached to the PIC pins. The PIC can drive two motors with the same line and usually the servos cannot be damaged by a wrong control signal. As default setting, when the circuit is powered or reset button is pressed, all the servos are turned off.

NOTE: Don't power the servos with inverted voltage, they can be damaged !

NOTE: Don't start all the servos simultaneosly. You should consider that a medium size servo can requires 2 amper as initial impulse !

There are some dip switches on the schematic.

DEFAULT-SWITCH: If this switch is on, the PIC will start the servos following all default control values. These values are defined inside the PIC program. If the switch is off, the startup values will be the previously recorded ones, inside the PIC EEPROM. (look at Software Interface part)

SERIAL-SWITCHES: they are needed to jump the MAX233 chip and directly connect the serial line to the PIC serial pins.

The serial line is set to 8/N/1, and the speed is 19200 bps as default value. If a fast PC is used, it can be possible to set the speed to 115200 bps.

The PCB layout (Download Eagle file ser8.brd ser16.brd or 600 dpi bitmap ser8_600dpi.png ser16_600dpi.png)

Components List

SER8 INTERFACE

SER16 INTERFACE

01 - 10 uF Electrolytic Cap. 16V01 - 10 uF Electrolytic Cap. 16V
02 - 22 pF Ceramic Cap.02 - 22 pF Ceramic Cap.
01 - 100 nF Ceramic Cap. 16V02 - 100 nF Ceramic Cap. 16V
01 - 220 nF Ceramic Cap. 16V02 - 220 nF Ceramic Cap. 16V
02 - 220 Ohm Resistor 1/4W02 - 220 Ohm Resistor 1/4W
01 - 3.3K Ohm Resistor 1/4W01 - 3.3K Ohm Resistor 1/4W
01 - 1K Ohm Resistor 1/4W01 - 1K Ohm Resistor 1/4W
01 - Standard (0.5 inch) LED01 - Standard (0.5 inch) LED
02 - Pin Headers 2x20 pins02 - Pin Headers 2x20 pins
05 - Single DIP switch03 - Single DIP switch
01 - Single button01 - Single button
01 - Wago Screw Clamp (2 pin)01 - Wago Screw Clamp (2 pin)
01 - OSC Crystal 20 MHz01 - OSC Crystal 20 MHz
01 - Conn. RS232 Female01 - Conn RS232 Female
01 - PIC 16F87601 - PIC 16F877
01 - MAXIM MAX23301 - MAXIM MAX233
01 - LM780501 - LM7805

The PIC program was developed with MPLAB:

Download 8 Servo Interface PIC16F876 program - source - HEX -
Download 16 Servo Interface PIC16F877 program - source - HEX -

The Power Circuit

Due to high current absorbed from medium and large size servo, a specific circuit is needed to separate the control section from the power one. There can be a lot of possible implemetation for a stable power supplier. A good solution is to use integrated chip like LM7806 or LM1084 to get a 5.5/6 Volt generator, which is a suggested value for normal servo operation

Inside the power circuit is possible to integrate a system to get the current consumption of the driven servo.

The Eagle schematic power.sch

A Maxim MAX471 is used to know the flowing current "Iload" from pins 2/3 to pins 6/7. The pin 8 generates a current I = Iload / 2000, so with a 2K load resistor there is a voltage V = Iload on pin 8. A RC filter is added because the servo consuption is impulsive and a low-pass filter is needed to get a value near the mean value. A feedback line is very useful to monitor the servo resistance and know if the servo reachs the right value of angle or velocity. The max current inside MAX371 is 3 amperes, so you must pay attention about what kind of servo you would like to monitor.