Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Sensors & Modules

Temperature Logger with DS1820 Bus: 10 Sensors on One Wire

Temperature Logger with DS1820 Bus: 10 Sensors on One Wire

March 11, 2026 /Posted byJayesh Jain / 0

What if you could monitor the temperature at 10 different points in a building, a server rack, a greenhouse, or a cold chain storage facility — all connected to a single data pin on your Arduino? That is exactly what the 1-Wire bus protocol and the DS1820 family of sensors (including the ubiquitous DS18B20) make possible.

The 1-Wire bus lets you chain dozens of sensors on a single GPIO line. Each sensor has a unique 64-bit address burned into ROM at the factory, so the master (Arduino) can address and read each one individually. The result is clean, scalable wiring — no analog channels consumed, no I2C address conflicts, and virtually unlimited sensor count on a single wire.

In this tutorial we will build a complete 10-sensor temperature logger: sensors on the bus, readings printed to Serial, and optionally logged to an SD card for long-term data collection.

Table of Contents

  1. How the 1-Wire Protocol Works
  2. DS1820 Sensor Family: DS18S20, DS18B20, DS1822
  3. Hardware Required
  4. Wiring Multiple Sensors on One Bus
  5. Required Arduino Libraries
  6. Step 1: Scan and Record All Sensor Addresses
  7. Step 2: Read All 10 Sensors
  8. Step 3: Log to SD Card with Timestamps
  9. Tips for Long-Bus Reliability
  10. Frequently Asked Questions

How the 1-Wire Protocol Works

1-Wire is a serial communication protocol developed by Dallas Semiconductor (now Maxim/Analog Devices). It operates on a single bidirectional data line that is shared between all devices on the bus. Power can optionally be provided over the same data line in “parasitic power” mode, though an external VDD supply gives much better performance.

All communication follows a master-slave model. The bus master (Arduino) controls all transactions. A typical read cycle looks like this:

  1. Reset pulse: Master pulls bus LOW for 480μs, then releases. Devices pull LOW for 60-240μs to acknowledge (presence pulse).
  2. ROM command: Master sends a command byte. For multi-device buses: 0x55 (Match ROM, followed by 64-bit address) or 0xCC (Skip ROM, broadcasts to all).
  3. Function command: E.g., 0x44 (Convert T — start temperature conversion) or 0xBE (Read Scratchpad).
  4. Data exchange: Device writes temperature data to its scratchpad; master reads it back as 9 bytes.

The timing is tight (microsecond precision) but the OneWire library handles all of this for you.

DS1820 Sensor Family: DS18S20, DS18B20, DS1822

Model Resolution Accuracy Range Notes
DS18S20 9-bit fixed ±0.5°C -55 to +125°C Older, simpler; 0.5°C steps
DS18B20 9–12 bit (programmable) ±0.5°C -55 to +125°C Most popular; 0.0625°C at 12-bit
DS1822 9–12 bit (programmable) ±2°C -55 to +125°C Lower accuracy, lower cost

For most logging applications, the DS18B20 at 12-bit resolution (0.0625°C steps) is the standard choice. It is waterproof versions are widely available, making it suitable for liquid temperature measurement, pipe monitoring, and outdoor use.

DS18B20 Programmable Resolution

DS18B20 Programmable Resolution Temperature Sensor IC

The industry-standard 1-Wire temperature sensor. Unique 64-bit ROM address makes it perfect for multi-sensor bus builds.

View on Zbotic

Hardware Required

  • Arduino Uno, Nano, or Mega
  • 10x DS18B20 sensors (TO-92 package or waterproof probe)
  • 4.7kΩ resistor (single one for the entire bus)
  • Micro SD card module (optional, for logging)
  • DS1307 or DS3231 RTC module (optional, for timestamps)
  • Jumper wires

Wiring Multiple Sensors on One Bus

