How can I program an electric brake on Pololu G2 High-Power Motor Driver 18v25

Hello I am using a 24V 37D pololu dc brushed motor with Pololu G2 High-Power Motor Driver 18v25. I am have trouble using the maximum torque on this motor. I have a spool attached to the motor and when I add a load hang on the spool , the motor free spins when powered. How can I add an electric brake to the code using this set up to maximizes the torque of the motor?


I am not sure what you mean by “add an electric brake to the code”. However, if you need to the motor hold position and the load causes your motor to back drive then there are generally a few ways to address that. One approach would be to add some mechanical device that helps the motor hold the load, such as an electric brake or a worm drive. Another option would be to implement some form of closed-loop position control using feedback from a sensor, such as an encoder. In case you are not already aware, there are versions of all of our 37D gearmotors available with integrated encoders if you decide to go that route.

- Patrick

How can I implement a closed loop position control using feedback from an encoder? Is there a library I can use in python or c/C++ that has a functions I can call from to hold position using the G2 high power motor driver?

We have not written and do not support a specific library for that, but some internent searches should lead you to several examples. I personally like the tutorial in this YouTube video by Curio Res, though please note that it does not use exact same hardware that you have.

- Patrick