|Home||Control Home||µC Stepper Control||µC Stepper Control 2 Plus|
by Martin Clausen (mc AT rotgradpsi DOT de)
This circuit employs a MCU to control up to two bipolar stepper motors via RS232.
Not recommended for new designs, for reference only, please use Stepper Control 2 Plus instead!
Address and line end character can be changed easily, just send me a mail with your demands.
The LED will be on after power-up. After each correct command it will toggle between on and off. If a buffer overflow occurs, the LED will stay permanently off and the MCU is stopped.
The hold jumper is used to switch off the hold current through the motor coils, while both motors stand still. A closed jumper corresponds to no hold current. The jumper is read every 100µs. If you want to control this pin via RS232 you could use a GPIO pin. There is no direct control of this feature via software, because in some application the motors might be driven with a higher current than allowed for infinite time because of too high power dissipation. Since in this case wrong settings might damage the motors this option is normally not accessible via RS232.
The GPIO lines are located at P1 of the MCU. They are open collector outputs with a weak pull-up resistor and contain also a circuit for read back. Refer to the microcontroller datasheet for details. The state of the GPIO after reset is high. Note that you need to write an one to a GPIO before it is possible to use it as an input, if it has been used as an output since the last reset.
If you send a new command while the old one is still executed on the same motor, the controller will change to the parameters of the new command, without the full execution of the previous command. If this occurs, a calculated position on the PC will not match the real position.
Messages from the controller are sent with its own address first and then followed by the data in hex-code (nibble by nibble from msb to lsb).
Note, that due to the limitations in computational power and number of timers, the motion profiler increases and dereceases the steptime linearly. In case of a long acceleration/deceleration time (maximum steptime > 3*steptime) this leads to large derivation from an almost linear to hyperbolic velocity profile and smoth motion without the loss of steps is not reached. See µC Stepper Control 2 Plus for a version for a single bipolar motor with a more advanced motion profiler.
|Motor No or|
|Mode And Direction||Steps||Steptime||Addtional Response||Description|
8 and 9 will warp around to 0 and 1 respectively.
|Value: 0000 to 9999|
Units: full/half/quarter steps depending on mode
|Value: 00 to 99|
|none||Move motor 0 with given steptime, mode and direction the number of steps.|
|1||same as Motor No 0|
|4||dummy||Lower byte is writen to GPIO||dummy||none||Write to GPIO.|
To pins which are used as inputs, only ones should be written.
|5||dummy||dummy||dummy||Device Address, two digit hex-number, line end character||Read GPIO|
|6||motor no||dummy||dummy||Device Address, four digit hex-number, line end character||The "steps to do register" is snapshot at the low transition of IE0 and send.|
Demanding data from a non-existing motor no will lead to invalid data being send, but no error message.
|7||motor no||Maximum steptime|
Should be limited to 255, otherwise the maximum steptime modulo 256 is taken. In case the maximum steptime is shorter than the steptime, the motion will consist of steps with the steptime in between only.
default: 5 ms
Must be 1 at least.
|none||It is important to set these parameters to obtain optimum performance (fast vibration-free movement without loss of steps).|
|8||dummy||dummy||dummy||Device Address, one digit hex-number, line end character||Check if any motor is still running.|
The response will be a hex-number with the bits of the corresponding motors set if they are running.
|MSB - LSB||Baudrate / kbps|
Meaning of 1 and 0 in this table:
The baudrate jumper are read up on reset.
|Type||no. of chips|
for two motors
|max. current||max. voltage||inhibit polarity||comment|
|TCA3727||2||0,75A||50V||PX.6||temperature prealarm via inhibit and GPIO possible,|
no gitch filter for current sensing possible: Do not use, if the motor is connected via a long cabel!
|TEA3718||4||1.2A||50V||none||temperature prealarm and alarm via GPIO possible|
|LMD18245||4||3A||55V||PX.7||use brake as enable|
The part description in schematics is read as follows:
part type + value in exponential form + package description + subpart number in package
for example: C1040805,1 means Capacitor, 100nF, package SMD 0805, first subpart in package
Disclaimer: No warranty at all!
Copyright by Martin Clausen, Germany.
Contact the author: mc AT rotgradpsi DOT de