Monitoring 1 Wire Circuit with Arduino Uno

I have a 1 wire circuit with 6 DS18B20 sensors on it. I am in the process of adding 6 additional sensors to the existing circuit. The circuit is about 60’ of CAT5 cable. I have a pull-up resistor at the Display unit’s connector block. Circuit work fine as is, but my curiosity has gotten the better part of me. The Display Unit connectors: +5VDC, DATA, GRD. Not using parasitic power. The Master Device is the display unit.

I want to insert an Arduino Uno into the 1 wire circuit to monitor and log the commands being transmitted back and forth between the Display unit and the sensors. I want the Arduino set up this way as I want to experiment with the Arduino and sensors in the future.

I am connecting the Arduino’s pin#2 to the data line coming out of the display unit and connecting the Arduino’s pin#3 to the DS18B20 sensor side of the circuit. I believe I need to connect the circuit ground to the Arduino. The only lead that would be split would be the DATA lead. I will then need to add a pull-up resistor to the sensor side of the Arduino. The Arduino is powered by a separate transformer.

The Arduino’s MAIN functions would be to listen for the Master Device commands (Pin#2) and send them via Pin #3 to the DS18B20 sensors. The Arduino would then receive the data from the sensors (pin #3) and send it back to the Display unit using (Pin#2. The Arduino would also log the data going back and forth (Hex) in a file on the DATA shield.

I believe that there is enough lee-way in the timing parameters of the DS18B20 sensors to allow for a little delay.

My electronic skills are good, but my programming skills, well let’s just say I am a beginner (could not think of a title lower that that one). I have done a number of Arduino projects with the Arduino, but nothing like this one. I know all the DS18B20 addresses so that is not an issue, I ran an Arduino sketch that identified the addresses. I have no clue as to where to begin with the script for listening, sending and logging.

I may be able to use the Display unit’s +5vdc and Ground to power the Arduino, but I do not think that would make for a stable circuit.

I will then report back with my findings… to me this is really an interesting project.


Display unit: 5VDC >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>DS18B20 >>>> DS18B20 >>>>
Display unit: GRD >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>DS18B20 >>>> DS18B20 >>>>
Display unit: DATA <<<>>> (pin#2) Arduino Uno (pin#3) <<<>>>DS18B20 <<>> DS18B20 <<>>

(cut the data line and inserted the Arduino Uno)

Thanks in advance for any assistance.

******* I found this code here and will be editing it to pass the data back and forth *******
******* This script is set up for two Arduino’s I need to change it for one Arduino Uno *******
******* I will remove the notes in the script as I go along *******

  Software serial multple serial test

 Receives from the two software serial ports,
 sends to the hardware serial port.

 In order to listen on a software port, you call port.listen().
 When using two software serial ports, you have to switch ports
 by listen()ing on each one in turn. Pick a logical time to switch
 ports, like the end of an expected transmission, or when the
 buffer is empty. This example switches ports when there is nothing
 more to read from a port

 The circuit:
 Two devices which communicate serially are needed.
 * First serial device's TX attached to digital pin 10(RX), RX to pin 11(TX)
 * Second serial device's TX attached to digital pin 8(RX), RX to pin 9(TX)

 Not all pins on the Mega and Mega 2560 support change interrupts,
 so only the following can be used for RX:
 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

 Not all pins on the Leonardo support change interrupts,
 so only the following can be used for RX:
 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

 created 18 Apr. 2011
 modified 19 March 2016
 by Tom Igoe
 based on Mikal Hart's twoPortRXExample

 This example code is in the public domain.


#include <SoftwareSerial.h>
// software serial #1: RX = digital pin 10, TX = digital pin 11
SoftwareSerial portOne(10, 11);

// software serial #2: RX = digital pin 8, TX = digital pin 9
// on the Mega, use other pins instead, since 8 and 9 don't work on the Mega
SoftwareSerial portTwo(8, 9);

void setup() {
  // Open serial communications and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only

  // Start each software serial port

void loop() {
  // By default, the last intialized port is listening.
  // when you want to listen on a port, explicitly select it:
  Serial.println("Data from port one:");
  // while there is data coming in, read it
  // and send to the hardware serial port:
  while (portOne.available() > 0) {
    char inByte =;

  // blank line to separate data from the two ports:

  // Now listen on the second port
  // while there is data coming in, read it
  // and send to the hardware serial port:
  Serial.println("Data from port two:");
  while (portTwo.available() > 0) {
    char inByte =;

  // blank line to separate data from the two ports:

I am still hunting for a script that will listen for activity on the data line. All the scripts are sending commands to the sensors...

Has to be one out there

Found a script... right here on the forum. It is something to start with. Inserted the code into the main post

Why do you feel you need to receive and retransmit the 1-wire data? If you can receive, why not just "snoop" on the data line?

Darn good question!

Occasionally I receive bad data from some of the sensors (my guess) and strange data is displayed on the display and I would like to troubleshoot the problem. Unfortunately, it is not the same sensor, but it is in the same area as the others that this happens to. I have re-done all the sensor connections to the cat5. I have changed out some the sensors, but that did not correct the problem. I am thinking that there is an environmental issue somewhere along the line. With the Arduino, I can monitor and check the log to see when the error occurred and if I am on the right track, check the time against the energy monitoring database. May be the AC unit, dryer, washer, microwave....

The second and the most important of the reasons, is to be able to mimic a DS18B20 sensor (since it is the only 1 wire sensor that the unit accepts) with the Arduino and send the data back to the Display in the DS18B20 format, I can then monitor water flow meters and change the text on the screen to reflect water/gallons, water pressure, solar radiation....

This will also give me a good picture as to what commands the unit is sending the sensors, initialize... ROM commands... Function commands......


the most important of the reasons, is to be able to mimic a DS18B20 sensor

That's a good and interesting reason!

My page on DS18B20,is HERE:

It has a note about long cables Here:

And See This Link
for Maxim's notes on "Guidelines for Reliable Long Line 1-Wire Networks".

Thank you Terry,

After reading some of the links, I got another brain storm. I have the existing 6 sensors utilizing the CAT5 circuit. Some of the existing sensors are in areas where I need to utilize the CAT5 circuit, as I can not easily do any modifications or changes to the physical sensors. I can however, get to the sensors area that seem to be having the issues.

So is there a way of connecting those sensor locations (has power available to them) using wireless, maybe using theNFR24l01 / Arduino Nano / DS18B02 at the remote location, transmitting to an Arduino with a NFR24l01 and is connected to the 1 wire circuit using the data lead?

Just a thought.

I am connecting the Arduino Uno to the CAT5 cable today to see if I can monitor it.