# DIY Dallas 1 Wire Slave discussion.

#### 3v0

##### Coop Build Coordinator
Forum Supporter
For a while I have been thinking it would be interesting to write the uC code for a Dallas 1 Wire slave.

Either it is an unpopular idea, or it has been discouraged by the Maxim Dallas people. About 2 weeks ago I found a vendor document stating that they have not allocated any device addresses/types for 3rd party use. About the same time I saw what was untested BASIC code.

3v0

Last edited:

#### blueroomelectronics

##### Well-Known Member
There's tons of 1 wire code. Search for iButton.

#### blueroomelectronics

##### Well-Known Member
Ahh you want to emulate an ibutton. Nope I've not seen any code for that.

#### 3v0

##### Coop Build Coordinator
Forum Supporter
Ahh you want to emulate an ibutton. Nope I've not seen any code for that.
Morning Bill. LOL

EDIT: I was looking for a bit of chat about the merits of creating a custom slave.

Last edited:

#### Mike - K8LH

##### Well-Known Member
I admit I've never thought of using the Maxim/Dallas 1-wire protocol.

I have however implemented a much higher speed Icom 1-wire (open-drain) CI-V protocol on a 12F683 based Ham radio accessory. The CI-V protocol uses standard serial data (8/1/N) at 5 volt TTL levels which necessarily limits the 1-wire bus length to relatively short distances. The packet protocol includes two header bytes ($FE,$FE), "To" and "From" address bytes, variable number of data bytes, and an \$FD end-of-record byte.

Ekki DF4OR's CI-V Info' Pages

Regards, Mike

Last edited:

#### 3v0

##### Coop Build Coordinator
Forum Supporter
I have been using 1 wire sensing (mostly temperature) for over two years and find them to be very durable. I have them outside, in the greenhouse and garage, and koi ponds.

In time I would like to create a monitoring, control, and security network. Speed is not important but not having to make repairs is.

There are some functions that the available 1 wire products do not address. A DIY slave based on a uC would fill the void.

#### Pommie

##### Well-Known Member
I have thought of doing this a few times. You could just make your slave look like a DS18x20 but return an invalid temperature (+127) when queried so you know it is your slave and you can then send it any custom commands you like. I thought of programming a 509 to act as a slave so I²C/SPI devices could be added to a OW bus. An obvious omission in OW devices is a humidity sensor.

<edit>Implementing the searchrom algorithm would be fun. I have managed to implement the searchrom and send RS232 on a 10f200! Fitting that into 256 words was a challenge.</edit>

Mike.

Last edited:

#### 3v0

##### Coop Build Coordinator
Forum Supporter
They have discontinued the DS2423 counter which was popular for building tip bucket type rain gauges.

I doubt one could put together a setup using parasite power but it is worth looking at. If not you will need a 3rd conductor or provide local power for the custom devices, maybe solar. Would be interesting.

Last edited:

#### Pommie

##### Well-Known Member
I think the parasitic power would be the easy bit. The protection diodes would conduct and so you would just need capacitors on the supply pins.

I might have a play with this in the new year.

Mike.

#### Mike - K8LH

##### Well-Known Member
Thank you. That looks like a very comprehensive (and impressive) sub-system...

#### Pommie

##### Well-Known Member
That is very impressive code. I'm looking forward to studying it (not now though - 1AM here).

Mike.

#### BigET

##### New Member
It is doable, I've done a ds2408 slave emulation for ir21w project.

the microcontroler was a pic 12f675 an you need a diode and a capacitor for parasite power to work.
I've done it in asm and it uses some 800 words.