Tobias Müller ced9fb271d initial commit 11 maanden geleden
..
examples ced9fb271d initial commit 11 maanden geleden
extras ced9fb271d initial commit 11 maanden geleden
src ced9fb271d initial commit 11 maanden geleden
LICENSE.txt ced9fb271d initial commit 11 maanden geleden
README.md ced9fb271d initial commit 11 maanden geleden
keywords.txt ced9fb271d initial commit 11 maanden geleden
library.properties ced9fb271d initial commit 11 maanden geleden

README.md

DS18B20

Arduino library for the Maxim Integrated DS18B20 1-Wire temperature sensor. This library is very simple and intuitive to use, and supports auto-discovering sensors with an optional high/low condition or manually addressing individual sensors.

For example, we can get the temperature from every sensor on the wire with just a few lines of code:

#include <DS18B20.h>

DS18B20 ds(2);

void setup() {
  Serial.begin(9600);
}

void loop() {
  while (ds.selectNext()) {
    Serial.println(ds.getTempC());
  }
}

See the included examples for more.

Installation

This library uses the OneWire library, so you will need to have this installed. Install it using the Library Manager in the Arduino IDE or download the latest release from GitHub.

In the OneWire.h file set ONEWIRE_SEARCH to 0 since the search functionality is also implemented in this library (don't do this if you need the search functionality for other 1-Wire devices). CRC must be enabled (choose whichever algorithm you prefer). This may save some space on your Arduino.

Wiring the DS18B20

The resistor shown in all the circuit diagrams is 4.7k Ohm pullup resistor.

External Power Mode

Single

A single externally powered DS18B20

Multiple

Multiple externally powered DS18B20s

Parasitic Power Mode

Single

A single parasite powered DS18B20

Multiple

Multiple parasite powered DS18B20s

Mixed Power Mode

Mixed mode DS18B20s