Skip to content

Commit

Permalink
DOCS-1079: Update sensor and servo config instructions (#1982)
Browse files Browse the repository at this point in the history
  • Loading branch information
JessamyT authored Oct 6, 2023
1 parent 9a575c5 commit 34da4a7
Show file tree
Hide file tree
Showing 31 changed files with 354 additions and 88 deletions.
Binary file modified assets/components/power-sensor/fake-config-builder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/power-sensor/ina219-config-builder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/power-sensor/ina226-config-builder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/power-sensor/renogy-config-builder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/sensor/bme280-sensor-ui-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/sensor/ds18b20-sensor-ui-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/sensor/fake-sensor-ui-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/sensor/sensirion-sht3xd-sensor-ui-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified assets/components/servo/fake-servo-ui-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/servo/gpio-servo-ui-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/servo/pi-servo-ui-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions docs/components/motor/28byj48.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "<your-board-name>",
"type": "board",
"model": "<your-board-model>",
"type": "board",
"namespace": "rdk",
"attributes": {},
"depends_on": [],
},
{
"name": "<your-motor-name>",
"type": "motor",
"model": "28byj48",
"type": "motor",
"namespace": "rdk",
"attributes": {
"board": "<your-board-name>",
"pins": {
Expand All @@ -76,13 +78,15 @@ Example configuration for a `28byj48` stepper motor:
"components": [
{
"name": "example-board",
"model": "pi",
"type": "board",
"model": "pi"
"namespace": "rdk"
},
{
"name": "example-motor",
"type": "motor",
"model": "28byj48",
"type": "motor",
"namespace": "rdk",
"attributes": {
"board": "example-board",
"pins": {
Expand Down
6 changes: 4 additions & 2 deletions docs/components/motor/dmc4000.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "<your-motor-name>",
"type": "motor",
"model": "DMC4000",
"type": "motor",
"namespace": "rdk",
"attributes": {
"amplifier_gain": <int>,
"low_current": <int>,
Expand All @@ -64,8 +65,9 @@ Example configuration for a stepper motor controlled by a DMC-40x0 motion contro
"components": [
{
"name": "my-dmc-motor",
"type": "motor",
"model": "DMC4000",
"type": "motor",
"namespace": "rdk",
"attributes": {
"amplifier_gain": 3,
"low_current": 1,
Expand Down
6 changes: 4 additions & 2 deletions docs/components/motor/fake.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "<your-motor-name>",
"type": "motor",
"model": "fake",
"type": "motor",
"namespace": "rdk",
"attributes": {
<...>
},
Expand All @@ -50,8 +51,9 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "fake-motor",
"type": "motor",
"model": "fake",
"type": "motor",
"namespace": "rdk",
"attributes": {
"pins": {
"dir": "",
Expand Down
12 changes: 8 additions & 4 deletions docs/components/motor/gpio/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "<your-board-name>",
"type": "board",
"model": "<your-board-model>",
"type": "board",
"namespace": "rdk",
"attributes": {},
"depends_on": [],
},
{
"name": "<your-motor-name>",
"type": "motor",
"model": "gpio",
"type": "motor",
"namespace": "rdk",
"attributes": {
"pins": {
<...>
Expand Down Expand Up @@ -73,15 +75,17 @@ An example configuration for a `gpio` motor:
"components": [
{
"name": "local",
"type": "board",
"model": "pi",
"type": "board",
"namespace": "rdk",
"attributes": {},
"depends_on": []
},
{
"name": "example-gpio",
"type": "motor",
"model": "gpio",
"type": "motor",
"namespace": "rdk",
"attributes": {
"pins": {
"dir": "36",
Expand Down
18 changes: 12 additions & 6 deletions docs/components/motor/gpio/encoded-motor.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,27 @@ Here’s an example configuration:
"components": [
{
"name": "<your-board-name>",
"type": "board",
"model": "<your-board-model>",
"type": "board",
"namespace": "rdk",
"attributes": {},
"depends_on": []
},
{
"name": "<your-encoder-name>",
"type": "encoder",
"model": "<your-encoder-model>",
"type": "encoder",
"namespace": "rdk",
"attributes": {
... // insert encoder model specific attributes
},
"depends_on": []
},
{
"name": "<your-motor-name>",
"type": "motor",
"model": "gpio",
"type": "motor",
"namespace": "rdk",
"attributes": {
"board": "<your-board-name>",
"pins": {
Expand All @@ -76,15 +79,17 @@ Here’s an example configuration:
"components": [
{
"name": "local",
"type": "board",
"model": "pi",
"type": "board",
"namespace": "rdk",
"attributes": {},
"depends_on": []
},
{
"name": "myEncoder",
"type": "encoder",
"model": "incremental",
"type": "encoder",
"namespace": "rdk",
"attributes": {
"board": "local",
"pins": {
Expand All @@ -96,8 +101,9 @@ Here’s an example configuration:
},
{
"name": "myMotor1",
"type": "motor",
"model": "gpio",
"type": "motor",
"namespace": "rdk",
"attributes": {
"board": "local",
"pins": {
Expand Down
12 changes: 8 additions & 4 deletions docs/components/motor/gpiostepper.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "<your-board-name>",
"type": "board",
"model": "<your-board-model>",
"type": "board",
"namespace": "rdk",
"attributes": {},
"depends_on": [],
},
{
"name": "<your-motor-name>",
"type": "motor",
"model": "gpiostepper",
"type": "motor",
"namespace": "rdk",
"attributes": {
"board": "<your-board-name>",
"pins": {
Expand All @@ -71,13 +73,15 @@ Here’s an example of a basic stepper driver config:
"components": [
{
"name": "example-board",
"model": "pi",
"type": "board",
"model": "pi"
"namespace": "rdk"
},
{
"name": "example-motor",
"type": "motor",
"model": "gpiostepper",
"type": "motor",
"namespace": "rdk",
"attributes": {
"board": "example-board",
"pins": {
Expand Down
6 changes: 4 additions & 2 deletions docs/components/motor/roboclaw.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "<your-roboclaw-motor-name>",
"type": "motor",
"model": "roboclaw",
"type": "motor",
"namespace": "rdk",
"attributes": {
"serial_path": "<your-serial-path>",
"motor_channel": <int>,
Expand All @@ -64,8 +65,9 @@ Example configuration for a `roboclaw` DC brushed motor:
"components": [
{
"name": "your-roboclaw-motor",
"type": "motor",
"model": "roboclaw",
"type": "motor",
"namespace": "rdk",
"attributes": {
"serial_path": "/dev/ttyUSB0",
"motor_channel": 1,
Expand Down
12 changes: 8 additions & 4 deletions docs/components/motor/tmc5072.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "<your-board-name>",
"type": "board",
"model": "<your-board-model>",
"type": "board",
"namespace": "rdk",
"attributes": {},
"depends_on": [],
},
{
"name": "<your-motor-name>",
"type": "motor",
"model": "TMC5072",
"type": "motor",
"namespace": "rdk",
"attributes": {
"board": "<your-board-name>",
"spi_bus": "<your-spi-bus-name>",
Expand Down Expand Up @@ -72,13 +74,15 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "example-board",
"model": "pi",
"type": "board",
"model": "pi"
"namespace": "rdk"
},
{
"name": "my-tmc-motor",
"type": "motor",
"model": "TMC5072",
"type": "motor",
"namespace": "rdk",
"attributes": {
"board": "example-board",
"chip_select": "36",
Expand Down
5 changes: 3 additions & 2 deletions docs/components/power-sensor/fake.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ Click on the **Components** subtab and click **Create component** in the lower-l
Select the type `power_sensor`, then select the `fake` model.
Name your sensor, and click **Create**.

{{<imgproc src="/components/power-sensor/fake-config-builder.png" resize="750x" declaredimensions=true alt="Fake power sensor configuration builder">}}
![Fake power sensor configuration panel in the Viam app. No attributes are configured.](/components/power-sensor/fake-config-builder.png)

{{% /tab %}}
{{% tab name="JSON Template" %}}

```json {class="line-numbers linkable-line-numbers"}
{
"name": "<your-sensor-name>",
"type": "power_sensor",
"model": "fake",
"type": "power_sensor",
"namespace": "rdk",
"attributes": {}
}
```
Expand Down
42 changes: 35 additions & 7 deletions docs/components/power-sensor/ina219.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,34 @@ Click on the **Components** subtab and click **Create component** in the lower-l
Select the type `power_sensor`, then select the `ina219` model.
Name your sensor, and click **Create**.

{{<imgproc src="/components/power-sensor/ina219-config-builder.png" resize="900x" declaredimensions=true alt="ina219 power sensor configuration tab">}}
![ina219 power sensor configuration panel in the Viam app.](/components/power-sensor/ina219-config-builder.png)

Edit and fill in the attributes as applicable.
Copy and paste the following attribute template into your power sensor's **Attributes** box.
Then remove and fill in the attributes as applicable to your power sensor, according to the table below.

{{< tabs >}}
{{% tab name="Attributes template" %}}

```json {class="line-numbers linkable-line-numbers"}
{
"i2c_bus": <int>,
"i2c-addr": <int>,
"max_current_amps": <float>,
"shunt_resistance": <float>
}
```

{{% /tab %}}
{{% tab name="Attributes example" %}}

```json {class="line-numbers linkable-line-numbers"}
{
"i2c_bus": 1
}
```

{{% /tab %}}
{{< /tabs >}}

{{% /tab %}}
{{% tab name="JSON Template" %}}
Expand All @@ -33,11 +58,14 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "ina1",
"type": "power_sensor",
"model": "ina19",
"type": "power_sensor",
"namespace": "rdk",
"attributes": {
"i2c_bus": "integer",
"i2c-addr": "integer"
"i2c_bus": <int>,
"i2c-addr": <int>,
"max_current_amps": <float>,
"shunt_resistance": <float>
},
"depends_on": []
}
Expand All @@ -55,7 +83,7 @@ The following attributes are available for `INA219` sensors:
| --------- | -----| --------- | ----------- |
| `i2c_bus` | integer | **Required** | The `number` of the [I<sup>2</sup>C bus](/components/board/#i2cs) that the sensor is connected to. |
| `i2c_address` | integer | Optional | The sensor's unique [I<sup>2</sup>C address](https://learn.adafruit.com/i2c-addresses/overview). <br>Default: `0x40`
| `max_current_amps` | number | Optional | Default: 3.2A. The maximum current that the sensor can measure in amperes (A).
| `shunt_resistance` | number | Optional | Default: 0.1Ω. The shunt resistance value of the sensor in Ohms (Ω).
| `max_current_amps` | float | Optional | Default: 3.2A. The maximum current that the sensor can measure in amperes (A).
| `shunt_resistance` | float | Optional | Default: 0.1Ω. The shunt resistance value of the sensor in Ohms (Ω).

{{< readfile "/static/include/components/test-control/power-sensor-control.md" >}}
Loading

0 comments on commit 34da4a7

Please sign in to comment.