Arduino and 1-wire

I've finished. I packaged the 1-wire functions into a library for Arduino. It includes the read and write byte functions, reset, device enumeration, and CRC computation. The comments about how one might use it are in the library source. Sadly, it won't fit in a post anymore.

You can pick up the files at http://core.federated.com/~jim/onewire/

Create an arduino-0007/lib/targets/libraries/OneWire/ directory and put them in there. You will probably need to quit the arduino program and restart to get it to notice. The test.c program doesn't go in the library, it was a little test program you might find useful.

The test is working fine on my unit with 4 DS18S20s connected.

Physically, I have all the DQ lines connected to my IO pin, all the grounds connected to a ground, and 4.7k ohm resistor from a Vcc to the DQ lines. It would be best to connect all the remaining pins of the DS18S20s to either Vcc or GND, then a regular DS18S20 (not a -P) would still work in either normal or parasite mode depending how you connected it.

If you are going to have any kind of wire run I would suggest looking at some of the ESD protection variations (resistor in series with IO pin and 5.5v Zener diode to ground) to keep the stress down when bad things happen. Likewise, I think it would be possible to make this work using the internal pull-up of the Arduino, but decided that would be a needless stress with there is a short, and the resistor is a bit too big so it would be bad on longer cable runs and possibly not able to supply parasite power.