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.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Stepper Motor Control

Solved!
Go to solution

Hi all. I am in need of some help and suggestions . I'd like to make my code more efficient and reduce the likelihood of errors. Specifically  i'd like  to know  how to create a simple algorithm in LabVIEW to control the steps and direction of my stepper motors. At present I am just repeating my code for each stepper in several states to control the same stepper but moving a  different number of steps and direction.  I have  one stepper that controls a pump mechanism hence the flow rate. One stepper that controls front/back motion of an sample injector block system. One stepper that controls up/down motion of the injector block. I am also using an Arduino Mega 2560 ( all the drivers etc and installed) .

0 Kudos
Message 1 of 7
(10,933 Views)

Hi Charles

I have look your code , but i don't understand your process. Can you describe it step buy step if you want i help you.

Eric Bobillier (France)

0 Kudos
Message 2 of 7
(4,334 Views)

Sure. The process is as follows:

1. First set the flow rate. Stepper number one will run at constant speed to mantain the pump flow rate at whatever the user inputs.

2. When prompted to sample

  •        Stepper number two will move 'x' number os steps forward.

  •       Stepper number three will then move 'y' number of steps forward

  •       After a wait period stepper number three will move 'y' backwards and stepper number two will move backwards 'x' number of steps.

3. Stepper number one will run at constant speed to mantain the pump flow rate at the input value.

Charles

0 Kudos
Message 3 of 7
(4,334 Views)
Solution
Accepted by topic author Charles.m

Hi Charles

Here is my version, can you test it (i don't have arduino card at home) but i think it's ok. Take care i have modify pump pin numbers (show diagram).

Eric

0 Kudos
Message 4 of 7
(4,334 Views)

Ok, so I am still going through your code but first things first... thank you for your help. I will post my feedback when  I test it .

0 Kudos
Message 5 of 7
(4,334 Views)

My first release is buggy.

Here one another version who run better when you stop. Eric

0 Kudos
Message 6 of 7
(4,334 Views)

I know its been a while but I am back again. I would like some help in modifying the current code to do the following.

1. Add a second pump (12vdc) to the stepper sequence.

2. Turn a fan on/off for five minute intervals.

3. Use a hall effect sensor to measure rpm and control pump speed.

The new step by step sequence is now as follows :

1. First set the  flow rate/ pump speed for stepper number one .

  • Measure rpm using hall effect sensor and show the measurement on  a gauge. Use the measurement to adjust the pump speed . Stepper number one will run at constant speed to maintain the pump speed/ flow rate at whatever the user inputs.

2. When prompted to sample

  •        Stepper number two will move 'x' number of steps forward.

  •       Stepper number three will then move 'y' number of steps forward .

  •       Turn on 12 vdc pump for 10s.

  •       After a wait period stepper number three will move 'y' backwards and stepper number two will move backwards 'x' number of steps.

* There are 4 different sampling positions so stepper number two and three will move different steps each time the user hits sample.

3. Turn fan on/off for five minute intervals.

I have two questions. Firstly is there a better way to do the five minute intervals. In my current code I think the event structure will only read when there is  a value change ( sample button) instead of the specified time interval.  Secondly how do i incorporate the hall effect sensor measurement and control to the current code. I would appreciate any help before I butcher the code that was given to me.

Thanks in advance

Charles

Download All
0 Kudos
Message 7 of 7
(4,334 Views)