6
\$\begingroup\$

I have been playing around with some 1-Wire components and got these questions

schematic

simulate this circuit – Schematic created using CircuitLab

  1. Can I break anything if I forget the 4.7 k resistor ________?
  2. Does it have to be 4.7k _________?

Came across an Adafruit lib that used 10 k but changing between the two resistors (4.7k and 10k) didn't seem to influence the readout. But is it the lib that defines what resistor size I should use or should it just be between an interval..?

I'm a newbie when it comes to electronics and right now I'm just learning-by-doing. Reading the theory behind thing doesn't help me that much since I don't understand half of the terms used..

\$\endgroup\$
6
\$\begingroup\$

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Ω.

\$\endgroup\$
  • \$\begingroup\$ My preferred one-wire implementation is to connect a resistor to an output-only port rather than to VDD, and use a second port pin as input only with a second resistor on it to protect against ESD. When wired in that fashion, nothing the processor can do will risk damaging anything. \$\endgroup\$ – supercat Dec 13 '14 at 0:22
5
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ How can you damage D1 by leaving out the resistor?? \$\endgroup\$ – Wouter van Ooijen Mar 24 '13 at 11:22
  • \$\begingroup\$ If you drive it low while it's connected to 5V? \$\endgroup\$ – pjc50 Mar 24 '13 at 13:32
  • \$\begingroup\$ @pjc50 - Can you edit to clarify this? I assumed the resistor not being there means the pin is not connected to anything (which I think many others might too) as opposed to a short between the pin and 5V. \$\endgroup\$ – Oli Glaser Mar 24 '13 at 13:51
  • \$\begingroup\$ I removed my downvote after the clarificaion. But note that if you remove the resistor, there is still power to the 1-wire device via the +5V connection. \$\endgroup\$ – Wouter van Ooijen Mar 24 '13 at 14:49
  • \$\begingroup\$ The +5V isn't connected to the 1-wire device (not shown), only data and ground are. \$\endgroup\$ – pjc50 Mar 24 '13 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.