From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Stepper Motor Driver

Code and Documents

Attachment

Download All

More experienced users will likely tell me I did this the hard way. It sure felt like it.

The LEDs on the screen indicate the the steps for several UNI-POLAR motors (nmbtc.com) that I swiped out of an old printer. I've tried this setup on several different Uni-Polar motors (6-wires; 2 sets of three) and it functions well.

I used a DAQ Express to wire the output to NI USB--6008. It uses the first four ports of the DO (p0.0, p0.1, p0.2, p0.3) to send the binary signal to the appropriate wire.

I never was able to figure out how to simultaneously have the LEDs and the motor output.

There is also a delay when changing directions; it doesn't fully change until the steps get back to Zero.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
ROVERFixer
Member
Member
on

Oops... The first version of the ~DAQ vi was incorrect; corrected.

Jeck avla
Member
Member
on

i would like to ask how did u conect the motor to the DAQ??

ROVERFixer
Member
Member
on

I'm using a 6-wire stepper motor. As you are probably aware, two of these six wires are common power wires. The remaining four wires I connected to a breadboard with each wire attached to the output pin of its own darlington transistor. These transistors (hence, the motor) I powered with an external 15V DC power supply.

Then, P0.0, P0.1, P0.2, & P0.3 were used (configured as a Port) to activate the transistors in sequence.

Contributors