Teensy 3.0 Problems with moderate range (~40m) OneWire Signals

teensytroubleshooting

I'm using a Teensy 3.0 (with its 3V TTL signaling) to try and communicate with some Dallas DS18B20 temperature probes.

I'm not using parasitic power because I've heard a separate power line allows for more reliable longer connections. I'm powering this using the 5V Vin pin of my Teensy:
enter image description here

Communication is done using one of the 3V TTL pins (pin 14) with a 4.7k ohm pullup resistor to 5V (more on this below).

Using the standard OneWire example sketch in the Arduino IDE enables me to receive perfect temperature measurements with a short (d = 5m) cable, even with several temperature probes on the line. But when using a d = ~40m cable, the signal seems to drop out and no communication can be had (address detection fails, and even when hard-coding the device addresses into the code, the resulting read bits are all zeros (or the CRC check fails)).

I originally thought it was a cable that had too much capacitance (as I read about in some other threads) so I tried replacing it with an equally long cat5e ethernet cable (using solid orange, blue, and brown for the 5V, signal, and GND respectively) with a RJ45 tester to know that the cable is good. This had the same results as my previous cabling attempt.

So my question is: does anyone have any troubleshooting steps to try? I don't have an oscilloscope or logic analyzer unfortunately, and I've tried naively watching the signal voltages using my multimeter without much success.

One puzzling part about the whole thing is: If I'm powering the Dallas probes with 5V, and I have a 5V pullup to a 3V TTL pin on the Teensy, then how is this setup working at all? Perhaps the Teensy is able to pull the line down to ground successfully even though it is 3V ttl?

I tried powering the probes with 3.3V pin (2 pins under Vin), and connecting the pullup resistor to that, but then even the short length of cabling didn't work.

I've also tried using another 4.7k resistor in parallel with the pullup resistor to get it closer to 2k (which I've heard is good for longer runs), but this didn't have any effect.

Thanks for any help/suggestions/comments!

* UPDATE *

I have added a (possibly the world's worst) circuit diagram to make the situation more understandable. Sorry for not doing this from the beginning.

Also, one good resource that I have looked over is this application note which recommends Cat5e cable and mentions networks up to several hundred meters in length.

Best Answer

The application note you linked to has the following paragraph on page 8, which is in complete agreement with your experience so far.

Simple microcontroller port pin interfaces are not capable of the drive currents necessary to support large- or even medium-sized networks. The pullup resistor value is often limited by the port pin pulldown capability to around 2,200Ω, which precludes heavy networks (networks with high weight values). Port-pin-only interfaces should be limited to networks with a tabletop radius and weight, about 3m maximum. (See Appendix A.)

I think that the basic problem is that a "bare" microcontroller pin simply doesn't have the drive strength to create a high-to-low edge on the bus with the timing that the protocol requires. You're going to have to use some sort of master-side driver to make this work.