Dallas 18B20 temperature sensor

Sat June 27, 2020
arduino iot

The DS18B20 is a three-pin digital thermometer that provides digital temperature measurements as 9 to 12-bit packets over a single wire serial connection. Its temperature range is between -55 and 125 degrees Celcius, with excellent accuracy of 0.5 degrees between -10 and 85 degrees Celcius.

It can convert a temperature to a 12 bit reading in 750ms.

ds18b20 pinouts

You can download the device datasheet from here.

Required libraries to use the DS18B20

To use the temperature sensor, one must include the Arduino Library for Maxim Temperature Integrated Circuits developed by Miles Burton. Constructing a DallasTemperature instance requires a reference to a OneWire object. OneWire is another library designed by Miles Burton that provides one wire or MicroLan capabilities. Constructing a OneWire object requires the Arduino pin to the single-wire device.

The program to read the temperature will therefore look as follows:

#include <OneWire.h>
#include <DallasTemperature.h>

// use pin 10 to read temperature
OneWire oneWire(10);

DallasTemperature dallasTemperature(&oneWire);


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

void loop()
{
  dallasTemperature.requestTemperatures();

  // as we only have one device, the index of the thermometer
  //is 0
  float temp = dallasTemperature.getTempCByIndex(0);

  Serial.print("Temperature: ");
  Serial.println (temp);

  delay(800);
}

The setup is as follows:

Circuit Diagram




Tinkering with a Microsoft MXChip IoT DevKit

February 10, 2020
iot mxchip
comments powered by Disqus


machine-learning 27 python 21 fuzzy 14 azure-ml 11 hugo_cms 11 linear-regression 10 gradient-descent 9 type2-fuzzy 8 type2-fuzzy-library 8 type1-fuzzy 5 cnc 4 dataset 4 datastore 4 it2fs 4 excel 3 paper-workout 3 r 3 c 2 c-sharp 2 experiment 2 hyperparameter-tuning 2 iot 2 model-optimization 2 programming 2 robotics 2 weiszfeld_algorithm 2 arduino 1 automl 1 classifier 1 computation 1 cost-functions 1 development 1 embedded 1 fuzzy-logic 1 game 1 javascript 1 learning 1 mathjax 1 maths 1 mxchip 1 pandas 1 pipeline 1 random_walk 1 roc 1 tools 1 vscode 1 wsl 1