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.

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:


You can probably emulate one with careful attention to timing. The specs for the DS18B20 describe the timings in some detail.


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?

Go Up