Inrush Current

Your source for all things Atmel.

Moderator: phalanx

Post Reply
wordyallen
Posts: 6
Joined: Sat Jun 28, 2014 8:58 pm

Inrush Current

Post by wordyallen » Fri Jul 11, 2014 8:37 pm

I'm controlling a small 12V motor (start and stop, no reverse). I remember hearing about inrush current so I wrote the code to gradually ramp up using PWM. I just don't wanna fry anything. However doing that has made the code a lot more complicated. I think its a mess right now. Can anyone help me simplify it? Or should I simply start it at full speed?

The breaking out of the ramping up loop and the steady state loop is really awkward.... here's what i have:

Code: Select all

char PLANT1; 


const int PUMP1=3;


void setup()
{
   Serial.begin(9600); 
   pinMode(PUMP1, OUTPUT);
}

void loop()
{
   if (Serial.available() > 0) //Input
   {
      PLANT1 = Serial.read(); //Read state of PLANT1

      if (PLANT1 == '1')   //Plant 1 is thirsty
      {
      Serial.println("Plant 1 is Thirsty.");
      for (int i=0; i<256; i++) //ramp to protect from high inrush
         {
            analogWrite(PUMP1, i);
	    delay(10);
	    
	    PLANT1 = Serial.read();
	    if (PLANT1 == '2')  //break out of ramp
	       {
		  Serial.println("Plant 1 is quenched.");
		  analogWrite(PUMP1, 0);
		  break;
	       }
	       if (i == 256 && PLANT1 == '1') //hold at steady state
	       {
		  i = 255;
		  	    }
	 }
       else if (PLANT1 == '2') //check for quench
       {
	 Serial.println("Plant 1 is quenched");
         analogWrite(PUMP1, 0);
	 delay(10);
       }
      delay(1000);
   }
}
   
Thanks!

jremington
Support Volunteer
Posts: 2268
Joined: Fri Jun 15, 2007 9:41 pm
Location: Eugene, Or

Re: Inrush Current

Post by jremington » Fri Jul 11, 2014 9:16 pm

A DC motor briefly draws the stall current every time it starts up, and it can draw nearly twice the stall current if it is suddenly reversed. There is nothing programmatically that you can do about that, but you can use a current-limiting motor driver to perform a soft start. PWM does not limit the instantaneous motor current, only the long term average.

What method are you using to drive the motor, and why are you worried about "inrush current"?

wordyallen
Posts: 6
Joined: Sat Jun 28, 2014 8:58 pm

Re: Inrush Current

Post by wordyallen » Fri Jul 11, 2014 11:07 pm

So are you saying that even if my PWM duty cycle starts at 1%, it will still draw the stall current?

I gave up on the gradual start. I'm starting the motor at 50% duty cycle. I'm using an NPN and flyback diode to drive.

jremington
Support Volunteer
Posts: 2268
Joined: Fri Jun 15, 2007 9:41 pm
Location: Eugene, Or

Re: Inrush Current

Post by jremington » Sat Jul 12, 2014 7:48 am

even if my PWM duty cycle starts at 1%, it will still draw the stall current
Yes. PWM applies the full voltage to the motor (for a short period of time) and by Ohm's law, the stall current flows until the armature starts rotating and generating back EMF.

Post Reply