1-wire with long cables

Can you post a link to the library you are using?

I had lots of problems with 15 meter cabling to ds18b20’s. Here are some steps I took to fix the issue:

  • I changed the timings used in hotaman’s OneWireSpark library. You can see mine here. Hotaman’s timings always worked for me with short wires, but they are the absolute minimum recommended by Maxim. All I’ve done is extend the timings so they are somewhere between the minimum and maximum recommended by Maxim.
  • I put the sensors in parasite power mode, even though they are hooked up in three wire mode. Not sure this did much, but for me it reduced the likelihood of getting bad readings errors

This has made them work well over the last week. I have about 35 of them in an outdoor ag setting with no bad readings in ~10 days.

The next change I will make is to use a different resistor value. 4k7 is what all the tutorials say, but if you get into Maxim’s docs on reliable long-range 1-wire, you’ll find that they sometimes recommend down to 1k resistors, especially for 3V networks.