537.6C displayed in Home Weather Project

Hi
I’ve just received the GrovePi+ starter kit and thought I’d try out the Home Weather Display project to make sure it’s all working, I got it to run but both the Shell and the LCD are displaying Temp: 537.6C Humidity: 998.4%.
They both do change so that implies the sensor is working but clearly they’re way off reality, do you think I have a faulty sensor or is there a configuration step that I missed?
Thanks

I was looking through the forum and found the solution posted by maganj3m (Thanks!) however there’s no mention of this in the documentation which is pretty poor given that this kit and the example projects are clearly aimed at beginners.

August 23, 2014 at 11:22 am #2396 REPLY

maganj3m

Participant
Hi again,

Changing the next line in code:

Original:
[ temp,hum ] = dht(dht_sensor_port,1) #Get the temperature and Humidity from the DHT sensor

Changed:
[ temp,hum ] = dht(dht_sensor_port,0) #Get the temperature and Humidity from the DHT sensor

is working for me.

Regards

It’s either VERY HOT where you live, or your using the wrong arguments.

There are a few different types of DHT temperature sensors.

  • DHT22 - white one, aka DHT Pro or AM2302
  • DHT21 - black one, aka AM2301
  • DHT11 - blue one

The GrovePi+ Starter Kit comes with a DHT11 (blue one).

When you call the python method grovepi.dht(pin,type) the 2nd argument is used to say which type of DHT sensor you are using.

For a DHT11 call: grovepi.dht(pin,0)

For a DHT22 call: grovepi.dht(pin,1)

For a DHT21 call: grovepi.dht(pin,2)

For a AM2301 call: grovepi.dht(pin,3)

If you use the wrong argument, you’ll get inaccurate results.

Read more about the DHTs: https://learn.adafruit.com/dht

There are other type of temperature sensors, which use thermistors:

There are several revisions to the thermistor temp sensors, each with different thermistors and R values. You’ll have to hit the wiki to find out specifics about each.

Thanks very much for that @mcauser

As this will affect everyone with the starter kit I’ve added a summary of the above into the comments at the top of the file on GitHub, and put a link to this thread for more info.

…which I see has been merged already, thanks dexterind :slight_smile:

I ran the Home Weather Display script and got the following error:

File “Home_Weather_Display.py”, line 9
SyntaxError: Non-ASCII character ‘xe2’ in file Home_Weather_Display.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

I have 0 Python experience and next to no programming experience. Is there a gap in the code waiting for me to paste in this “call” thing? If so, can you give me an example of that the code should look like? I got the blue sensor.

Thanks

You need to update the code from GitHub, a fix for that ASCII character error was applied yesterday. To do that run ‘git pull’.

Then edit the file, you’ll see a line
dht_sensor_type = 1

Because you have the blue sensor change that line so it reads:
dht_sensor_type = 0

If it complains about permissions when you run it then try running it as root.

I’m pleased to say I got the script working with your helpful directions. Thanks! :slight_smile: