Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Controlling Pololu G2 High-Power Motor Driver 18v25 with Arduino


I am wanting to use a DC Brushed Motor that has a max current of 19A at 12v. I am considering a Pololu G2 High-Power Motor Driver 18v25 and controlling it with an Arduino

I want to be able to drive the motor in both directions and use the encoder to know where the motor is.

Is there anything I need to think about or consider?


It sounds like you chose a driver that is a good match for your motor. There are a couple general things that are good to consider:

  1. Since 19A a lot of current, you should make sure you choose a power source that can handle it; otherwise, the voltage could dip and cause brownout resets.

  2. That driver does not have any special features for measuring the encoder and doing closed-loop speed control, so you will need to implement your own control algorithm in your Arduino program. I recommend one of the rotary encoder libraries on Arduino’s site that supports interrupts for reading the encoder ticks. You will likely want to use some kind of PID controller to do the closed-loop position control. If you have not programmed one before, you might try using Arduino’s PID library, or you could review the tutorial linked to in this blog post (though keep in mind, that tutorial uses a different motor driver).

  3. You can provide the PWM signal to the G2 High-Power Motor Driver 18v25 using analogWrite(). However, the frequency of the PWM (which will depend on the specific Arduino board and pin you use) will be relatively low; low enough to be audible (less than 20kHz). If you would rather use higher PWM frequencies, you could use the PWM registers directly. You can find details about this in this “Secrets of Arduino PWM” tutorial.