LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Arduino to control a stepper motor.

Hi I am pretty new to using Labview and Arduino, I want to control a stepper motor, the motor I am using is a SM-42BYG011-25, it has 200 steps per revolution at 1.8 degrees. I just want to make a program that has a user defined step input, where say, I tell the program i want to step 30 times.

to control the motor I am using the easy driver motor driver .

I was thinking of using a formula node and putting C code in that to control the motor? would this work?

I would really appreciate if someone could point me in the right direction. Any help would is appreciated.

Cheers

Ben

0 Kudos
Message 1 of 11
(7,234 Views)

I am having a hard time relating what you want to do with the Arduino Stepper motor.VI that comes with LIFA.   What are you trying to accomplish with your modifications to the Arduino Stepper Motor.VI?

hrh1818

Message 2 of 11
(3,929 Views)

Hi hrh1818,

I'm working on a project that needs to control the position of an antenna along a horizontal axis, taking signal strength measurements at each position.  I want to use the Arduino Stepper Motor VI to tell the motor to move a certain distance, then take a reading of signal strength at that position.  Once a signal reading has been taken, then I want to motor to move to the next position (another distance along the horiztonal axis).  For example, starting at point 0, take a reading, record this reading, then move to the next position, record another reading.  This process needs to be repeated to take a defined number of readings (I will define the number of readings from a control on the front panel).  I hope this helps to clarify, please let me know if it doesn't!

Message 3 of 11
(3,929 Views)

Further to the above - I was trying to use the stepper motor VI, however I couldn't get it to step the motor properly, when I input the number of steps to move ie, I want my motor to rotate one full revolution which should be 1600 micrsteps as the easydriver is defaulted to 1/8th of a step and 200 divided by 1/8 = 1600, using the VI it steps less than a quarter of a revolution?.

I was thinking of using the Digital Write VI & PWM Write VI's in the low level options in the arduino library - just not sure which is the best way to make them do the above...

Thanks

Message was edited by: Ben3

0 Kudos
Message 4 of 11
(3,929 Views)

I would suggest not abandoning the Stepper Motor VI just yet.  Many people have gotten it to work.

How many "steps" to do you have to tell the VI to do to get 1 revolution?  Is this number consistent or does it fluctuate alot?

0 Kudos
Message 5 of 11
(3,929 Views)

Hi Nathan,

One revolution for my motor equals 200 steps, but my motor driver defaults to 1/8th of that step which means that I need to to 1600steps to get one revolution. I can step the motor successfully using the arduino sketch platform and I have confirmed that 1600micro steps is one complete revolution. When I try and achieve this using the steppor motor VI it only turns about 1/4 of a turn and yes it does fluctuate, if by fluctuate you mean the movements are unreliable and it does not stop at the same spot when I try o step it.

I have had a little success today where by I have used the digital write and pwm write VI's and I am able to move the motor by changing a boolian input into the pwm and the direction the same way but into the digital write.

cheers

Ben

0 Kudos
Message 6 of 11
(3,929 Views)

Hello Ben,

You  are not the first one to have problems with the nimbler of steps being off by a factor of 4.  See:

<https://decibel.ni.com/content/thread/12365?tstart=330>

What type of signal is the "Signal Strength" signal"   Is it an analog signal or some other type?

hrh1818

0 Kudos
Message 7 of 11
(3,929 Views)

thanks, that cleared up a few things.

I am aquiring an RF signal, I am then converting this analogue signal to a digital signal. I have already developed the code which connects with a spectrum analyser, grabs this signal. I am currently putting this into an excel spreadsheet, what I want the code to do is wait until I have received this signal before moving the motor, or in this case an antenna to the next step to measure the RF signal.

0 Kudos
Message 8 of 11
(3,929 Views)

Hello Ben3,

Thank you for your reply. 

How can you tell when "you have received the signal"?  Is it a visual indication or is it an electrical signal generated?

Because there is a "number of steps off by 1/4 problem"  it looks like LIFA is a poor fit for your project.   My suggestion is to use one of the Easy Driver programs you find on the Internet and Interrupts. You would configure the Easy Driver program to run a fixed number of steps each time an interrupt occurs.  the interrupt could be either a manual switch closing or an electrical signal. 

LIFA is a poor choice for producing a pulse signal to drive an Easy Driver.  The pulse rate is low compared to what can be produced by an Easy Driver program running on an Arduino. 

hrh1818

0 Kudos
Message 9 of 11
(3,929 Views)

Ben3,

The Stepper Motor Example works.  Keep playing with it and look at other's examples.  Adjust the amps on the Driver Board.  If it is set to low the motor will skip steps.  I contorl two neutral density filter wheels for an infrarerd setup.  Without LabVIEW and Arduino it would have cost us $4K.  I made it for under $300.

0 Kudos
Message 10 of 11
(3,929 Views)