E. 0x86 & 0x87: motor m0 & m1 variable brake, Command 0x86 (134): motor m0 brake, Command 0x87: motor m1 brake – Pololu Qik 2s12v10 User Manual
Page 25: F. 0x88 - 0x8f: set motor forward/reverse, Motor control overview, Section 5.f, Section 5.e

Once you have set the value of a configuration parameter, that value is saved in non-volatile memory, so it
will persist even if the qik is subsequently turned off or reset. Please note that the memory used to store these
parameters is only rated for approximately 100,000 erase/write cycles, so you should avoid putting this command
within loops that are executed many times a second; it is intended that the configuration parameters will initially
be set as desired and then only changed occasionally.
5.e. 0x86 & 0x87: Motor M0 & M1 Variable Brake
Command 0x86 (134):
Motor M0 Brake
Compact protocol: 0x86, brake amount
Pololu protocol: 0xAA, device ID, 0x06, brake amount
Command 0x87:
Motor M1 Brake
Compact protocol: 0x87 (135), brake amount
Pololu protocol: 0xAA, device ID, 0x07, brake amount
These commands will set the specified motor to variable brake based on the brake amount data byte. When brake
amount is zero, the motor outputs are high impedance, which lets the motor turn freely (coast). When brake
amount is 127, the motor outputs are both tied to ground, which causes the motor to brake. For values of brake
amount between 0 and 127, the motor outputs will PWM between high impedance (coast) and ground (brake),
with the percentage of the time the motor spends braking given by
(brake amount / 127) * 100%
.
Please note that a brake amount value of 127 always results in full braking, even when the PWM configuration
parameter selects for 8-bit resolution. Braking is not affected by the acceleration parameters, and transitioning
from brake to drive or vice versa does not produce a change-of-direction “brake duration” (see
for
more information about these configuration parameters).
You can familiarize yourself with motor coasting and braking using nothing more than a motor. First, with your
motor disconnected from anything, try rotating the output shaft and note how easily it turns. Then hold the two
motor leads together and try rotating the output shaft again. You should notice significantly more resistance while
the leads are shorted together. A brake amount of zero is equivalent to disconnecting your motor and letting it turn
freely; a brake amount of 127 is equivalent to shorting the motor leads together. All other brake amount values
produce a mixture of the two scenarios.
5.f. 0x88 - 0x8F: Set Motor Forward/Reverse
Motor Control Overview
The qik can independently drive up to two bidirectional brushed DC motors, referred to as M0 and M1, using
two VNH2SP30 motor drivers. Variable speed is achieved with 7-bit or 8-bit pulse width modulated (PWM)
outputs at one of several selectable frequencies. 7-bit control allows for PWM frequencies of 19.7 kHz, 2.5 kHz,
and 310 Hz; 8-bit control allows for PWM frequencies of 9.8 kHz, 1.2 kHz, and 150 Hz. The highest achievable
frequency of 19.7 kHz is ultrasonic, which can result in quieter motor control. Lower frequencies might produce
louder motor noise, but they can help decrease power losses due to switching. The resolution and frequency can
be set via the qik’s PWM configuration parameter (see
The motor direction convention used in this document is that “forward” corresponds to holding the + output at
VIN while PWMing the - output between ground and high impedance. “Reverse” is the same as forward but with
the outputs flipped: - is held at VIN while + is PWMed between ground and high impedance. As a result, the
motor is rapidly alternating between drive and coast when the direction is “forward” or “reverse”. Variable speed
control is achieved by varying the fraction of the cycle that the motor outputs are driving. Full speed arises when
the motor outputs are driving 100% of the time (one motor output is held at steady at VIN and the other steady
at ground). In 7-bit mode, motor speed ranges from stopped (high-impedance outputs, or “coast”) to full speed
Qik 2s12v10 User's Guide
© 2001–2012 Pololu Corporation
5. Serial Parameters and Commands
Page 25 of 33