+ Reply to Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    116

    Default PWM Motor Control with Soft Start, Soft Stop Example Please

    Hi All,

    It has been a while!

    I need to drive a small 12v motor with PWM speed control to include soft start and stop. I would like to keep the circuit board small and I have a bunch of 675's at my disposal. Ultimately I would like to use a single pot to determine both speed and direction with half-way being the motor stop position. Can you point me to some fairly simple code examples (it has really been a while :-) to get me going?

    Thank you!!!

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  2. #2
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    222

    Default Re: PWM Motor Control with Soft Start, Soft Stop Example Please

    Ross

    Here's a snippet of some old code that might get you started with the pot control:

    Code:
    DEFINE ADC_BITS     8   ' Set number of bits in result
    DEFINE ADC_CLOCK    3   ' Set clock source (3=rc)
    DEFINE ADC_SAMPLEUS 50  ' Set sampling time in uS
    
    Speed   VAR WORD
    Wait_1  VAR WORD
    
    ' Turn ON every other output varying speed with pot from center
    Pots:
        ADCIN 1, Speed
        
        IF Speed < 128 THEN       'Checks if pot in CCW position range
        wait_1 = ABS(Speed-128)   'Sets pot value to increase in CCW direction
        PORTC = $50               'Turn outputs 4 and 6 ON
        ENDIF
        PAUSE wait_1              'Pause with new pot value
        PORTC = $0                'Turn OFF all outputs
        
        IF Speed >= 128 THEN      'Checks if pot in CW position range
        wait_1 = (Speed-128)+1    'Sets pot value to increase in CW direction
        PORTC = $A0               'Turns outputs 5 and 7 ON
        ENDIF
        PAUSE wait_1              'Pause with new pot value
        PORTC = $0                'Turn OFF all outputs
    
    GOTO Pots
    This routine sets the pot to a plus/minus from center position for direction and speed value. Change the A/D to 10 bit for better resolution.
    It doesn't have dead band gap in center for the OFF position but you can change that.
    Then instead of using the A/D value for the "PAUSE wait_1" control, use it to adjust your PWM signal.
    Louie

  3. #3
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    116

    Default Re: PWM Motor Control with Soft Start, Soft Stop Example Please

    Thank you for replying Louie!

    Soooo... I'm leaning towards ditching the dead-band and throwing in a DPDT slide switch on the board edge. The switch determines motor direction and that leaves me with PWM motor speed and Soft Start/Stop. To get up and going, I'm going to put a resistor/capacitor timer between the pot and the A/D pin. Power to the pot will be through a foot switch. When power is supplied, the capacitor charges through the pot position and resistor. When power is removed, the capacitive charge drains back through the resistor and pot. That gives me soft start/stop. I'll get that going first then move to writing code to eliminate the RC circuit.

    Any thoughts, suggestions, wise-cracks?

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  4. #4
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    222

    Default Re: PWM Motor Control with Soft Start, Soft Stop Example Please

    Your method simplifies it enough to get it started, especially after a long break.
    I'm guilty of diving fingers first with "intentional coding" then get stuck with paralysis of analysis.
    Louie

  5. #5
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    116

    Wink Re: PWM Motor Control with Soft Start, Soft Stop Example Please

    Amen to that brother!
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,910

    Default Re: PWM Motor Control with Soft Start, Soft Stop Example Please

    Since you have the software, why would you put extra hardware for the soft start part?

    Consider a loop with maybe a for-next to increase the PWM to the set point gradually.

    Ioannis

Similar Threads

  1. Soft-start for mains LEDs?
    By ardhuru in forum Off Topic
    Replies: 10
    Last Post: - 29th September 2015, 14:54
  2. Soft On/Off switch
    By Audette in forum General
    Replies: 6
    Last Post: - 18th August 2012, 19:54
  3. 'Soft' On/Off Power Switch
    By Art in forum General
    Replies: 19
    Last Post: - 14th November 2008, 01:54
  4. Cad Soft Eagle?
    By fowardbias in forum Off Topic
    Replies: 1
    Last Post: - 4th September 2008, 08:28
  5. HT-Soft C compiler issues
    By ken_mazur in forum General
    Replies: 1
    Last Post: - 19th October 2006, 14:10

Members who have read this thread : 28

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts