Preventing Starting Current Burn my Motor Driver

I have a motor driver whose voltage input ranges 12~30V, and max continuous current can be up to 30A.

Here, I want to power up a big dc motor, whose nominal voltage is 24V, and nominal current 15A.

What I'm worry about is that when I start the motor, the starting current is expected to be larger than the motor driver's capacity. to prevent this excessive current burn my motor driver, I made this psudo-code. basic idea is gradually increasing PWM signal's duty cycle from 0 to 255.

will this work?

pseudo code for arduino

#define ENABLE_BIG 12

#define PWM_BIG_PIN 10



#define DC_BIG_ON 2



#define CURRENT_SENSOR A0



//desired motor speed
int pwm = 0;

bool is_dc_big_on = false;
float big_motor_current = 0;
float V_hall_sensor = 2.5;
float Current_analog_read = 0;

void setup()

{
  //
  pinMode(ENABLE_BIG, OUTPUT);
  pinMode(PWM_BIG_PIN, OUTPUT);
  //
  pinMode(DC_BIG_ON, INPUT_PULLUP);
}

void loop()
{
  is_dc_big_on = digitalRead(DC_BIG_ON);

  Current_analog_read = analogRead(CURRENT_SENSOR);
  V_hall_sensor = (Current_analog_read)*5/1024; 
  big_motor_current = (V_hall_sensor-2.5)/0.066;

  if(!is_dc_big_on)

  {
    if(big_motor_current<=15)
    {
     pwm = addPwm(pwm, 1);
      setMotor(pwm,ENABLE_BIG,PWM_BIG_PIN);         .
    }
  }
  else
  {
    pwm = addPwm(pwm, -1)
    setMotor(0,ENABLE_BIG,PWM_BIG_PIN);
  }
}

  

int addPwm(int pwm, int addition)
{
   pwm += addition;
   if(pwm<0){ return 0; }
   else if(pwm>255){return 255;}
   else {return pwm;}

}

void setMotor(int speed, int enable, int pwm_pin)   
{                                         
  analogWrite(pwm_pin, speed);         
  digitalWrite(enable, HIGH);        
}

========================

What are these pins connected to?

Arduino pin 12 - Motor driver "enable" pin (setting this high lets motor driver run in one direction)
Arduino pin 10 - Motor driver "PWM" pin
Arduino pin 2 - a toggle switch

I see some problems.

  1. Why do you ramp down when the motor is turned off? There is no current surge in that case.
  2. Where is the timing? Doesn't the current increase have to be limited to some controlled interval?

By the way, actual pseudocode would have been more useful. What I see there is "rough C" which does not abstract the problem like pseudocode should.

Thank you for answer sir, Here's what I intended.

  1. when I turn off input to arduino pin 2, gradually reducing pwm's duty cycle, so that the motor slowly declelerates.
  2. yes, I should consider time interval. I thought the frequency of arduino running the loop function would be enough consideration.

A motor slowly decelerates by itself when power is removed. Why do you think you need to augment that?

If you are just performing a "soft start" of the motor, the actual timing will depend on the motor, the application, the power supply, etc., but no matter what those are, you should control the timing in code, not leave it to the arbitrary timing of the loop() function. As you add more code to loop(), the motor timing would become slower and slower, unless you do that... also it would be more difficult to know exactly what the timing is...

1 Like

A motor slowly decelerates by itself when power is removed. Why do you think you need to augment that?

Because I haven't studied enough. I'll make a note here, sudden stop of DC motor doesn't cause surge current...

anyway I think I can figure out that "timing" with some experiment. a way too slow acceleration can matter in terms of efficiency or speed... whatever, but not excessive surge current. right?

A sudden stop will generate a surge if you apply electromagnetic braking. If you want to stop it dynamically, that is a similar but different problem. In that case, there is no static friction in the armature to overcome. With most driving circuits, in the absence of explicit braking, there would still be some braking due to absorption of back EMF in the driver protection diodes.

The appropriate method of finding the correct timing is your personal choice as a designer. But I strongly advise you to utilize a controlled timing source such as the millis() function, rather than depending on, and perhaps having to play around with the code.

Also, some power supplies safely limit the current, so that the power supply itself might provide the protection from start up currents that you need.

I wasn't able to think about power supply. I have 24V SMPS, maximum current 20A. so there will be no such a large current that may burn my motor driver.

Is that supply powering anything else, in addition to the motor?
Have you tried connecting the motor to the supply? :slight_smile:

Here is pseudocode for millis() timing:

loop
{
if now - timestamp >= PWMinterval
  {
  timestamp = now
  if motor enabled
    {
    ++PWMvalue
    }
  else
    {
    --PWMvalue
    }
  constrain (PWMvalue, min, max)
  output = PWMvalue
  }
// other loop code runs undisturbed here...
}
1 Like

May I ask why do I need to try conencting the motor directly to the supply?
I am planning to power a number of small motors with the power supply. I don't think I need to run them at the same time.

So you don't have to guess what happens.

Have you tried connecting the motor to the supply? :slight_smile:

I can try this tomorrow. thank you for answering my dumb question, sir.

It seems working

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.