Go Down

Topic: Soft Starter code using PWM to control DC Motor (Read 2055 times) previous topic - next topic

maraldz

Hey guys, I'm pretty new at programming but I heard an Arduino is a great micro controller to help me get started.

I need the proper PWM code to implement a soft starter to control a DC motor. An SCR configuration will be used to drive the motor, but I need to use my Arduino Uno to adjust the duty cycle in order to control the phase angle of the SCR. I have been playing with a general PWM code shown below:

#include "SoftPWM.h"

void setup()
{
  // Initialize
  SoftPWMBegin();

  // Create and set pin 10 to 0 (off)
  SoftPWMSet(10, 0);

  // Set fade time for pin 10 to 100 ms fade-up time, and 500 ms fade-down time ( I do not know the relevance of this )
  SoftPWMSetFadeTime(10, 100, 500);
}

void loop()
{
  // Turn on - set to 100%
  SoftPWMSetPercent(10, 100);
  delay(2000);
 
  SoftPWMSetPercent(10, 50);
  delay(2000);

  SoftPWMSetPercent(10, 0);
  delay(2000);
}
///////////////////////

This is just to get the feel of how I can adjust the duty cycle for my application. I'm unsure what I need to know about the Arduino's frequency specifications and what not.
If you guys have any suggestions or a better PWM code to try out I would greatly appreciate it. Thanks a lot!!

ash901226

one idea is to use for loop that would give you your softstart

PeterH


I have been playing with a general PWM code shown below:


You could code the whole thing yourself, but the SoftPWM library seems to be exactly what you need and it looks to me as if you already have the basis of a working solution. Does it do what you want?
I only provide help via the forum - please do not contact me for private consultancy.

arduinoadrian

If you are trying to control DC already, the SCR is not a good choice. A transistor is what you need.
http://www.youtube.com/watch?v=Ns2IbNM1o8I
http://www.youtube.com/watch?v=ZgoKRlh9T5Y
Perseverance is 90% of the solution. The remaining 10% is more perseverance.

Go Up