DHT22 sensor bought from Amazon and Raspberry PI 2(Model B).
- Wire Pin 1(VDD) of DHT22 to Pin 1(+3.3v) of PI
- Wire Pin 2(DATA) of DHT22 to Pin 7(GPIO4) of PI
- Wire Pin 3(GND) of DHT22 to Pin 9(GND) of PI
Some tutorials require 10K resistor between wires of PIN1 and PIN2 of DHT22 sensor. I haven't used the resistor.
I tried with pi4j for java and it didn't work. I then tried in C using wiringpi. It worked with no issues. Went ahead with C and JNI. JNI to interface C and Java. I wanted Java to read and post measurements to Elasticsearch for graph.
Install wiringpi library as in the documentation.