Triple PWM Motor Control UnitSubmitted to Parallax by Guenther Daubach This SX28-based module is used to control three DC motors (24 V, 2 A each) with integrated tacho-sensors. It was initially designed for an orthopedic appliance.
The PWM Motor Control Board To drive the motors, full H-bridge power ICs with integrated over-heat protection are used which are directly controlled by outputs of the SX28. All functions are controlled via an I²C bus by some easy to use commands, where the module acts as an I²C slave. For each motor channel, opto-isolated inputs are provided for the tacho-sensors. The tacho pulses are analyzed by the SX28 controller to follow the current motor positions, and to detect blocking situations, i.e. no tacho pulses while the motor is supposed to be in motion. One motor channel has opto-isolated inputs for two end sensors, and the other two motor channels have opto-isolated inputs each, for reference sensors. In this application, one motor drives a carriage along a linear rail. So it is important here, to detect the two end-positions, where one end-position also indicates the reference point, i.e. the zero position. The other two motors drive revolving gears without end-positions. Therefore, for each gear only one sensor is required to detect the reference point, or the zero position. For all three motor channels current-sensing circuits with adjustable maximum current thresholds have been implemented in order to shut down the system in case of over-current situations. In addition, each motor cannel is fused to protect against shortages between different motor channels, and LEDs indicate possibly blown fuses.
The following I²C commands are available to control the unit:
- Reset/Stop: Resets the module, turns off all motor channels, and resets the status information.
- Go to target: The specified motor moves to the specified target at the specified speed.
- Set: Sets the target coordinates and speeds for all three channels without actually starting the motors.
- Control all: For each motor channel, the required actions can be specified together with this command.
- Nop: No action
- Stop: Stop this channel
- Go: Move to the position, previously specified with the “Set” command at the previously defined speed.
- Ref: Perform a reference search, i.e. the motor turns at the speed, defined with the most recent “Set” command, until the reference position is found.
GetStatus: The module returns a status record with information about the following states for each channel: - Valid reference point detected - At target - At left end position (first channel only) - At right end position (first channel only) - Turning left - Turning right - Over-current - Blocked
The last byte of the status record is a checksum that allows the master to validate the status data. In a practical application, the GetStatus command will be periodically issued by the master controller in order to track the status of the PWM module. As an additional safety measure, the PWM module will stop any activity, and halt all motors when no status request has been received within a certain period of time. For testing purposes, this time-out feature can be de-activated by placing a jumper across a 2-pin header on the board.
The “Breadboard” This picture shows an early version of the PWM board (with separate “piggy-back” modules for each motor channel) together with the three DC motors, and an I²C/RS-232 Adapter “piggy-backed” on an I/O Board. Descriptions for both, the I²C/RS-232 Adapter and the I/O Board can be found elsewhere on this site.
Specifications: Power Supply: 5V DC, stabilized and filtered for the SX28 controller 15...32V DC for the motor channels (separate supply connectors for each channel) I²C: Slave address 0xD0, transfer rate up to 100 kbit/s Dimensions: 6.3” * 4.0” (160mm * 100mm) Connectors: Clamp plugs, 0.15” (3.81mm) spacing
The “Almost Final” This picture shows the PWM module (bottom left) together with other components, including an I²C-RS-232 Adapter and a Parallel I/O Module (top right) as it is installed in the orthopedic appliance.
Conclusion Developing the PWM module, together with the software for the SX28 was one of the greatest challenges I’ve been faced to so far. It is really amazing how all the required functionality (handling the I²C bus, generating the PWM signals, watching the various inputs, counting the tacho pulses, and keeping track of the current and target positions, checking for over-current and dead-lock situations, etc.) could be handled by just one SX28, clocked at 20 MHz – and there is still some free space in the SX RAM and ROM areas for enhancements!
Guenther Daubach MDA EDV-Beratung GmbH Im Eulenflug 25 D-51399 Burscheid, Germany Tel./Fax: +49 2174 – 785 931 email: info@mda-burscheid.de home: http://www.g-daubach.com |