Component: ST3215 Servo Motor (Mechatronics)

From Flowcode Help
Jump to navigationJump to search
Author Matrix TSL
Version 2.0
Category Mechatronics


ST3215 Servo Motor component

Control ST3215 servo motors via serial UART communication using the STS protocol.

Detailed description

No detailed description exists yet for this component

Examples

No additional examples








Macro reference

ChangeBaudrate

Fc9-comp-macro.png ChangeBaudrate
Change the servo baud rate. Baud rate values: 0=9600, 1=57600, 2=115200, 3=1000000. EEPROM must be unlocked. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u8-icon.png - BYTE Baudrate
Baud rate value: 0=9600, 1=57600, 2=115200, 3=1000000 
Fc9-bool-icon.png - BOOL Return


ChangeID

Fc9-comp-macro.png ChangeID
Change the servo ID. New ID must be 0-253. EEPROM must be unlocked. Note: New ID takes effect after power cycle. 
Fc9-u8-icon.png - BYTE ServoID
Current servo ID 
Fc9-u8-icon.png - BYTE NewID
New servo ID (0-253) 
Fc9-bool-icon.png - BOOL Return


DefineMiddle

Fc9-comp-macro.png DefineMiddle
Define the 2048 position by setting torque to 128. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-bool-icon.png - BOOL Return


Initialise

Fc9-comp-macro.png Initialise
 
Fc9-void-icon.png - VOID Return


IsMoving

Fc9-comp-macro.png IsMoving
Check if the servo is currently moving. Returns True if moving, False otherwise. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-bool-icon.png - BOOL Return


ListServos

Fc9-comp-macro.png ListServos
Scan and return a list of all responsive servos. Returns number of servos found. 
Fc9-u8-icon.png - BYTE ServoList
Array to store found servo IDs 
Fc9-u8-icon.png - BYTE MaxCount
Max number of servos to try and return. 0=Don't limit 
Fc9-u8-icon.png - BYTE Return


LockEEPROM

Fc9-comp-macro.png LockEEPROM
Lock EEPROM to prevent writes from being saved after power loss. IMPORTANT: Use the NEW servo ID after ChangeID. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID (use NEW ID after ChangeID) 
Fc9-bool-icon.png - BOOL Return


PingServo

Fc9-comp-macro.png PingServo
Check if a servo is responding. Returns True if successful, False otherwise. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID to ping (0-253) 
Fc9-bool-icon.png - BOOL Return


ReadAcceleration

Fc9-comp-macro.png ReadAcceleration
Read current acceleration value in steps per second squared. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u8-icon.png - BYTE Return


ReadAngle

Fc9-comp-macro.png ReadAngle
Read current position of servo. Returns position in steps (0-4095). 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-f32-icon.png - FLOAT Return


ReadCorrection

Fc9-comp-macro.png ReadCorrection
Read position correction value in steps. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-s16-icon.png - INT Return


ReadCurrent

Fc9-comp-macro.png ReadCurrent
Read current in milliamps (6.5mA resolution). Returns current / 6.5. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u16-icon.png - UINT Return


ReadID

Fc9-comp-macro.png ReadID
Read the servo ID from EEPROM. Returns the stored ID value. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID to query 
Fc9-u8-icon.png - BYTE Return


ReadLoad

Fc9-comp-macro.png ReadLoad
Read motor load in percentage. Returns load percentage. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u8-icon.png - BYTE Return


ReadMode

Fc9-comp-macro.png ReadMode
Read current operational mode. Returns: 0=position, 1=speed, 2=PWM, 3=step 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u8-icon.png - BYTE Return


ReadPosition

Fc9-comp-macro.png ReadPosition
Read current position of servo. Returns position in steps (0-4095). 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-s16-icon.png - INT Return


ReadSpeed

Fc9-comp-macro.png ReadSpeed
Read current speed of servo. Returns speed in steps per second. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u16-icon.png - UINT Return


ReadStatus

Fc9-comp-macro.png ReadStatus
Read servo status flags. Returns status byte with bits: Voltage, Sensor, Temperature, Current, Angle, Overload 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u8-icon.png - BYTE Return