All DS18B20 sensors share the same three wires: VCC, GND, and DATA. The 4.7kΩ pull-up resistor between DATA and VCC is mandatory — without it, the bus will not function.

Arduino 5V  ──┬─── DS18B20 #1 VCC
              ├─── DS18B20 #2 VCC
              ├─── ... (all VCC lines together)
              └─── DS18B20 #10 VCC

Arduino GND ──┬─── DS18B20 #1 GND
              ├─── DS18B20 #2 GND
              └─── ... (all GND lines together)

Arduino D2  ──┬── 4.7kΩ ──── Arduino 5V   (pull-up resistor)
              ├─── DS18B20 #1 DATA
              ├─── DS18B20 #2 DATA
              └─── ... (all DATA lines together)

All sensors are literally connected in parallel on the same three wires. The 1-Wire protocol’s address-based addressing allows the master to select and communicate with each sensor independently despite the shared bus.

Long Bus Runs (>3 metres)

For longer cable runs, lower the pull-up resistor to 2.2kΩ–3.3kΩ. Use shielded cable (Cat5, twisted pair) with the shield connected to GND. Terminate the far end with a 100Ω resistor between DATA and GND to reduce ringing. In parasitic power mode, limit bus length to 1–2 metres; with external VCC, you can go much further.

Required Arduino Libraries

Install both via Arduino IDE Library Manager (Sketch → Include Library → Manage Libraries):

  • OneWire by Jim Studt et al. — low-level 1-Wire protocol driver
  • DallasTemperature by Miles Burton — high-level DS18B20/DS1820 library built on top of OneWire

Step 1: Scan and Record All Sensor Addresses

Before building the logger, you need the 64-bit ROM address of each sensor. The easiest way is to connect all 10 sensors and run the address scanner sketch. Note that order on the bus is arbitrary — label each physical sensor after you identify it.

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

#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup() {
  Serial.begin(115200);
  sensors.begin();

  int count = sensors.getDeviceCount();
  Serial.print("Found "); Serial.print(count); Serial.println(" sensors:");

  DeviceAddress addr;
  for (int i = 0; i < count; i++) {
    if (sensors.getAddress(addr, i)) {
      Serial.print("Sensor "); Serial.print(i); Serial.print(": ");
      for (int j = 0; j < 8; j++) {
        if (addr[j] < 0x10) Serial.print("0");
        Serial.print(addr[j], HEX);
        if (j < 7) Serial.print("-");
      }
      Serial.println();
    }
  }
}

void loop() {}

Run this sketch and copy the addresses from Serial Monitor. You will get output like:

Found 10 sensors:
Sensor 0: 28-FF-A1-B2-C3-D4-E5-F6
Sensor 1: 28-11-22-33-44-55-66-77
...

Label each physical sensor (tape, cable marker) and record which address corresponds to which location.

Step 2: Read All 10 Sensors

The most efficient way to read multiple sensors is to trigger all conversions simultaneously with a broadcast command (requestTemperatures()), then read each device individually after the conversion completes.

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

#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

const char* sensorLabels[] = {
  "Server Room", "UPS Room", "Corridor", "Office 1", "Office 2",
  "Rooftop", "Store", "Basement", "Lab", "Reception"
};

int numSensors;

void setup() {
  Serial.begin(115200);
  sensors.begin();
  numSensors = sensors.getDeviceCount();
  sensors.setResolution(12);  // 12-bit: 0.0625°C steps, 750ms conversion
  Serial.print("Initialized "); Serial.print(numSensors); Serial.println(" sensors");
}

void loop() {
  sensors.requestTemperatures();  // Broadcast: all sensors convert simultaneously
  delay(750);                     // Wait for 12-bit conversion to complete

  Serial.println("--- Temperature Reading ---");
  for (int i = 0; i < numSensors; i++) {
    float tempC = sensors.getTempCByIndex(i);
    if (tempC == DEVICE_DISCONNECTED_C) {
      Serial.print(sensorLabels[i]);
      Serial.println(": DISCONNECTED");
    } else {
      Serial.print(sensorLabels[i]);
      Serial.print(": ");
      Serial.print(tempC, 2);
      Serial.println(" °C");
    }
  }
  Serial.println();
  delay(5000);  // Log every 5 seconds
}

