Go Down

Topic: Long Distance oneWire (DS18S20) (Read 4644 times) previous topic - next topic

Ian Johnston

Hello,

Hope someone can help me. I want to use the Dallas Semi One Wire bus over a 150 metres. I've read Application Note 148 and Appendix A shows a 200m solution using a 2N7000 MOSFET.

There isn't much in the way of an explanation in appendix A, just the diagram.

It looks to me (not an electronics expert) that the 2N7000's job is to sink current supplied through the 1K resistor. There are two connections into the micro controller, one drives the one wire to the DS18B20 the other switches the 2N7000 via the 3.3K resistor.

My question is, does the second connection go to a data pin on the arduino?

If so then I'm guessing I would need to modify the oneWire library to drive the second data pin.

As the DS18B20 will have to drive the oneWire to send data back the the arduino then I'm further guessing that the wire will be tri- state in nature, so the second data pin would need to be more than just the inverse of the first pin, the states would be:

                    oneWire           2N7000
Write a high          1                    0
Write a low           0                     1
Float                  detach               0

Any advice or alternative solution gratefully received.

Thanks
Ian.

mrmeval


http://www.maxim-ic.com/app-notes/index.mvp/id/148/CMP/ELK5

It's actually "Slew Rate Control" and the document explains how to make it work.

I personally would like for them to create a 1-wire RS485 transceiver. I may look using bidirectional buffers to control data to a standard RS485 transceiver.
If it was designed by man it can be repaired by man.

mrmeval

http://www.aag.com.mx/aagusa/index.html

Give this a read too.
If it was designed by man it can be repaired by man.

Ian Johnston

#3
Jan 19, 2011, 11:11 pm Last Edit: Jan 19, 2011, 11:32 pm by JohnLi Reason: 1
I've changed the oneWire and DallasTemperature classes to work with the MOSFET. I've imaginatively called this oneWireLong and DallasTemperatureLong. I've tested it with 4 DS18B20's over 150 metres of CAT 6 cable and it works fine. The arduino seems to reboot occasionally so there might be a memory leak but I can't find it. It might be somewhere else in the application.

The oneWireLong constructor takes two parameters, the Transmit pin and the Receive pin.
Basically when receiving the transmit pin goes low, switching off the MOSFET and allowing the one wire to float unless being driven by the DS18B20.
When transmitting the transmit pin works in negative logic to to send a 1 the transmit goes low, switching off the MOSFET and the line goes high.

If anyone is interested in the long library (four files) then could you let me know where I can upload the file to, there must be somewhere on the arduino web site!

Alternatively send me a message and I'll email the files to you.

Questions, suggestions and improvements welcome.

Ian.


Go Up