Component: Solenoid Template (Mechatronics)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.1 (Release)
Category Mechatronics


Image Solenoid Template component

Base component for constructing solenoids. These take a single input pin and move an actuator between two positions depending on the pin state.

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

Image The component Solenoid DC1 is inherited from this.

Examples

A solenoid will likely require more current than a microcontroller device can supply to activate the mechanical mechanism.

To amplify the current from the microcontroller simply use a NPN transistor or N channel FET.

The diode is required as with any inductive loads to help protect the microcontroller from back EMF generated by the inductor as the control signal switches the current through the inductor on and off

Solenoid.jpg


If the solenoid requires a large DC voltage, say 12V then you can connect the 12V directly to the top of the solenoid as shown above rather than using VCC or VDD. The transistor / FET will protect the micro from the large Voltage.

Downloadable macro reference

TurnOn

Activate the solenoid

Parameters

This macro has no parameters


Return value

This call does not return a value


SetState

Trun the solenoid on or off using a boolean value.

Parameters

BOOL State
The new state for the solenoid to take.


Return value

This call does not return a value


TurnOff

De-activate the solenoid

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

SetTarget

Choose an extermal object to move along with the solenoid's actuator

Parameters

HANDLE Object
An object to be moved by the solenoid


Return value

This call does not return a value



Property reference

Pin

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

Chip pin to connect the solenoid circuit to.

NB) Solenoid cannot be moved unless there is a valid connection.

Moving part

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

A panel object to be moved back and forth when the solenoid is activated.

Pivot object

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

A position to rotate around when the solenoid type is set to 'Rotate'

Not required for linear solenoids.

Type

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

The type of motion of the solenoid actuator.

Axis

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

For linear solenoids, the axis along which the actuator will move.

For rotary solenoids, the axis around which it will rotate.

Distance

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

For linear solenoids, the distance between the 'off and 'on' states in model units.

For rotary solenoids, the rotation in degrees.

Time (ms)

This property is of type Unsigned integer and can be referenced with the variable name animate_time.

The time taken for the solenoid to move between the on and off positions.

Used only for the purpose of System Panel animations on screen.