Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
martha-johnston authored Nov 6, 2024
1 parent 1d8417f commit 2874178
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
# [`uln2003` module](https://github.com/viam-modules/uln2003)

This [uln2003 module](https://app.viam.com/module/viam/uln2003) implements a uln2003 [28byj-48 motor](<LINK TO HARDWARE>), used for <DESCRIPTION> using the [`rdk:component:motor` API](https://docs.viam.com/appendix/apis/components/motor/).
This [uln2003 module](https://app.viam.com/module/viam/uln2003) implements a [ULN2003](https://www.ti.com/product/ULN2003A), used for low-current and low-precision applications using the [`rdk:component:motor` API](https://docs.viam.com/appendix/apis/components/motor/). It supports full, half, and quarter stepping with 4096 steps in a rotation in full-step mode.

## Configure your 28byj-48 motor

> [!NOTE]
> Before configuring your motor, you must [create a machine](https://docs.viam.com/cloud/machines/#add-a-new-machine).
## Configure your 28byj-48 motor

Navigate to the [**CONFIGURE** tab](https://docs.viam.com/configure/) of your [machine](https://docs.viam.com/fleet/machines/) in the [Viam app](https://app.viam.com/).
[Add motor / uln2003:28byj-48 to your machine](https://docs.viam.com/configure/#components).

On the new component panel, copy and paste the following attribute template into your motor's attributes field:

```json
{
<ATTRIBUTES>
"board": "<your-board-name>",
"pins": {
"in1": "<pin-number>",
"in2": "<pin-number>",
"in3": "<pin-number>",
"in4": "<pin-number>"
},
"ticks_per_rotation": <int>
}
```

### Attributes

The following attributes are available for `viam:uln2003:28byj-48` motors:

<EXAMPLE !!>
| Attribute | Type | Required? | Description |
| --------- | ---- | --------- | ---------- |
| `i2c_bus` | string | **Required** | The index of the I<sup>2</sup>C bus on the board that the motor is wired to. |
| `i2c_address` | string | Optional | Default: `0x77`. The [I<sup>2</sup>C device address](https://learn.adafruit.com/i2c-addresses/overview) of the motor. |
| `board` | string | **Required** | `name` of the [board](https://docs.viam.com/components/board/) the motor driver is wired to. |
| `pins` | object | **Required** | A JSON object containing the {{< glossary_tooltip term_id="pin-number" text="pin numbers" >}} the `in1`, `in2`, `in3`, and `in4` pins of the motor driver are wired to on the [board](https://docs.viam.com/components/board/). |
| `ticks_per_rotation` | int | **Required** | Number of full steps in a rotation. The motor takes 5.625*(1/64)° per step. One full rotation (360°) is 4096 steps. |

Refer to your motor and motor driver data sheets for specifics.

## Example configuration

Expand All @@ -38,12 +47,20 @@ The following attributes are available for `viam:uln2003:28byj-48` motors:
"type": "motor",
"namespace": "rdk",
"attributes": {
},
"board": "example-board",
"pins": {
"in1": "11",
"in2": "12",
"in3": "13",
"in4": "15"
},
"ticks_per_rotation": 4096
}
"depends_on": []
}
```

### Next Steps
- To test your motor, expand the **TEST** section of its configuration pane or go to the [**CONTROL** tab](https://docs.viam.com/fleet/control/).
- To write code against your motor, use one of the [available SDKs](https://docs.viam.com/sdks/).
- To view examples using a motor component, explore [these tutorials](https://docs.viam.com/tutorials/).
- To view examples using a motor component, explore [these tutorials](https://docs.viam.com/tutorials/).

0 comments on commit 2874178

Please sign in to comment.