Electronic control unit MARS is designed for position control of DC motors (up to the amount of three) with incremental sensors of position increment and one index mark per one motor revolve. Working area of the controlled equipment can be marked off by electromechanical terminal switches connected to power parts of the motors or by limit position sensors with logic outputs. To precise the initial position, it is possible to use terminal switches and sensors in a selectable combination with an index output.
Commands for the control unit can be inserted with the help of a selectable local keyboard or via I2C interface of the connected keyboard. From a superior computer, the commands can be transmitted via I2C interface, RS-232 or via RS-485. The control unit can be equipped with an input for a three-axes analog joystick.
In addition to the motor control, 5 digital outputs, 4 power outputs and 2 outputs galvanicaly separated from the unit electronics can be used. Index marks of motors and up to nine digital inputs can be used as digital inputs. Five of them are also usable as analog inputs 0...2.5 V with resolution of 10 bits. When using joystick, three of the inputs are used for joystick.
When a change of the input state is defined and after selection of one of four digital inputs, each of two setable event triggers can send information about the position of the controlled axes and about the state of digital inputs. During the trigger activation it is possible to stop motion of the selected axes and set a state of digital outputs.
Variable | Value | Units |
Supply voltage | 18 - 36 | VDC |
Max. safe current for one motor | 5 | A |
- current protection | electronic for each axes | |
Position sensor input (IRC) | 2 signals out of phase + TTL level index or RS-422 | |
Max. frequency of IRC signals | 3 | MHz |
Inputs of joystick sensors | 0 - 5 | V |
- supposed central position | 2.5 | V |
- sensitivity of joystick sensors | range can be adjusted for a particular joystick with the help of resistors | |
Fine tuning of sensitivity and zero position of joystick | by software | |
Desired position generator | trapezoidal course with settable acceleration and maximal velocity | |
Motors position control | sliding PID controller with nonlinear damping | |
Setting of P, I, and D constants | by software | |
Correction of power exciter non-sensitivity | by software | |
Range of motor position | ±8000.000 | step 0.001 |
- range in periods of the IRC signal (4 phases) | 4000000 | |
Absolute position calibration | automatic search of a selectable combination of the index and terminal switches |
To mark off a working area it is possible to connect terminal (limit) switches with diodes to the power outputs for motors. It ensures return from the positions behind the limit switches and quick stop when getting out of the working area.
As a power supply a feeder with a double-insulated transformer or a pulse power supply can be used. The unit MARS , all peripheries and motors are not dangerous to touch when supplied.
The electronic control unit MARS requires NO MAINTENANCE.
The electronic control unit communicates with computers via serial asynchronous interface. The following configuration of the communication port is demanded: 9600 baud, 8 bits, no parity, and 2 stop-bits. Data flow control is executed with the help of hardware by signals CST and RTS. The communication speed is settable within the range from 2400 baud up to 19200 baud with the help of a local keyboard. The chosen value is loaded into the EEPROM memory along with other parameters.
Each command consists of a name, operation symbol, and parameters. Individual parts of a command can be separated by spaces.
Gm, GRm, APm, HHm, HH
REGPm, REGIm, REGDm, REGS1m, REGS2m, REGMSm, REGACCm,
REGMEm, REGCFGm, REGDBGm, REGTYPEm, REGSFRQ
REGDBGm, REGDBGHIS, REGDBGPRE, REGDBGGNS, REGDBGGNR
STOPm, STOP, PURGE, CLEARm, CLEAR, RELEASEm, RELEASE
READY, R, Rm, REPLY
KEYLOCK, JOYSTICKm, JOYSTICK, JOYOFFSm, JOYRESm, JOYHYSm, JOYCAL
STm, ST
SPDm, SPDTm
PWMm, DIGO, DIGI, ADCx, TRIGt
VER, HEXLD, TEST, CFGNVSAVE, CFGDEFAULT
The detailed description of the individual commands is given in this section. The commands indicated by '*opt' are available only for several system configurations.
Name | Op | Parameters | Function |
Gm | : | xxx.xxx | Movement to absolute position |
-8000,8000.000 |
Name | Op | Parameters | Function |
GRm | : | xxx.xxx | Movement to relative position |
-8000,8000.000 |
Name | Op | Parameters | Function |
APm | ? | Actual position | |
Name | Op | Parameters | Function |
HH | : | Reference position |
Name | Op | Parameters | Function |
HHm | : | Reference position of 'm' |
Name | Op | Parameters | Function |
REGPm | : ? | xxx | Proportional gain for 'm' |
0,255 | |||
REGIm | : ? | xxx | Integral constant for 'm' |
0,255 | |||
REGDm | : ? | xxx | Derivative constant for 'm' |
0,255 | |||
REGS1m | : ? | xxx | 1. auxiliary constant for 'm' |
0,255 | |||
REGS2m | : ? | xxx | 2. auxiliary constant for 'm' |
0,255 |
Name | Op | Parameters | Function |
REGMSm | : ? | xxx | Maximal velocity for 'm' |
0,30000 |
Name | Op | Parameters | Function |
REGACCm | ? | xxx | Acceleration for motor 'm' |
0,30000 |
Name | Op | Parameters | Function |
REGMEm | : ? | xxx | Maximal PWM for 'm' |
0,30000 |
Name | Op | Parameters | Function |
REGCFGm | : ? | xxx | Configuration word for 'm' |
0,30000 |
Name | Op | Parameters | Function |
REGTYPEm | : | x | Controller change for 'm' |
*opt | 0,5 |
Value | Controller |
0 | Default type |
1 | PID with nonlinearity |
2 | Linear PID |
3 | Discrete filter |
4 | Relay characteristic |
5 | Output without IRC coupling |
Name | Op | Parameters | Function |
REGSFRQ | : ? | x | Sampling frequency of controllers |
*opt | 0,4 |
Name | Op | Parameters | Function |
REGDBGm | : | x | Debugging of 'm' enabled |
0,1 |
Name | Op | Parameters | Function |
REGDBGHIS | : | xxxx | Motion history reading |
0,3000 |
Name | Op | Parameters | Function |
REGDBGPRE | : | xxxx | Data preprocessing for response debugging |
0,3000 |
Name | Op | Parameters | Function |
REGDBGGNS | : | Motor response |
Name | Op | Parameters | Function |
REGDBGGNR | : | Response of the motor control |
Name | Op | Parameters | Function |
CLEARm | : | Control switching off and clearing of 'm' | |
CLEAR | : | Control switching off and clearing of all motors |
Name | Op | Parameters | Function |
STOPm | : | Stopping of the motor 'm' motion | |
STOP | : | Stopping of all motors motion |
Name | Op | Parameters | Function |
PURGE | : | Stops control with an error |
Name | Op | Parameters | Function |
RELEASEm | : | Releases control and stops 'm' | |
RELEASE | : | Releases control and stops all motors |
Name | Op | Parameters | Function |
READY | : | x | Operation completed response |
0,1 |
Name | Op | Parameters | Function |
R | : | Only one operation completed response |
Name | Op | Parameters | Function |
Rm | : | Response for a specific motor |
Name | Op | Parameters | Function |
REPLY | : | x | Command acknowledgement |
0,1 |
Name | Op | Parameters | Function |
KEYLOCK | : | x | Keyboard locking |
0,1 |
Name | Op | Parameters | Function |
JOYSTICKm | : | Joystick control of the 'm' axis | |
JOYSTICK | : | Joystick control of all axes |
Name | Op | Parameters | Function |
JOYRESm | : ? | xxx | Joystick axis resolution |
-32000,32000 | |||
JOYOFFSm | : ? | xxx | Central position offset of joystick axis |
0,65000 | |||
JOYHYSm | : ? | xxx | Hysteresis angle of joystick axis |
0,65000 |
Name | Op | Parameters | Function |
JOYCAL | : | Central position calibration |
Name | Op | Parameters | Function |
STm | ? | Motor 'm' status |
Bit | Meaning |
0 | IRC reading enabled |
1 | Controller enabled |
2 | Generator enabled |
3 | Error |
4 | Last command execution |
5 | Control course storage ON |
Name | Op | Parameters | Function |
ST | ? | Status of all motors |
Name | Op | Parameters | Function |
SPDm | : | xxx | Movement with given velocity |
*opt | -32000,32000 |
Name | Op | Parameters | Function |
SPDTm | : | xxx,yyy | Movement with the velocity of 'xxx' continuing within the max. interval 'yyy' |
*opt | -32000,32000 | ||
0,32000 |
Name | Op | Parameters | Function |
PWMm | : | xxx | Direct PWM setting |
*opt | -32000,32000 |
Name | Op | Parameters | Function |
DIGO | : | xxxxx | Digital outputs setting |
*opt | 0,65535 |
Name | Op | Parameters | Function |
DIGI | ? | Digital input state reading | |
*opt |
Name | Op | Parameters | Function |
ADCa | ? | Analog input reading | |
*opt |
Name | Op | Parameters | Function |
TRIGt | : | s,m,do | Trigger setting |
*opt |
Name | Op | Parameters | Function |
VER | ? | Returns software version |
Name | Op | Parameters | Function |
IHEXLD | : | Loads new software |
Name | Op | Parameters | Function |
TEST | : ? | Connection test |
Name | Op | Parameters | Function |
REBOOT | : | Unit software reboot |
Name | Op | Parameters | Function |
CFGNVSAVE | : | Saves parameters into EEPROM |
Name | Op | Parameters | Function |
CFGDEFAULT | : | Default parameters setting |
Configuration setting for individual axes executed by the command REGCFGm determinates a course of velocity when moving from one position to another one and a way of zero position finding. The inserted decadic number is interpreted as a bit field.
Bit | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Flags | x | x | x | x | x | N | x | T | x | L | C | R | D | S | S | S |
Flags | Meaning |
SSS | Stop search speed during HH is REGMSm / 2^SSS |
D | Initial direction for stop search for HH |
R | To find HH the revolve mark from HP HEDS is used |
C | Mark middle search |
L | Limit switch usage |
T | Trapezoidal velocity profile usage |
N | Coordinates from RS232 are not converted |
LCR=111 | Mark search only |
CR=11 | Mark middle search only |
Value | Meaning |
0 | Motor limit switch search only |
16 | Search the first revolve mark (first from the hardware terminal switch) |
32 | Search the middle of the first revolve mark (first from the hardware terminal switch) |
48 | Search the middle of the mark |
64 | Search the limit switch only |
80 | Search the first revolve mark (first from the limit switch) |
96 | Search the middle of the first revolve mark (first from the limit switch) |
112 | Mark search only |
Event trigger setting is executed by the following command:
TRIGt:s,m,do | ||
t | Trigger number (0 or 1) | |
s | Trigger source 0 .. 3 ( -1 trigger disconnection ) | |
s.0 s.1 | Source number | |
s.4 | Rising edge | |
s.5 | Trailing edge | |
s.6 | Sent input state | |
s.7 | Set digital outputs | |
m | Mask of the motors that should be stopped and transmission of their position | |
m.0 | Stop A | |
m.1 | Stop B | |
m.2 | Stop C | |
m.4 | Send A | |
m.5 | Send B | |
m.6 | Send C | |
do | Value of digital outputs set at trigger event |
Triggers transmit:
TGt!di,ma,mb,mc | |
t | Trigger number (0 or 1) |
di | Digital inputs at trigger event or "N", if transition disabled |
ma,mb,mc | According to the choice of m in the setting it sends the IRC position |
A message consists of an information about a type of the message and of data. Types of the I2C messages used in the unit MARS are given in the following table.
Symbol | Code | Type of message |
IC_CMD | 40H | Commands for motor control |
IIC_CMM | 41H | Reserved |
IIC_STM | 42H | Reserved |
IIC_TEC | 51H | Control of IIC keyboard and a display |
IIC_TEK | 52H | Information about pressed keys |
IIC_TED | 53H | Data display |
Write to IIC addr 10H+W | |
0 | Type of the IIC_CMD message |
1 | Operation |
2 | Motor number |
3,4,[5,6] | Parameter value for given motor |
Read from IIC addr 10H+R | |
0,1 | System status |
2,3,[4,5] | Parameter value of given motor |
Codes for the individual operations are given in the table bellow. In the second column (Parameter) there are given the parameter values that are settable or readable for the given operation.
Code | Parameter | Description |
0 | Actual position | Actual position reading |
1 | Desired position | Desired position setting |
2 | Desired position | After inserting the position the motion starts up |
3 | Status | Runs hard home |
4 | REG P | Setting and reading of P constant |
5 | REG I | Setting and reading of I constant |
6 | REG D | Setting and reading of D constant |
7 | REG ME | Maximal duty of PWM |
8 | REG MS | Maximal speed of motion |
9 | REG ACC | Maximal acceleration |
A | REG SCM | Multiplicative constant for coordinates conversion |
B | REG SCD | Dividing constant for coordinates conversion |
C | Min LS | Not implemented |
D | Max LS | Not implemented |
E | REG CFG | Configuration flags |
F | Status | Motor status |
State flags read via I2C are given in the following table.
Bit | Symbol | Description |
0 | TRP_SGN | |
1 | FL_HH | |
2 | FL_ATIM | |
3 | FL_ENOV | Energy overflow for a motor start |
4 | ENE_ON | |
5 | ERR_FLG | Error during control |
6 | CMD_LCK | Next command can not be received |
7 | CMD_BSY | Last command execution |
The MARS control unit can be handled directly by the local keyboard or a keyboard connected via the I2C interface.
For the MARS unit, an analog joystick with three potentiometers is required. The unit connector has the following wiring:
Pin | Signal | Alt. TTL input | DB9 |
1 | VCC | 8,9 | |
2 | INPUT A | I13 | 3 |
3 | INPUT B | I14 | 4 |
4 | INPUT C | I15 | 5 |
5 | GND | 1,2 |
Cable is connected to the unit board via a crimped connector. To the control unit, a transfer connector is supplied to use standard connectors DB9 or DB25. To connect the unit to PC, the connection with DB 25V is given in the table bellow.
MARS | PC | ||||
Board pin | Signal | DB9 | Signal | DB25 | DB9 |
1 | TxD | 2 | RxD | 3 | 2 |
2 | RxD | 3 | TxD | 2 | 3 |
3 | RTS | 8 | CTS | 5 | 8 |
4 | CTS | 7 | RTS | 4 | 7 |
5 | GND | 5 | GND | 7 | 5 |
Power outputs for individual motors are accessible via MOTOR A, MOTOR B and MOTOR C connectors. Incremental sensors of position need to be connected to the unit via IRC A,IRC B and IRC C connectors.
Pin | Signal |
1 | GND 0V |
2 | Phase A |
3 | VCC +5V |
4 | Phase B |
5 | INDEX |
IRC A INDEX | I0 |
IRC B INDEX | I1 |
IRC C INDEX | I5 |
Pin | Signal |
Connector I1 | |
1 | VCC |
2 | I11 (I2) |
3 | GND |
Connector I2 | |
1 | VCC |
2 | I12 (I3) |
3 | GND |
Connector I/O1 | |
1 | GND |
2 | I6 |
3 | VCC |
4 | I7 |
5 | O14 |
Connector I/O2 | |
1 | I5 |
2 | I4 |
3 | O0 |
4 | O1 |
5 | O2 |
6 | O3 |
7 | VCC |
8 | GND |
POWER OUT | |
1 | PWR 12 - 24V |
2 | O4 |
3 | O5 |
4 | O6 |
5 | O7 |
Pin | Signal |
1 | GND |
2 | SCL |
3 | VCC |
4 | SDA |