1-wire temperature feeding a LAN/server with data


So I was already running something like this, but I'm getting so often problems with the setup it's not working more than it is!
I have a few ds18b20 sensors around the house and outside. Two are on an Arduino leonardo to monitor the hot water thank and two are outside on an arduino Uno.
Each of these has an enc28j60 for ethernet connectivity and does a GET to send the data to my server for graphing, etc.

The Arduino leonardo has a short run for the ds18b20's (only around 30cm) and temperature polling works fine no issues, but this one often stops responding over ethernet and gets stuck. The ethernet seems to go totally dead on it as the network device it plugs into things the port has gone to sleep and goes into low power state. I've written various watchdogs into the code to reset and try to recover but these don't work. I have to go up and hit the reset on the Arduino to get it back to life, which it will then fail at a further random time.

The two outside ds18b20's are on a long CAT5 cable, probably about 10 metres. So the Arduino sits in the garage (again enc28j60 but this one doesn't fail!) and I have lots of problems with the two sensors failing with various replies. Sometimes 0oC and sometimes -127oC
I've tried different size resistors, 2k 4k4, 900ohm. I've also tried the resistors in different locations, at the Arduino end, in the middle, at the end. The two sensors are run on a single line, so I have the CAT5 that runs along, one sensor then hangs off it and it continues to the end with the last sensor on it.
This one causes me the most problems, and so I'm trying to work out how to resolve so it's more reliable.

So I'm open to suggestions on how to make things more reliable. I can switch to wireless, but suspected the ESP8266 would potentially be just as likely to fail randomly as the enc28j60 does. I'm not sure if I should move the Arduino outside closer to my ds18b20 sensors to reduce the long cable run on the 1-wire as that is prone to problems, but then I have the problem of how to get the data back, run another CAT5 for network/data?

So I'm open to suggestions on how to do this reliably and any gotchas people can think of.


1-wire bus without stubs is the best solution - wire from one sensor to another (linear topology). Try to look for "1-wire-design guide v1.0" on web and read (pg. 51).

Thanks Budvar10
Yes I'd looked through the guide and have followed it fairly closely.
I've reduced the length of the stub cables as much as possible too, so on one sensor it's only a few feet and the other sensor is directly on the end of the cable run but still having problems.

Even dropping the sensor along the wire (So I simply have the single sensor on the end of the wire run) and i'm not getting values back from it.

BTW: I'm using active, so using 3 wires, +5ve, data and ground.

Did you try to communicate without long cable, like on the breadboard (just to exclude other problems)? Post a picture.
I'm using DS18B20 with or without parasite power and on long STP cable ~70m, without problems.

if you look on the UNO and MEGA boards there is a tracer you can cut, it say RESET_ON, read into that,
it might help to produce a automated reset function, i havnt realy used it myself as of yet but im actualy gonna play around with it.
Did you test the lines on an osiloscope or something to see if there is a big drop in the lines as the wire gets longer ? i know that if you use canbus you need to change the resistors for the lines the longer they get, maybe you can read into that aswel to understand the data feed over long distances a bit better

Thanks both of you. Just to finalise part of this, I found the issue on my long run with the two sensors on it.

The 5v supply had degraded (non-parasitic mode) and was only supplying 2-3v at best so I think my issue was power to the sensors not their data reply and length.
I've replaced the 5v supply and those sensors are working great now.

That leaves me with the enc28j60 constantly dropping and needing recovery.
I wondered about the hard recovery option that Frostedfocus mentioned. I'm using the watchdog timer to do a soft reset on the board which did help a little, but it appears more a problem on the enc28j60 than the Arduino side of things. Perhaps I should control the power/reset of the enc28j60 on the Arduino board so I can force a hard reset of it to recover.

Otherwise, does anyone know of a better way of feeding data back to a server (Not able to use USB due to distance involved).

Otherwise, does anyone know of a better way of feeding data back to a server (Not able to use USB due to distance involved).

You can use for an example RS232 for longer distance ~10m or RS485 ~1000m. All you need is some kind of tranceiver for Arduino's serial port. Another way is use of ethernet interface.