Note: calling requestTemperatures() once broadcasts to ALL sensors. All 10 sensors convert simultaneously, so total wait time is just 750ms for 12-bit resolution — not 750ms × 10.

DS18B20 Temperature Sensor Module

DS18B20 Temperature Sensor Module

Ready-to-use DS18B20 module with pull-up resistor and connectors. Drop it straight onto the bus without extra components.

View on Zbotic

Step 3: Log to SD Card with Timestamps

For long-term logging, extend the sketch to write CSV data to an SD card. Wire the SD module: CS to D10, MOSI to D11, MISO to D12, SCK to D13, VCC to 5V, GND to GND. Add a DS3231 RTC on I2C (SDA=A4, SCL=A5) for real timestamps.

#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <SD.h>
#include <RTClib.h>

#define ONE_WIRE_BUS 2
#define SD_CS        10

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
RTC_DS3231 rtc;
File logFile;

void setup() {
  Serial.begin(115200);
  sensors.begin();
  sensors.setResolution(12);
  rtc.begin();
  SD.begin(SD_CS);

  // Write CSV header
  logFile = SD.open("templog.csv", FILE_WRITE);
  if (logFile) {
    logFile.print("DateTime");
    int n = sensors.getDeviceCount();
    for (int i = 0; i < n; i++) {
      logFile.print(",Sensor_"); logFile.print(i);
    }
    logFile.println();
    logFile.close();
  }
}

void loop() {
  sensors.requestTemperatures();
  delay(750);

  DateTime now = rtc.now();
  char buf[20];
  sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d",
    now.year(), now.month(), now.day(),
    now.hour(), now.minute(), now.second());

  Serial.print(buf);

  logFile = SD.open("templog.csv", FILE_WRITE);
  if (logFile) logFile.print(buf);

  int n = sensors.getDeviceCount();
  for (int i = 0; i < n; i++) {
    float t = sensors.getTempCByIndex(i);
    Serial.print(","); Serial.print(t, 2);
    if (logFile) { logFile.print(","); logFile.print(t, 2); }
  }

  Serial.println();
  if (logFile) { logFile.println(); logFile.close(); }

  delay(60000);  // Log every 60 seconds
}

The resulting templog.csv file can be opened directly in Excel or Python/pandas for analysis, graphing, and alerting.

Tips for Long-Bus Reliability

  • One pull-up resistor per bus, not per sensor. Multiple pull-ups in parallel reduce the effective resistance and can cause signalling problems.
  • Check CRC. The DallasTemperature library validates CRC-8 checksums. If you get sporadic garbage readings, increase the pull-up capacitor (add 100pF from DATA to GND) or reduce pull-up resistance.
  • Address by ROM address, not by index. Sensor index (0, 1, 2…) can change if a sensor is added or removed from the bus. Address by the fixed 64-bit ROM address using getTempC(deviceAddress) for stable location-to-label mapping in production systems.
  • Power-on settling time. After power-up, wait 500ms before issuing the first requestTemperatures(). The sensors need a conversion cycle to initialise their scratchpad.
  • Hot-plug support. The 1-Wire protocol allows adding/removing sensors while the bus is powered. Call sensors.begin() again after topology changes.
  • Maximum parasitic power bus length: About 1 metre. With external VDD power: up to 100+ metres with appropriate cable and pull-up adjustments.

Frequently Asked Questions

Q: How many DS18B20 sensors can I put on one bus?

Theoretically unlimited (2⁶⁴ unique addresses). In practice, signal integrity limits you to around 100 sensors on a typical Arduino setup. For large networks, use multiple buses (one per GPIO pin) or a bus master IC.

