µModule Servo-32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
![]() IntroductionThis µModule implements a 32-channel R/C servo controller. The module interfaces to the external world using the TWI interface that's common among all µModules. It also has an optional CMOS-level RS-232 interface option. The module is ideal for biped (humanoid) or hexapod robot control applications where a large number of servos have to be controlled. For even higher number of servos multiple servo controllers can be connected to the same TWI channel. With this feature hundreds of servos can be controlled by a single central controller.Features
LicenseThis document and all the accompanying design documentation (for example schematic and PCB files) are covered by the H-Storm Non-Commercial License (HSNCL). H-Storm Non-Commercial License (HSNCL)Copyright 2004-2007 Andras Tantos and Modular Circuits. All rights reserved. Redistribution and use in source or binary forms, or incorporated into a physical (hardware) product, with or without modification, are permitted for non-commercial use only, provided that the following conditions are met:
ALL THE INFORMATION, TECHNOLOGY, AND SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANDRAS TANTOS, MODULAR CIRCUITS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR TECHNOLOGY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Design descriptionThe bus interfaceThe TWI bus interface follows the µModule standards. There are six or four-pin connectors on the board, both with identical functionality. Two wires are used for the TWI signal transmission (clock and data) while the rest provide power and ground signals. The interface can be operated at a rate up to 400kHz. This module never initiates any transactions on the bus, it operates in slave-only mode. Status information can be acquired by polling and commands can be sent to the module at any time. The module implements the standard 8-bit register bank µModule communication protocol with 32 8-bit registers, one for each channel.Powering optionsThe module can source and sink power on this interface. The power to and from these sockets can be interrupted by an on-board jumper. With this there are three possible powering configurations with regards to the logic-level functions:
Servo controlEach servo output is a PWM signal, with an approximately 50Hz repetition rate and a pulse width between 0 and 2.5ms. The pulse width is controlled by an 8-bit register so the step-increment in the pulse is around 10us. Most R/C servos require a 1..2ms pulse with, with 1.5ms corresponding to the center position. These values lead to 100 different values that servos can interpret or about 7 bits of usable resolution. The control signal for the servos is a 3.3V-compatible CMOS signal (unless an external 5V power supply is used) which is compatible with 5V TTL input levels that most R/C servos require.Note that these are approximate values and are not intended to be used as a source of any kind of timing. Our measurements show that for example a Hitec HS-425BB servo requires value 61 for its left-most position and the value 220 for its rightmost position. Exact values and limits differ from servo to servo and must be experimented with for each application. Power consumptionThe current drawn by the circuit is around 7mA when operated from the TWI interface. The optional external RS-232 level shifter consumes an additional 4mA.Miscellaneous functionsThe module on the top of the standard TWI interface, that is common among all µModules also contains a (logical level) RS-232 interface. This interface can be used to connect the module to other microcontroller modules or (after level-shifting) to a PC which doesn't have a TWI interface.Serial interfaceThe serial interface is configured to 38400 BAUD, 8 data bits, no parity and 2 stop bits. The communication protocol is very simple.The host uses commands to initiate communication with the servo controller. The command consists of a single character identifying the command followed by zero or more data transmitted by either the servo controller or the host. For each byte the servo controller receives it will send exactly one byte. This way the host can make sure that the communication channel is intact. The
The purpose of this command is to establish connection from the host to the servo controller or re-synchronize the communication in case
it is lost. The host transmits a single 'c' (dec 99) character to which the servo controller responds with the same 'c' character. If
any other response is received it can be assumed that there was a communication error and/or the syncronization between the host
and the servo controller has been lost. The |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Register offset | Register name | Comment |
|---|---|---|
| 0 | Servo0 | Servo channel 0 position control |
| 1 | Servo1 | Servo channel 1 position control |
| 2 | Servo2 | Servo channel 2 position control |
| 3 | Servo3 | Servo channel 3 position control |
| 4 | Servo4 | Servo channel 4 position control |
| 5 | Servo5 | Servo channel 5 position control |
| 6 | Servo6 | Servo channel 6 position control |
| 7 | Servo7 | Servo channel 7 position control |
| 8 | Servo8 | Servo channel 8 position control |
| 9 | Servo9 | Servo channel 9 position control |
| 10 | Servo10 | Servo channel 10 position control |
| 11 | Servo11 | Servo channel 11 position control |
| 12 | Servo12 | Servo channel 12 position control |
| 13 | Servo13 | Servo channel 13 position control |
| 14 | Servo14 | Servo channel 14 position control |
| 15 | Servo15 | Servo channel 15 position control |
| 16 | Servo16 | Servo channel 16 position control |
| 17 | Servo17 | Servo channel 17 position control |
| 18 | Servo18 | Servo channel 18 position control |
| 19 | Servo19 | Servo channel 19 position control |
| 20 | Servo20 | Servo channel 20 position control |
| 21 | Servo21 | Servo channel 21 position control |
| 22 | Servo22 | Servo channel 22 position control |
| 23 | Servo23 | Servo channel 23 position control |
| 24 | Servo24 | Servo channel 24 position control |
| 25 | Servo25 | Servo channel 25 position control |
| 26 | Servo26 | Servo channel 26 position control |
| 27 | Servo27 | Servo channel 27 position control |
| 28 | Servo28 | Servo channel 28 position control |
| 29 | Servo29 | Servo channel 29 position control |
| 30 | Servo30 | Servo channel 30 position control |
| 31 | Servo31 | Servo channel 31 position control |