🌡 Connecting ds18b20 to Arduino (temperature sensor)
The DS18B20 temperature sensor is a digital temperature sensor. This means that you can measure the temperature using a very simple circuit. It communicates with a common bus, which means that you can connect multiple devices and measure their values using only one Arduino digital output.
The sensor has only three contacts, as you can see in the following figure. The DS18B20 is also available in a waterproof version.
Here are some of the main features of the DS18B20 temperature sensor:
- Communication over a single-wire communication bus
- Operating temperature: -55ºC to 125ºC
- Accuracy +/- 0.5 ºC (between a range from -10ºC to 85ºC)
- Arduino (Uno, Nano, Mega, ...)
- DS18B20 sensor
- 4,7 kOhm resistor
3-wire connection required. Here is the scheme you must follow:
The black part in the diagram is a temperature sensor.
You will need to install the OneWire and DallasTemperature libraries.
- You must have .zip archives of libraries.
- Add via “sketch” - “libraries” - ”add zip library”
Download the following code to the Arduino board.
And write in the comments if there are difficulties.