How many temperature sensors can I connect to one bus without losing accuracy.Can I use for example 50 sensors to one bus? Should I change the resistor when I connect too many sensors? Here is the manual http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf

I use this schematic

//  This Arduino sketch reads DS18B20 "1-Wire" digital
//  temperature sensors.
//  Copyright (c) 2010 Mark McComb, hacktronics LLC
//  License: http://www.opensource.org/licenses/mit-license.php (Go crazy)
//  Tutorial:
//  http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html

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

// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 3

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

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

// Assign the unique addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

DeviceAddress insideThermometer = { 0x28, 0x94, 0xE2, 0xDF, 0x02, 0x00, 0x00, 0xFE };
DeviceAddress outsideThermometer = { 0x28, 0x6B, 0xDF, 0xDF, 0x02, 0x00, 0x00, 0xC0 };
DeviceAddress dogHouseThermometer = { 0x28, 0x59, 0xBE, 0xDF, 0x02, 0x00, 0x00, 0x9F };

void setup(void)
  // start serial port
  // Start up the library
  // set the resolution to 10 bit (good enough?)
  sensors.setResolution(insideThermometer, 10);
  sensors.setResolution(outsideThermometer, 10);
  sensors.setResolution(dogHouseThermometer, 10);

void printTemperature(DeviceAddress deviceAddress)
  float tempC = sensors.getTempC(deviceAddress);
  if (tempC == -127.00) {
    Serial.print("Error getting temperature");
  } else {
    Serial.print("C: ");
    Serial.print(" F: ");

void loop(void)
  Serial.print("Getting temperatures...\n\r");

  Serial.print("Inside temperature is: ");
  Serial.print("Outside temperature is: ");
  Serial.print("Dog House temperature is: ");
  • \$\begingroup\$ Have you considered using multipule IO pins on the Arduino to break up the sensors into separate networks? You could, for example, use 5 pins and then only need to have 10 nodes on each network. This avoids some of the electrical problems and can also greatly reduce the amount of time it takes to poll all the sensors since you can do the multiple networks in parallel. \$\endgroup\$
    – bigjosh
    Jun 25, 2016 at 15:24
  • \$\begingroup\$ Yes I said that on comments under the answer \$\endgroup\$
    – Jim
    Jun 25, 2016 at 15:36

1 Answer 1


First answer: As many as you like.

Second answer: There are limitations. For example, if the total length of the bus gets large (e.g. 50m), you will suffer from the capacity of the cable (making transitions slow) and reflections (distorting transitions). The port pin of your (unspecified) Arduino might not be able to drive a long cable with sufficient speed and quality. Note that just a stronger driver does not help here because it will cause stronger reflections. There are dedicated 1-wire master chips with a proper driving ciruit (e.g. DS2482).

Also, keep an eye on memory usage in your microcontroller. It seems you want to store the unique IDs of each sensor which will eat up a substantial amount of resources in the smaller Arduino variants. The total time needed to read out the temperature of all sensors does not seem to be a limiting factor, but this depends on the exact implementation of the protocol in your library.

To your second question: The resistor should stay as it is. It pulls up the bus if none of the connected sensors are sending a '0' and does not depend on the number of sensors connected. For long cables you might want to lower the value slightly or distribute several resistors along the cable (e.g. 3x 15k or 2x 10k).

In any case, for many sensors you should run (as shown) a dedicated power line and not rely on parasitic power mode.

  • \$\begingroup\$ Thank you for your answer. I don't mind about ms I care just for the correct temperature. So the best way is to use more busses(less reflections), lower cable for low resistance. And if there is no memory I have to upgrade the microcontroller. Or i have buy DS2482 right? \$\endgroup\$
    – Jim
    Jun 25, 2016 at 11:41
  • \$\begingroup\$ Does Ethernet cable improve the performance? Will be any problem if I use 9 sensors per bus, total 45 sensors? \$\endgroup\$
    – Jim
    Jun 25, 2016 at 11:52
  • \$\begingroup\$ If several shorter busses are possible, this is preferable. Thicker/Thinner wire doesn't help with signal quality - DC resistance is different from behavior in the 100kHz-1MHz regime. The DS2482 does only help with signal quality, not with respect to memory. Ethernet cable is fine, but it won't improve much compared to standard 3-wire cables. \$\endgroup\$
    – asdfex
    Jun 25, 2016 at 11:54
  • 1
    \$\begingroup\$ It looks like you are hardcoding the device addresses, so I assume this is a static installation where the sensors are not being swapped in and out. If so, you can save a lot of RAM by using PROGMEM to store the addresses in FLASH which is much less constrained. You will need to make a very small edit to the library for it to work with addresses in PROGMEM. \$\endgroup\$
    – bigjosh
    Jun 25, 2016 at 15:18
  • 3
    \$\begingroup\$ Some great info on large 1-wire networks.... maximintegrated.com/en/app-notes/index.mvp/id/148 \$\endgroup\$
    – bigjosh
    Jun 25, 2016 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.