MOTO4 Hard vs Soft Brake

I have been studying the WickedMotorShield library for use a MOTO4. What exactly is meant by “hard brake” versus “soft brake” since I don’t have an actual brake on the motors. Is one of these dynamic braking with the two motor leads connected electrically? If so, which one?

In studying the documentation, I created a fork of the library which can be viewed at https://bradleyross.github.io/WickedMotorShield with the actual repository at https://githb.com/BradleyRoss/WickedMotorShield. Could somebody take a look and see my notes are correct. Thank you for any assistance.

I would invite you to take a look at the H-Bridge IC datasheet, most notably the schematics and diagrams on page 4 of the PDF.

Hard braking generates a “wheels locked” condition on the H-bridge. This amounts to the H-bridge being configured in such a way that the H-Bridge outputs are both driven low. They refer to this as a “Brake” condition in the datasheet. A DC motor shaft will not turn in this condition, and it resists external attempts to force it to turn.

Soft braking generates a “free wheeling” condition on the H-bridge. This amounts to the motor being disconnected from Power and GND altogether. Stated differently, the H-bridge is configured in such a way that the H-Bridge outputs are both high-impedance. They refer to this as a “Stop” condition in the datasheet. A DC motor shaft will freely rotate if external forces are applied to it.

The unknown pair of pins next to “M1 A0” in the “9x2 Header strip” are both GND, available for whatever you want as you surmised.

The unknown pair of pins next to “Power interconnect” in the “9x2 Header strip” are both +5V (from Arduino), available for whatever you want as you surmised.

The middle pin of all the Servo headers is +5V (from Arduino).

The top pin of all the Servo headers connect to an Arduino PWM pin corresponding to the speed control for the various motor channels. The associated motor channels are labeled on the PCB under the headers (left to right: M3, M5, M4, M2, M1, M6). The corresponding Digital pins on the Arduino are correspondingly labelled for ease of reference (noting that M1 and M6 are select-able by way of the first two columns of the 3x5 header J1; where wM1 and wM6 correspond to J1 column 1 in the “up” position and J1 column 2 in the “up” position respectively).

By the way, thanks for doing this. I’ll include a link your docs to our README if you’d permit me, and when you think that would be useful to do.

If both outputs are driven low, that sounds like electrically connecting the two outputs, which would be another way of saying dynamic braking. As I understand it, “hard brake”, which is marked as a “Brake” condition in the datasheet, is dynamic braking. A “soft brake”, which is listed as “stop” in the datasheet, is equivalent to turning off the power. In addition, I think that you mean that a “hard brake” will cause the rotation to slow until it stops by creating torque in the motor that is opposite to the direction the motor is rotating.

As I’m going through the information, it appears that there are four states: brake hard, brake soft, clockwise, and counterclockwise. To me, this indicates that setting the direction (CW/CCW) should also result in a BRAKE OFF operation with the bit for the direction being copied to old_dir. Executing BRAKE_OFF should copy the value from old_dir back to the direction bit as well as changing the brake bit. Switching to BRAKE HARD or BRAKE SOFT should change both bits but not change old_dir. This is a little different from the way the code acts now. It looks like the current code will allow some inconsistent states.

I would also like to change the code to allow the use of bluetooth. This might mean another constructor for WickedMotorShield.

You will notice the Doxygen comments. These comments make the code much more understandable.

What I would therefore like to do is to improve the fork until everyone finds it acceptable. You can then merge the fork with the original if you desire.

Having a documentation page on GitHub at https://wickeddevice.github.io would be a very useful item as it provides a way of presenting all of the material on the repository in an organized fashion.

For a number of comments that I have seen in the forum, it seems that people have a hard time finding understandable and usable documentation. Attempting to battle this problem seems a worthwhile goal and I intend to proceed on this quest.