|
Post by camblonie on Dec 12, 2014 13:02:50 GMT
Does anyone have a good source for temp sensors of the DHT type that work at 3.3v? The batch of dht22's that I got will only work at 5v.
|
|
|
Post by Admin on Dec 13, 2014 23:51:14 GMT
Does anyone have a good source for temp sensors of the DHT type that work at 3.3v? The batch of dht22's that I got will only work at 5v. Why do you need 3.3V DHT22's? Can't they run off the 5V rail, even if the Arduino is in 3.3V mode?
|
|
|
Post by camblonie on Dec 14, 2014 19:57:10 GMT
I'm planning to use some pro mini boards. There's no 5V takeoff. I guess since I'm going to use a wallwart and need a little board to tie things together I can rig up a 5v regulator and power things from there.
|
|
|
Post by camblonie on Dec 19, 2014 0:18:59 GMT
Have you tried this yourself? It doesn't seem to give me a reading when I use 5V.
|
|
|
Post by Admin on Dec 23, 2014 3:30:11 GMT
Have you tried this yourself? It doesn't seem to give me a reading when I use 5V. No, I haven't tried pro-minis. I'd be interested if you find a good way around the issue. I don't have any better ideas than what you've mentioned - separate 5V reg.
|
|
|
Post by camblonie on Dec 24, 2014 17:51:32 GMT
As usual my mistake. The pro mini is 8 MHz. I just needed to add a parameter per the example text. A value of 3 is working for me.
|
|
|
Post by papa on Jul 10, 2017 18:05:33 GMT
I had not looked much at DHT coding since something like the following (& maybe some added delays) worked for me (DHT11, not tried DHT22) on my Buono Uno Arduino compatibles.
#define DHTTYPE DHT11 // type of sensor or #define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE, 3); // initialise temp/humidity sensor for 8Mhz Arduino Timing matters with DHT sensors. The third parameter in the DHT initialization (3 above) helps it to adjust to the processor clock speed (MHz) in the device. If left blank, the default third parameter is 6 for 16MHz, typical for standard Arduino Unos.
3.3 volt devices, like maybe a pro mini may run at 8MHz.
However, a Buono Uno Arduino compatible that I & others use runs at 16MHz so we might want to use an initialization code of DHT dht(DHTPIN, DHTTYPE, 6); // or DHT dht(DHTPIN, DHTTYPE); // default processor speed to 16MHz
I've been testing a DHT11 on an ESP8266 device that runs at 80MHz One thing that prevented garbage data from the DHT was a line like this just before a DHT temp or humidity read: delay(300); // delay to avoid garbage ^^ This seems to work pretty reliably so far
I also tested an initialization of: DHT dht(DHTPIN, DHTTYPE, 30); // initialize DHT sensor on 80MHz ESP8266 device To get consistent reads, besides the changed 3rd parameter, I still needed delay(300) before a DHT read. The third parameter as 30 made the sensor readings slow to respond to temp/humidity changes. Only adding delay(300) before a DHT read, I believe I rarely get garbage & DHT readings are more responsive. I changed initialization back to DHT dht(DHTPIN, DHTTYPE, 3);
Using a DHT sensor with your devices, you might try the delay before a DHT temp or humidity read. (That works best so far for me.)
You might also try tweaking the 3rd parameter of DHT initialization according to the CPU frequency of your device (In Arduino IDE, see /Tools/Board ... or check your device's specifications.) Divide your CPU Frequency by 8, multiply the result by 3, & round to the nearest whole number. 80/8 = 10, 10 X 3 = 30 Even then, you might get better results with a slightly higher or lower number than you calculate.
|
|