This uln2003 module implements a ULN2003, used for low-current and low-precision applications using the rdk:component:motor API. It supports full, half, and quarter stepping with 4096 steps in a rotation in full-step mode.
Note
Before configuring your motor, you must create a machine.
Navigate to the CONFIGURE tab of your machine in the Viam app. Add motor / uln2003:28byj-48 to your machine.
On the new component panel, copy and paste the following attribute template into your motor's attributes field:
{
"board": "<your-board-name>",
"pins": {
"in1": "<pin-number>",
"in2": "<pin-number>",
"in3": "<pin-number>",
"in4": "<pin-number>"
},
"ticks_per_rotation": <int>,
"step_mode": "<half|full>"
}The following attributes are available for viam:uln2003:28byj-48 motors:
| Attribute | Type | Required? | Description |
|---|---|---|---|
board |
string | Required | name of the board the motor driver is wired to. |
pins |
object | Required | A JSON object containing the pin numbers the in1, in2, in3, and in4 pins of the motor driver are wired to on the board. |
ticks_per_rotation |
int | Required | Number of half steps in a rotation. The motor takes 5.625*(1/64)° per step. One full rotation (360°) is 4096 steps. |
step_mode |
string | Optional | Full (4 step) or Half (8 step) mode. Valid values: "full" or "half". Full mode is recommended for higher speeds. Adjust ticks_per_rotation accordingly. (default: "half") |
Refer to your motor and motor driver data sheets for specifics.
{
"board": "example-board",
"pins": {
"in1": "11",
"in2": "12",
"in3": "13",
"in4": "15"
},
"ticks_per_rotation": 2048,
"step_mode": "full"
}- To test your motor, expand the TEST section of its configuration pane or go to the CONTROL tab.
- To write code against your motor, use one of the available SDKs.
- To view examples using a motor component, explore these tutorials.