Arduino library for interfacing with Maxim temperature sensors
C++
1,043
285 commits
updated Apr 12, 2026
A robust and feature-complete Arduino library for Maxim Temperature Integrated Circuits.
| device | power | notes |
|---|---|---|
| DS18B20 | 3-5 V | the reference |
| DS18S20 | 3-5 V | 9 bit only |
| DS1822 | 3-5 V | |
| DS1820 | 5 V | 9 bit only |
| MAX31820 | 3 V ⚠️ | |
| MAX31850/1 | 3-3.7V ⚠️ | thermocouple |
Hardware Setup
Code Example
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is connected to GPIO 4
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void) {
Serial.begin(9600);
sensors.begin();
}
void loop(void) {
sensors.requestTemperatures();
delay(750);
float tempC = sensors.getTempCByIndex(0);
Serial.print("Temperature: ");
Serial.print(tempC);
Serial.println("°C");
delay(1000);
}
getTempC(address) and getTempF(address))You can slim down the code by defining the following at the top of DallasTemperature.h:
#define REQUIRESNEW // Use if you want to minimise code size
#define REQUIRESALARMS // Use if you need alarm functionality
If you want to contribute to the library development:
The project includes a development container configuration for VS Code that provides a consistent development environment.
Prerequisites
Development Commands Within the dev container, use:
arduino-build - Compile the library and examplesarduino-test - Run the test suitearduino-build-test - Complete build and test processNote: Currently compiling against arduino:avr:uno environment
MIT License | Copyright (c) 2026 Miles Burton
Full license text available in LICENSE file.
8 followers · starred Jul 2020
86 followers · starred Oct 2015
194 followers · starred Apr 2017
18 followers · starred May 2017
Arduino library for interfacing with Maxim temperature sensors
C++
1,043
285 commits
updated Apr 12, 2026
A robust and feature-complete Arduino library for Maxim Temperature Integrated Circuits.
| device | power | notes |
|---|---|---|
| DS18B20 | 3-5 V | the reference |
| DS18S20 | 3-5 V | 9 bit only |
| DS1822 | 3-5 V | |
| DS1820 | 5 V | 9 bit only |
| MAX31820 | 3 V ⚠️ | |
| MAX31850/1 | 3-3.7V ⚠️ | thermocouple |
Hardware Setup
Code Example
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is connected to GPIO 4
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void) {
Serial.begin(9600);
sensors.begin();
}
void loop(void) {
sensors.requestTemperatures();
delay(750);
float tempC = sensors.getTempCByIndex(0);
Serial.print("Temperature: ");
Serial.print(tempC);
Serial.println("°C");
delay(1000);
}
getTempC(address) and getTempF(address))You can slim down the code by defining the following at the top of DallasTemperature.h:
#define REQUIRESNEW // Use if you want to minimise code size
#define REQUIRESALARMS // Use if you need alarm functionality
If you want to contribute to the library development:
The project includes a development container configuration for VS Code that provides a consistent development environment.
Prerequisites
Development Commands Within the dev container, use:
arduino-build - Compile the library and examplesarduino-test - Run the test suitearduino-build-test - Complete build and test processNote: Currently compiling against arduino:avr:uno environment
MIT License | Copyright (c) 2026 Miles Burton
Full license text available in LICENSE file.
8 followers · starred Jul 2020
86 followers · starred Oct 2015
194 followers · starred Apr 2017
18 followers · starred May 2017