VB 2010 - linear actuator coding on 1063?

Supporting Visual Studio on Windows
kayaker
Phidgetly
Posts: 35
Joined: Thu Jan 03, 2013 3:58 pm
Contact:

VB 2010 - linear actuator coding on 1063?

Postby kayaker » Wed Jan 16, 2013 8:02 am

Another newbie question. . . How would I modify the Stepper-full VB sample program code to have a bipolar linear actuator move at a specified velocity a specified number of steps in one direction, then reverse and move the same number of steps in the opposite direction, continuing until the engaged control has reached the specified total steps?

Ultimately I want to run two 1063's on for each of two motors from a single VB program. One a linear actuator motor is to travel back and forth a predetermined number of steps at a predetermined velocity until the second rotary motor has traveled a specified number of steps. The velocity of the linear actuator motor being a function of the velocity of the rotary motor.

Thanks in advance.
Last edited by kayaker on Wed Jan 16, 2013 11:30 am, edited 1 time in total.
Take Care,

Jim. . .

User avatar
mparadis
Site Admin
Posts: 643
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: VB 2010 - linear actuator coding on 1063?

Postby mparadis » Wed Jan 16, 2013 8:47 am

In order to move the actuator as you've described, you'll first need to zero the position of the actuator. Some linear actuators come with limit switches built-in to make this process easier. If you don't ensure the actuator is in a known position when the program starts, it won't behave the way you expect it to. Once the actuator is in a known position, for example, it's most contracted position, you can set a loop that follows this sort of pattern:

