Hello,
So I have bought a GrovePi Temperature and humidity sensor => http://www.seeedstudio.com/wiki/Grove_-_Temperature_and_Humidity_Sensor_Pro. I’m able to get some readings, but the readings seem a bit off. For example running this code:
import grovepi
# Connect the Grove Temperature & Humidity Sensor Pro to digital port D4
# This example uses the blue colored sensor.
# SIG,NC,VCC,GND
sensor = 4 # The Sensor goes on digital port 4.
# temp_humidity_sensor_type
# Grove Base Kit comes with the blue sensor.
blue = 0 # The Blue colored sensor.
white = 1 # The White colored sensor.
while True:
try:
# This example uses the blue colored sensor.
# The first parameter is the port, the second parameter is the type of sensor.
[temp,humidity] = grovepi.dht(sensor,white)
print("temp = %.02f C humidity =%.02f%%"%(temp, humidity))
except IOError:
print ("Error")
I get:
temp = 23.70 C humidity =60.00%
temp = 23.70 C humidity =59.90%
temp = 23.70 C humidity =59.90%
temp = 23.70 C humidity =59.90%
temp = 23.70 C humidity =60.00%
temp = 23.70 C humidity =59.90%
temp = 23.70 C humidity =59.90%
temp = 23.70 C humidity =60.00%
Traceback (most recent call last):
File "/usr/lib/nagios/plugins/check_lin_grove_temp_hum.py", line 17, in <module>
[temp,humidity] = grovepi.dht(sensor,white)
TypeError: 'int' object is not iterable
So my first problem is that after a few iterations I keep getting “TypeError: ‘int’ object is not iterable”
And the temperature readings is a bit wrong. I’m quite sure it’s not 23,70 degrees over here, as I have two other temperature meters, one saying 21,60 and the other 22,20. What could cause this higher temperature? The sensor is not placed on anything warm or next t the RaspBerry.
Grtz
Willem