2

Trying to get the DHT22 sensor working on my raspberry pi zero W. I have connected everything as required, I checked like 20 times but just in case here is a pic:

enter image description here

I used this links to figure out what to connect and where https://www.pubnub.com/blog/2015-07-09-raspberry-pi-humidity-temperature-sensor-dashboard-dht-22-sensor/ https://pinout.xyz/pinout/io_pi_zero

I have tried to use the Adafruit_Python_DHT library and i just always get None, None for both sensors even if looping several times.

I then decided to give DHTXXD a try and still nothing I get repeatedly 3 0.0 0.0

Now I wonder what else I can try? I also tried using GPIO 17 and nothing, I tried using 5V also but same results. How can I test if even the sensor is detected? Nor adafruit library nor DHTXXD give any crashes errors. TIA

Update1: after trying @Jamie JaysCom answer and it does not work for me. I think now maybe my sensor was damaged due to my first wiring attempts(not sure) so will try getting another one. Also wondering if the breadboard could be damaged? How about the resistor? Rpi is the only thing that seems to work well: I have tested with http://wiringpi.com/the-gpio-utility/pin-test/ and got OK for all the pins.

5
  • Can you add an overhead shot I can't tell where the resistor is connected. Don't use 5 Volts it can damage your Pi or the Pin. Commented Jul 22, 2017 at 20:12
  • @Steve Robillard so I cannot make a pic right now but the sensor has 4 pins so the resistance is connected to the 2 ones most left (1 and 2)
    – vallllll
    Commented Jul 22, 2017 at 20:23
  • 1
    I just connected a DHT22 like the one pictured. Pin 1 to Pi 3V3, pin 2 to GPIO 4 (Pi pin 7), pin 4 to Pi ground. No pull-up resistor needed. Works fine with DHTXXD (./DHTXXD 0 23.0 61.5 ./DHTXXD 0 23.0 61.6).
    – joan
    Commented Jul 22, 2017 at 20:47
  • @joan what does it mean no pull up resistor needed? you mean no restance? bybthe way did you use pi zero w?
    – vallllll
    Commented Jul 22, 2017 at 20:50
  • 1
    It needs a pull-up, but GPIO 4 has a weak (60k) pull-up to 3V3 enabled by default which is sufficient for testing at least. Yes, I used a Pi Zero W.
    – joan
    Commented Jul 22, 2017 at 21:11

3 Answers 3

1

Ive not used a zero yet (although i do have several zero W's that im playing with, using DS18b20 temperature sensors) http://www.home-automation-community.com/temperature-and-humidity-from-am2302-dht22-sensor-displayed-as-chart/

ive written out my own Procedures for this stuff, as a lot of web pages TRY to help, but dont always include all the "nitty bitty" stuff you have to do if just one step fails, or isnt there, or spelled wrong.

sudo apt update

To enable the protocol, run shell command

sudo raspi-config

Then select Advance Options and enable I2C and SPI You need to reboot to effect the configuration.

Have this installed too:

sudo apt-get install build-essential python-dev python-openssl

VCC is 3.3v Use the AdaFruit library.....google that puppy (git hub download)

We’re using DHT22 and connected to the GPIO PIN 4, so, our command line will be

sudo ./AdafruitDHT.py 22 4

Let us know if that helps!

3
  • Thanks for your post it really explains everything well, I will try it out after work tonight the doubt I have is the resistor. I am using the one I got from thepihut.com/products/… the thing is it says it is 4.7-10k so I am wondering should I use another one?
    – vallllll
    Commented Jul 24, 2017 at 7:27
  • Actually, I have another question: so looking at your wiring (and I have seen similar ones online) I find it odd, let me explain: for example for ground you first connect rpi to breadboard and then from there to another hole on the breadboard, why not connect it directly (you have 2 black cables, why not use just the big one)? Sorry if it is a stupid question but I have no idea about electronics.
    – vallllll
    Commented Jul 24, 2017 at 7:36
  • sorry, i sometimes forget to check my posts. yes, i have tried it with both 4K7ohm (4700 ohm) and 10K (10,000 ohm) resistors. Both work the same so far. those images and sites are not mine, i should have said i have used many of sites like that, to make my own inhouse documentation. The resistor goes on the VCC and the DATA, like it is SHORTING them out. here are 2 good images: [link]code.mios.com/trac/mios_arduino-sensor/wiki/HumiditySensor and [link]cityos.io/tutorial/1989/…
    – JRR
    Commented Jul 25, 2017 at 12:07
0

Fixed it by removing the following part from the project: parts removed

and connected the jump cables directly to the raspberry pi. Wonder why that is, maybe these parts only work if soldered? I managed to solve the issue by trying outjust a simple led project which helped me to realize which part was not working: https://thepihut.com/blogs/raspberry-pi-tutorials/27968772-turning-on-an-led-with-your-raspberry-pis-gpio-pins

1
  • 3
    The part on the right needs to be soldered to the pi for the connections to work. The part on the left pushes onto the pins on the right and that connection does not need to be soldered.
    – Matt
    Commented Dec 23, 2018 at 3:04
-1

The only pins I know of that dont have to be saudered require a jig and are tapped in are available here: https://is.gd/u6Goftenter image description here

1
  • 1
    I'm not sure how this is answering the question about getting the DHT22 sensor to work. Are you suggesting that the OP had bad soldering on their GPIO header? If so then maybe clarify this in your answer. Commented Mar 9, 2019 at 18:39

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.