Dual MC33926 PWM problem

Hello,

I am trying to run the motor given on the link (http://www.pololu.com/catalog/product/2286) with Dual MC33926 but I've run into several problems. First let me explain my setup:

I am using Dual MC33926 driver with this pin configurations:

EN -------- Arduino Digital 7 M1IN1----- Arduino Digital 4 M1IN2----- Arduino Digital 5 M1D2 ----- Arduino Digital 10 (PWM) M1D1 ----- Arduino GND 1 GND ------ Arduino GND 2 VDD ------- Arduino 5 V VIN -------- Power Source (+) 7 V GND ------- Power Source (-) M1OUT1 and M1OUT2 to Motor

and I am using this code:

#define stby 7
#define motoryon1 4
#define motoryon2 5
#define motorhiz 10

int incoming=0;
int derece;
void setup(){
  
  pinMode(stby,OUTPUT);
  pinMode(motoryon1,OUTPUT);
  pinMode(motoryon2,OUTPUT);
  digitalWrite(stby,HIGH);
  digitalWrite(motoryon1,HIGH);
  digitalWrite(motoryon2,LOW);
  Serial.begin(9600);
}

void loop(){
  
  if(Serial.available()>0){
    incoming=Serial.read()-'0';
  }
   derece=map(incoming,0,9,0,255);
   analogWrite(motorhiz,derece);
   Serial.println(derece);
   delay(1000);
}

As you can see I am giving a number from Serial port and then mapping it to PWM values. Normally the motor is running but when I watched the signal with an oscilloscope I've seen some problems:

  • Firstly my motor is not running until the PWM rate is 120 (assuming full PWM is 255), so it starts to run with high velocity, but I need to start running on slower speeds. When I measure the voltage on lower PWM like 50 I see 0.3-0.5 V but it supposed to be higher when you calculate it with a linear relation (e.g. x/7v = 50/255). On the other hand when the motor is running I can decrease PWM rates to for example 50 and I see voltages like 1.2-1.5 V.

  • Second problem occured when I measured the output signal given from MOUT pins. Here it means the PWM outputs. When I doesnt give a PWM rate from Arduino the voltage output stays at zero as expected. However when I start to run the motor with 1/2 duty cycle. The signal I see has a square wave with its amplitude on 7 V and its base on 2 V which should be 0 V. Well this explains why I measure highter voltages than I expected on different PWM rates but I still doesnt understand why this problem happens. Additionally the wave I see on oscilloscope is not an exact square wave. The rising edge seems a bit leaned.

I will be glad if you can tell me how to fix this problems. Normally I am trying to do position control on my motor with a potantiometer. However It starts to run on high speeds so I get errors like 80-90 degrees, which makes it hard to control with PID or something like that. Thanks for the help already

What frequency are you running the PWM at? If it is to high the motor will display such behavior. You have to look at the current for each pulse to see if there is sufficient time for the current to rise. This will be determined by the Inductance or reluctance of the the motor coils. So you have to determine the delta I over delta T. Use a current probe and a scope to look at the current through the motor winding. You could also look at the motor spec to find the coil inductance and determine what max frequency you can apply.

xf = 2*pie*(1/sqr of L*C) I think,not to sure about the formula (Its been a long time)