Difference between revisions of "Component: Stepper Motor Template (Mechatronics)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix Ltd
 
| Matrix Ltd
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.2 (Release)
+
| 1.2
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Mechatronics
 
| Mechatronics
 
|}
 
|}
  
  
 +
==Stepper Motor Template 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.
  
==[[File:Component Icon faf668b1_a0e6_426f_b1ef_9d4f8e54d784.png|Image]] Stepper Motor Template component==
+
==Detailed description==
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
+
''No detailed description exists yet for this component''
  
The following components all inherit the traits of Stepper Motor Template:
+
==Examples==
  
{| class="wikitable" width="50%"
 
|+|-
 
|[[File:Component Icon cfd176dc_a2c1_4dad_ac45_117781624c82.png|Image]] Stepper _ Generic
 
|A generic stepper motor model.  Includes a visual simulation showing the activaton pattern
 
of the coils.
 
Make another object move along with the stepper shaft using the 'Target' property.
 
The target object can rotate with the stepper shaft with a given gearing ratio, or be
 
moved linearly according to a given lead screw pitch.
 
|-
 
|[[File:Component Icon 23f522d8_3986_4482_a2dd_eac5e407c0d6.png|Image]] Stepper (NEMA8)
 
|A NEMA8 stepper motor model.  Includes a visual simulation showing the activaton pattern
 
of the coils.
 
Make another object move along with the stepper shaft using the 'Target' property.
 
The target object can rotate with the stepper shaft with a given gearing ratio, or be
 
moved linearly according to a given lead screw pitch.
 
|}
 
  
==Examples==
 
 
===Attaching a primitive to a stepper motor===
 
===Attaching a primitive to a stepper motor===
  
Line 72: Line 50:
 
==Downloadable macro reference==
 
==Downloadable macro reference==
  
===<span style="font-weight: normal;"><u><tt>IncrementStep</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Move the motor forward by one step.
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''IncrementStep'''
 +
|-
 +
| colspan="2" | Move the motor forward by one step.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:''This macro has no parameters''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTarget'''
 +
|-
 +
| colspan="2" | 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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:]] -
 +
| width="90%" | target
 +
|-
 +
| colspan="2" | An object to be moved by the motor.&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DecrementStep'''
 +
|-
 +
| colspan="2" | Move the motor backwards by one step.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This call does not return a value''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''EnableMotor'''
 +
|-
 +
| colspan="2" | Turn on the motor.  This must be done before it will respond to any other macros.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>DecrementStep</tt></u></span>===
 
Move the motor backwards by one step.
 
  
'''Parameters'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DisableMotor'''
 +
|-
 +
| colspan="2" | Turn off the motor.  It will no longer respond to any other macros.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This macro has no parameters''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTrim'''
 +
|-
 +
| colspan="2" | Allows the level of trim for each servo channel to be adjusted progmatically.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | The channel to set the position for.  First channel is zero.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Trim
 +
|-
 +
| colspan="2" | Legacy: 0=0us, 1=+25us, 2=+50us, 3=+75us, 4=+100us, 5=-25us, 6=-50us, 7=-75us, 8=-100us or Smooth: 0-200&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:''This call does not return a value''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''IsAutoMoving'''
 +
|-
 +
| colspan="2" | Is the AutoMoveToPosition movement complete.  Returns 1 if the servos are still moving.  Returns 0 if all servo movement is complete.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
===<span style="font-weight: normal;"><u><tt>EnableMotor</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Turn on the motorThis must be done before it will respond to any other macros.
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetAutoMoveSpeedInt'''
 +
|-
 +
| colspan="2" | Sets the speed of the auto move to position macroDefault speed is shown in the Servo_Period_Multiplier property.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Speed
 +
|-
 +
| colspan="2" | 1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:''This macro has no parameters''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''IsServoAutoMoving'''
 +
|-
 +
| colspan="2" | Is the AutoMoveToPosition movement complete for a specific servo output.  Returns 1 if the servo is still moving.  Returns 0 if the servo movement is complete.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | Servo Motor Output Range: 0-7&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AutoMoveToPosition'''
 +
|-
 +
| colspan="2" | Automatically moves towards the new position at a fixed rate determined by the AutoMoveSpeed.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | The channel to assign the new position. Range: 0-7&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Position
 +
|-
 +
| colspan="2" | Position to automatically move to. Range: 0-255&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This call does not return a value''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''EnableServo'''
 +
|-
 +
| colspan="2" | Enables a servo channel effectivly setting the position of the motor to the value in the local position variable.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | The channel to set the position for.  First channel is zero.&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>DisableMotor</tt></u></span>===
 
Turn off the motor.  It will no longer respond to any other macros.
 
  
'''Parameters'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetAutoMoveSpeed'''
 +
|-
 +
