Hello There,
I'm currently using the library http://learn.adafruit.com/dht for my DHT22 and I'm using a Adrunio Uno.
Looking at the serial monitor, I'm not having any intellectual readings coming from it.
A sample:
"BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨U ¡ ¥1¡ !¡BANNED ¥qñ;!¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1ó;
(%ÿ ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨PüÊ õ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED¨P ¡ ¥1¡ !¡BANNED ¥1¡ !¡BANNED ¥1¡ !¡BANNED"
Both the Uno and the Sensor has the Pwr miniled on, and the Tx led flashing as it samples.
Would anybody know how to fix this?
Cheers,
Dennis
DHT22 Temperature/Humidity spitting out gibberish using the ladyada DHT22 Library.
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 5
- Joined: Sat May 18, 2013 6:41 am
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: DHT22 Temperature/Humidity spitting out gibberish using the ladyada DHT22 Library.
Looks like a baud-rate mismatch. Make sure that the baud rate setting of the serial monitor is the same as the baud-rate set in the sketch.
-
- Posts: 5
- Joined: Sat May 18, 2013 6:41 am
Re: DHT22 Temperature/Humidity spitting out gibberish using the ladyada DHT22 Library.
Hello adafruit_support_bill , Thank you for a prompt response.
The baud rate is set 9600 at serial monitor.
I wouldn't have a clue about the baud rate in the sketch, but maybe you can identify it, the sketch is as follows:
`// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
#include "DHT.h"
#define DHTPIN 2 // what pin we're connected to
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(38400);
Serial.println("DHT test");
dht.begin();
}
void loop() {
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
Serial.println("Failed to read from DHT");
} else {
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C");
}
}
The baud rate is set 9600 at serial monitor.
I wouldn't have a clue about the baud rate in the sketch, but maybe you can identify it, the sketch is as follows:
`// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
#include "DHT.h"
#define DHTPIN 2 // what pin we're connected to
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(38400);
Serial.println("DHT test");
dht.begin();
}
void loop() {
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
Serial.println("Failed to read from DHT");
} else {
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C");
}
}
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: DHT22 Temperature/Humidity spitting out gibberish using the ladyada DHT22 Library.
The sketch is using 38400
It is specified in the Serial.begin statement:
It is specified in the Serial.begin statement:
Code: Select all
void setup() {
Serial.begin(38400);
Serial.println("DHT test");
dht.begin();
}
-
- Posts: 5
- Joined: Sat May 18, 2013 6:41 am
Re: DHT22 Temperature/Humidity spitting out gibberish using the ladyada DHT22 Library.
Worked a Charm!! Thank you so much!!
Out of curiosity and for the benefit of the people who are reading this post and don't know, what is the Baud rate
specifically?
Out of curiosity and for the benefit of the people who are reading this post and don't know, what is the Baud rate
specifically?
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: DHT22 Temperature/Humidity spitting out gibberish using the ladyada DHT22 Library.
baud rate is the rate at which individual bits are sent over the wire for serial communication. Typically, for each character transmitted, there are 8 data bits and one "stop bit". As a rough rule of thumb, the number of characters transmitted per second is about 1/10th the baud rate.
-
- Posts: 5
- Joined: Sat May 18, 2013 6:41 am
Please be positive and constructive with your questions and comments.