One-wire protocol through long distances

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
I've been successfully using these DS1822 temperature sensors for a while now, but the distance between the sensor and my MCU seems to be limited to less than 3 or 4 feet before trouble begins to show. They're cheap, simple and reliable.
These sensors are interfaced to my MCU through the use of one-wire protocol technology, which allows for a single line to both transmit and receive data. That is, the line is bidirectional.

Would it be possible to incorporate some sort of level shifter so as to make the signal run at a higher voltage, and hence allow for much greater distance between the sensor and the MCU? I'm powering these sensors at 5V, and I'd like to shift their signals to say, 12V, for instance.
Or... maybe a converter to RS485 would be best, and allow me to transmit the signal to much greater lengths? After all, transmission runs at an average of around 30 KHz... how can I design such a bidirectional converter?

Any ideas?
 

Attachments

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
I've never used the 1-wire interface and am not very familiar with it. As I understand it, though, it is not readily adapted to RS-485 or other similar physical layer.

However, Maxim has an application note, "Guidelines for Reliable Long Line 1-Wire Networks", at http://www.maximintegrated.com/en/app-notes/index.mvp/id/148. Maybe that could give some worthwhile suggestions?
Thanks, I had already read that note a while ago ... and it seems that I discarded it too soon. I just noticed that in that note there's a mention of another one titled Advanced 1-Wire Network Driver that seems to do what I'd like it to do.
I'm going to study it thoroughly, and see if I can understand it.
Thanks again!
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
How are your 8051's outputs configured? quasi-bi, open collector, push-pull? or do you switch between states?
 

atferrari

Joined Jan 6, 2004
4,771
Hola César,

Just completed the writing of my code for a PIC succesfully. I've read the AN suggested by OBW. With due precautions, longer distances are possible, of course more than those poor cm of yours...:)

Not tested that myself...but soon will do. Otherwise there is that chip and others.

Buena suerte.


/EDIT to add.

My PIC 18F452 uses one pin that releases the bus when set as IN (high Z) or OUT (showing a logical 0) what brings the bus down. It works flawlesly.

EDIT/
 

Brevor

Joined Apr 9, 2011
297
Yup... that's exactly how I'm doing it... same MCU, same resistor.
Are you using shielded twisted pair cable for that?
Hmm.. Trying to remember, I built it almost 20 years ago. I know the cable is shielded, but I dont believe it's twisted.

Output is open collector.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
Hmm.. Trying to remember, I built it almost 20 years ago. I know the cable is shielded, but I dont believe it's twisted.

Output is open collector.
Maybe what I'm doing wrong is that I configured the mcu's outputs as quasi bi-dir and also used a 4k7 pull-up...
Gonna try open collector only and see what happens... thanks!
 

MikeML

Joined Oct 2, 2009
5,444
The only thing that should ever pull the bus high should be the pull-up resistor. The things that can drive it low is the MCU or the sensor...

PS Nope, I misremembered it. I just went and read the data sheet, and here is what it says:

ds.gif
 
Last edited:

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
The only thing that should ever pull the bus high should be the pull-up resistor. The things that can drive it low is the MCU or the sensor...

PS Nope, I misremembered it. I just went and read the data sheet, and here is what it says:

View attachment 89924
the bi-dir mode in an AT89LP4052 works through a strong pull-up when its state changes from low to high, and is held high through a weak pull-up after a brief time has elapsed.
Maybe that's what's bringing noise to my circuit. A plain open-collector i/o would probably not do that and fix things.
 

MikeML

Joined Oct 2, 2009
5,444
The 4.7K can already source 20X more current than the "weak pullup" in a MCU, and according to the data sheet, the 4.7K cannot supply enough current to the sensor while it is doing a conversion, so must be shunted by the PMOS shown in Fig 6, above.

Here is what the data sheet says:

ds1.gif
DS2.gif
 
Last edited:

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
The 4.7K can already source 20X more current than the "weak pullup" in a MCU, and according to the data sheet, the 4.7K cannot supply enough current to the sensor while it is doing a conversion, so must be shunted by the PMOS shown in Fig 6, above.

Here is what the data sheet says:

View attachment 89926
View attachment 89927
Yeah, but that is only true when parasite-powered mode is being used. My circuit always provides power to the Vdd pin, and is not connected as in fig 6
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,257
I spent a while looking for an AN... and it was a TB instead!!

Read it César. It even talks about the wire selection. The way I configure the pin, works OK always, provided you use an external pull up resistor.
Gracias, Agustín! I'm sure going to read it.
 
Top