Dark Light
, , ,

Temperature Sensor Ds18b20



This is the latest Digital Temperature Sensor DS18B20 from Maxim IC (but sourced from Sparkfun). The DS18B20 sensor measures temperature in degrees Celsius with 9 to 12-bit precision, -55C to 125C (+/-0.5C). Each temp sensor has a unique 64-bit serial number programmed into it which allows for a huge number of sensors to be used on one data bus. The best Arduino temperature sensor is a wonderful part that is the cornerstone of many data-logging and temperature control projects.

Features & Specifications Of DS18B20 Best Temperature Sensor:

  1. Unique 1-Wire® interface requires only one port pin for communication.
  2. Each device has a unique 64-bit serial code stored in an onboard ROM.
  3. Multidrop capability simplifies distributed temperature sensing applications.
  4. Requires no external components.
  5. It can be powered from the data line. Power supply range is 3.0V to 5.5V.
  6. Measures temperatures from –55°C to +125°C (–67°F to +257°F).
  7. ±0.5°C accuracy from –10°C to +85°C.
  8. Thermometer resolution is user-selectable from 9 to 12 bits.
  9. Converts temperature to 12-bit digital word in 750ms (max.).
  10. User-definable nonvolatile (NV) alarm settings.
  11. Alarm search command identifies and addresses devices whose temperature is outside of programmed limits (temperature alarm condition).
  12. Applications include thermostatic controls, industrial systems, consumer products, thermometers, or any thermally sensitive system.

Applications Of DS18B20 Digital Temperature Sensor for Arduino:

  • Thermostatic Controls
  • Industrial Systems
  • Consumer Products
  • Thermometers
  • Thermally Sensitive Systems

Datasheet Of DS18B20:

Package Includes:

  • 1 x DS18B20 Temperature Sensor

Best Online Shopping website for Best Arduino Temperature Sensor DS18B20 Digital Temp Sensor in cheap price in Karachi, Lahore, Islamabad, Rawalpindi, Sukkur, Peshawar, Multan, Quetta, Faisalabad and all over Pakistan.

Temperature Sensor Ds18b20Temperature Sensor Ds18b20Temperature Sensor Ds18b20Temperature Sensor Ds18b20



Example Code

// Include the libraries we need

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

// arrays to hold device address
DeviceAddress insideThermometer;

 * Setup function. Here we do the basics
void setup(void)
  // start serial port
  Serial.println(“Dallas Temperature IC Control Library Demo”);

  // locate devices on the bus
  Serial.print(“Locating devices…”);
  Serial.print(“Found “);
  Serial.print(sensors.getDeviceCount(), DEC);
  Serial.println(” devices.”);

  // report parasite power requirements
  Serial.print(“Parasite power is: “); 
  if (sensors.isParasitePowerMode()) Serial.println(“ON”);
  else Serial.println(“OFF”);
  // Assign address manually. The addresses below will beed to be changed
  // to valid device addresses on your bus. Device address can be retrieved
  // by using either oneWire.search(deviceAddress) or individually via
  // sensors.getAddress(deviceAddress, index)
  // Note that you will need to use your specific address here
  //insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };

  // Method 1:
  // Search for devices on the bus and assign based on an index. Ideally,
  // you would do this to initially discover addresses on the bus and then 
  // use those addresses and manually assign them (see above) once you know 
  // the devices on your bus (and assuming they don’t change).
  if (!sensors.getAddress(insideThermometer, 0)) Serial.println(“Unable to find address for Device 0”); 
  // method 2: search()
  // search() looks for the next device. Returns 1 if a new address has been
  // returned. A zero might mean that the bus is shorted, there are no devices, 
  // or you have already retrieved all of them. It might be a good idea to 
  // check the CRC to make sure you didn’t get garbage. The order is 
  // deterministic. You will always get the same devices in the same order
  // Must be called before search()
  // assigns the first address found to insideThermometer
  //if (!oneWire.search(insideThermometer)) Serial.println(“Unable to find address for insideThermometer”);

  // show the addresses we found on the bus
  Serial.print(“Device 0 Address: “);

  // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
  sensors.setResolution(insideThermometer, 9);
  Serial.print(“Device 0 Resolution: “);
  Serial.print(sensors.getResolution(insideThermometer), DEC); 

// function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
  // method 1 – slower
  //Serial.print(“Temp C: “);
  //Serial.print(” Temp F: “);
  //Serial.print(sensors.getTempF(deviceAddress)); // Makes a second call to getTempC and then converts to Fahrenheit

  // method 2 – faster
  float tempC = sensors.getTempC(deviceAddress);
  Serial.print(“Temp C: “);
  Serial.print(” Temp F: “);
  Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
 * Main function. It will request the tempC from the sensors and display on Serial.
void loop(void)

  // call sensors.requestTemperatures() to issue a global temperature 
  // request to all devices on the bus
  Serial.print(“Requesting temperatures…”);
  sensors.requestTemperatures(); // Send the command to get temperatures
  // It responds almost immediately. Let’s print out the data
  printTemperature(insideThermometer); // Use a simple function to print out the data

// function to print a device address
void printAddress(DeviceAddress deviceAddress)
  for (uint8_t i = 0; i < 8; i++)
    if (deviceAddress[i] < 16) Serial.print("0");
    Serial.print(deviceAddress[i], HEX);

Based on 0 reviews

0.0 overall

Only logged in customers who have purchased this product may leave a review.

There are no reviews yet.