Adafruit motor shield [Arduino Mega 2560]

Probably I should post this topic on adarfuit forum, but if anyone knows - please help:)

I want to use motor shield for a project.
I’m using an arduino mega 2560.

I notice that the speed of the motors is different so the robot turn to the left instead of going in straight line :frowning:

Here is an example code

#include <AFMotor.h>

AF_DCMotor motorL(1, MOTOR12_64KHZ);         // Create motor #1, 64KHz pwm
AF_DCMotor motorR(2, MOTOR12_64KHZ);         // Create motor #2, 64KHz pwm

void setup() {

void loop() {;;

I use a multimeter to measure the output voltage of motor 1 and motor 2. On motor 1 voltage output was 6.50v and for motor 2 output voltage was 8.10v
I thought that my motor shield may be broken, but when I test it on arduino with the same code, output voltage was approximately 6.60v in both motors

Is the motor shield not compatible with Arduino mega?
Or is it a bug of AFMotor library?

P.s: Driver chips are piggybacked

Thanks in advance

Try to remove MOTOR12_64KHZ from code

And try connect motor to battery pack directly, and test the speed

Can that old L293D do 64kHz ?

Hey! I tried on 1khz ,8khz, 16khz modes and the problem remains. There is still a voltage difference on motor terminals

On arduino uno all modes seems to work fine.:(


I have the same problem with the mega . It was working on top of an UNO R3 Saint Smart and then I got an Original Arduino MEGA and the motor goes fine when in backward mode but the RIGHT one does not move or move really slow. It happens the same with every mega I tried.

Did you find any solution for this?

Hello dude

First of all try to do this on your motors This will be prevent your arduino to restart itself if the motors drain much power (3x0.1μF capacitors)

Then try to connect the motors to M3 and M4 terminals @ 64khz instead of M1/M2 Ps: I think that Adafruit says that M3/M4 do not support 64khz, but I have not problem when I used this setting

Let my know if this works for you!