PDA

View Full Version : help in step motor




kishkashta
Feb 22, 2006, 01:51 AM
I have a project in my school and I need a way to controll the step motor.
it is a floppy step motor with 2 coils and I need something that will conect between the micro and the engine, so I could give an prder to the motor to turn right or left. I'm only in highschool so plz if you can make it simple do so.
thx



demallien
Feb 22, 2006, 05:34 AM
I have a project in my school and I need a way to controll the step motor.
it is a floppy step motor with 2 coils and I need something that will conect between the micro and the engine, so I could give an prder to the motor to turn right or left. I'm only in highschool so plz if you can make it simple do so.
thx

My advice would be to not do it with a Mac. They don't have any ports that are simple to control at the application level. Actually, to do simple control on stepper motor, the easiest way is just to wire up a simple electrical ciruit - stepper motors are designed to be easy to control.

Alternatively, I happened to have to control a stepper motor as part of my thesis for my elec. eng degree (automatic shifting on a bicycle). But again, the simplest way was to use a small microcomputer that gave direct access to CPU ports.

Assuming you absolutely HAVE to use a mac, the simplest way I can think of is to get a USB -> RS-232 converter, and then write an app that sends differnt bytes "down the line". At the other end of the line you stick an RS-232 controller chip, and you pick of the stepper motor control signals on the controller's output...

Anyone got a better idea? :-)

savar
Feb 22, 2006, 01:49 PM
I have a project in my school and I need a way to controll the step motor.
it is a floppy step motor with 2 coils and I need something that will conect between the micro and the engine, so I could give an prder to the motor to turn right or left. I'm only in highschool so plz if you can make it simple do so.
thx

Whoa--that's a very advanced project for a high school student. There isn't a cheap answer that's pre-built. If you can't build it yourself, ask your teacher about it.

What is the end goal that you're trying to achieve? An RC servo motor may be more appropriate.

notjustjay
Feb 22, 2006, 04:01 PM
Personally, I'd use a parallel port, since it's easy to wire 4 data lines from the port to the 4 activation wires in the stepper motor (through a power transistor, please!!!)

Then you can write software to cycle the bits in the appropriate sequence. For example, say you had a 4-wire stepper and the step sequence is:

0001 --> 1
0010 --> 2
0100 --> 4
1000 --> 8

Then your pseudocode would look something like:

repeat (for as long as you need)
output 1
delay a few ms
output 2
delay
output 4
delay
output 8
end repeat

On a PC, in QuickBasic, it might be as easy as:

OUT 888, 1
OUT 888, 2
(and so on)

To reverse the direction, just reverse the output order. There are also other bit patterns you can use, depending on the particular step sequence of the motor in question.

... I used to LOVE this stuff in high school and university (systems engineering degree... :) ) I did my fourth-year university project on a stepper-motor and servo-controlled pan/tilt camera unit for an autonomous robot, which was pretty fun...

edit: hmm, OP refers to a two-coil motor, which is going to be bipolar, and therefore might not be quite as easy to control without building a little bit of additional circuitry (e.g. an H-bridge). My write-up above is for unipolar motors... if you can find one of those, it'll probably be easier for you...

edit2: here's a sample bipolar motor controller which uses 2 discrete CMOS IC's (a dual flip flop and a quad XOR) and a 10 MOSFETs to build the H-bridge... http://www.web-ee.com/Schematics/Stepper/stepper.htm It wouldn't be too difficult to breadboard or perfboard this.

What's nice about this is that once built, you only need to generate a clock source, enable, and a direction signal. If your motor is only ever going to operate at one speed, you could "permanently" wire an oscillator into the CLK input of the flip-flops, and then just use the enable and direction signals. You could easily drive that from RS232 (just toggle some signal lines like DTR, RTS)...