PDA

View Full Version : Long 1-wire bus



Ioannis
- 7th August 2023, 22:57
I would like to implement a 1-wire network for up to 8 temperature sensors (18B20) and with up to 50 meters long cable.

Besides lowering the pull-up resistor, any other ideas to make the bus more robust and reliable please?

Seems 1-wire does not like long UTP cables.

Ioannis

HenrikOlsson
- 8th August 2023, 09:25
Never used any 1-wire devices but internet seems to suggest that the maximum cable lenght is anywhere between 100m and 300m, or even 500m with a master supporting active pullup so your 50m seems doable.

Are the 8 sensors distributed along the 50m length cable or are they connected with stubs (of any considerable length)? If stubs are used adding a series resistor to each stub will help with reflections caused by the impedance mismatch but will also have a negative effect on noise immunity. (I got all that from this Analog Devices article: https://www.analog.com/en/technical-articles/guidelines-for-reliable-long-line-1wire-networks.html )

Have you actually tried this and noticed any issues or are you just concerned about possible problems?

Ioannis
- 8th August 2023, 10:18
Thanks Henrik.

The network of sensors will be different in every case. The end user will have 1 up to 8 max of these sensors.

They are connected in mixed ways, some with stubs of short length, others directly on the cable. I insisted on seperate line for the power and not use a parasitic power. After all, a UTP cable can support that.

At short distances it works just fine. Longer cables have some times error in the communication and lowering the pull-up, sure helps a lot.

I have read that article by Analog about active pull-ups. The problem, for me, is to write a routine that will do all of the signal handling, plus the 1-wire protocol, since OWIN and OWOUT do not support such a circuit.

Ioannis

HenrikOlsson
- 8th August 2023, 10:36
How do you distribute the power and signal across the pairs in the UTP-cable?
I mean, do you have one pair for power & ground and then a single wire for the data and if so, what do you do with the other wire of that pair?

I'd probably start with it grounded but I don't KNOW that's the best way.
Perhaps using BOTH wires in a pair for the signal?
Or run power and signal in one pair and both wires in another pair for ground.
Maby a capacitor across power and ground at the far end of the cable?
If the error(s) doesn't occur TOO often perhaps a simple retry is enough?

Just tossing ideas up in the air, perhaps one or more helps, I don't know :-)

I understand the "trickyness" in making this rugged if the bus topology is to be decided by the end user. I think you need to specify like max 50m length, each sensor connected to the main trunk by max 50cm - or whatever. Set that up with margin and test.

Acetronics2
- 8th August 2023, 10:43
Hi, Ioannis

Have a look to Maxim AN 148 and AN244 ...

Best regards
Alain

Ioannis
- 8th August 2023, 12:09
Henrik:

I use one pair for the +5V, two pairs as ground and one pair as ground and signal.

I cannot be very strict on the precise topology the user will make.

You are right about different setup on the cables. Maybe some other configuration work better. It would be best though that we have a specific one for all networks.

Alain:
I did read all these AN and datasheets. The main trick to have long cable is to replace the passive pull up with active one, but this needs to come up with a routine, maybe in assembly, to control all the necessary timing for the pull-upo/pull-down and the 1-wire communication. This cannot be done with the commands OWIN and OWOUT and I am not that good anymore in assembly as I used to be 30 years ago, when I started with PIC controllers.

Ioannis

lappy1
- 9th August 2023, 13:40
Hi Ioannis !

The longest line for a ds18b20 in my heating is about 35 meters.
The sensor line to my oven ( it is a small water-bearing oven which is in my living room ) is a Ymm 4x1.5mm˛ cable, because of the line resistance. Attempts with a network cable failed miserably for me. :frown:
I chose the smallest pullup resistance according to the data sheet. It is a 1k resistor.
My setup is working now for 4 years without any problems :smile:

Ioannis
- 9th August 2023, 14:12
I was testing with telephone 4 wire cable initially and then with CAT-5 UTP cable.

As I have 2 pairs (and a half..) for power and one wire out of 8 for data, I thought I am OK and never thought wire resistance would be a problem.

Thanks for your input. Will see if thicker cable is better.

Ioannis

lappy1
- 9th August 2023, 18:59
Do not underestimate the voltage drop over long lines.
Also you should not use the parasitic mode. ( 2 lines ) . This causes more problems than it is useful.

Ioannis
- 10th August 2023, 15:07
Usually one thinks that thin cables will not be a problem since the current is really low, but you are right. It is more than the current. It is also the capacitance along with the voltage drop that all together will contribute in the system fail.

Ioannis