Skip to content

ds18b20

Iain Prior edited this page Mar 26, 2024 · 3 revisions

The ds18b20temp module is designed to read the temperature and relative humidity values from a DS18B20 1-wire sensor. It sends these values as telemetry.

UI

The UI looks like this:

Temperature Block On Main UI

The UI updates with fresh telemetry each time the telemetry data is refreshed.

Hardware / Pinout

I used these DS18B20 sensors from Adafruit: https://www.adafruit.com/product/381

The wiring diagram is:

  • Data -> GPIO18 on S2 Mini (D3 on D1 Mini)
  • VCC -> 3.3V
  • GND -> GND

In addition you need a resistor between the data and VCC lines. I used a 4.7k resistor.

I used a S2 Mini as the main controller: https://www.wemos.cc/en/latest/s2/s2_mini.html

Configuration

The DS18B20 sensor is a 1-wire sensor, so it only needs one pin to communicate with the controller. The pin is configurable via the profile.json i.e. not user changeable but determined at time of flashing / updating the board.

To configure this module:

  • Include it in the list of included modules in the profile.json file.

    "activeModules": ["basic", ... "ds18b20temp"],

  • Add a document for the ds18b20. In this the pin key is set to the correct pin for the 1-wire sensor.

    "ds18b20": { "pin": 18, "readEveryMs": 10000 }

  • Add andother key for the ds18b20temp module called "readEveryMs". This key is used to determine how often the sensor is read (as a number of milliseconds).

    "ds18b20": { "pin": 18, "readEveryMs": 10000 }

Telemetry provided

The main point of this module is to provide telemetry about what the temperature. It provides this as telemetry on each cycle. It will not provide any telemetry if it has not been able to read the sensor (yet).

telemetry = {
    "temperature/32498239823bcd332" : self.currentT
}

Telemetry consumed

This module consumes no telemetry from other modules.

Commands provided

This module does not provide any commands to other modules. It only provides telemetry about the internal state.

Commands consumed

This module does not consume any commands from other modules.

Clone this wiki locally