JohnLi

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:

JohnLi

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!