Controlling 6 window motors with Arduino mega 2560 R3

I am looking to control 6 car window motors (I repurposed the motors for a project), the motors will all be running at the same time. I was looking at using 3 of the Pololu Dual VNH5019 Motor Driver Shield, is that possible with the Mega 2560 R3? Would a different motor controller be more suited to the project? Or would it be better to use multiple micro controllers (i.e) my mega would be the master and I would have 3 uno slaves with a dual driver shield on each slave.

Thanks for all help

All the heavy power goes through the controllers. The Mega just needs to send control signals to the motor controllers, which it can do as long as it has available digital output pins.
For 6 motors, you will need 6 “direction” pins (plain digital) and 6 “PWM” pins (analogWrite() or PWM digital output pins.) The Mega can easily drive that.

Thank you for such a quick response.

I was doing some research into the library for the dual motor shield, and I have several questions:

  1. In order to use 6 pwm pins how would I specify the pins, in the read me file on github I did not see a place in the constructor to add pwm pins. I noticed that there was another forum post on this issue, Modified VNH5019 shield library for 20kHz PWM with Mega , where someone updated the library but I was a bit confused by what they were doing.
  2. How often should I check for errors, once a second, once a minute?


Hi, Joel.

I don’t think that modified library for the VNH5019 shield will be very useful for you, since it only changes the timer (and pins) used to drive the motors and does not give more access to initializing multiple drivers and setting them to output on different PWM pins. Instead, you might find this library that lets you change the pins used for PWM helpful.

How often you should check for errors depends on your application. If you want to check for errors regularly, you should do it as often as you can so that you can deal with an error appropriately, but you don’t need to check for errors at all.


Thank you so much, that library looks like it will work.