1-Wire and the resistor

1) "Can I break anything if I forget the 4.7 k resistor?"

No. You might damage the external device if you drive the Arduino output active HIGH instead of high-impedance. Usually the libraries take care of this.

digitalWrite( 1 , HIGH ); pinMode( 1 , OUTPUT );  // Bad, active HIGH
digitalWrite( 1 , LOW );  pinMode( 1 , INPUT );   // Good, high impedance.

2) "Does it have to be 4.7k"?

No. Check the datasheet for details and considerations. Depending on speed and power requirements pull up resistors usually vary from 1kΩ to 100kΩ. Your 4k7 is about as good as my usual 10kΩ.


1-Wire devices have open drain outputs so the pullup is required to maintain a logic "1" when the bus is not driven, just like with I2C. The reason for using open drain outputs is also the same as in I2C: to allow multiple devices on the same bus (see also this question).

The value of 4.7K is most likely chosen to ensure sufficiently small rise time with common cable lengths. The real parameter that governs the maximum allowed resistor value is rise time of the signal, determined by bus resistance and capacitance.

You won't fry anything if you forget the resistor (as long as you don't drive the bus high from your master device) but your 1-wire bus isn't going to work except by some accident.

All of this is thoroughly documented in Maxim literature including datasheets and app notes.


If you replace the resistor with a short you can potentially damage D1, if it ever tries to output '0'. If you don't have the resistor at all, there is no power supply to the 1-wire device.

It's a "pullup" resistor. Its exact value isn't important, there is probably a broad range in which it will work.

Tags:

Arduino

1 Wire