Q: Why is my reading 85°C every time I power on?

85°C is the DS18B20’s power-on reset value in the scratchpad. It means the sensor is returning the default value before a conversion has been requested. Add a 500ms delay after power-up and before the first requestTemperatures() call.

Q: Can DS18B20 sensors be used in water?

The bare TO-92 packaged sensor is not waterproof. Use the waterproof probe version (stainless steel tube, 1m/2m/3m cable) for liquid temperature measurement. The sensor IC inside is the same DS18B20 — accuracy and protocol are identical.

Q: What is the difference between DS18S20 and DS18B20?

The DS18S20 is an older device with fixed 9-bit resolution (0.5°C steps). The DS18B20 offers programmable 9-12 bit resolution (0.0625°C at 12-bit). The DS18B20 is universally preferred for new designs. Both use the same 1-Wire protocol and pin-out.

Q: Can I mix DS18B20 and DS18S20 on the same bus?

Yes. The DallasTemperature library handles both. However, if you use the DS18S20’s “enhanced precision” mode, the conversion time changes — it is simpler to use only one type on a bus.

Q: My sensors read different values from each other in the same environment. Is this normal?

A small variation (±0.5°C) is within the sensor’s specified accuracy. If variation exceeds 1-2°C, check that the sensors are all in the same thermal environment (not some in direct airflow, some not) and verify CRC-validated readings to rule out communication errors.

Build your multi-sensor temperature logger today. Zbotic stocks DS18B20 sensors in both TO-92 and waterproof probe variants, along with Arduino boards, SD modules, and all the components you need. Fast delivery across India.

Conclusion

The 1-Wire bus and DS18B20 sensors are one of the most elegant solutions in electronics — a single GPIO pin, a single 4.7kΩ resistor, and you can scale from 1 to 10 to 100 temperature sensors without adding any additional hardware. The DallasTemperature library makes the coding accessible to beginners, while the protocol’s robustness over long cable runs makes it equally suitable for professional installations. Whether you are monitoring a server room, tracking greenhouse temperatures through the seasons, or logging a cold-chain distribution network, the DS18B20 1-Wire bus remains the gold standard for distributed temperature measurement.

Tags: DS1820 temperature sensor, DS18B20 tutorial, multi sensor logger, one wire bus arduino, temperature logging arduino
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
3D Printing Costs India: Calcu...
blog 3d printing costs india calculate material and electricity 595874
blog cinewhoop drone build safe indoor filming with ducts 595876
Cinewhoop Drone Build: Safe In...

Related posts

Svg%3E
Read more

Encoder Module: Position and Speed Measurement with Arduino

April 1, 2026 0
A rotary encoder converts the angular position and rotation speed of a shaft into electrical signals that Arduino can count... Continue reading
Svg%3E
Read more

Infrared Obstacle Sensor: Line Follower and Object Detection

April 1, 2026 0
Infrared obstacle sensors are the building blocks of line-following robots, edge detection systems, and proximity triggers. These tiny modules emit... Continue reading
Svg%3E
Read more

Rain Sensor and Raindrop Detection Module: Arduino Guide

April 1, 2026 0
A rain sensor module detects the presence of water droplets on its surface, giving Arduino a simple signal to trigger... Continue reading
Svg%3E
Read more

LiDAR Sensor TFmini: Distance Measurement Beyond Ultrasonic

April 1, 2026 0
When ultrasonic sensors hit their limits — range too short, accuracy too coarse, outdoor sunlight causing interference — LiDAR sensors... Continue reading
Svg%3E
Read more

Pressure Sensor BMP280: Weather Station and Altitude Meter

April 1, 2026 0
The BMP280 barometric pressure sensor by Bosch measures atmospheric pressure with ±1 hPa accuracy and temperature with ±1°C precision. These... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now