| colspan="2" | Sets the speed of the auto move to position macro.  Default speed is shown in the Servo_Period_Multiplier property.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Speed
 +
|-
 +
| colspan="2" | 1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This macro has no parameters''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AutoMoveToPositionInt'''
 +
|-
 +
| colspan="2" | Automatically moves towards the new 16-bit position at a fixed rate determined by the AutoMoveSpeed.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Channel
 +
|-
 +
| colspan="2" | The channel to assign the new position. Range: 0-7&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Position
 +
|-
 +
| colspan="2" | Position to automatically move to. Range: 0-65535&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:''This call does not return a value''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Sets up the servo motor interrupts&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteLEDs'''
 +
|-
 +
| colspan="2" | Allows control of all 8-LEDs on the front of the Formula Flowcode.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | LED_Byte
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
==Simulation macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>SetTarget</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Assign a panel object to be moved by the motor.
+
|-
 
+
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
Once linked, the object will respond to the 'Motor Simulation' properties, and it
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
+
|-
will be moved whenever the motor is stepped.
+
| colspan="2" | Starts up the formula flowcode PWM for motor control and performs the wait for button press&nbsp;
 
+
|-
'''Parameters'''
+
|-
 
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
:[[Variable Types|HANDLE]] ''target''
+
| width="90%" style="border-top: 2px solid #000;" | ''Return''
::An object to be moved by the motor.
+
|}
 
 
 
 
'''Return value'''
 
 
 
:''This call does not return a value''
 
  
  
Line 148: Line 321:
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Driver</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Driver''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
''<span style="color:red;">No additional information</span>''
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
 
+
|-
 
+
|-
<span style="font-weight: normal;"><u>Coil 1</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Winding Type
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Coil_1''.
+
|-
 
+
| colspan="2" | The polarity settings of the motor windings. Refer to the data-sheet for your chosen hardware to determine this value.&nbsp;
Chip pin to which the first motor coil is connected.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
<span style="font-weight: normal;"><u>Coil 2</u></span>
+
| width="90%" | Step Type
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Coil_2''.
+
| colspan="2" | 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.&nbsp;
 
+
|-
Chip pin to which the second motor coil is connected.
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
+
| width="90%" | Steps Per Revolution
<span style="font-weight: normal;"><u>Coil 3</u></span>
+
|-
 
+
| colspan="2" | 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.&nbsp;
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Coil_3''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
Chip pin to which the third motor coil is connected.
+
| width="90%" | Angle Increment
 
+
|-
<span style="font-weight: normal;"><u>Coil 4</u></span>
+
| colspan="2" | Amount of change in the shaft angle when the IncrementStep / DecrementStep functions are called.&nbsp;
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Coil_4''.
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Rotating Part
Chip pin to which the fourth motor coil is connected.
+
|-
 
+
| colspan="2" | Select a panel object here that will represent the moving part of the motor - for example, an output shaft or actuator.&nbsp;
<span style="font-weight: normal;"><u>Winding Type</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Winding_Type''.
+
| width="90%" | Rotation Centre
 
+
|-
The polarity settings of the motor windings.
+
| colspan="2" | 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.&nbsp;
 
+
|-
Refer to the data-sheet for your chosen hardware to determine this value.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Rotate Around
<span style="font-weight: normal;"><u>Step Type</u></span>
+
|-
 
+
| colspan="2" | The axis of the 'Rotaion Centre' object around which the 'Rotating Part' will rotate.&nbsp;
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Step_Type''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
Trade accuracy against torque by changing the type of stepping.
+
| width="90%" | Waveforms
 
+
|-
Refer to the data-sheet for your chosen hardware to determine which modes your device supports.
+
| colspan="2" | Allows waveforms to be auto generated on the data recorder window.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Steps Per Revolution</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Coil Simulation
This property is of type ''Signed integer'' and can be referenced with the variable name ''Steps_Per_Rev''.
+
|-
 
+
| colspan="2" | Turn coil simulation on and off.&nbsp;
The number of steps it takes for the motor shaft to turn a full circle (360 degrees).
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
Refer to the data-sheet for your chosen hardware to determine this value.
+
| width="90%" | Coil 1
 
+
|-
<span style="font-weight: normal;"><u>Rotating Part</u></span>
+
| colspan="2" | Choose a panel object to represent the first coil. The simulation will automatically change this object's color to visualise when it is energised.&nbsp;
 
+
|-
This property is of type ''Panel object'' and can be referenced with the variable name ''moving_part''.
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Coil 2
Select a panel object here that will represent the moving part of the motor - for example, an
+
|-
 
+
| colspan="2" | Choose a panel object to represent the second coil.  The simulation will automatically change this object's color to visualise when it is energised.&nbsp;
output shaft or actuator.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
<span style="font-weight: normal;"><u>Rotation Centre</u></span>
+
| width="90%" | Coil 3
 
