I’ve been meaning to try Josh’s 4-line change to the OneWire Arduino library that enables using the popular DS18B20 temperature sensor without the otherwise required external 4.7K pull-up resistor on the DQ line for quite some time now. It is sometimes hard to solder those pesky resistors on SMD PCBs, and Josh has gone great lengths in analysing what can be done to get away without these. Basically using the internal pullup resistors will do the job when the sensor is wired at short distance, his detailed analysis is well worth reading. Grab the patched up OneWire library from his Github repo.
So that means I can just plug in a DS18B20 in Funky v3‘s header (GND, D8,D2) like this:
I used this code to test it out, all works just fine. Neat.
I then wanted to see how the DHT22/AM2302 temperature/humidity would behave; Examining the DHT22 library code I noticed it is already does internal pullup, so I just plugged it in as follows and uploaded this code to test it out. Note the unused pin of the DHT22 needs to be bent out, or better cut off altogether, otherwise this setup won’t work. The sensor attaches to the same GND, D8, D2 pins, sensor facing down:
That too worked well, to not surprise as the DHT22 needs a weaker pull-up resistor anyway;
So that’s nice to know, but for sensors wired further away I’d still throw in the appropriate pull-up resistor.
Page views: 9052