DS18B20 1-Wire on noisy lines over CAT5E cables - Page 1
Forum section: electronics / projects

author: stan001
author_rank: Contributor
timestamp: May 25, 2019, 03:13:00 am
content: I have this 1-Wire issue I have been trying to solve for quite some time...I'm running 2 or 3 DS18B20 temp sensors over a kitchen into the freezer, less than 20m, a very noisy environment, initially using UTP (unshielded twisted pair), first picture, and later using FTP (foiled twisted pair wrapped) but still cannot solve the problem on having more than one sensors on the same bus.Laster I found out the wiring guy did not terminate the small conductor wires ( shown in pic4 ) and not using a metal RJ45 socket and therefore I did not get anygroundingon both ends ...The sensor end is stuffed and packed into the freezer near the compressor using a long 2m flat RJ45 cable (unshielded) ....My circuit diagram is as follow ( last pic ) :-- 2.2K pullup to 3.3V- 3.6V zener protection diode- 1K on the wire- Jumper is solderedI'm suspecting a"mismatched impedance"and lots of signal bouncing to and from both ends....Can anyone please suggest how do I :-Q1. Remove or reduced the impedance mismatch ?Q2. How to further troubleshoot this ?Q3. Reduce the noise or improve the SNR ?Q4. Do I need to use a higher value resistors on R7 ( currently 2.2K ) ??Thank you for your time to read this long post...StanleyCable 1 UTPUTP cable - noise levelCable 1 FTPFTP cable - noise levelCable 1 - compareComparing UTP vs FTP noise levelBoth end not connect to the RJ45 jacks/grounded1-wire sch

author: David Hess
author_rank: Super Contributor
timestamp: May 25, 2019, 03:46:02 am
content: Replacing the pull-up resistor with a constant current source will improve noise immunity.Adding parallel termination with a series RC network (AC termination) at both ends of the cable to limit bandwidth as much as possible and suppress noise will also improve noise immunity.

author: stan001
author_rank: Contributor
timestamp: May 25, 2019, 04:26:11 am
content: QuoteThanks for the reply ..Could u explain more about the constant current source ?Also about the parallel termination with a series RC network (AC termination) ?Do you have a sample circuit for the two mentioned suggestions or where (or search keywords ) to look for them ?

author: magic
author_rank: Super Contributor
timestamp: May 25, 2019, 10:47:33 am
content: Check if they work on a breadboard without all that long cabling. I got Chinese knockoffs once and one of them simply didn't work at all if there was anything else on the bus. Or your software could be buggy.I'm not sure if it's a noise problem if one sensor works but two or more don't. More likely too much capacitance on the bus. Try stronger pullup. 1k should be OK, the (genuine) chip is supposed to be able to sink at least 4mA while maintaining <400mV output.

author: David Hess
author_rank: Super Contributor
timestamp: May 26, 2019, 12:12:32 am
content: Quote from: stan001 on May 25, 2019, 04:26:11 amThe idea here is that by providing a constant current for the pull-up, instead of an logarithmic RC curve, there will be a linear one with a faster rise time.The constant current source could be a pair of PNP transistors configured as a current mirror (search for "PNP current mirror") with some low value emitter resistors to give consistent performance.You said you are using a 2.2 kilohm pull-up at 3.3 volts which is 1.5 milliamps. So the emitter resistors should be say 0.3 volts at 1.5 milliamps or 200 ohms maximum. 100 ohms would work.The current setting resistor would be 3.3 volts - 1 Vbe (0.6 volts) - 0.3 volts (emitter resistor) divided by 1.5 milliamps or 1.6 kilohms. I would use 1.5 kilohms.Note that you only need one pull-up but the AC termination can go at both ends.QuoteA search for "ac termination" turns up many examples. The resistance should be roughly equal to the line impedance so perhaps 120 ohms and the capacitance should be selected for the desired rise and fall time with the pull-up circuit.Let's see ... 100 microseconds at 2.2 kilohms (your pull-up value or 1.5 milliamps at 3.3 volts) is ... I don't like that result.1 microsecond rise time for 3.3 volts is 3.3 volts/microsecond. With a current of 1.5 milliamps, that requires a maximum capacitance of about 500 picofarads. I am not sure what the DS18B20 wants as far as rise time but 220 picofarads (one at each end in series with 150 ohms) would be a good place to start. If there are still problems, increase the capacitance to further reduce noise.

author: stan001
author_rank: Contributor
timestamp: May 28, 2019, 04:42:15 pm
content: Thanks for the long reply, really appreciate your long and detail explanation ... will do more readings on this matter ...Been reading on the 1-Wire design guide and have been doing all the wrong things like astar network,no terminationandplacing the sensors close to a noise source( aircon compressor ) ..Once the cafe closes, we trace the source of the noise to a large & noisy ceiling fan / exhaust blower ...once the fan was off, all the noise was totally gone ..Gonna identify the primary freq of the noise and add a filter for it ...Cable1 - fanOFFSome of the other measurements I took ..DS1Z_QuickPrint5DS1Z_QuickPrint7DS1Z_QuickPrint4

author: NorthGuy
author_rank: Super Contributor
timestamp: May 28, 2019, 07:50:20 pm
content: I would try simple things first. I would remove R20, or at least made it much stronger - 100 Ohm or something. I would make the pull-up stronger and would distribute it - say 2.2k pull-up on MCU endand2.2k pull-up on the sensor end.

author: Fratink
author_rank: Contributor
timestamp: May 26, 2021, 06:38:44 pm
content: Thanks David Hess, I just tried your idea of the constant current source and it did really improve the rise time. Creating a PNP mirror as you described with a max current of around 2.5mA meant that the rising edge was able to reach Vcc regularly, where before with a pullup resistor only it would often not be able to. The rising edges are also very straight rather than exponential in shape.The main problem problem is the high consumption of the reference, but I think that could be alleviated by using a CC IC or with diodes as a reference. This page has some neat ideas:http://www.bristolwatch.com/ccs/index.htmHopefully that extra information is helpful to someone.