Shop OBEX P1 Docs P2 Docs Learn Events
BS2 + PBASIC + Easy Stepper Motor Driver + ripped motor from old HDD ... — Parallax Forums

BS2 + PBASIC + Easy Stepper Motor Driver + ripped motor from old HDD ...

wperkowperko Posts: 66
edited 2013-08-07 09:50 in BASIC Stamp
Hi,

New to putting stepper motors to work ... the idea is to learn this enough so that I might be able to make some neat visual art projects with movement and lights etc... Later maybe design a new D.A.I.R. for stepper motors a little beefier than a hobby servo motor.

But I don't know what I'm doing ... yet!

My program that got the motor turning, but isn't under very good control ... now I need to know what I'm doing wrong ... for instance ... why doesn't the motor turn reverse when I send the low to the DIR pin?

I'm using this basic wiring to a Parallax HomeWork Board for starters; http://bildr.org/blog/wp-content/uploads/2011/05/EasyDriver-Stepper-Motor-Driver2-400x722.png


' EasyStepperDrive-02.bs2

' {$STAMP BS2}
' {$PBASIC 2.5}

' BS2 Pins to Easy Driver Pins
' P0 - Dir
' P1 - Step
' P2 - MS1
' P3 - Sleep
' P4 - MS2

' Vss to Gnd on Easy Stepper Motor Driver
' Vin to M+ on Easy Stepper Motor Driver
' Vdd to +5V on Easy Stepper Motor Driver

' Declare Variables
i VAR Word

' Main Body
DO
GOSUB stepforward
PAUSE 500
'GOSUB stepbackward
LOOP
END

' Subroutines
stepforward:
FOR i = 0 TO 10
HIGH 0
HIGH 1

HIGH 0
LOW 1
NEXT
RETURN

stepbackward:
FOR i = 0 TO 50
HIGH 1
HIGH 1

HIGH 1
LOW 1
NEXT
RETURN

END



The second motor is a BiPolar Stepper motor with each wire pair separate from the other wire pair and about 4Ω on each pair.

This motor reactions are not so much different than the other motor ... the Brushless Stepper seems more controllable, but from further study on the net it seems to need a different kind of motor controller ... still I can't get the Easy Stepper Motor Drive to control the BiPolar stepper motor as I want. It does respond better with PWM inputs to the STEP pin on the Easy Stepper Motor Drive, but I need to know more;

From what I can see in the demos, the Step pin uses a PWM input … in PBASIC that's:
FOR I = 1 TO (Steps?)
PULSOUT (BS2 Pin1 connected to STEP Pin on EasyDriver), (how many pulses?)
PAUSE (how many ms?)
NEXT

For the direction do I just toggle the DIR pin Logic 1 or 0?

For the MS1 and MS2 pins do I just toggle the DIR pin Logic 1 or 0?

For the Enable pin do I just toggle the DIR pin Logic 1 or 0?

For the RST pin do I just toggle the DIR pin Logic 1 or 0?

For the SLP pin do I just toggle the DIR pin Logic 1 or 0?



http://www.schmalzhaus.com/EasyDriver/EasyDriver_v44/EasyDriver_V44_Description.png

The D.A.I.R. project: http://www.brainless.org/DAIR-Kit.html

