LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

linear actuator controlled with external encoder and smart motor - randomly stops

Hi,

 

This is my first experience with Labview or any sort of programming for that matter.  I am using an Animatic Smart Motor Model: SM1720M version 4.15b with an Ultra Motion Bug linear actuator: 4-2B.125-SM17-3.2-1NO-B/EC4 and a 600 series optical encoder.  I am trying to write a VI that allows me to manually control the linear actuator using the encoder.  I attached the one I have been using, but for some reason it randomly stops working, generally  when the actuator is extended about an inch and 2 1/2 inches.  It stops in the same general area, but not the exact same spot.  Any ideas?  Any help would be much appreciated!

0 Kudos
Message 1 of 2
(2,533 Views)

1. The VISA Clear and VISA Close should be outside the loop. You do not want to be re-initializing the VISA session each time through the loop.

2. You have the port initialized to use line feed as a termination character. When using termination character, you should not use Bytes at Port. Just set the byte count input of VISA Read to a constant larger than the longest message you expect to receive.

3. With the termination character you do not need the waits between or before the reads.

4. The 10 ms Wait in the outer loop is rather meaningless when the start button is True. The VISA Write takes much longer than 10 ms for the string you are writing. It does make sense to have a Wait in the False case.

5. The start button is set to Latch When Released mechanical action. With that setting it retuns to False every time it is read. The result is that the code in the True case only executes one time for each press of the button. Is that what you want?

 

A state machine architecture is more flexible and more robust.

 

As to why it stops in a particular place, you have not given us nearly enough information to even guess. What is the relationship between motor speed and displacement? Where do you do anything with the encoder? What is the format of the encoder output? How far does the motor move at various speed settings during one iteration of the outer loop? Where is the command to stop the motor when it gets to where you want it? 

 

What error messages, if any, do you get when it stops?

 

Lynn

0 Kudos
Message 2 of 2
(2,523 Views)