DS18B20 for Arduino
📒 Datasheet
PDFThere are many libraries for DS18B20 sensors. This write-up will use the most common set.
1.
🔽 Install Arduino IDE
Install the Arduino IDE2.
📦 Install the library
Start the Arduino IDE, press the Sketch menu, and then Include Library > Manage Libraries. Search for DallasTemperature and install the library.There are also lots of other DS18B20 libraries, any of them will work if you prefer.
3.
🔌 Connections
Module | Controller |
---|---|
GND | ground |
VCC | 3.3 - 5 volt power supply |
SIG | signal data line for 1-Wire sensor |
A pull-up resistor is needed for the signal line, more data can be found in the datasheet. On our carrier boards, this resistor is present.
4.
🔢 Code
5.
➡️ Upload the code
Pick the board and port, then Upload the code.
6.
🔎 View the output
Open the Serial Monitor, measurements should be displayed in the monitor, with updates every
second.