Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Discover and calibrate a connected tinymovr BLDC driver through a CANine USB-to-CAN controller.

Parameters
----------
None

Returns
-------
TextBlob
Traceback error
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Direct a tinymovr BLDC driver to a set velocity.

Input
-----
velocity : Scalar
Servo velocity (10k ticks/sec [1, 15]).

Returns
-------
Textblob
Traceback error (if any)
47 changes: 47 additions & 0 deletions docs/nodes/IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC/TIC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

[//]: # (Custom component imports)

import DocString from '@site/src/components/DocString';
import PythonCode from '@site/src/components/PythonCode';
import AppDisplay from '@site/src/components/AppDisplay';
import SectionBreak from '@site/src/components/SectionBreak';
import AppendixSection from '@site/src/components/AppendixSection';

[//]: # (Docstring)

import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt';
import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt';

<DocString>{DocstringSource}</DocString>
<PythonCode GLink='IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC/TIC.py'>{PythonSource}</PythonCode>

<SectionBreak />



[//]: # (Examples)

## Examples

<AppDisplay
GLink='IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC'
nodeLabel='TIC'>
</AppDisplay>

<SectionBreak />



[//]: # (Appendix)

import Notes from './appendix/notes.md';
import Hardware from './appendix/hardware.md';
import Media from './appendix/media.md';

## Appendix

<AppendixSection index={0} folderPath='nodes/IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC/appendix/'><Notes /></AppendixSection>
<AppendixSection index={1} folderPath='nodes/IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC/appendix/'><Hardware /></AppendixSection>
<AppendixSection index={2} folderPath='nodes/IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC/appendix/'><Media /></AppendixSection>


Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"description": "The user defines the speed and the sleep time between movements.\n\n(To choose the position, use the STEPPER_DRIVER_TIC_KNOB.)",
"parameters": [
{
"name": "current_limit",
"type": "int",
"description": "Defines the current limitation that the stepper motor will receive."
},
{
"name": "sleep_time",
"type": "int",
"description": "Defines the sleep time after moving to each position."
},
{
"name": "speed",
"type": "int",
"description": "Defines the speed of the motor movement (between 0 and 200000)."
}
],
"returns": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
The STEPPER_DRIVER_TIC node controls a stepper motor's movement with a TIC driver.

The user defines the speed and the sleep time between movements.

(To choose the position, use the STEPPER_DRIVER_TIC_KNOB.)

Parameters
----------
current_limit : int
Defines the current limitation that the stepper motor will receive.
sleep_time : int
Defines the sleep time after moving to each position.
speed : int
Defines the speed of the motor movement (between 0 and 200000).
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from flojoy import flojoy, OrderedPair
from typing import Optional
from ticlib import (
TicUSB,
) # Import the TicUSB library to send command to Tic drivers with USB connection
from time import sleep


@flojoy(deps={"ticlib": "0.2.2"})
def TIC(
default: Optional[OrderedPair] = None,
current_limit: int = 30,
sleep_time: int = 2,
speed: int = 100000,
) -> OrderedPair:


# Setting default positions
positions: list[int] = [50, 100, 150, 200]

# Declaration of the stepper driver
tic: TicUSB = TicUSB()
tic.halt_and_set_position(0) # Set the position to 0
# Set the current limit of the TIC driver
tic.set_current_limit(current_limit)
tic.energize() # Turn on the driver
tic.exit_safe_start() # The driver is now ready to receive commands

for i in range(0, len(positions)):
tic.set_max_speed(speed) # Set motor speed
tic.set_target_position(positions[i]) # Set target positions
sleep(sleep_time)

tic.deenergize()
tic.enter_safe_start()

return OrderedPair(x=positions, y=positions)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No supporting screenshots, photos, or videos have been added to the media.md file for this node.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No theory or technical notes have been contributed for this node yet.
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"rfInstance": {
"nodes": [
{
"width": 150,
"height": 150,
"id": "STEPPER_DRIVER_TIC-deb4fca7-fc18-443d-bd70-f1455a749eff",
"type": "INSTRUMENTS",
"data": {
"id": "STEPPER_DRIVER_TIC-deb4fca7-fc18-443d-bd70-f1455a749eff",
"label": "STEPPER DRIVER TIC",
"func": "STEPPER_DRIVER_TIC",
"type": "INSTRUMENTS",
"ctrls": {
"current_limit": {
"type": "int",
"default": 30,
"functionName": "STEPPER_DRIVER_TIC",
"param": "current_limit",
"value": 30,
},
"sleep_time": {
"type": "int",
"default": 2,
"functionName": "STEPPER_DRIVER_TIC",
"param": "sleep_time",
"value": 2,
},
"speed": {
"type": "int",
"default": 100000,
"functionName": "STEPPER_DRIVER_TIC",
"param": "speed",
"value": 100000,
},
},
"inputs": [
{
"name": "default",
"id": "default",
"type": "OrderedPair",
"multiple": false,
}
],
"outputs": [
{"name": "default", "id": "default", "type": "OrderedPair"}
],
"pip_dependencies": [{"name": "ticlib", "v": "0.2.2"}],
"path": "PYTHON/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC/STEPPER_DRIVER_TIC.py",
"selected": false,
},
"position": {"x": 883.1245033729516, "y": -2.309719518942927},
"selected": false,
"positionAbsolute": {"x": 883.1245033729516, "y": -2.309719518942927},
"dragging": true,
}
],
"edges": [],
"viewport": {
"x": -358.59636577932724,
"y": 99.85117439980638,
"zoom": 1.0581352782820395,
},
},
"ctrlsManifest": [
{
"type": "input",
"name": "Slider",
"id": "INPUT_PLACEHOLDER",
"hidden": false,
"minHeight": 1,
"minWidth": 2,
"layout": {
"x": 0,
"y": 0,
"h": 2,
"w": 2,
"minH": 1,
"minW": 2,
"i": "INPUT_PLACEHOLDER",
},
}
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: STEPPER_DRIVER_TIC
description: This node controls a stepper motor movement with a TIC driver. The user defines the speed and the sleep time between movements.
keyword: [Python, Instrument, Stepper motor control, Python integration with stepper driver, Motion control and automation, Python"-"based stepper motor control, Stepper motor driver integration, Accurate motor movement with Python, Enhance motion control with Python, Streamline motor automation, Precise motor control using Python, Python control of stepper driver TIC]
image: https://raw.githubusercontent.com/flojoy-ai/docs/main/docs/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC/examples/EX1/output.jpeg
---

In this example, the [`STEPPER_DRIVER_TIC`](https://github.com/flojoy-io/nodes/blob/main/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC/STEPPER_DRIVER_TIC.py) node controls a stepper motor movement with a TIC driver.

First, the user must define the current limitation, which depends on the motor's size and model.
After that, he can set the speed and choose the sleep time between movements.

Then, after clicking the PLAY button, the motor will move between the four default positions. (To choose positions, use the [`STEPPER_DRIVER_TIC_KNOB`](https://github.com/flojoy-io/nodes/blob/main/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC_KNOB/STEPPER_DRIVER_TIC_KNOB.py) node.)

To create a repetitive movement, use the [`LOOP`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/LOOPS/LOOP/LOOP.py) node.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

[//]: # (Custom component imports)

import DocString from '@site/src/components/DocString';
import PythonCode from '@site/src/components/PythonCode';
import AppDisplay from '@site/src/components/AppDisplay';
import SectionBreak from '@site/src/components/SectionBreak';
import AppendixSection from '@site/src/components/AppendixSection';

[//]: # (Docstring)

import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt';
import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt';

<DocString>{DocstringSource}</DocString>
<PythonCode GLink='IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC_KNOB/TIC_KNOB.py'>{PythonSource}</PythonCode>

<SectionBreak />



[//]: # (Examples)

## Examples

<AppDisplay
GLink='IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC_KNOB'
nodeLabel='TIC_KNOB'>
</AppDisplay>

<SectionBreak />



[//]: # (Appendix)

import Notes from './appendix/notes.md';
import Hardware from './appendix/hardware.md';
import Media from './appendix/media.md';

## Appendix

<AppendixSection index={0} folderPath='nodes/IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC_KNOB/appendix/'><Notes /></AppendixSection>
<AppendixSection index={1} folderPath='nodes/IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC_KNOB/appendix/'><Hardware /></AppendixSection>
<AppendixSection index={2} folderPath='nodes/IO/MOTION/MOTOR_DRIVERS/STEPPER/POLULU/TIC_KNOB/appendix/'><Media /></AppendixSection>


Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"description": "The user controls the motor's rotation with the knob position, specified in the node's parameters.",
"parameters": [
{
"name": "knob_value",
"type": "int",
"description": "Defines the position of the motor (rotational movement)."
},
{
"name": "current_limit",
"type": "int",
"description": "Defines the current limitation that the stepper motor will receive."
},
{
"name": "sleep_time",
"type": "int",
"description": "Defines the sleep time after moving to each position."
},
{
"name": "speed",
"type": "int",
"description": "Defines the speed of the motor movement (between 0 and 200000)."
}
],
"returns": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
The STEPPER_DRIVER_TIC_KNOB controls a stepper motor's movement with a TIC driver.

The user controls the motor's rotation with the knob position, specified in the node's parameters.

Parameters
----------
knob_value : int
Defines the position of the motor (rotational movement).
current_limit : int
Defines the current limitation that the stepper motor will receive.
sleep_time : int
Defines the sleep time after moving to each position.
speed : int
Defines the speed of the motor movement (between 0 and 200000).
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from flojoy import flojoy, OrderedPair
from typing import Optional

# Import the TicUSB library to send command to Tic drivers with USB connection
from ticlib import TicUSB
from time import sleep


@flojoy(deps={"ticlib": "0.2.2"})
def TIC_KNOB(
default: Optional[OrderedPair] = None,
knob_value: int = 0,
current_limit: int = 30,
sleep_time: int = 2,
speed: int = 200000,
) -> OrderedPair:


# Converting the knob value into a position
knob_position: int = 2 * knob_value

# Declaration of the stepper driver (You can add serial number to specify the driver)
tic: TicUSB = TicUSB()
# Set the current limit for the driver TIC
tic.set_current_limit(current_limit)
tic.energize() # Turn on the driver
tic.exit_safe_start() # The driver is now ready to receive commands
# Set maximum speed for the motor during first movement.
tic.set_max_speed(speed)

tic.halt_and_set_position(0) # Set initial position to origin
sleep(sleep_time)

# Set target position for the first movement
tic.set_target_position(knob_position)
sleep(sleep_time)

tic.deenergize()
tic.enter_safe_start()

return OrderedPair(x=knob_position, y=speed)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No supporting screenshots, photos, or videos have been added to the media.md file for this node.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No theory or technical notes have been contributed for this node yet.
Loading