+
|-
This property is of type ''Panel object'' and can be referenced with the variable name ''axis''.
+
| colspan="2" | Choose a panel object to represent the third coil.  The simulation will automatically change this object's color to visualise when it is energised.&nbsp;
 
+
|-
Select a panel object to be the centre of rotation of the 'Rotating Part'. If non is chosen, the
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Coil 4
'Rotating Part' will revove around its own axes.
+
|-
 
+
| colspan="2" | Choose a panel object to represent the fourth coil.  The simulation will automatically change this object's color to visualise when it is energised.&nbsp;
<span style="font-weight: normal;"><u>Rotate Around</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-1-icon.png]]
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''rot_axis''.
+
| width="90%" | Colour Non Active Coil
 
+
|-
The axis of the 'Rotaion Centre' object around which the 'Rotating Part' will rotate.
+
| colspan="2" | Make coil object this colour when they are NOT energised.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Waveforms</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-1-icon.png]]
 
+
| width="90%" | Colour Active Coil
This property is of type ''True or false'' and can be referenced with the variable name ''Waveforms''.
+
|-
 
+
| colspan="2" | Make the coil objects this colour when they ARE energised,.&nbsp;
Allows waveforms to be auto generated on the data recorder window.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
<span style="font-weight: normal;"><u>Coil Simulation</u></span>
+
| width="90%" | Gear Ratio
 
+
|-
This property is of type ''True or false'' and can be referenced with the variable name ''coils_enable''.
+
| colspan="2" | 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.&nbsp;
 
+
|-
Turn coil simulation on and off.
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
+
| width="90%" | X Linear Pitch
<span style="font-weight: normal;"><u>Coil 1</u></span>
+
|-
 
+
| colspan="2" | 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.&nbsp;
This property is of type ''Panel object'' and can be referenced with the variable name ''coil1_object''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
Choose a panel object to represent the first coil.  The simulation will automatically change this
+
| width="90%" | Y Linear Pitch
 
+
|-
object's color to visualise when it is energised.
+
| colspan="2" | 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.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Coil 2</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
+
| width="90%" | Z Linear Pitch
This property is of type ''Panel object'' and can be referenced with the variable name ''coil2_object''.
+
|-
 
+
| colspan="2" | 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.&nbsp;
Choose a panel object to represent the second coil.  The simulation will automatically change this
+
|-
 
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
object's color to visualise when it is energised.
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''  
 
+
|-
<span style="font-weight: normal;"><u>Coil 3</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''Panel object'' and can be referenced with the variable name ''coil3_object''.
+
| width="90%" | Driver
 
+
|-
Choose a panel object to represent the third coil.  The simulation will automatically change this
+
| colspan="2" | &nbsp;
 
+
|-
object's color to visualise when it is energised.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | Coil 1
<span style="font-weight: normal;"><u>Coil 4</u></span>
+
|-
 
+
| colspan="2" | Chip pin to which the first motor coil is connected.&nbsp;
This property is of type ''Panel object'' and can be referenced with the variable name ''coil4_object''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
Choose a panel object to represent the fourth coil.  The simulation will automatically change this
+
| width="90%" | Coil 2
 
+
|-
object's color to visualise when it is energised.
+
| colspan="2" | Chip pin to which the second motor coil is connected.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Colour Non Active Coil</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | Coil 3
This property is of type ''Color picker'' and can be referenced with the variable name ''colour_non_act''.
+
|-
 
+
| colspan="2" | Chip pin to which the third motor coil is connected.&nbsp;
Make coil object this colour when they are NOT energised.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
<span style="font-weight: normal;"><u>Colour Active Coil</u></span>
+
| width="90%" | Coil 4
 
+
|-
This property is of type ''Color picker'' and can be referenced with the variable name ''colour_act''.
+
| colspan="2" | Chip pin to which the fourth motor coil is connected.&nbsp;
 
+
|-
Make the coil objects this colour when they ARE energised,.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
<span style="font-weight: normal;"><u>Gear Ratio</u></span>
+
|-
 
+
|}
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.
 
 
 
<span style="font-weight: normal;"><u>X Linear Pitch</u></span>
 
 
 
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.
 
 
 
<span style="font-weight: normal;"><u>Y Linear Pitch</u></span>
 
 
 
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.
 
 
 
<span style="font-weight: normal;"><u>Z Linear Pitch</u></span>
 
 
 
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.
 

Revision as of 21:05, 16 November 2021

Author Matrix Ltd
Version 1.2
Category Mechatronics


Stepper Motor Template 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.

Detailed description

No detailed description exists yet for this component

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

