Extending 1Wire

23 replies [Last post]
BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010

Hi Derek/Brett,

Ran into another problem today while extending my 1wire sensor 'array'.

I got 2 running no problem, set up my pachube and data started flowing.  Later, I added another and my readings all turned to "?".

To give you some more info...I purchased some stereo, 3.5mm jack extension cables...after checking prices etc it seems you only save a £1 or 2 by making the cables yourself.  I've added a 5m cable for the second sensor split immediately after the livebox using a stero cable splitter like the one in your picture.  One of those splits was then split again using the splitter device sent with the sensors, into that I plugged 1 more sensor and a 10m extension cable terminating at another sensor.

After moving the location of sensor 2(it was in direct sunlight), I then went to check the readings.  All read "?"

XFX msgs report the same.

I have tried to disconnect and revert back to 2.. no effect, I even tried going back to 1...no effect.  Don't think I've shorted anything, the only thing I can think off is the temp of the box?  I know Derek said he has no problems with his but mine is upstairs in the loft(no vents), only a couple of fans running(set by temp sensor) and it's sitting on quite a hot Dell switch.  Temp at the box get's upto about 37c.

Weird how it just 'went' though. 

** Edit **

I should also have added that at "almost" the same time I added 3 more RF modules.  Not the S variety but the W ones.

This seems to have been part of the issue.  Sometime later in the eveinging, with everything being so hot, I had to shift things(one of the fans in the loft) around a bit.  When I removed one of the RF modules(one that's been running for a week or so), the temps(all but one of the 3 connected came back initially, after a reboot, all 3 came back).

So I decided to unpolug one of the new RF modules which has been turning on & off on it's own since I installed it.

I've probably tried to do too much at onse.  Tomorrow, I'll remove all the new RF entries I've put in and try and get the 1wire stuff going.  Then move from there in a more methodical approach.

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Hot stuff

Box running at 37C should be OK (that said, I now run mine in the basement where background temp is generally a constant 16C).

There should be no relation between RF devices and 1-wire operation.

It's more likely that there is a wiring issue on the 1-wire array. Some of the 3.5mm stereo cables are very cheaply made & don't use decent connectors. If you have a can of servisol switch cleaner to hand, try a little of this on the 3.5mm contacts. Don't 'hot plug' the 1-wire devices. Wire up everything with power off. Perhaps just try one device at the end of your 10m cable to see how this goes.

It would be interesting to know what voltage there is at the end of this 10m cable. The 1-wire devices really like to have a solid 5VDC. If you have a multimeter handy, you might want to check this - but for goodness sake don't short out the 5V line when taking a reading - doing so will trash your Livebox!

Also, read this appnote from Maxim re running reliable 1-wire busses. http://www.maxim-ic.com/app-notes/index.mvp/id/148

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
Hi Derek,Thanks for quick

Hi Derek,

Thanks for quick response.  All sensors now running again.  Tested the sensor at end of 10m cable and I'm getting 4.84.

Is this enough?  Seems to be working OK, I'll be running another 10m from that to get a sensor in my Kitchen(fire alarm), I'll let you know what the reading is on 20m...

The cables look to be quite good quality,  I bought them here:

http://www.tvcables.co.uk/cgi-bin/tvcables/tag/3.5mm-Male-Jack-Plug-to-F...

Thought the price was reasonable.

Will be adding the RF modules back into the system this morning.  Will wipe the control registrations in them first and start again.  Will let you know how that goes. 

In the ini file it says you can register upto 12 channels, I assume that equates to 6 RF modules?

Cheers

Gary

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
12 RF modules supported

>In the ini file it says you can register upto 12 channels, I assume that equates to 6 RF modules?

Just checked with Brett (and the source code). You can specify control strings for upto 12 RF modules (an 'on' and an 'off' hex string for each).

Brett has rolled a new version of the HAH firmware, that will allow RF units > number 4 to be controlled directly via the web UI. This is currently in beta test.

Derek.

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
1wire down and out

Thanks Derek.

I spoke too soon about my sensor array.  It only worked for about 5 mins then crashed again.

When I had 3 sensors connected with 2 10m extensions and 1 connected v close to box, the system seems to lose it.

I get "?" on all the Inputs and "?" again on all my sensors.  It seems the extension cable being connected even without a sensor on the end is enough to throw it off.

I checked the voltage though at the end of the 20m and was still getting 4.84.  I then checked it as the start i.e. connector attached to controller and that's 4.84 too.

Why is this extension cable throwing my system out, is it something to do with the load on the 5v from the resitance in the cables? 

And how can I get this working, my flat is all on 1 floor but is at least 20m long.  I tried having a look at the link you included but they were down for maintenance.

Can I throw a capacitor in it or something?

 

** Edit **

I managed to get on that site last night, there are two suggestions.  One involves an r-c filter(whatever that is) to help a DS2480 master and one suggests resistors on each stub.  I can't see any reference to what master is used in HAH, I imagine that's somewhere in the Mega8.  I had a look in the specs for that and can't see anything about 1wire.

I found this buried in the DS18b20 references: "If you have more then 1 device on the bus then you must use the power pin I found that parasytically no more than one could be driven. You're mileage may vary." but I'm assuming I am already doing this from the way you have soldered the chips into the 3.5mm jacks?

Am I then correct in assuming that 150ohm resistors placed in series accross at split point for each stub might help my array?

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
More research needed

My permanent 1-wire setup has one sensor within 1m of the HAH and another at the end of a 5m extension cable. This seems totally reliable.

I must chat with Brett re the '?'s that you are seeing on the UI and the exact circumstances that cause these to be shown. Then, I must also go try a 'long run' of the 1-wire - easily done as I've got lots of the 3.5mm extension cables.

It's quite possible that the 5V supply is being stresssed. I also note that it's pretty damn warm at your location just now. I can easily replicate this with a fan heater.

Some of this is as much an art as a science.

I'll keep you advised of progress.

I'm also thinking that in many cases, rather than having the fuss of a long cable run, it might be smarter to implement a decoder for a commonly available RF temperature module. These are relatively cheap and much easier to deploy. Yet another reason to press on with the RF receiver capability for the HAH.

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
Would the 5v rail be being

Would the 5v rail be being pulled down by the 1wire to effect the Inputs?

All 4 were showing "?"... I've got mine back to stability now by running just 2, 1 within 1m and 1 at end of 10m cable.

The moment I plug in anything anywhere, it goes TU.  I guess it's not the voltage but the current that's being drawn because I was reading 4.84v at the end of a 20m run.

I'll try and pick up some 150ohm resistors tomorrow and monitor the effect.

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
So much to learn ...

Reading up more on how to get the best out of 1-Wire. Lots of docs on this topic e.g.  ftp://ftp.elin.ru/pdf/1-Wire/app108.pdf

So many things that need to be done better than we currently do. The long cable on the 1-Wire is indeed causing the micro to hang - that's why even the Inputs report as '?'. Might well be down to the 5V rail suffering.

So, an active pullup/a resistor in-line may well be the way to go. I'm also thinking that Cat5 cable (with its twisted pairs) might be a lot better than the 3.5mm jack cables. A bit more work to wire up, but it's reliability that we are looking for.

I'll be looking at the bus with my 'scope next weekend to get a better understanding of what is actually going on.

Also found this interesting document http://arduinoha.googlecode.com/issues/attachment?aid=1809249904413282613&name=wmr928-weijenberg.pdf&token=801df2db0837c15865335ae5a3a65a34

You are expanding the boundaries of the project with your experimentation on 1-Wire. Keep up the good work. 

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
Hi Derek,I had a little

Hi Derek,

I had a little attempt with the resistors on my 1wire bus.

I put the resistor in line on the 5v line.  It was a 150ohm, 0.6w resistor.

Reset the config back to 1 sensor and added each one, one at a time. 

Result was for the sensor 1 and sensor 2 to be transposed, then sensor 1 jump to 85 degrees and temp 3 stayed as "?"

Didn't loose the 'Inputs' though, they stayed as "off" rather than dropping to "?".

Cheers

Gary

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
1wire devices

I'm not sure if this is of any use, but some of the posts in this thread refer to all the things you guys have been talking about, http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238032295.

I'm trying to get a 1wire device working on my Arduino with Bretts code.  My code works fine on it's own, as does Bretts, but when I bring them together it stops working, so I've been looking for a solution.  Hope it helps.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
1wire and parasytic power

I do recall we made a decision not drive the 1wire devices parasytically due to power loss issues, as the data pin is also the power pin.  I think possibly it has more to do with shielding and interferance picked on the wire.

Use cat5 or shielded cable for the run would get better quality.  Most 3.5 jack extension cables are simply parallel paired wires, not the best.  Occasionaly you can find good quality coax (shielded) cable, this would be better as the data and power pairs would be wrapped in a ground sheath.

The arduino notes are interesting thou.  With the work that I've just finished on the arduino with xAP/Ethernet plugging in a 1-wire sensor and sending data should be trivial if you want to think about this approach for a standalone sensor.

http://www.dbzoo.com/livebox/hah_arduino

Perhaps Derek can put together a 1-wire xAP Arduino app (hint hint).

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Arduino xAP and 1Wire

I was working on this last night, basing it on your latest code.  But whenever I introduce the 1wire coding, it just stops working.  I started again using some different 1wire libraries and got a bit further, but still miles from where I want to be.  I can test and trouble shoot quite well, but it's about 20 years since I coded so I'm learning this as I go along, it's just slow, not to mention the late night taking their toll.  I could e-mail it to, as long as you promise not to laugh, I'd like to be able to do this myself really, but some constructive feedback would probably help.

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Different approaches

I'm also tempted by the idea of a 'standalone' temperature sensor. However, having a whole Arduino with Ethernet shield just to get a temp reading seems a bit of overkill. I see a serial-bridge Arduino connected directly to the HAH as a good way to beef up 'in HAH' capability, and the Ethernet Shield UDP capable Arduino as a way to add a whole new xAP enabled, remote, subsystem that can leverage the Plugboard in the HAH.

My thinking on the way ahead on this is in three workstreams.

First is to have a look at what state the 1-Wire signal looks like as the bus coming out the HAH (made from the 3.5mm cables) is extended. Also try tweaking down the value of the 1-Wire pullup resistor. I will 'scope this & put up some pictures.

Second is to try using UTP cable runs. From reading all the notes re 1-Wire, this should help.

Third (and much harder) is to decode the RF signal from the Oregon Scientific 433MHz RF wireless sensors. These are pretty inexpensive and have a decent range. I already have code that reliably decodes the RF signals from a BBSB transmitter.

... and thanks to Brett for all his good Arduino work, as well as the hint!

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Well my next project is to

Well my next project is to get a universal transmitter working on the arduino so that you can send it an xAP packet that will define the RF pulse train you want to transmit.

This will then allow the HAH to control ANY RF capable device.

Once I get that sorted (insert laugh here) I'll work on a RF decoder (more laugher).

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
In my mind, that last laugh

In my mind, that last laugh turned slightly maniacal, like a meglomaniac thinking about his plan to take over the world.....

Calm down Brett! 

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
In my mind, that last laugh

In my mind, that last laugh turned slightly maniacal, like a meglomaniac thinking about his plan to take over the world.....

Calm down Brett! 

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
Any Progress on 1-Wire?

Hi Derek,

Did you manage to look at the 1-Wire bus through your magic wave box?

Did you find anything?

Are there any plans to implement some of the improvements you discovered above?

 

...no pressure!

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
1Wire Design Guide

This is a long read, and I'm sure Derek has probably read this, or at least something like it, but it might be of use

http://www.1wire.org/Files/Articles/1-Wire-Design Guide v1.0.pdf

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Some progress

Well, I have done a bundle of reading. Turns out that for a 'long' 1-wire runs, driving the bus directly from a microcontroller pin (with external pullup resistor) isn't really sufficient. So, I used the 'master driver' reference design on Pg 64 of this document http://www.1wire.org/Files/Articles/1-Wire-Design%20Guide%20v1.0.pdf and the 'slave passthru' design on the top of page 65 to produce this PCB design http://www.flickr.com/photos/kenned/5007289299/

This board can be populated to work as a master or a slave.

Sourcing the ferrite chip component for the slave was tricky, but I eventually got these from a guy in LA (the surface mount parts are truly tiny).

I included a USB B style socket to allow optional 5V power injection.

Before going to fab with this design, I need to add mounting holes to the board & cross check the dimensions against a few suitable enclosures.

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
That's the one

Yes! This is THE document when it comes to being thorough with 1-Wire.

I did base my latest design on a thorough read of all this (see post above). The wiring standard for the RJ45s is that published here http://www.hobby-boards.com/catalog/howto_wiring_diagram.php?referer=how... is what I used on the PCB design.

I will add solder pads to allow folks who wish to keep using the 3.5mm stereo jacks to simply solder on a socket at the master end.

BodgeIT
Offline
London, United Kingdom
Joined: 10 Jun 2010
External Module?

Reading between the lines, this would be an external module that one could easily retrofit?

Reason I ask is I'm about to build 2 HAHs and ship them to Northern Cyprus.  I know they'll need long 1-wire leads and so if I need to do any dismantelling to add the new board, I'll hold off sending them, if it's just a part that's easily fitted, I can send them and send on the boards later.

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Simple to refit

Yes, easy to refit. The Master end could just be placed in an enclosure & connect to the existing 3.5mm stereo jack socket on the side of the HAH. Re dismantelling, if you are using the external master driver, you would want to leave R7 on the main PCB unpopulated (as the Master circuit will have its own, better, arrangement).

Of course, wiring to slaves DS18b20s will be via Cat5 and not stereo cables.

All this is awaiting PCB fab & some decent testing.

aivo
Offline
Tallinn, Estonia
Joined: 2 Mar 2011
Longer 1wire runs

Hi Derek,

If there have been some further developments or clarification ;) regarding the PCB/solution you designed?

I have managed to get three sensors running over ca 15m Cat5 socket to panel segment + ca 2m patches but beyond this it seems difficult.  From hah board to patch it is also your supplied 20cm cable with Cat5 socket.  E.g. when connecting next segment and powering up hah one even sees some random chars on lcd.  At same time the cabling is properly tested and able to run 1Gb.  Have also tried parasite power supply, measured power drop in the end of cable to be insignificant etc.  Will go for shottky diodes today to see if they can help me ..

Also if there are good ideas regarding how to use 1wire with "normal" in place Cat5 cabling that by nature physically is star-like whereas 1wire design guide says that "do not use network like this!" :| ?

---- Edited ----

Tried shottky diodes at sensors (ground to data), this did not help for current issues.

Had a short mail conversation with Derek today and heard two more suggestions that I tried:
- used external power to sensors, this did not help either
- used smaller pullup resistor, far away from controller .. and this indeed did help!

In fact, as I had two "branches" I removed 4k7 resistor from hah board and used two 2k7 resistors in end of both branches.  These resistors are in parallel so it makes ca 1.35 kohm pullup.

Later added two more sensors without pullups in two extra rooms and two more next to first two, six in total (all I have planned for home use).  And it still works - no signs of "overloading" hah board as before!

Working setup: 1wire network over existing Cat5 cabling, four segments in star connection, six sensors, pullup resistor ca 1.35 kohm, 17 to 24m network segments, total ca 85 of used cable lenght.

Regards,

Aivo

percih70
Offline
Joined: 3 Jan 2011
Extracting the last few feet from a 1 wire run

Hello Aivo

 

Yes I’ve found adjusting the pull up resistor is crucial to getting long runs to work - as is selecting the right conductors within the cat 5 run - avoid using more conductors than necessary - and leave the unused ones floating - the real killer on long runs in the capacitance in the cable - the pdf mentioned earlier in this tread is very informative.. 

http://www.1wire.org/Files/Articles/1-Wire-Design Guide v1.0.pdf

 

and a must read if you trying to get long runs to work, and if you have access to an oscilloscope, it will help in selecting the pull-up resistor value.

 

Cheers

 

Harry

 

 

 

Hardware Info