µM-Servo brain

Introduction

This µModule replaces the built-in electronics of many standard R/C servos. It adds the same features to a servo that the µModule H-Bridge module offers. It is capable to drive up to 1.5A servo motors and uses the built-in potentiometer for position-feedback. For modified continuous-rotation servos it offers the same back-EMF based speed-control than it’s larger cousin offers. It operates from 5V. and communicates using the TWI interface that’s common among all µModules. It also has an optional logic-level RS-232 interface. Due to size constrains the module does not use the standard µModule interface headers but is electrically compatible with all other modules.

Features

  • Standard µModule TWI with optional RS-232 interface
  • 1.5A current limit
  • Over-current protection
  • High efficiency complementary MOSFET bridge
  • Rich speed-feedback options for closed-loop operation
  • Back-EMF feedback for continuous rotation servos
  • PID control loop
  • Acceleration and deceleration limits for continuous rotation servos
  • Traveled distance calculation for continuous rotation servos
  • ‘Go-to-distance’ support with trapezoid speed-profile for continuous rotation servos
  • Braking and free-wheeling support
  • Parameters can be stored in permanent EEPROM storage
  • Duty-cycle throttling to limit torque
  • Per-cycle programmable current-limit

License

This 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:

  • The redistribution doesn’t result in financial gain.
  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in any other form must contain in printed or electronical format the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • All advertising materials mentioning features or use of this technology must display the following acknowledgment:
    This product includes H-Storm technology developed by Andras Tantos and Modular Circuits.
  • Neither the name of Andras Tantos or Modular Circuits may be used to endorse or promote products derived from or using this technology without specific prior written permission.

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 description

The bus interface

The 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.

Powering options

The 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:

  • The module is powered form the same power supply as the motor. The module provides power to other devices on the TWI bus
  • The module is powered from the power supply of the motor however it does not power other devices on the TWI bus
  • The module is powered from the TWI bus

The third powering mode has to be used if 5V operation is required.

The H-bridge

The H-bridge is comprised from tow n-channel and two p-channel power MOSFETs. These transistors have extremely low on-resistance, leading to high-efficiency and low heat-generation even at high power levels. The high-side transistors are driven through a HW over-current protection circuit. All four MOSFETs can independently be turned on and off allowing all possible valid operating modes of the bridge to be used:

  • Forward drive
  • Backward drive
  • Free-wheeling
  • Braking

Feedback options

A wide range of feedback options are available on the module to provide additional health-monitoring and establishing closed-loop speed-control functionality. Both voltage (relative to the ground) on the motor connectors can be monitored as well as the voltage across the current-sense resistor which is proportional to the current flowing through the motor. Monitoring these values with a 10-bit resolution A/D converter precise knowledge of the current system status can be established. These measurements can be used to calculate the back-EMF response of the driven motor, which is proportional to the rotation speed. This value in turn can be used to close the control loop and create a true speed-controlled H-bridge. For traditional servo control, the module uses the R/C servos integrated potentiometer as feedback.

Miscellaneous functions

The module on the top of the standard TWI interface, that is common among all µModules also contains a (logical level) RS-232 interface as well. 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.

The TWI interface

The TWI interface adheres to the standard µModule communication protocol. It implements 8-bit register-bank addressing, and defines 32 registers. Each register corresponds to a single channel.

Offset Size Name Access Comment
0 int16_t RequestValue R/W Position or speed control request signal R/W (Scaled between -0x3fff and 0x3fff). 0x4000 is freewheeling and 0x4001 is braking.
2 int16_t IFactor R/W PID control loop integrator value
4 int16_t PFactor R/W PID control loop proportional value
6 int16_t DFactor R/W PID control loop differentiator value
8 int16_t PFFactor R/W Control bypass proportional value
10 int16_t SampleOffset R/W Control loop input bias
12 int16_t MaxPositiveChange R/W Maximum single-step change in speed in the positive direction. If a bigger change is requested in RequestValue a ramp is generated.
14 int16_t MaxNegativeChange R/W Maximum single-step change in speed in the negative direction. If a bigger change is requested in RequestValue a ramp is generated.
16 int32_t Distance R/W Integrated actual speed value. An approximate measurement of the travelled distance.
20 int32_t FwDistanceLimit R/W Maximum distance allowed in the positive direction. When Distance approaches this value, a speed-ramp usingMaxPositiveChange is generated such that speed will reach 0 when distance reaches FwDistanceLimit
24 int32_t BwDistanceLimit R/W Maximum distance allowed in the negative direction. When Distance approaches this value, a speed-ramp usingMaxNegativeChange is generated such that speed will reach 0 when distance reaches BwDistanceLimit
28 int32_t DistanceToStop R/O Current estimated distance required to stop
32 int16_t CurrentRequest R/O Actual current speed request value. This in general is equal to RequestValue except when ramp-generation is in progress
34 int16_t Command R/O Command given to the H-bridge. This is the output of the control loop
36 int16_t IValue R/O PID loop working set
38 int16_t LastError R/O
40 int16_t Error R/O
42 int16_t VoltageSample R/O This is the measured position or speed, and the input of the control loop
44 int16_t BaseValue R/O Back-EMF sampling code working set
46 int16_t SampleCnt_Snapshot R/O
48 int16_t MinValue_Snapshot R/O
50 int16_t MinValue R/O
52 int16_t MaxValue R/O
54 int16_t SampleCnt R/O
56 int16_t OriginalRequestValue R/O Ramp-generation code working set
58 uint8_t SampleState R/O Back-EMF sampling code working set
59 uint8_t DutyCycleThrottle R/W Maximum duty cycle allowed on the H-bridge. This limits the maximum (average) voltage that can be applied to the motor
60 uint8_t NewData R/O Used for debug outputs
61 bool8_t IsForward R/O Set to true if the motor is energized in the forward direction
62 uint16_t CurrentMax R/O Peak current drawn by the motor
64 uint16_t CurrentDelta R/O Current draw detection code working set
66 uint16_t CurrentTemp R/O
68 uint16_t CurrentMaxSearch R/O
70 uint8_t ADBufferEnable R/O When set to 0, AD sampling is in progress
71 bool8_t ADBufferEnableHost R/W When set to true, host request a new set AD sampling. It will happen in the next control cycle. When sampling is done, it is reset to false
72 uint16_t CurrentLimit R/W Maximum current draw allowed. If during the ‘on’ part of the cycle, the current draw reaches above this level, the MOSFETs are switched off and the ‘on’ part of the cycle is terminated
74 uint8_t OperatingMode R/W Set to 0 for speed-controller, and 1 for servo-controller mode
75 uint8_t Dummy1 R/W Reserved
76 uint16_t*80 ADBuffer R/W AD sampling buffer

Legend:

int8_t
Signed 8-bit integer
int16_t
Signed 16-bit integer
int32_t
Signed 32-bit integer
uint8_t
Unsigned 8-bit integer
uint16_t
Unsigned 16-bit integer
uint32_t
Unsigned 32-bit integer
bool8_t
8-bit boolean value (possible values are 0 for false, and non-zero for true)
R/W
Register has read/write access
R/O
Register has read-only access

Design files

µModule Users Manual (HSOL)
Schematic and PCB in PDF format (HSNCL)

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *