Go Down

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


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

  // 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);
  SoftPWMSetPercent(10, 50);

  SoftPWMSetPercent(10, 0);

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


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


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.


If you are trying to control DC already, the SCR is not a good choice. A transistor is what you need.
Perseverance is 90% of the solution. The remaining 10% is more perseverance.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131