Pages: [1]   Go Down
Author Topic: Soft Starter code using PWM to control DC Motor  (Read 1191 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!
Logged

Malaysia
Offline Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Shannon Member
****
Karma: 183
Posts: 11138
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Miami/Florida
Offline Offline
Sr. Member
****
Karma: 10
Posts: 285
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are trying to control DC already, the SCR is not a good choice. A transistor is what you need.

Logged

Perseverance is 90% of the solution. The remaining 10% is more perseverance.

Pages: [1]   Go Up
Jump to: