jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

1-wire problem (can't see sensors if all connected)

Wed Nov 13, 2013 8:20 am

I have trouble if I connect the long cable which connects two temperature sensors in other building/cabin to the 1-wire adapter. If I connect the long cable, all sensors disappear from the network.

I have a setup where I have:

-Rpi
-1-wire+rs232 add on ( http://www.partco.biz/verkkokauppa/prod ... anguage=en )
-4 18B20 temperature sensors
-Few meters of indoor-telephone cable
-Some 25-30 meters of 3x1.5mm2 cable

The configuration is as follows, starting from Rpi's side:

Rpi -> 1-wire+rs232 -> 2m telcord -> 18b20 -> 3m telcord -> 18b20 -> 2m telcord -> 25m 3x1.5mm2 cable -> 18b20 -> 5m telcord -> 18b20
(meters not accurate)

Now, if I do NOT connect the 25m cable, the first two 18B20 sensors work fine. If I connect the 25m cable, I can't see any of the sensors, even if I wait for a long time.

I have connected all 18B20's so that: GND -> 1-Wire adaptors GND, DATA -> 1-wire adaptors DATA, VCC -> 1-wire adaptors +5V (comes from Rpi).

What could be causing this? Not enough power from the Rpi? I have 2.1A PSU that powers the Rpi.

How can I add additional PSU to the 1-Wire?

mistRasp
Posts: 8
Joined: Mon Jan 14, 2013 8:09 pm

Re: 1-wire problem (can't see sensors if all connected)

Wed Nov 13, 2013 1:52 pm

Hi,

When building a 11 sensor network for a room by room heating system, we had to reduce the pull up resistance after adding 4 or 5 sensors. It's a few years back but I think we started out with a 5k resistor and ended up with something like 1.5kOhm.


PS! Our system run on an Arduino who's resources are pressed to the limit, but we still managed to control heat in 9 separate heat loops, log data on the ethernet sd-card, and have a simple protocol for setting and retrieving data over a socket interface.

-Michael

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: 1-wire problem (can't see sensors if all connected)

Wed Nov 13, 2013 2:02 pm

mistRasp wrote:Hi,

When building a 11 sensor network for a room by room heating system, we had to reduce the pull up resistance after adding 4 or 5 sensors. It's a few years back but I think we started out with a 5k resistor and ended up with something like 1.5kOhm.


PS! Our system run on an Arduino who's resources are pressed to the limit, but we still managed to control heat in 9 separate heat loops, log data on the ethernet sd-card, and have a simple protocol for setting and retrieving data over a socket interface.

-Michael
Well, I do not have a resistor in the setup at all, unless the Rpi's 1-wire adaptor has one already.

mistRasp
Posts: 8
Joined: Mon Jan 14, 2013 8:09 pm

Re: 1-wire problem (can't see sensors if all connected)

Wed Nov 13, 2013 2:24 pm

Hi,

Sorry I'm not familiar with the interface you use, but I would assume the pull up resistor is included in the device you use.
We use the 18s20 sensor, and more or less the configuration shown in Figure 5 in the data sheet (http://datasheets.maximintegrated.com/en/ds/DS18S20.pdf)

-Michael

achrn
Posts: 398
Joined: Wed Feb 13, 2013 1:22 pm

Re: 1-wire problem (can't see sensors if all connected)

Wed Nov 13, 2013 5:50 pm

I think we need to know how the adapter is configured to say much.

If it's just a passive connection of a GPIO to the one-wire bus with a pull-up resistor, then it will probably be less good with long buses than if it's a dedicated driver chip (such as a DS2482-100). If it runs teh 1-wire bus at 5V or at 3.3V may affect reliability too.

If you don't already know what your hardware is, what are the markings on the chips are on the adapter, and how have you configured your Pi to talk to it?

Your long cable is very heavy - I've only used cat5, cat6, 0.2mm2 conductors and similar. With those, driven by a dedicated driver, I've not had problems with 20m+ and 10 or more DS18B20s.

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: 1-wire problem (can't see sensors if all connected)

Wed Nov 13, 2013 6:15 pm

achrn wrote:I think we need to know how the adapter is configured to say much.

If it's just a passive connection of a GPIO to the one-wire bus with a pull-up resistor, then it will probably be less good with long buses than if it's a dedicated driver chip (such as a DS2482-100). If it runs teh 1-wire bus at 5V or at 3.3V may affect reliability too.

If you don't already know what your hardware is, what are the markings on the chips are on the adapter, and how have you configured your Pi to talk to it?
Well, in my first post I stated what adapter I have, but anyway, here are more details:
General: http://www.abelectronics.co.uk/products ... and-1-Wire

More details:
http://www.abelectronics.co.uk/docs/sto ... -ComPi.pdf

And more about the 1-wire:
http://www.abelectronics.co.uk/docs/sto ... S2482S.pdf

And yes, my Pi talks OWFS quite well, I do see the first two sensors IF the long heavy cable is disconnected on either end. However, when I connect the long cable, all sensors disappear, but OWFS is still there. So I believe all is good with the Pi.
Your long cable is very heavy - I've only used cat5, cat6, 0.2mm2 conductors and similar. With those, driven by a dedicated driver, I've not had problems with 20m+ and 10 or more DS18B20s.
Yep, I know it is heavy, I originally planned using my old long parallel port cable, which has a lot of wires, but it was not long enough. Basically I chose the heavy cable as it was long enough. I thought it would have no relevance on which cable I used. I thought one point of the 1-wire was that it does not have much requirements for the cable type or thickness.

I do have some cat6, but probably not enough for this.

When you who understand more about this look at the Com Pi adapter and it's RJ12, to what pins would you have connected which pins of 18B20? I connected simply GND-GND, Data-Data and Vdd-+5V. Now that I look at the technical details of the Com Pi, maybe I should have used RT instead of standard Ground?

These are the Com Pi's RJ12 pins:
Pin Usage
1 N/C
2 N/C
3 RT (1-Wire Return/Ground, ESD Protected)
4 OW (1-Wire Data, ESD Protected)
5 Ground
6 5V

And now I have it so that 18B20's middle foot (2) is connected to OW-Data, right most (3) to 5V and left most (1) to Ground.

Well it seems to work with two 18B20's, so I thought it would be right..

achrn
Posts: 398
Joined: Wed Feb 13, 2013 1:22 pm

Re: 1-wire problem (can't see sensors if all connected)

Wed Nov 13, 2013 9:32 pm

jets wrote:
Well, in my first post I stated what adapter I have, but anyway, here are more details:
General: http://www.abelectronics.co.uk/products ... and-1-Wire
As far as I can see, your first post linked to a page that shows a photo of an adaptor. It has no technical details. From the photo it could have been entirely passive (the chips being part of teh RS232 system and/or ESD protection), just a level shifter, or something more clever.
jets wrote: More details:
Much more useful. Especially the schematic in the data sheet. It's a DS2482-100 master, which is good. That's a dedicated chip with assorted electronic magic and should be able to handle a 20m bus with four devices with ease. I've had buses longer than that with more devices than that on such a chip. In fact, I have a 2m-long string of nine sensors on my desk as I type (just because I built it yesterday and haven't installed it yet) and I've just spliced in a 30m cat5 network cable between that and a (different) Pi interface board with a DS2482 and it is reading it happily as I type.

Your board also has proper I2C level shifting on it - also good. A 5V I2C device will normally work on a 3V3 bus, but it's outside spec. So it normally works, but sometimes it might not. Anyhow, the board you have does not take this shortcut, so that's good. It's got ESD protection too. That's good too.

So in summary - the board you have should be good for the application you have, unless the data sheet is actually lies.

But you are right to raise your wiring. You should have your sensors connected to the pins their datasheet calls RT, OW and 5V. That is, use the 'return' connection rather than the 'ground' connection. I'm not sure that will solve your problem (needs more knowledge than I have) but it's certainly how it should be connected.

As to heaviness of the cable, I wouldn't go so far as to say any long bus doesn't care about the cables. I don't know if it's the source of your problem.

I would adjust your connections as noted and try again. If that doesn't help, I'd try all all sensors on a shorter cable (I don't think you say you've tried this) and then I'd be tryuing a more normal cable for the application, myself. As I say, your board should be able to cope with the application - it's not that you're doing anything too outlandish, so problems should be solvable.

repton
Posts: 91
Joined: Sat Mar 17, 2012 6:06 pm
Location: North Yorkshire, UK.
Contact: Website

Re: 1-wire problem (can't see sensors if all connected)

Thu Nov 14, 2013 6:59 am

I would say it is almost certainly your wiring. Replace all the cables with a twisted pair cable (i.e. cat5/cat6) and it should work.

You should not need a resistor anywhere on the network with the host adapter you're using.

Paul
UK Supplier of 1-Wire components, kits and modules:
http://www.sheepwalkelectronics.co.uk/

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: 1-wire problem (can't see sensors if all connected)

Thu Nov 14, 2013 7:08 am

Thank you all for advice.

The link I posted in the original post was supposed to contain all the necessary information, it seems that Finnish version of that page contains links to detailed information. Sorry for that.

And I am now also coming to conclusion that it is indeed my wiring. The thick cable is MMJ, typically used for electricity cabling here in Finland. Someone in other forum had tried the quite similar setup with similar cable and it caused the whole 1-wire network to stop working.

I am now looking for cheap replacement for this cable. Suggestions?

achrn
Posts: 398
Joined: Wed Feb 13, 2013 1:22 pm

Re: 1-wire problem (can't see sensors if all connected)

Thu Nov 14, 2013 10:52 pm

jets wrote:I am now looking for cheap replacement for this cable. Suggestions?
For long 1-wire buses (tens of metres) I've used cat5, cat6, and alarm cable - 6core each 7x0.2mm strands. All are just in domestic environment - nowhere electrically noisy. All have worked.

Whether any count as cheap, I don't know. If I need a particular cable I tend to buy in bulk (at least 100m, preferably 300m reel) and then by the time you've used the fourth or fifth length for something you've forgotten what it cost you and it feels like it's free...

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: 1-wire problem (can't see sensors if all connected)

Fri Nov 15, 2013 7:28 am

achrn wrote:
jets wrote:I am now looking for cheap replacement for this cable. Suggestions?
For long 1-wire buses (tens of metres) I've used cat5, cat6, and alarm cable - 6core each 7x0.2mm strands. All are just in domestic environment - nowhere electrically noisy. All have worked.

Whether any count as cheap, I don't know. If I need a particular cable I tend to buy in bulk (at least 100m, preferably 300m reel) and then by the time you've used the fourth or fifth length for something you've forgotten what it cost you and it feels like it's free...
Yep, I found 100m reel of CAT5e 4x2 UTP, I guess that should be fine. 100m reel costs about 36EUR.

To my understanding, I should not need any resistors with my setup? Or maybe some 150ohm in series with the dataline to cut off interference?

achrn
Posts: 398
Joined: Wed Feb 13, 2013 1:22 pm

Re: 1-wire problem (can't see sensors if all connected)

Fri Nov 15, 2013 8:55 am

jets wrote: To my understanding, I should not need any resistors with my setup? Or maybe some 150ohm in series with the dataline to cut off interference?
If you've got a decent topology (ie, straight length of cable with the pi at one end and sensors at intervals along it, no side branches, no star-shape) then no resistors. That is, look at http://www.maximintegrated.com/app-note ... mvp/id/148 and if you have what they call linear topology (first diagram), no resistors. If you have long side legs then put resistors on (there's a diagram further down under 'Distributed Impedance Matching').

A pull-up is needed on the bus, and if you are using a passive bus master (ie, connecting the one-wire to GPIO pin) then you need an external pull-up, especially if you're using parasitic power (ie, not connecting the 5V line to the sensors). The chip on your adaptor (the DS2482-100) includes all the pull-up you need for a normal number of normal devices (and from what you've said you're well inside the limits), and what's more does it more cleverly than just a resistor on the bus.

If you're using twisted pair cat5 cable then put the OW and RT on the same pair, so they are twisted together. Put the 5V on another wire (doesn't matter which) and leave all the other wires floating (don't connect them to anything at either end). If you use the 5V in the cable for anything other than your onewire devices, connect the ground connection in your adapter, connect that to the other half of the pair you've got the 5V on, and put your other devices between those two, so your power supply is on different wires to your onewire signalling.

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: 1-wire problem (can't see sensors if all connected)

Fri Nov 15, 2013 10:47 am

Excellent, thank you!

Though, I will have one short "branch" to measure the temperature in Sauna. If it does not work, I will try to make the whole thing a chain/linear. Or then I will just skip the sauna.

If all this works, I will and try at least to add some more sensors. However, for example for weather recon I plan to use just standard USB/Wireless weather station with all its advantages.

I will let you know if and when I solved my problems. Unfortunately the installation site is at my cabin, in the middle of woods far away. I can go there mostly only on weekends. Today I will drive there again.

I got a 100m reel of cat5 utp now, some resistors (just in case) and few rj12 :)

jets
Posts: 58
Joined: Mon May 06, 2013 9:40 am

Re: 1-wire problem (can't see sensors if all connected)

Sat Nov 16, 2013 3:19 pm

It works now! I just changed the cable and that fixed it. I did not even change the GND to RT-line.

Edit: To those who have the same problem, do NOT use MMJ cable. MMJ has probably wrong capacitance or something like it and timings will get fu**ed up (or something like it). Cat5 cable works fine for me.

achrn
Posts: 398
Joined: Wed Feb 13, 2013 1:22 pm

Re: 1-wire problem (can't see sensors if all connected)

Sat Nov 16, 2013 10:27 pm

Excellent news!

Beware that with the adaptor you have on your pi you now don't have ESD protection on one of your long wires hanging out the side of the pi. It will possibly be fine, but it might not. If you look on the schematic you can see that the return and the ground lines get tied together on the board, but the RT one goes through ESD protection first.

Personally, I'd change it, but I wouldn't worry about it until I got round to changing it.

WhoStoleMyPie
Posts: 1
Joined: Fri Dec 05, 2014 12:23 pm

Re: 1-wire problem (can't see sensors if all connected)

Fri Dec 05, 2014 12:38 pm

I had the very same problem, solved with two actions:

- replaced the power supply with a 2A model
- changed the resistor from 4,7K to 2,2K

I noticed the read operation on the sensors now is faster with the smaller resistor, I hope not to burn them.

anthony_c
Posts: 39
Joined: Fri Oct 25, 2013 5:58 am

Re: 1-wire problem (can't see sensors if all connected)

Fri Dec 05, 2014 11:04 pm

I just purchased the waterproof version of the DS18B20. I saw some people mention Dallas 1-wire and how you need a special kernel for this sensor?

I was just wondering if I can follow directions on installing/configuring the NON waterproof temperature sensor or if this is a different process?

I guess this might be related to your issue also?

User avatar
rpdom
Posts: 16363
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: 1-wire problem (can't see sensors if all connected)

Sat Dec 06, 2014 7:42 am

The "special kernel" is only if you want to use more than one pin for connecting sensors to. The standard kernel works just fine if using pin 7 (GPIO4), and with a small paramter change if you want to use a different pin.

Return to “Automation, sensing and robotics”