Configure a ds18b20 Sensor

Configure a ds18b20 sensor to integrate a DallasTemperature DS18B20 1-wire digital temperature sensor into your robot:

Navigate to the Config tab of your robot’s page in the Viam app. Click on the Components subtab and click Create component. Select the sensor type, then select the ds18b20 model. Enter a name for your sensor and click Create.

Creation of a ds18b20 sensor in the Viam app config builder.

Edit and fill in the attributes as applicable.

  "components": [
      "name": "<your-ds18b20-sensor-name>",
      "type": "sensor",
      "model": "ds18b20",
      "attributes": {
        "unique_id": "<your-sensor-unique-id>"
      "depends_on": []

The following attributes are available for ds18b20 sensors:

unique_idstringRequiredThe unique 64-bit serial code of your DS18B20 sensor. Laser engraved onto your sensor and available programmatically. Example: "28EEB2B81D160127". Note that this ID will also be the last 16 digits of the device file when the sensor is mounted in a Linux filesystem.

Test the sensor

After you configure your sensor, navigate to the Control tab and select the Sensors dropdown panel. If you have multiple sensors configured, your sensor will be listed here among others. To access detailed readings from your sensor, select the Get Readings button.

The sensor component in the control tab

Have questions, or want to meet other people working on robots? Join our Community Discord.