-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07488c8
commit f3a5d01
Showing
4 changed files
with
142 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: "Micro-RDK Sensor Models" | ||
linkTitle: "Sensor" | ||
weight: 30 | ||
type: "docs" | ||
description: "Support in the micro-RDK for sensors, devices that measur information about the outside world." | ||
images: ["/icons/components/sensor.svg"] | ||
tags: ["sensor", "components", "micro-rdk"] | ||
no_list: true | ||
# SMEs: Andrew Morrow | ||
--- | ||
|
||
A sensor is a device that can measure information about the outside world. | ||
For more information and models supported by the {{< glossary_tooltip term_id="rdk" text="RDK" >}}, see [Sensor Component](/components/sensor/). | ||
|
||
## Supported models | ||
|
||
For configuration information, click a supported sensor model name: | ||
|
||
<!-- prettier-ignore --> | ||
| Model |Description | | ||
| ----- | ---------- | | ||
| [`ultrasonic`](ultrasonic/) | [HC-SR04](https://www.sparkfun.com/products/15569) ultrasonic sensors | | ||
|
||
{{% readfile "/static/include/micro-create-your-own.md" %}} | ||
|
||
## API | ||
|
||
The micro-RDK [sensor API](/components/sensor/#api) supports only the following client SDK API methods, which operate the same as in the full-featured RDK: | ||
|
||
- [`GetReadings()`](/components/sensor/#getreadings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
title: "Configure an Ultrasonic Sensor (Micro-RDK)" | ||
linkTitle: "ultrasonic" | ||
weight: 60 | ||
type: "docs" | ||
description: "Configure an ultrasonic sensor." | ||
tags: ["sensor", "components", "ultrasonic"] | ||
icon: true | ||
images: ["/icons/components/sensor.svg"] | ||
# SME: Andrew Morrow | ||
--- | ||
|
||
Configure an `ultrasonic` sensor to integrate the [HC-S204](https://www.sparkfun.com/products/15569) ultrasonic distance sensor into your machine: | ||
|
||
{{< tabs >}} | ||
{{% tab name="Config Builder" %}} | ||
|
||
Navigate to the **Config** tab of your machine's page in [the Viam app](https://app.viam.com). | ||
Click on the **Components** subtab and click **Create component**. | ||
Select the `sensor` type, then select the `ultrasonic` model. | ||
Enter a name for your sensor and click **Create**. | ||
|
||
![Creation of a ultrasonic sensor in the Viam app config builder.](/build/micro-rdk/ultrasonic/ultrasonic-sensor-ui-config.png) | ||
|
||
Copy and paste the following attribute template into your sensor's **Attributes** box. | ||
Then remove and fill in the attributes as applicable to your sensor, according to the table below. | ||
|
||
{{< tabs >}} | ||
{{% tab name="Attributes template" %}} | ||
|
||
```json {class="line-numbers linkable-line-numbers"} | ||
{ | ||
"trigger_pin": "<pin-number>", | ||
"echo_interrupt_pin": "<pin-number>", | ||
"timeout_ms": <int> | ||
} | ||
``` | ||
|
||
{{% /tab %}} | ||
{{% tab name="Attributes example" %}} | ||
|
||
```json {class="line-numbers linkable-line-numbers"} | ||
{ | ||
"trigger_pin": "15", | ||
"echo_interrupt_pin": "18", | ||
"timeout_ms": "200" | ||
} | ||
``` | ||
|
||
{{% /tab %}} | ||
{{< /tabs >}} | ||
|
||
{{% /tab %}} | ||
{{% tab name="JSON Template" %}} | ||
|
||
```json {class="line-numbers linkable-line-numbers"} | ||
{ | ||
"components": [ | ||
{ | ||
"name": "<your-ultrasonic-sensor-name>", | ||
"model": "ultrasonic", | ||
"type": "sensor", | ||
"namespace": "rdk", | ||
"attributes": { | ||
"trigger_pin": "<pin-number>", | ||
"echo_interrupt_pin": "<pin-number>" | ||
"timeout_ms": <int> | ||
}, | ||
"depends_on": [] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
{{% /tab %}} | ||
{{% tab name="JSON Example" %}} | ||
|
||
```json {class="line-numbers linkable-line-numbers"} | ||
{ | ||
"components": [ | ||
{ | ||
"name": "my-ultrasonic-sensor", | ||
"model": "ultrasonic", | ||
"type": "sensor", | ||
"namespace": "rdk", | ||
"attributes": { | ||
"trigger_pin": "15", | ||
"echo_interrupt_pin": "18", | ||
"timeout_ms": "200" | ||
}, | ||
"depends_on": [] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
{{% /tab %}} | ||
{{% /tabs %}} | ||
|
||
The following attributes are available for `ultrasonic` sensors: | ||
|
||
<!-- prettier-ignore --> | ||
| Attribute | Type | Inclusion | Description | | ||
| --------- | ---- | --------- | ----------- | | ||
| `trigger_pin` | string | **Required** | The GPIO number of the [board's](/build/micro-rdk/board/) GPIO pin that you have wired the ultrasonic's trigger pin to. | | ||
| `echo_interrupt_pin` | string | **Required** | The GPIO number of the pin you wired the ultrasonic's echo pin to on your board. | | ||
| `timeout_ms` | int | Optional | Time to wait in milliseconds before timing out of requesting to get ultrasonic distance readings. <br> Default: `1000`. | | ||
|
||
{{< readfile "/static/include/components/test-control/sensor-control.md" >}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters