Devices on the OneWire bus are not responding

Code that worked in December has stopped working. The devices on the OneWire bus are not responding. I can get the same failure using the examples.

Can someone here confirm a working combination of:

  The arduino esp32 board library (I have 2.0.18-arduino.5)
+ OneWire  (2.3.8)
+ DallasTemperature (4.0.3)
+ Pin Mapping (by GPIO #)

Here is my test code.

// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into port 2 on the Nano ESP32
#define ONE_WIRE_BUS D2

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

void setup(void)
{
  // start serial port
  Serial.begin(9600);

  // Blink to show life
  Serial.println("Starting...");
  pinMode(LED_BUILTIN, OUTPUT);
  for (int i=0; i<=20; i++){
    digitalWrite (LED_BUILTIN, i&1);
    delay(250);
  }
  Serial.println(__FILE__);

  // Scan the bus
  Serial.print("Locating devices...");
  sensors.begin();
  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");

}


void loop(void)
{
  delay (1000);
}


How have you pinpointed the error to the code?

Not the code anymore?

Not the code anymore.

So it's in hardware. Check the wiring. Wire up new wires, a pullup resistor and one of the sensors. Also check that you have a suitable resistor for 3.3 V.

1 Like

No.

Hardware that worked in December has stopped working.

Most likely you are using solderless bread board?

If so the contacts degrade over time and although they look like they are making physical contact, there is a layer of oxide round them which stops any electrical contact being made.

  1. Simple solution :- remove and reinsert all the components.

  2. Permanent solution :- solder up your circuit onto strip board.

This link tells you the fundamentals of one wire communication.

1-Wire Communication Protocol: Single Wire Interface Overview | RF Wireless World.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.