I am connecting a single motor driver pololu mc33926 to a mega but the only library I have is the dualmc33926. Can I use that same library for the single motor mc33926 or is there a different library for the single motor driver.
thanks.
I am connecting a single motor driver pololu mc33926 to a mega but the only library I have is the dualmc33926. Can I use that same library for the single motor mc33926 or is there a different library for the single motor driver.
thanks.
Hello.
We do not have an Arduino library for that motor driver, but controlling it is pretty easy. Just connect digital outputs to the IN1 and IN2 pins and a PWM output to the PWM/D2 pin. The IN pins set the operating mode (forward, reverse, or brake) the PWM pin determines the speed. All you really need are a few digitalWrite() and analogWrite() calls to the appropriate pins. Don’t forget that you will need to do something with the Enable and D1 pins to enable the driver. Please make sure you look over the product page carefully.
- Ben
ok, I set up the wiring from my uno to the single driver MC33926 and wrote a little program that writes HIGH/LOW digital to In1 and In2. Then it has a PWM pulse of 100 from D11 on the UNO and 5v and gnd from the UNO. On the other side is 5V gnd and wires to the motor.
Although the led I use to test the program works, the motor does not turn. I previously tested the motor so it does work.
My ground on the motor side is different than the ground from the digital side to my UNO. Is the ground on the motor side supposed to have the same ground as the 5v on the digital side?
How can I tel if the MC33926 is working since nothing happens.
Thanks
by the way, the not very original code is below:
// this is a pololu motor test
int ledPin = 13;
int pwmPin = 11;
int motorPin1= 7;
int motorPin2 = 8;
void setup()
{
pinMode(ledPin,OUTPUT);
pinMode(pwmPin,OUTPUT);
pinMode(motorPin1,OUTPUT);
pinMode(motorPin2,OUTPUT);
}
void loop()
{
digitalWrite(ledPin,HIGH);
digitalWrite(motorPin1,LOW);
digitalWrite(motorPin2,HIGH);
analogWrite(pwmPin, 100);
delay(500);
analogWrite(pwmPin,0);
delay(1000);
digitalWrite(ledPin,LOW);
digitalWrite(motorPin1,HIGH);
digitalWrite(motorPin2,LOW);
analogWrite(pwmPin,100);
delay(500);
analogWrite(pwmPin,0);
delay(1000);
}
Can you tell me exactly how everything is connected? A picture of your connections might help.
- Ben
Thanks, but it’s a little hard for me to see what’s connected. Can you also post a closer shot of the motor driver and specify in text what you have each driver pin connected to? What is your motor power supply and what motor are you using (e.g. do you know its stall current?)?
- Ben
Ben
This is how I connect the pins
arduino pin D11(PWM)(white wire) → pololu D2 (pin6)
arduino pin D7(green wire) → pololu IN1 (pin5)
arduino pin D8(red wire) → pololu IN2 (pin4)
arduino ground(blue wire) → pololu gnd (pin 2)
arduino 5 v (orange wire) ->pololu EN (pin 10)
and here’s a fuzzy closeup but the colors are clear and the pins shine.
Ben
I forgot
I don’t know where the motor stalls, but I do know that if I run it directly from the arduino it will turn fine when the PWM is 100 and that’s what I am using in this program.
You need to do something with D1 to prevent it from disabling the board. You can just connect this pin directly to ground.
- Ben
Ben
terrific. It works great. Thanks for your help.
joe
Hi there,
I tried that setup on a Nano (Pin 11 for PWM) with almost no luck.
The motor “sings” until a value of 90 and then starts. Not much of a control range.
Which PWM frequecy likesthis driver best ?
Hello.
The input range for analogWrite()
is 0-255, so even if it takes 35% duty cycle to get going (that is what applying an argument of 90 would correspond to in analogWrite
) it seems like you should still have a decent control range. However, that would generally seem to indicate a rather high amount of static friction and cogging torque; are you sure that your power supply and load are appropriate for your motor?
The MC33926 can operate with PWM frequencies up to 20kHz, which we like to use since it is ultrasonic. However, programming your Arduino Nano to supply that signal requires some more advanced programming. You could look at our dual MC3396 motor driver shield library as a reference for how to set up the PWM frequency, or you might check out this “Secrets of Arduino PWM” article.
- Patrick