Component: Stepper motor base (Mechatronics)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.2 (Release)
Category Mechatronics


Image Stepper motor base component

Enables the creation of a stepper motor component by specifying objects for its appearance. 'Attach to...' property should be exposed in any components buit from this - this sets a target object to be joined to the motor shaft. The target can then be rotated around the axis with a custom gear ration, or moved linearly according to the pitch of a given lead screw.

This component can be used as a base to create child components

Image The component Stepper _ Generic is inherited from this.

Examples

Attaching a primitive to a stepper motor

This example links a panel primitive to the output of the motor. FC6 Icon.png Stepper Example 1 The linked object can be rotated or moved in a fixed direction by the motor.

StepperProps.jpg


Linear movement using a stepper motor

This example links two stepper motors together using linear type movements rather then rotational similar to a stepper attached to a lead screw. FC6 Icon.png Stepper Example 2 The stepper is linked to the objects on the panel using properties and grouping.

LinStepper.jpg


Creating a multi-axis actuator using stepper motors

This example links three stepper motors together using panel primitive objects and groups. FC6 Icon.png Stepper Example 3 Here we can see the actuator arm in motion.

LinkedStepper.jpg

Downloadable macro reference

IncrementStep

Move the motor forward by one step.

Parameters

This macro has no parameters


Return value

This call does not return a value


DecrementStep

Move the motor backwards by one step.

Parameters

This macro has no parameters


Return value

This call does not return a value


EnableMotor

Turn on the motor. This must be done before it will respond to any other macros.

Parameters

This macro has no parameters


Return value

This call does not return a value


DisableMotor

Turn off the motor. It will no longer respond to any other macros.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

SetTarget

Assign a panel object to be moved by the motor.

Once linked, the object will respond to the 'Motor Simulation' properties, and it

will be moved whenever the motor is stepped.

Parameters

HANDLE target
An object to be moved by the motor.


Return value

This call does not return a value



Property reference

Coil 1

This property is of type Single digital pin and can be referenced with the variable name Coil_1.

Chip pin to which the first motor coil is connected.

Coil 2

This property is of type Single digital pin and can be referenced with the variable name Coil_2.

Chip pin to which the second motor coil is connected.

Coil 3

This property is of type Single digital pin and can be referenced with the variable name Coil_3.

Chip pin to which the third motor coil is connected.

Coil 4

This property is of type Single digital pin and can be referenced with the variable name Coil_4.

Chip pin to which the fourth motor coil is connected.

Winding Type

This property is of type Fixed list of ints and can be referenced with the variable name Winding_Type.

The polarity settings of the motor windings.

Refer to the data-sheet for your chosen hardware to determine this value.

Step Type

This property is of type Fixed list of ints and can be referenced with the variable name Step_Type.

Trade accuracy against torque by changing the type of stepping.

Refer to the data-sheet for your chosen hardware to determine which modes your device supports.

Steps Per Revolution

This property is of type Signed integer and can be referenced with the variable name Steps_Per_Rev.

The number of steps it takes for the motor shaft to turn a full circle (360 degrees).

Refer to the data-sheet for your chosen hardware to determine this value.

Rotating Part

This property is of type Panel object and can be referenced with the variable name moving_part.

Select a panel object here that will represent the moving part of the motor - for example, an

output shaft or actuator.

Rotation Centre

This property is of type Panel object and can be referenced with the variable name axis.

Select a panel object to be the centre of rotation of the 'Rotating Part'. If non is chosen, the

'Rotating Part' will revove around its own axes.

Rotate Around

This property is of type Fixed list of ints and can be referenced with the variable name rot_axis.

The axis of the 'Rotaion Centre' object around which the 'Rotating Part' will rotate.

Enable Sim

This property is of type True or false and can be referenced with the variable name coils_enable.

Turn coil simulation on and off.

Coil 1

This property is of type Panel object and can be referenced with the variable name coil1_object.

Choose a panel object to represent the first coil. The simulation will automatically change this

object's color to visualise when it is energised.

Coil 2

This property is of type Panel object and can be referenced with the variable name coil2_object.

Choose a panel object to represent the second coil. The simulation will automatically change this

object's color to visualise when it is energised.

Coil 3

This property is of type Panel object and can be referenced with the variable name coil3_object.

Choose a panel object to represent the third coil. The simulation will automatically change this

object's color to visualise when it is energised.

Coil 4

This property is of type Panel object and can be referenced with the variable name coil4_object.

Choose a panel object to represent the fourth coil. The simulation will automatically change this

object's color to visualise when it is energised.

Colour Non Active Coil

This property is of type Color picker and can be referenced with the variable name colour_non_act.

Make coil object this colour when they are NOT energised.

Colour Active Coil

This property is of type Color picker and can be referenced with the variable name colour_act.

Make the coil objects this colour when they ARE energised,.

Gear Ratio

This property is of type Floating point and can be referenced with the variable name gear_ratio.

Set a non-zero value here to make the target object rotate whenever the motor spins. The target

will revolve around the same axis as the motor's own 'Moving Part' (e.g. drive shaft).

A value of 1.00 make the target spin at the same speed as the motor. Choose other values

to set the ratio of a 'virtual gearbox' to change the speed of the target's movement.

X Linear Pitch

This property is of type Floating point and can be referenced with the variable name x_pitch.

Set this to a non-zero value to move the target object linearly along its X-Axis whenever the motor spins.

The value is the distance to move (world units) per complete rotation of the motor shaft - i.e. it

simulates a typical linear drive that uses a lead-screw, with the property value equal to the

screw pitch.

Y Linear Pitch

This property is of type Floating point and can be referenced with the variable name y_pitch.

Set this to a non-zero value to move the target object linearly along its Y-Axis whenever the motor spins.

The value is the distance to move (world units) per complete rotation of the motor shaft - i.e. it

simulates a typical linear drive that uses a lead-screw, with the property value equal to the

screw pitch.

Z Linear Pitch

This property is of type Floating point and can be referenced with the variable name z_pitch.

Set this to a non-zero value to move the target object linearly along its Z-Axis whenever the motor spins.

The value is the distance to move (world units) per complete rotation of the motor shaft - i.e. it

simulates a typical linear drive that uses a lead-screw, with the property value equal to the

screw pitch.