0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ And because I couldn't think of anything else to try, I'm also going to try this communication with the GPIO pins of my Raspberry Pi to see if I can get different results there. But that's more of a workaround. (although maybe it'll give me some more insight). \$\endgroup\$ – JKnight Jun 29 '14 at 17:12
  • \$\begingroup\$ Maybe you can show a circuit instead of something that appears to resemble a mosaic of colours and random blocks? \$\endgroup\$ – Andy aka Jun 29 '14 at 18:06
  • \$\begingroup\$ Running a logic level signal over 40m is not a good idea. At that length you will have ground potential differences between the ends of the cable + you could be picking up EMI and with low voltage it means you'll have a high noise floor. You could convert the signals to a higher voltage like 12V using open collector device. You can also use even higher voltage (24V) and use optocoupler to isolate your digital system from the high voltages of the cable. \$\endgroup\$ – user34920 Jun 29 '14 at 19:20
  • \$\begingroup\$ If you're going to do this, you absolutely need to take a look at the signal at both ends of the cable with an oscilloscope. Anything else is just guesswork. Open-collector signaling only works if there's a solid ground, so my own guess is that the ground resistance of the cable prevents whichever device is at the far end from the pullup resistor from generating a usable "low". And I second the motion for a detailed schematic of your actual setup. \$\endgroup\$ – Dave Tweed Jun 29 '14 at 23:17
  • \$\begingroup\$ I've added a circuit diagram, sorry for not doing so from the beginning. @DaveTweed: That's what I was thinking too, but OneWire is known to work up to 400m and Cat5e is recommended for these use cases: midondesign.com/Documents/Reliable1-WireNetworksApp148.PDF \$\endgroup\$ – JKnight Jun 30 '14 at 0:43
1
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I must have missed that paragraph. Bummer! So I guess I need to either buy a OneWire driver device (built for this purpose) or rig up some kind of transistor circuit with less pulldown resistance? \$\endgroup\$ – JKnight Jun 30 '14 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.