...

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-08-06 17:17
    Are you sure it's a stepper motor?

    All the motors from hard drives I've seen were brushless.
  • wperkowperko Posts: 66
    edited 2013-08-06 17:30
    Hi,

    It has 4 wires and it doesn't turn on a straight 5V DC or AC so I presume it is a stepper motor. When applying volts to a pair the motor STEPS and STOPS, then apply the voltage to the other pair the motor STEPS and STOPS. It is turning with the Easy Stepper Driver ... I just can't seem to figure out how to control speed, steps and direction yet. It does do a floppy kind of thing when I try to do slower steps with the FOR/NEXT loops ... but without any pauses it seems to spin medium speed and smoothly.

    Pin1 - Pin2 = 1.3Ω
    Pin1 - Pin3 = 1.3Ω
    Pin 1 - Pin4 = 1.3Ω

    Pin2 - Pin3 = 2.4Ω
    Pin2 - Pin4 = 2.4Ω

    Pin3 - Pin4 = 2.4Ω

    Pin1 seems the common ... and this meets the basic criteria of a certain type of Stepper Motor.

    See: http://forums.parallax.com/showthread.php/119874-Hard-Drive-Stepper-Motor-with-high-speed-spin-up-circuit

    ...

    The second motor is a BiPolar Stepper motor with each wire pair separate from the other wire pair and about 4Ω on each pair.

    This motor reactions are not so much different than the other motor ... the Brushless Stepper seems more controllable, but from further study on the net it seems to need a different kind of motor controller ... still I can't get the Easy Stepper Motor Drive to control the BiPolar stepper motor as I want. It does respond better with PWM inputs to the STEP pin on the Easy Stepper Motor Drive, but I need to know more;

    From what I can see in the demos, the Step pin uses a PWM input … in PBASIC that's:
    FOR I = 1 TO (Steps?)
    PULSOUT (BS2 Pin1 connected to STEP Pin on EasyDriver), (how many pulses?)
    PAUSE (how many ms?)
    NEXT

    For the direction do I just toggle the DIR pin Logic 1 or 0?

    For the MS1 and MS2 pins do I just toggle the DIR pin Logic 1 or 0?

    For the Enable pin do I just toggle the DIR pin Logic 1 or 0?

    For the RST pin do I just toggle the DIR pin Logic 1 or 0?

    For the SLP pin do I just toggle the DIR pin Logic 1 or 0?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-08-06 18:19
    I really doubt it's a stepper motor. You'll need to use a brushless motor driver. I know there have been several people on the forum who have made their own drivers for hard drive motors. There's a link to Rich's forum search in post #1 of my index (see signature) I think Rich's search page works better than the forum's built-in search feature. Rich's search page should make easier to find these previous hard drive motor drivers.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-08-06 19:06
    Here's a good thread about hard drive motors. It also has information about stepper motors.
  • bsjohnbsjohn Posts: 19
    edited 2013-08-06 19:39
    Check out https://www.sparkfun.com/tutorials/400 the comments in the code example should give you a good idea how to code it with PB.

    I think first you need to set the diection once you enter your sub function, not each time through your for loop. Pin0 low to high transition for one direction, then high to low for the other direction. Also pay attention to the purposeful delays in the example, those are needed. Plus do more than 10steps, steps on a stepper are quite fine to the human eye, try a thousand steps so you can see movement.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-08-06 20:03
    bsjohn wrote: »
    Check out https://www.sparkfun.com/tutorials/400 the comments in the code example should give you a good idea how to code it with PB.

    But it still needs to be a stepper and not a brushless motor. (Though it can be argued a stepper is a brushless motor but I think a hard drive motor needs a different controller.)
    bsjohn wrote: »
    I think first you need to set the diection once you enter your sub function, not each time through your for loop.

    Not a bad idea but it shouldn't matter. The direction pin will still stay either high or low either way.
    bsjohn wrote: »
    Pin0 low to high transition for one direction, then high to low for the other direction.

    I don't think this is required nor desirable. The Arduino code uses low to high in each direction.
    bsjohn wrote: »
    Also pay attention to the purposeful delays in the example, those are needed.

    Agreed but the 500ms pause should be plenty.
    bsjohn wrote: »
    Plus do more than 10steps, steps on a stepper are quite fine to the human eye, try a thousand steps so you can see movement.

    Agreed (sort of). I'd also suggest more than ten steps but a hundred or two should be plenty. Many (most?) stepper motor have 200 steps per revolution.

    Again, all this applies to stepper motors not to brushless motors.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-08-06 21:54
    From my testing and playing with hard drive motors @Duane Degn is correct, they are not stepper motors.
  • Hal AlbachHal Albach Posts: 747
    edited 2013-08-07 09:50
    Use an Ohmmeter and see if you get readings from any two motor wires or only between two specific pairs. If you get readings from any two wires then it's probably a brushless 3 phase motor, although they usually have 3 wires. If readings are limited to two specific pairs of wires then it's probably a bipolar step motor. If it is a step motor make sure you are connecting it so that one winding is connected to A+/A- and the other winding to B+/B-. Use your meter to make sure, don't rely on the wire colors, they vary between manufacturers.
Sign In or Register to comment.