Component: Servo Motor Controller (Mechatronics): Difference between revisions
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;" align="center"" to "width="10%" align="center" class="mtx-class-macrohead"" |
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder"" |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 72: | Line 72: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''AutoMoveToAngle''' | ||
|- | |- | ||
| colspan="2" | Automatically moves towards the new angle at a fixed rate determined by the AutoMoveSpeed. AutoMove not currently supported by ESP32. | | colspan="2" | Automatically moves towards the new angle at a fixed rate determined by the AutoMoveSpeed. AutoMove not currently supported by ESP32. | ||
| Line 96: | Line 96: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''AutoMoveToPosition''' | ||
|- | |- | ||
| colspan="2" | Automatically moves towards the new position at a fixed rate determined by the AutoMoveSpeed. | | colspan="2" | Automatically moves towards the new position at a fixed rate determined by the AutoMoveSpeed. | ||
| Line 120: | Line 120: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''AutoMoveToPositionInt''' | ||
|- | |- | ||
| colspan="2" | Automatically moves towards the new 16-bit position at a fixed rate determined by the AutoMoveSpeed. | | colspan="2" | Automatically moves towards the new 16-bit position at a fixed rate determined by the AutoMoveSpeed. | ||
| Line 144: | Line 144: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''DisableServo''' | ||
|- | |- | ||
| colspan="2" | Disables a servo channel effectivly disabling the motor. | | colspan="2" | Disables a servo channel effectivly disabling the motor. | ||
| Line 163: | Line 163: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''EnableServo''' | ||
|- | |- | ||
| colspan="2" | Enables a servo channel effectivly setting the position of the motor to the value in the local position variable. | | colspan="2" | Enables a servo channel effectivly setting the position of the motor to the value in the local position variable. | ||
| Line 182: | Line 182: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Initialise''' | ||
|- | |- | ||
| colspan="2" | Sets up the servo motor interrupts | | colspan="2" | Sets up the servo motor interrupts | ||
| Line 196: | Line 196: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''IsAutoMoving''' | ||
|- | |- | ||
| colspan="2" | Is the AutoMoveToPosition movement complete. Returns 1 if the servos are still moving. Returns 0 if all servo movement is complete. | | colspan="2" | Is the AutoMoveToPosition movement complete. Returns 1 if the servos are still moving. Returns 0 if all servo movement is complete. | ||
| Line 210: | Line 210: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''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. | | 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. | ||
| Line 229: | Line 229: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MoveToAngle''' | ||
|- | |- | ||
| colspan="2" | Moves a single step towards the new angle, the rate of movement is determined by how often the move to macro is called. Returns 1 if the position has been reached. | | colspan="2" | Moves a single step towards the new angle, the rate of movement is determined by how often the move to macro is called. Returns 1 if the position has been reached. | ||
| Line 253: | Line 253: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MoveToPosition''' | ||
|- | |- | ||
| colspan="2" | Moves a single step towards the new position, the rate of movement is determined by how often the move to macro is called. Returns 1 if the position has been reached. | | colspan="2" | Moves a single step towards the new position, the rate of movement is determined by how often the move to macro is called. Returns 1 if the position has been reached. | ||
| Line 277: | Line 277: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''MoveToPositionInt''' | ||
|- | |- | ||
| colspan="2" | Moves a single step towards the new position, the rate of movement is determined by how often the move to macro is called. Returns 1 if the position has been reached. | | colspan="2" | Moves a single step towards the new position, the rate of movement is determined by how often the move to macro is called. Returns 1 if the position has been reached. | ||
| Line 301: | Line 301: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetAutoMoveSpeed''' | ||
|- | |- | ||
| colspan="2" | Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property. | | colspan="2" | Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property. | ||
| Line 320: | Line 320: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetAutoMoveSpeedInt''' | ||
|- | |- | ||
| colspan="2" | Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property. | | colspan="2" | Sets the speed of the auto move to position macro. Default speed is shown in the Servo_Period_Multiplier property. | ||
| Line 339: | Line 339: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetPosition''' | ||
|- | |- | ||
| colspan="2" | Moves directly to the specified position with no interpolation. | | colspan="2" | Moves directly to the specified position with no interpolation. | ||
| Line 363: | Line 363: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetPositionInt''' | ||
|- | |- | ||
| colspan="2" | Moves directly to the specified position with no interpolation. Uses a 16-bit position parameter to add extra precision. | | colspan="2" | Moves directly to the specified position with no interpolation. Uses a 16-bit position parameter to add extra precision. | ||
| Line 387: | Line 387: | ||
|- | |- | ||
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''SetTrim''' | ||
|- | |- | ||
| colspan="2" | Allows the level of trim for each servo channel to be adjusted progmatically. | | colspan="2" | Allows the level of trim for each servo channel to be adjusted progmatically. | ||
| Line 411: | Line 411: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-macrohead" | '''Properties''' | ||
|- | |- | ||
|- | |- | ||
| Line 420: | Line 420: | ||
| colspan="2" | Set the number of servo's that you need to control. Value from 1 to 8. | | colspan="2" | Set the number of servo's that you need to control. Value from 1 to 8. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Connections | ||
|- | |- | ||
|- | |- | ||
| Line 464: | Line 464: | ||
| colspan="2" | Pin on which to output PWM for the servo motor. | | colspan="2" | Pin on which to output PWM for the servo motor. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Resources | ||
|- | |- | ||
|- | |- | ||
| Line 473: | Line 473: | ||
| colspan="2" | Lists the internal peripherals of the MCU used by the component. When the servo motor is initialised you will not be able to use the listed peripherals for other functionality. | | colspan="2" | Lists the internal peripherals of the MCU used by the component. When the servo motor is initialised you will not be able to use the listed peripherals for other functionality. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Trim | ||
|- | |- | ||
|- | |- | ||
| Line 522: | Line 522: | ||
| colspan="2" | Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. | | colspan="2" | Trim the pulse width for this channel. Use this to trim the positioning of two servos so that similar input values will produce the same degree of movement. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Pulse Width | ||
|- | |- | ||
|- | |- | ||
| Line 541: | Line 541: | ||
| colspan="2" | Number of instructions for 1 / 256th of the positional accuracy. This sets the default movement speed to maintain legacy move speeds. Also sets the multiplication factor to convert from a byte 0-255 to a clocked position value. | | colspan="2" | Number of instructions for 1 / 256th of the positional accuracy. This sets the default movement speed to maintain legacy move speeds. Also sets the multiplication factor to convert from a byte 0-255 to a clocked position value. | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] | ||
| width="90%" | | width="90%" class="mtx-class-propfolder" | Simulation | ||
|- | |- | ||
|- | |- | ||
Latest revision as of 14:37, 13 July 2026
| Author | Matrix Ltd |
| Version | 8.8 |
| Category | Mechatronics |
Servo Motor Controller component
Can control up to eight standard PWM driven servo's. Supports 8-bit and 16-bit movement resolutions. 'Servo Object' properties allow you to connect the controller to on-screen simulations using the "Servo Motor" component and its derivatives.
Version information
Library Version, Component Version, Date, Author, Info 8, 8.0, 28-01-25, MW, Fixed bug that is preventing duty remain the same below 128, remins high above 127.
Detailed description
No detailed description exists yet for this component
Examples
Example showing how to control three servos using AutoMoveToPosion, MoveTopposition & SetPosition component macros.
Controlling Servos Example.fcfx
Example using BL0162 Servo controller for BL0055 Arduino Shield
Samples the Port D8-D13 (portB) switches and moves the servo motors based on the input states.
D8 increments motor 0, D9 decrements motor on channel 0.
D10 increments motor 1, D11 decrements motor on channel 1.
D12 increments motor 3, D13 decrements motor on channel 2.
Connections:
Servo Board Port D0-D2.
Switch Board Port D8 - D13
LCD A0 to A5 (PortC)
BL0162 Servos Example for BL0055
Macro reference
AutoMoveToAngle
AutoMoveToPosition
AutoMoveToPositionInt
DisableServo
| DisableServo | |
| Disables a servo channel effectivly disabling the motor. | |
| Channel | |
| The channel to set the position for. First channel is zero. | |
| Return | |
EnableServo
Initialise
| Initialise | |
| Sets up the servo motor interrupts | |
| Return | |
IsAutoMoving
| IsAutoMoving | |
| Is the AutoMoveToPosition movement complete. Returns 1 if the servos are still moving. Returns 0 if all servo movement is complete. | |
| Return | |
IsServoAutoMoving
MoveToAngle
MoveToPosition
MoveToPositionInt
SetAutoMoveSpeed
SetAutoMoveSpeedInt
SetPosition
SetPositionInt
SetTrim
Property reference
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Servo_Controller.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Servo_Controller.fcfx