Shop OBEX P1 Docs P2 Docs Learn Events
Stepper Control Questions — Parallax Forums

Stepper Control Questions

CharlieCCharlieC Posts: 14
edited 2005-03-12 21:03 in BASIC Stamp
I am·learning how to use the BS2 and a stepper.· I am using a stepper that seems to be the same as the one that parallax sells and the homework board.· (attached picture)

It seems to be working fine and I (almost) understand the code (stollen and modifyed from parallax stepper docs - attached), but I have a couple questions.

1)· The stepper is rated at 12 volts and I am feeding it with only 9v from Vin.· Can this damage the motor?· Can this damage the bs2?· I've see in various docs that I need a separate power supply for motors.· I have assumed that this means separate from the regulated power going to the actual bs2 chip.

2)· In the code, the StpsPerRev is accurately set at 48.· I figured that if I increase this number, it will just cause the stepper to move beyond a full revolation (times five in this code), and this is true if I increase it· up to 51.· But anything beyond 51 causes the stepper to turn continiously.· Why?

Thanks



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Charlie Chisholm

That part, at least,·I'm sure of.
930 x 536 - 23K

Comments

  • NewzedNewzed Posts: 2,503
    edited 2005-03-12 14:19
    Your stepper requires X amount of power to operate efficiently.· If you run it at 9 volts when it is designed for 12 volta, then the stepper will try to draw more current in order to satisfy the power requirements.· This current, which will be higher than the rated current, could damage your stepper.· Run the stepper at the voltage it is designed for.

    If it runs continuously when you pulse it more than 51 times there is an error in yiour code somewhere.· Your loop to run the stepper should look something like this:

    for x = 1 to whatever
    pulsout pin, 10············ 'pulse width of 10 = 20 us
    next
    'go to next instruction.





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    NEW! 4 MB EEPROM

    http://hometown.aol.com/newzed/page4.html
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-03-12 19:05
    Charlie,

    ·· Seeing that you are using a 9V battery to power your board and the stepper motor, I'm actually kind of surprised that it's turning the stepper motor at all.· You really should get a separate power supply for the stepper motor, and make sure there is a common ground.

    ·· As for the stepper motor turning contiuously, I didn't look at your code, but one thing you could check is to see if the stepper motor is causing the BS2 to brown-out.· You can do this by adding the following code before your main loop:

    DEBUG "Program Running...", CR
    

    You should see the text, "Program Running..." on the screen once.· If you see it printing more than once, then the program is restarting due to brown-out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Tech Support
    csavage@parallax.com
  • duckieduckie Posts: 12
    edited 2005-03-12 20:28
    I wouldn't worry too much about running the motor on 9 volts. If it runs on less than 12 volts, great! Just about any elementry DC electronics info source will tell you that (volts) = (current in amps) x (resistance in ohms) And the resistance of your motor isn't going to change a great deal under normal operationg conditions. So, if you reduce the voltage, you will also reduce the current. The tradeoff is that you get less power out of your motor.

    You will probably drain your battery quick. If you can find a 9volt (or 12volt) "wallwart" power supply that you can savotage, that would be prefered.

    I don't know anything about your code, so I can't really help you there. I've come to parallax looking for a solution to a specific problem so am super new to this product.
  • CharlieCCharlieC Posts: 14
    edited 2005-03-12 21:03
    Well, i figured out the running continues part....

    In the code, I had ....

    idx··········· VAR· byte····· · ' for the counter
    stpsPerRev CON 48·········· ' steps per revolution

    for looping through the 1 to 48 positions.

    In the code, I had modified the loop to be

    for idx = 1 to stpsPerRev * 5· ' for five revolutions

    So as long as I left stpsPerRev at 48, (or below 52), I was fine.· But going beyond 51, I would·over-run the idx with a number beyond it's max 255·

    It was interesting that I tried your suggestion, Chris, and found that it was only starting the program once, but when I put a DEBUG inside the idx loop to indicate it's value, the display got very bizaar indeed.· Obvious memory location over-run.

    I will now separate the power supplies (removing· the question of damaging the motor or the BS2) and move on to the next learning experience.

    Thanks


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Charlie Chisholm

    That part, at least,·I'm sure of.
Sign In or Register to comment.