I read that there needs to be a pull-up resistance for dht22 when connected to arduino. When dht22 is close, arduino's internal resistor value is enough, we have to add external resistor. I want to know the exact relation that for X-meters, you should add an external resistor. Can anyone give some info about this?

  • 1
    \$\begingroup\$ you should make your points clearer, to me, a generic value for pull up resistor is 10k \$\endgroup\$
    – muyustan
    Commented Jun 10, 2020 at 5:30
  • \$\begingroup\$ @muyustan my arduino will be kept 20-30 m away from dht22. I do not care of strong pull-up wasting electricity. I need accurate readings. Suppose I add 10k resistor. Can I, for testing purpose, use it with 1 cm wire, or it will cause a lot of current? \$\endgroup\$ Commented Jun 10, 2020 at 5:38
  • \$\begingroup\$ Pull ups only use power when you use the I2C bus to read the sensor... So if it is not frequently, like once per minute, there is almost no power used. \$\endgroup\$
    – MadHatter
    Commented Jun 10, 2020 at 6:10
  • \$\begingroup\$ The most-most-most generic pull up that you always try first unless you have reasons not to, is 10k. Since you're going to greater line lenghts, "downgrade" to 4.7k safely. There is no way it can damage anything (5V/4.7k = 1ma peak consumption). Even 2.2k will be safe to use, but usually the higher the frequency or longer the line (to counter line's capacitance and toggle up and down quick enough), the lower resistor you need. Keep it simple for now. 4.7k will work 100%. \$\endgroup\$
    – Ilya
    Commented Jun 10, 2020 at 11:26

1 Answer 1


Depending on the cable you are planning to use (for relatively long distances), the pull-up resistor and the cable capacitance form a nice, one-stage low-pass filter which directly affects tr and tf.

enter image description here

tr (Rise Time): The duration that the signal rises from its 10% to its 90% level.

tf (Fall Time): The duration that the signal falls from its 90% to its 10% level.

tp (Pulse duration): The duration between 67% and 33%.

As a result,

$$ t_r = t_f = 2.2 \ R_P \ C_L $$

where RP is the pull-up resistor and CL is the total cable capacitance.

I will not fill in the answer with a proof. But it's easy - use the capacitor's charge and discharge equations.

For example, let's assume you are using a 20-meter-long cable with a capacitance of 30pF/m (running two cables: data and ground), so CL=600pF, and a pull-up resistor of RP = 10kOhm.

From the formula above, tr = tf = 13.2μs. We can fairly assume that the width of a pulse will be decreased by ~10μs. It's also easy to say that this RC network will chop-off the incoming frequencies beyond fC= 1/(2 π RP CL) = ~26kHz.

From the datasheet of your sensor, the minimum pulse width is 26-28μs which allows us to make tr = tf = ~1μs. With the same cable in the example above, the maximum pull-up resistor can be calculated as RP = ~1Ω which is completely unacceptable and impractical. So, you should either decrease the length or use buffers-repeaters at both ends.

  • \$\begingroup\$ Sir!!! This is my first ever electronic project. And such a complicated answer! Anyway i got your point. I was planning to use just a normal electric wire used for home wiring... Do they worsen this problem? \$\endgroup\$ Commented Jun 10, 2020 at 6:54
  • 1
    \$\begingroup\$ @BhavyaGupta probably yes. Using long wires with pull-up resistors is not a good idea for your project. As I said in my answer, you can use buffers which allow you to use longer cables with higher speeds. \$\endgroup\$ Commented Jun 10, 2020 at 6:56
  • \$\begingroup\$ Thanks for replying. What is speed related to? Sorry for my lack of knowledge but I don't get where the parameter of speed came from? I just need to get temperature readings once every 30 minutes. \$\endgroup\$ Commented Jun 10, 2020 at 7:00
  • 1
    \$\begingroup\$ I meant the maximum communication speed without distortion/deformation of the signal. In your case the speed is determined by the sensor itself, so nothing to worry about. My answer about buffers/repeaters for long distances still applies. \$\endgroup\$ Commented Jun 10, 2020 at 7:19
  • 1
    \$\begingroup\$ @BhavyaGupta most likely there'll be no communication between the Arduino and the sensor at all - The sensor will not understand what Arduino says and vice versa - so you can't get any reading from the sensor. If you are lucky, you can get wrong readings such as -127°C in a room environment. \$\endgroup\$ Commented Jun 10, 2020 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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