Example: Dynamic braking with SPice10213

This is a very simple example program illustrating how to apply dynamic braking.

Note: Dynamic braking with the SPice10213 is intended for and tested with small permanent magnet brushed DC motors.

The principle of dynamic braking of a DC motor is as follows: When the motor rotates, the movement of the wound coil in a magnetic field generates a voltage. During normal running that voltage will nearly equal the voltage supplied by the power supply. If the power supply is removed, the motor will continue to spin and still generate a voltage which can be measured across its terminals. The motor will then gradually slow down as its rotational energy is dissipated in friction and in the mechanical load. If, during the slow-down phase you short the motor terminals, a large current will flow (limited only by the resistance of the motor windings). The motor has now become a dynamo that is converting the mechanical energy of rotation into electrical energy, and that energy is dissipated rapidly in the motor windings as heat. The result is that the motor comes to a stop much sooner.

In practice The SPice10213 does not directly short out the motor terminals for braking. Instead it uses a series connected 1.2ohm resistor and diode in conjunction with the direction relay. The resistor limits the braking current to a safe level. The diode is present in the circuit to protect the PWM driver transistor from inductive kick-backs, and serves incidentally in the braking function.

Given the motor is running, the dynamic braking process consists of the following steps:

  1. Turn off the power to the motor. The dynamo voltage from the motor will at this point be reverse biasing the diode.
  2. Change the reversing relay to the opposite direction. This will forward bias the diode, it turns on and current flows through the diode and resistor so the mechanical energy of the motor can quickly dissipate as electrical energy in the resistor, diode and motor winding.
  3. Allow enough time for the motor to come to a halt. The time required will depend on the motor and possible inertia of its load (i.e. a big fly-wheel will take longer to stop because it contains more rotational energy), and needs to be determined for each application. Typical stop times would be 100mS to 500mS.
  4. (Optionally) restore the direction relay to the original direction. This will depend on the overall logic of your program - you just want to be sure it's set for the correct direction next time you start the motor.

Note that it's important to turn off the power (set PWM=0) before reversing the relay.

;MDrv0  SPice10213 dynamic braking example

;This program simply illustrates dynamic braking of a small DC motor using the SPice10213
;on an MS12. It has a stop/start button. The motor is driven in simple on/off mode 
;(no speed control) off the motor 1 output.

iStopStart      iEQU            16              ;The Stop/Start button

oDirection      oEQU            12              ;The direction relay
oMotor          oEQU            16              ;The on/off output

;------ 
;Start of program
                setu            0,1             ;set spice connector pin 4 as DO
                setu            4,1             ;set spice connector pin 8 as DO
                SpiceConfigU


Idle:                   ;Back here when motor is stopped
                WaitOnK         iStopStart      ;Wait for start command
                On              oMotor          ;Run the motor
Running:
                WaitOnK         iStopStart      ;Wait for stop command
Stop:
                Off             oMotor          ;Turn off the motor

;Comment out the following line to see the effect of not using dynamic braking
                ON              oDirection      ;Apply the brake

                Pause           50              ;Allow motor time to stop
                Off             oDirection      ;Turn off the brake
                GoTo            Idle