Fc9-comp-macro.png IncrementStep
Move the motor forward by one step. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png 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. 
[[File:]] - target
An object to be moved by the motor. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png DecrementStep
Move the motor backwards by one step. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png EnableMotor
Turn on the motor. This must be done before it will respond to any other macros. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png DisableMotor
Turn off the motor. It will no longer respond to any other macros. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetTrim
Allows the level of trim for each servo channel to be adjusted progmatically. 
Fc9-u8-icon.png - BYTE Channel
The channel to set the position for. First channel is zero. 
Fc9-u8-icon.png - BYTE Trim
Legacy: 0=0us, 1=+25us, 2=+50us, 3=+75us, 4=+100us, 5=-25us, 6=-50us, 7=-75us, 8=-100us or Smooth: 0-200 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png IsAutoMoving
Is the AutoMoveToPosition movement complete. Returns 1 if the servos are still moving. Returns 0 if all servo movement is complete. 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png SetAutoMoveSpeedInt
Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property. 
Fc9-u16-icon.png - UINT Speed
1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png IsServoAutoMoving
Is the AutoMoveToPosition movement complete for a specific servo output. Returns 1 if the servo is still moving. Returns 0 if the servo movement is complete. 
Fc9-u8-icon.png - BYTE Channel
Servo Motor Output Range: 0-7 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png AutoMoveToPosition
Automatically moves towards the new position at a fixed rate determined by the AutoMoveSpeed. 
Fc9-u8-icon.png - BYTE Channel
The channel to assign the new position. Range: 0-7 
Fc9-u8-icon.png - BYTE Position
Position to automatically move to. Range: 0-255 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png EnableServo
Enables a servo channel effectivly setting the position of the motor to the value in the local position variable. 
Fc9-u8-icon.png - BYTE Channel
The channel to set the position for. First channel is zero. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SetAutoMoveSpeed
Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property. 
Fc9-u8-icon.png - BYTE Speed
1=Slowest (Default), 2= Double, 3=Triple, 4=Quadruple 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png AutoMoveToPositionInt
Automatically moves towards the new 16-bit position at a fixed rate determined by the AutoMoveSpeed. 
Fc9-u8-icon.png - BYTE Channel
The channel to assign the new position. Range: 0-7 
Fc9-u16-icon.png - UINT Position
Position to automatically move to. Range: 0-65535 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Sets up the servo motor interrupts 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png WriteLEDs
Allows control of all 8-LEDs on the front of the Formula Flowcode. 
Fc9-u8-icon.png - BYTE LED_Byte
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Starts up the formula flowcode PWM for motor control and performs the wait for button press 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png Winding Type
The polarity settings of the motor windings. Refer to the data-sheet for your chosen hardware to determine this value. 
Fc9-type-16-icon.png 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. 
Fc9-type-14-icon.png Steps Per Revolution
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. 
Fc9-type-15-icon.png Angle Increment
Amount of change in the shaft angle when the IncrementStep / DecrementStep functions are called. 
Fc9-type-17-icon.png Rotating Part
Select a panel object here that will represent the moving part of the motor - for example, an output shaft or actuator. 
Fc9-type-17-icon.png Rotation Centre
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. 
Fc9-type-16-icon.png Rotate Around
The axis of the 'Rotaion Centre' object around which the 'Rotating Part' will rotate. 
Fc9-type-7-icon.png Waveforms
Allows waveforms to be auto generated on the data recorder window. 
Fc9-type-7-icon.png Coil Simulation
Turn coil simulation on and off. 
Fc9-type-17-icon.png Coil 1
Choose a panel object to represent the first coil. The simulation will automatically change this object's color to visualise when it is energised. 
Fc9-type-17-icon.png Coil 2
Choose a panel object to represent the second coil. The simulation will automatically change this object's color to visualise when it is energised. 
Fc9-type-17-icon.png Coil 3
Choose a panel object to represent the third coil. The simulation will automatically change this object's color to visualise when it is energised. 
Fc9-type-17-icon.png Coil 4
Choose a panel object to represent the fourth coil. The simulation will automatically change this object's color to visualise when it is energised. 
Fc9-type-1-icon.png Colour Non Active Coil
Make coil object this colour when they are NOT energised. 
Fc9-type-1-icon.png Colour Active Coil
Make the coil objects this colour when they ARE energised,. 
Fc9-type-15-icon.png 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. 
Fc9-type-15-icon.png X Linear 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. 
Fc9-type-15-icon.png Y Linear 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. 
Fc9-type-15-icon.png Z Linear 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. 
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png Driver
 
Fc9-type-5-icon.png Coil 1
Chip pin to which the first motor coil is connected. 
Fc9-type-5-icon.png Coil 2
Chip pin to which the second motor coil is connected. 
Fc9-type-5-icon.png Coil 3
Chip pin to which the third motor coil is connected. 
Fc9-type-5-icon.png Coil 4
Chip pin to which the fourth motor coil is connected. 
Fc9-conn-icon.png Simulations