Hello,
I’ve been trying to PWM through the D pins of the MC33926 motor driver using Ardunino Duemilanove.
I can successfully PWM through the IN pins and the motor and shield seems to be working fine if I ignore the D pins and only use the IN pins. However, I’d like to PWM through the D pins.
Here are my connections:
EN - 2
SF - 3
D1 - 11 (PWM)
D2 - 10 (PWM)
IN1 - 9 (PWM)
IN2 - 6 (PWM)
GND - GND
VIN - 12V power supply
GND - GND
OUT2 - Motor (+)
OUT1 - Motor (-)
All my grounds are connected together to make a common ground.
Here’s my simplified code:
int ledPin = 13;
int enPin = 2;
int d1Pin = 10;
int d2Pin = 11;
int in1Pin = 9;
int in2Pin = 6;
int sfPin = 3;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(enPin, OUTPUT);
pinMode(d1Pin, OUTPUT);
pinMode(d2Pin, OUTPUT);
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
pinMode(sfPin, INPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(enPin, HIGH);
digitalWrite(in1Pin, HIGH);
digitalWrite(in2Pin, LOW);
digitalWrite(d1Pin, LOW);
analogWrite(d2Pin, 100);
delay(5000);
}
I’m simply trying to control the motor with PWM through D2 pin, but when I run this code, the motor just runs at its top speed and the voltage at OUT2 is 12V.
I have tried many different things, like changing the HIGH/LOW of the different pins in all possible combinations (tedious!!).
I’ve attached pictures of my setup:
It seems as though it doesn’t matter whether the D pins are low or high or whatever combination.
I’d be happy to explain further exactly what I’ve tried.
Thanks
- Mars