DS18B20 - Parasitic power mode

Zápisník experimentátora

Hierarchy: DS18B20 Senzor teploty

The integrated circuit DS18B20 (1-Wire digital thermometer) can be connected in two ways. In normal wiring, pin 3 connects the VCC and the circuit is powered from there. The other option is to connect the pins 1 and 3 to each other and connect both to the GND. Then the circuit switches to parasitic mode and is powered directly from the data wire.

This is possible thanks to an internal integrated circuit design that contains a capacitor that is charged from both voltage sources.

Installing libraries

You need to install two libraries:

  • OneWire - The One Wire Protocol itself. The library can be downloaded directly from Paul Stoffregen's site. Or install it directly in the library manager. In the libraries directory, the OneWire directory will be added after installation. There is a directory of examples, where there are several examples and one of which is also applicable to the DS18B20 sensor.
  • Dallas Temperature - This is not a necessary library, but if you install it, you will be more comfortable with the sensor. The library can be downloaded from Dallas Temperature Control Library. The DallasTemperature directory will be added to the libraries directory.


The Dallas Temperature Library is ready for use with both power sources, and when initializing the integrated circuits, it finds out how it is powered and internally adapts communications so that it works in parasitic mode as well.

The picture shows an example of the possible use of an integrated circuit on a breadboard.