VB 2010 - "Stepper-full" controller parameter questions

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

VB 2010 - "Stepper-full" controller parameter questions

Postby kayaker » Mon Jan 14, 2013 10:31 am

Please be gentle. I am starting to learn VB 2010 from an entry level text after taking Basic, Cobol, Fortran, etc. back in the mid to late 70's. Hard slog. . .

Being impatient, I am trying to modify the "Stepper-full" sample code in VB for the Phidgets 1063 controller board to run a Phidgets 3301 Bipolar Stepper. Displaying my incompetence, my objective was to set the

velocityTrk.SetRange(-200000,200000)
currentPositionTrk.SetRange(-200000,200000)

parameters to accept variables input from the Form1 such as:

positionTrk.SetRange(-dblSteps, dblSteps)
currentPositionTrk.SetRange(-dblSteps, dblSteps)

I planned to get the variable "dblSteps" by placing "GetSteps()" at the top of the "stepper.Attach" section. dblSteps is generated from inputs and calculation in the Form1 as follows:

Private Sub btnCalcSteps_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcSteps.Click

'Calculate number of Steps required for number of full rotations
GetSteps()

End Sub
...................................................................
Private Sub GetSteps()

'Dim variables from input box
Dim StrValue As Double
Dim dblWind As Double
Dim dblSteps As Double

'Calculate Steps from Winds Value
StrValue = txtRotationsNumber.Text
dblWind = StrValue
dblSteps = dblWind * 3200

Label15.Text = Format(dblSteps.ToString("n0"))

End Sub
..............................................................

The button click would would take the value entered in txtRotationsNumber and convert it to the required Steps (based on 1.8 degrees - 16 micro steps X 200 Steps = 3,200 Steps for a full rotation).

It didn't work. My questions is how can I accomplish this from entering the desired steps from the result of a calculation in the form?

I appreciate your thoughts as I continue through the entry level VB 2010 text and the other Phidgets documentation. I know it is above my current knowledge, but I'd really like to figure it out and understand a bit better how to do it.

Take Care,

Jim. . .
Take Care,

Jim. . .

User avatar
burley
Human-Cyborg Relations
Posts: 441
Joined: Tue Sep 27, 2011 2:37 pm
Location: Calgary
Contact:

Re: VB 2010 - "Stepper-full" controller parameter questions

Postby burley » Mon Jan 14, 2013 12:17 pm

You say "It didn't work". What exactly happened?

In general you should just set the range of the sliders to be some arbitrarily large numbers. There should be no need to change the range of the sliders dynamically.

If you want the motor to perform a full rotation then you will be changing the position value not velocity or current position.
Brian Burley
403-282-7335 ext. 6003
support@phidgets.com

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

Re: VB 2010 - "Stepper-full" controller parameter questions

Postby kayaker » Mon Jan 14, 2013 2:36 pm

burley wrote:You say "It didn't work". What exactly happened?

The target range did not get updated based on how I tried to write it. I did get it working partially the way I wanted.

In general you should just set the range of the sliders to be some arbitrarily large numbers. There should be no need to change the range of the sliders dynamically.

I want to be able to change the range (number of steps) such that min to max is a specific number of full rotations. I want to use the motor to wind a specified number of winds (full rotations) and stop when it gets to the specified number of full rotations. It is for winding electric guitar pickups. Some have 6,000 winds of wire, some have 8,000 winds of wire, some have 6,800 winds of wire and so on. Some are wound clockwise, others counterclockwise. I want to wind one, then wind the next one with a different number of full rotations.
Take Care,

Jim. . .

User avatar
burley
Human-Cyborg Relations
Posts: 441
Joined: Tue Sep 27, 2011 2:37 pm
Location: Calgary
Contact:

Re: VB 2010 - "Stepper-full" controller parameter questions

Postby burley » Mon Jan 14, 2013 3:51 pm

I am not sure why you couldn't just specifiy the amount of movement you want based on the guitar type instead of adjusting the range of the slider. It is not as though you need to move the slider the full range every time. You could just set it up such that when you select guitar type A the motor moves to position A and when you select motor type B the motor moves to position B.

The range of the sliders does not need to be adjusted dynamically for this to occur.
Brian Burley
403-282-7335 ext. 6003
support@phidgets.com

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

Re: VB 2010 - "Stepper-full" controller parameter questions

Postby kayaker » Wed Jan 16, 2013 7:58 am

burley wrote:I am not sure why you couldn't just specifiy the amount of movement you want based on the guitar type instead of adjusting the range of the slider. It is not as though you need to move the slider the full range every time. You could just set it up such that when you select guitar type A the motor moves to position A and when you select motor type B the motor moves to position B.

The range of the sliders does not need to be adjusted dynamically for this to occur.


I've figured out how to modify the Stepper-full program to act as a the driver for the rotary motor as a guitar pickup winder. I can specify the number of turns (complete number of coil wraps around the bobbin) e.g. 8,000, the winder speed e.g. 60 rpm, and the acceleration to speed as a range from 1% - 100%. The progress of the parameters is displayed during the fully cycle of the wind. All these are the actual terms used and values recognized when winding pickups. I have attached an image of how I modified the interface with meaningful parameters to the winding process.

Winder_new.JPG
Winder_new.JPG (59.89 KiB) Viewed 4847 times


My next question (which I'll put in a new thread) is how to modify the Stepper-full sample program to have a bipolar linear actuator move 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.

Take Care,

Jim. . .
Take Care,

Jim. . .

User avatar
burley
Human-Cyborg Relations
Posts: 441
Joined: Tue Sep 27, 2011 2:37 pm
Location: Calgary
Contact:

Re: VB 2010 - "Stepper-full" controller parameter questions

Postby burley » Wed Jan 16, 2013 9:26 am

I imagine it would look something like this:

Code: Select all

while(count is not 0)
{
    motor position = motor position + X
    wait
    motor position = motor position - X
    count--
}
Brian Burley
403-282-7335 ext. 6003
support@phidgets.com


Return to “VB .NET”

Who is online

Users browsing this forum: No registered users and 1 guest