Shop OBEX P1 Docs P2 Docs Learn Events
Motors keep running??? strange.... — Parallax Forums

Motors keep running??? strange....

Technic-R-CTechnic-R-C Posts: 117
edited 2008-03-30 15:45 in BASIC Stamp
Hello,
·· Hi have a question in regards to a motor that i am controlling with a HB-25.· The problem arises from the fact that·my DC·motor does not stop at the end of the program execution.· Instead it keeps on spinning very slowly.· At the moment, I am using a 9.6 volt fairly high amperage rechargable battery, a HB-25, a BS2px,·and a very small DC motor.· I have tried stopping the wheel that is driven by the motor with my hand after the program has executed, but the motor continues to spin.· Can anyone provide me with some information on what is going on.· I think that the·DC motor might still somehow be receiving power from the battery even after shut down, but I am just guessing. (code below)· I tried replacing the small motor with another bigger motor and·the bigger DC motor stops at the end of the ocde and does not continue spinning.· I have also incorporated LED's into the design to check if the program gets executed until the very end and the LED's indicated the the program had executed all the way.
All help is appreciated
Technic-R-C

'   {$STAMP BS2px}
'   {$PBASIC 2.5}

' -----[noparse][[/noparse] I/O Definitions ]------------------------------------------------- 

 
HB25 PIN 15                             ' I/O Pin For HB-25 

' -----[noparse][[/noparse] Variables ]------------------------------------------------------- 

 
index VAR Word ' Counter For Ramping 

' -----[noparse][[/noparse] Initialization ]-------------------------------------------------- 

DO : LOOP UNTIL HB25 = 1                ' Wait For HB-25 Power Up 
LOW HB25                                ' Make I/O Pin Output/Low 
PAUSE 5                                 ' Wait For HB-25 To Initialize 
PULSOUT HB25, 1875                      ' Stop Motor 1 


' -----[noparse][[/noparse] Program Code ]---------------------------------------------------- 
Main: 


PAUSE 20                                ' Wait 20 mS Before Ramping 

 
FOR index = 0 TO 150                    ' Ramp Up To Full Speed 
  PULSOUT HB25, 1875 + index            ' Motor 1 Forward 

  PAUSE 20                              ' 20 mS Smoothing Delay 
NEXT 

 
PAUSE 2500                              ' Wait 2.5 Seconds 

 
FOR index = 150 TO 0                    ' Ramp Back Down 
  PULSOUT HB25, 1875 + index            ' Motor 1 Forward Slowing 
  PAUSE 20                              ' 20 mS Smoothing Delay 
NEXT 

STOP                                    ' Use STOP To Prevent State Change 

END

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-03-30 14:58
    if you try PULSOUT HB25, 1875 what do you get? You may need to adjust that number for full stop.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-30 15:00
    The HB-25 normally continues running the motor at the last speed and direction it was sent. The STOP statement doesn't do anything to the HB-25. It only affects the Stamp processor. There is a Communications Timeout Mode that can be enabled (see the documentation for the HB-25) that causes the motor to stop if the HB-25 doesn't receive a control pulse for 4 seconds.
  • Technic-R-CTechnic-R-C Posts: 117
    edited 2008-03-30 15:33
    For the BS2px, full stop is equal to 1875 so that can't be the problem.· If it ramps up·to 2025 and ramps back down to 1875, then the motor should stop.··Is there a chance that·some current is still able to·access the DC motor?·

    Any other ideas?

    Technic-R-C
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-30 15:45
    As Franklin suggested, 1875 may not be the right value for a full stop. Experiment with values around that (like 1850 to 1900) to see what value actually stops the motor. I strongly suggest using the Communications Timeout Mode as well.
Sign In or Register to comment.