Set actuator to zero position.
Do While rotary motor is not stopped,
actuator target position = (# of 16th steps needed to reach maximum position)

Do While actuator is not stopped,
Wait.
Loop

actuator target position = 0

Do While actuator is not stopped,
Wait.
Loop

Loop

To see the actual function calls for initializing a 1063 and setting the target position, take a look at the sample code. To check whether a motor is stopped or not, get the "Stopped" boolean. If stopped is true, the motor is not moving. (Although it's worth mentioning that if the motor stalls, the program will still consider the motor to be moving because it's still receiving a signal from the controller). Hope this helps!

Mike Paradis

kayaker
Phidgetly
Posts: 35
Joined: Thu Jan 03, 2013 3:58 pm
Contact:

Re: VB 2010 - linear actuator coding on 1063?

Postby kayaker » Wed Jan 16, 2013 9:12 am

mparadis wrote:In order to move the actuator as you've described, you'll first need to zero the position of the actuator. Some linear actuators come with limit switches built-in to make this process easier. If you don't ensure the actuator is in a known position when the program starts, it won't behave the way you expect it to. Once the actuator is in a known position, for example, it's most contracted position, you can set a loop that follows this sort of pattern:

Set actuator to zero position.
Do While rotary motor is not stopped,
actuator target position = (# of 16th steps needed to reach maximum position)

Do While actuator is not stopped,
Wait.
Loop

actuator target position = 0

Do While actuator is not stopped,
Wait.
Loop

Loop

To see the actual function calls for initializing a 1063 and setting the target position, take a look at the sample code. To check whether a motor is stopped or not, get the "Stopped" boolean. If stopped is true, the motor is not moving. (Although it's worth mentioning that if the motor stalls, the program will still consider the motor to be moving because it's still receiving a signal from the controller). Hope this helps!

Mike Paradis


Thanks Mike. Is there a reference that describes the syntax off all the calls for VB 2010 .NET that are used in, say, the Stepper-full sample program? The syntax references I see on the Phidgets website for the 1063 appear more generic (as in not the same) as the types of communications commands I see the Stepper-full to interface with the controller. Or, is my newbie(ish) just so bad I can't see.

The linear actuator I am looking at has a hall effect sensor at the retracted end of the stroke. On that, in terms of the 1018_2 - PhidgetInterfaceKit 8/8/8, would the hookup of the hall effect sensor be done through the digital or analog inputs? Dumb newbie questions I know.

Thanks in advance.
Last edited by kayaker on Wed Jan 16, 2013 11:30 am, edited 1 time in total.
Take Care,

Jim. . .

User avatar
mparadis
Site Admin
Posts: 643
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: VB 2010 - linear actuator coding on 1063?

Postby mparadis » Wed Jan 16, 2013 9:29 am

Visual Basic uses our COM library- you can read the COM API manual here. The names of all of the functions and members should be the same as described in this manual, although you'll have to write it in Visual Basic syntax like in the examples.

As for the hall effect sensor, what sort of output does it provide? Is it a simple signal that jumps from 0 to 5 volts when the limit is reached? If so, you could use a digital input. If the signal varies from 0 to 5 volts depending on the position of the actuator, an analog input would be ideal. If it provides a quadrature output, you'd need an encoder input to read the position of the actuator.

kayaker
Phidgetly
Posts: 35
Joined: Thu Jan 03, 2013 3:58 pm
Contact:

Re: VB 2010 - linear actuator coding on 1063?

Postby kayaker » Wed Jan 16, 2013 11:27 am

mparadis wrote:Visual Basic uses our COM library- you can read the COM API manual here. The names of all of the functions and members should be the same as described in this manual, although you'll have to write it in Visual Basic syntax like in the examples.

As for the hall effect sensor, what sort of output does it provide? Is it a simple signal that jumps from 0 to 5 volts when the limit is reached? If so, you could use a digital input. If the signal varies from 0 to 5 volts depending on the position of the actuator, an analog input would be ideal. If it provides a quadrature output, you'd need an encoder input to read the position of the actuator.

Thanks for the link to the documentation Mike.

I have attached the technical stuff on the hall effect sensor that will be attached to the linear actuator. Can you tell me if this sensor will connect to 1018 Phidgets Interface Kit 8/8/8 analog or digital input?

Hall_sensor.JPG
Hall_sensor.JPG (93.36 KiB) Viewed 5703 times

Thanks again for all your patience.
Take Care,

Jim. . .

User avatar
mparadis
Site Admin
Posts: 643
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: VB 2010 - linear actuator coding on 1063?

Postby mparadis » Thu Jan 17, 2013 9:12 am

From the diagram, it looks like you could connect this sensor to a digital input, and you could connect the sensor's power and ground to the exposed +5V and ground terminals on the InterfaceKit. When the hall effect sensor becomes active, it will switch the digital input line to ground, which will register as a logical "True" on the InterfaceKit's active-low digital inputs.

kayaker
Phidgetly
Posts: 35
Joined: Thu Jan 03, 2013 3:58 pm
Contact:

Re: VB 2010 - linear actuator coding on 1063?

Postby kayaker » Thu Jan 17, 2013 11:37 am

mparadis wrote:From the diagram, it looks like you could connect this sensor to a digital input, and you could connect the sensor's power and ground to the exposed +5V and ground terminals on the InterfaceKit. When the hall effect sensor becomes active, it will switch the digital input line to ground, which will register as a logical "True" on the InterfaceKit's active-low digital inputs.


Thanks Dave.

In the "Stepper-full" sample program, where do the scroller/slider objects come from? I don't see them as part of the Controls in the Toolbox when I am designing a form in VB 2010 Express.

Thanks in advance.
Take Care,

Jim. . .

User avatar
mparadis
Site Admin
Posts: 643
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: VB 2010 - linear actuator coding on 1063?

Postby mparadis » Fri Jan 18, 2013 8:39 am

The sliders and all of the pieces of the interface are stored in Form1.frm. I'm not sure how these elements are accessed in Visual Basic 2010... I know that in Visual Studio 2005, they get put into Form1.vb. It's possible the express version does not have a graphical editor, so you may have to open Form1.frm directly in a text editor and edit the elements that way.


Return to “VB .NET”

Who is online

Users browsing this forum: No registered users and 1 guest