Go Down

Topic: Arduino as 1-wire slave/device (Read 1 time) previous topic - next topic

Matt Elias

Has anyone done any work on adapting the 1-wire library to allow the Arduino to act/respond as a 1-wire slave/device? While searching I found a few old short posts inquiring about this but no replies or follow ups.

Nick Gammon

The 1-wire master is implemented entirely in software, so conceivably you could do a slave that way as well. It is fairly timing-critical. Why not just use 2-wire or serial comms? According to tests I did, 1-wire is somewhat slower than async serial. And I think someone recently was playing with doing bi-directional serial using only 2 wires (you had to switch between sending and receiving, I forget how they did it right now). Of course, the 1-wire interface is really 2 wires (data and ground) so if you only want a single direction, then normal serial would be fine (like an RFID reader) and if you want bi-directional, look up the 2-wire serial approach.
http://www.gammon.com.au/electronics

Matt Elias

My reason for wanting to use the 1-wire protocol is that we are currently monitoring/logging a 1-wire bin temperature setup and it would be nice to emulate the 1-wire slave protocol with an Arduino to monitor non-temperature related items with our existing software. This is a bit of a hack as the software is designed to read DS18B20 compatible sensors, but I figure it should be possible to submit any data I want as long as the existing hardware/software thinks it's a DS18B20.

Nick Gammon

It's probably possible. I have some timings shown here from the logic analyzer:

http://www.gammon.com.au/forum/?id=10902

You can probably emulate one with careful attention to timing. The specs for the DS18B20 describe the timings in some detail.
http://www.gammon.com.au/electronics

gareth10

Thanks for sharing the link to your website, it is helpful to understand the timing issues.
Has anyone actually emulated an Arduino as a slave device then?
Cheers

PaulRB

#5
Nov 16, 2013, 10:16 am Last Edit: Nov 16, 2013, 10:54 am by PaulRB Reason: 1
I agree with Gareth. It would be really handy to be able to use an 8 pin ATTiny to interface with various types of sensor and enable them to be connected to a 1-wire bus. For example, humidity sensors, which are quite expensive to buy with 1-wire interface.

I did find this...
http://hsbp.org/owslave

Paul

gareth10

Does that code essentially make the AVR microcontroller act as a slave device?
I would like to use a Mega2560 to emulate a 1 wire EPROM..

PaulRB

I believe that's the idea, yes. Now you know as much as I do...

Go Up