Has anyone ever used the arduino (or other microcontroller) as a one-wire "slave" device, and if so, do we have code (or even a library?) available?
I'm building water level detectors for multiple locatiosn in a boat. Because boat wire is very expensive (6ft == one microcontroller!) and adds weight, I was thinking of adding a uC/barebones arduino acting as a 1-wire slave at each sensor location, instead of using I2C/TWI
It will (periodically) draw several 10's of mA current, so I'm not thinking of parasitic power.
I see your point RE cost but wouldn't it be easier to make loop powered sensors with 4-20mA output.
4-20 only because that is a recognised and very widely used standard.
If you use 1 wire that is 1core for coms and 2 for power right.
However If you use a little cheep uP that reads the level sensor and translates that to a current you only need two cores.
The circuit go's something like this ...
Power is supplied on the + line, usually 30 volts or so but it isn't that important.
The returning current is fed through a sensing resistor and the voltage measured.
The voltage available to the device is + less the maximum design sensing voltage.
The device needs some current to operate, this needs to be less than the 4mA minimum input
The device measures the loop current, which includes what it requires to operate, and then adds what is required to correct the loop with a PWM controlled parallel load.
I appreciate that you say the sensor will require 10's of mA, which seems a lot but yopu could just as easily build a 34-50mA interface.
In fact you could use almost any range of calibration provided you don't go dissipating too much heat in the dump load and sense resistor.
Give me a shout if you want to talk ... I was going to tray and build something like this to monitor my battery temp anyway.
Al
You can easily do your own async protocol using Softserial. Writing proper 1-wire stuff would be quite a challenge and I doubt there's an existing library for the slave although it's possible.