ReadTemperature

Fc9-comp-macro.png ReadTemperature
Read temperature in degrees Celsius. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u8-icon.png - BYTE Return


ReadTorqueLimit

Fc9-comp-macro.png ReadTorqueLimit
Read torque limit value (0-1000). 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u16-icon.png - UINT Return


ReadVoltage

Fc9-comp-macro.png ReadVoltage
Read voltage in volts (0.1V resolution). Returns voltage * 10. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u8-icon.png - BYTE Return


Rotate

Fc9-comp-macro.png Rotate
Rotate servo continuously in specified direction. Speed range: 50-1000. Direction: 0=forward, 1=reverse. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u16-icon.png - UINT Speed
Rotation speed (50-1000) 
Fc9-u8-icon.png - BYTE Direction
Direction: 0=forward, 1=reverse 
Fc9-bool-icon.png - BOOL Return


SetAcceleration

Fc9-comp-macro.png SetAcceleration
Set servo acceleration in steps per second squared. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u8-icon.png - BYTE Acceleration
Acceleration value (0-254) 
Fc9-bool-icon.png - BOOL Return


SetAngle

Fc9-comp-macro.png SetAngle
Move servo to a target angle. Angle range: -180 to 180 degrees. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-f32-icon.png - FLOAT Angle
Angle range: -180 to 180 degrees. 
Fc9-bool-icon.png - BOOL Return


SetCorrection

Fc9-comp-macro.png SetCorrection
Set position correction value in steps. Adds correction to position. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-s16-icon.png - INT Correction
Correction value in steps 
Fc9-bool-icon.png - BOOL Return


SetMode

Fc9-comp-macro.png SetMode
Set operational mode. Mode: 0=position, 1=speed, 2=PWM, 3=step 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u8-icon.png - BYTE Mode
Mode: 0=position, 1=speed, 2=PWM, 3=step 
Fc9-bool-icon.png - BOOL Return


SetPosition

Fc9-comp-macro.png SetPosition
Move servo to a target position. Position range: -30719 to 30719 steps. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u16-icon.png - UINT Position
Target position in steps (0 to 4095) 
Fc9-bool-icon.png - BOOL Return


SetSpeed

Fc9-comp-macro.png SetSpeed
Set servo speed in steps per second. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u16-icon.png - UINT Speed
Speed in steps per second (0-3400) 
Fc9-bool-icon.png - BOOL Return


SetTorqueLimit

Fc9-comp-macro.png SetTorqueLimit
Set torque limit value (0-1000). Controls maximum torque output. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-u16-icon.png - UINT TorqueLimit
Torque limit value (0-1000) 
Fc9-bool-icon.png - BOOL Return


StartServo

Fc9-comp-macro.png StartServo
Enable torque (start servo). 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-bool-icon.png - BOOL Return


StopServo

Fc9-comp-macro.png StopServo
Disable torque (stop servo). 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-bool-icon.png - BOOL Return


UnlockEEPROM

Fc9-comp-macro.png UnlockEEPROM
Unlock EEPROM to allow writes to be saved after power loss. 
Fc9-u8-icon.png - BYTE ServoID
Servo ID 
Fc9-bool-icon.png - BOOL Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png Channel
UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller. 
Fc9-type-5-icon.png TX
Pin to be used for Transmit data 
Fc9-type-5-icon.png RX
Pin to be used for Receive data 
Fc9-type-16-icon.png Use Flow Control
Flow Control (Handshake) enable or disable. On: Two I/O pins are used to control the flow of data in and out of the device. Off: Flow control is disabled. 
Fc9-type-16-icon.png Baud Options
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
 
Fc9-conn-icon.png Simulation
Fc9-type-10-icon.png Label
Textual label shown on the component I/O flasher 
Fc9-type-7-icon.png Scope Traces
Selects if the scope traces are automatically added to the data recorder window or not. 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-21-icon.png Console Columns
Number of characters that can be displayed on a single line of the console. 
Fc9-type-16-icon.png Data Source
Simulation data source used to allow the component to connect to various remote devices 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_ST3215.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_ST3215.fcfx