Temperature and Humidity (HDC1000) Problem[SOLVED]


#1

Hi, I was using the code from https://github.com/DexterInd/GrovePi/tree/master/Software/Python/grove_i2c_temp_hum_hdc1000. However I think there may exist some problems in the code. In the code you read the same raw data for tem and hum, which makes me believe that tem and hum are related. However, when I was looking at the code in Arduino (https://github.com/Seeed-Studio/HDC1000), I found that they use different functions to get data for tem and hum. So I suppose the raw data we read should be different. Do you have any idea?


#2

I did have a look at the code and I think this line https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_i2c_temp_hum_hdc1000/grove_i2c_temp_hum_hdc1000.py#L109 has to be changed to read the register 0x01 instead of 0x00. Is that what you were talking about.

-Karan


#3

Hi yushengz, I was wondering if resolved your issues. I’m receive the following messages and was wondering if had the same issue.
temp = 78.8 F humidity = 34.4 %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
Error
Error
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = 79.0 F humidity = 34.2 %
temp = nan F humidity = nan %
temp = 79.2 F humidity = 34.1 %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = 79.3 F humidity = 33.8 %


#4

Hi Karen, Do you have any suggestion or any help on how I should troubleshoot and find out why the py script reporting temp = nan F humidity = nan ? Listed below the py script # display_temp.py.

temp = 78.8 F humidity = 34.4 %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
Error
Error
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = 79.0 F humidity = 34.2 %

display_temp.py

This scripts access the tempeture and humidity from the sensor and displays on the screen (updated every few seconds)

import time

from grovepi import *
from grove_rgb_lcd import *

dht_sensor_port = 7 # Connect the DHt sensor to port 7
dht_sensor_type = 1

setRGB(51,102,153)

while True:
try:
[ temp,hum ] = dht(dht_sensor_port,dht_sensor_type)
currTime=time.strftime("%I:%M%p")
currDay=time.strftime("%D")
temp = round(temp * 9/5 + 32,1)
print “temp =”, temp, “F\thumidity =”,hum,"%"
t = str(temp)
h = str(hum)
setText("SmartKeg " + currTime + t + "F " + currDay)
time.sleep(1)
except (IOError,TypeError) as e:
print “Error”


#5

Hey billh,
Can you take a picture of your setup and upload it here. Can you run the troubleshooting script by following the instructions here and upload the log to the forums so that we can narrow down the problem: https://www.youtube.com/watch?v=ZMadpIEYq5o&list=PLGXEJ4Ye1qCMWziVrynnrIPpgfOr-2aj9&index=4.

-Karan


#6

Hi Karan, Thank you for responding and helping out trying to find out what’s going on.

Here you go.
200004928@smartkeg:/ cd /etc/rc3.d 200004928@smartkeg:/etc/rc3.d ls
K01dhcpcd README S01ifplugd S01shellinabox S02apache2 S03display_temp S03ntp S03restartd S03vncboot S04bluetooth S05saned S07plymouth
K06nfs-common S01bootlogs S01motd S01sudo S03cron S03dphys-swapfile S03redis-server S03rsync S03vncproxy S04lightdm S05sixad S07rc.local
K06rpcbind S01cgroup-bin S01rsyslog S01triggerhappy S03dbus S03lirc S03reset_button S03ssh S04avahi-daemon S05cups S06samba S07rmnologin
200004928@smartkeg:/etc/rc3.d$ cd …/rc2.d
200004928@smartkeg:/etc/rc2.d$ ls
K01dhcpcd README S01ifplugd S01shellinabox S02apache2 S03display_temp S03ntp S03restartd S03vncboot S04bluetooth S05saned S07plymouth
K06nfs-common S01bootlogs S01motd S01sudo S03cron S03dphys-swapfile S03redis-server S03rsync S03vncproxy S04lightdm S05sixad S07rc.local
K06rpcbind S01cgroup-bin S01rsyslog S01triggerhappy S03dbus S03lirc S03reset_button S03ssh S04avahi-daemon S05cups S06samba S07rmnologin


#7

Hi Karen, I’m sorry to bother you. I was just wondering if you had a chance to review the info I sent you.


#8

Hey billh,
Sorry for taking this long to reply back. I was having a look at the troubleshooting log and it looks like either you are using some other sensor or your sensor is broken. If you run i2cdetect -y 1 on your Pi it should have atleast 1 entry for the GrovePi and another for the HDC1000 sensor. There can be other entries if you have connected other sensors. I have attached a screenshot of what it looks like here.

Can you check if you are using this sensor: http://www.seeedstudio.com/wiki/Grove_-Temperature&Humidity_Sensor(HDC1000) and just try out this example first: https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_i2c_temp_hum_hdc1000/grove_hdc_1000_example.py.

-karan


#9

Karen, Thank you again for your help and support. I’m in the process of trying to find out how to run i2cdetect -y 1 on my Pi checking. I believe we have the following Grove - Temperature & Humidity Sensor Pro SKU: SEN51035P installed. I’m also verifying, I noticed the sensor looks different than what you mentioned.

Thanks again, billh


#10

Hey billh,
If you are using the DHT pro which has a big white or blue sensor on the top then you should try this example: https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_dht_pro.py. Just select the blue or white variable and try with the sensor to see if you get good readings.

-Karan


#11

Hi Karen, Here’s the additional info and the info you requested.

Let me explain and document the issue again - (sometime the py script reporting temp = nan F humidity = nam %) .

Do you have any suggestions or comments on how we should troubleshoot to find why the py script reporting temp = nan F humidity = nam % .

Listed below the py script output report.

temp = 78.8 F humidity = 34.4 %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %
temp = nan F humidity = nan %

Listed below everything plugged in:
A2 Ultrasonic ranger
12C-1 LCD RGB backlight
A1 Button
D7 Temperature & humidity sensor
A0 Sound sensor
D4 Green LED

We have a Grove - Temperature&Humidity Sensor (its’s a white sensor) Pro SKU: 101020019 installed in port D7.

(please reference the Notepad attachment reporting the run i2cdetect -y 1 results

Listed below the py script report that’s running.

display_temp.py

This scripts access the tempeture and humidity from the sensor and displays on the screen (updated every few seconds)

import time

from grovepi import *
from grove_rgb_lcd import *

dht_sensor_port = 7 # Connect the DHt sensor to port 7
dht_sensor_type = 1

setRGB(51,102,153)

while True:
try:
[ temp,hum ] = dht(dht_sensor_port,dht_sensor_type)
currTime=time.strftime(“%I:%M%p”)
currDay=time.strftime(“%D”)
temp = round(temp * 9/5 + 32,1)
print “temp =”, temp, “F\thumidity =”,hum,”%”
t = str(temp)
h = str(hum)
setText(“SmartKeg ” + currTime + t + “F ” + currDay)
time.sleep(1)
except (IOError,TypeError) as e:
print “Error”


#12

Hey billh,
Can you just connect the DHT sensor to port D4, change the second parameter in line 53 here: https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_dht_pro.py to white and run that example and post the output you get when you run it.

-Karan


#13

Hi Karen, Thanks again for all your help and support.

Ok, as requested, I connected the DHT sensor to port D4, changed python rtn (it’s now the same as you suggested) the second parameter in line 53 here:

temp = nan C humidity =nan%
temp = 27.10 C humidity =40.20%
temp = 27.10 C humidity =40.20%
temp = nan C humidity =nan%
temp = 27.10 C humidity =40.10%
temp = nan C humidity =nan%
temp = 27.10 C humidity =40.10%
temp = 27.10 C humidity =40.10%
temp = nan C humidity =nan%

The bad news, it’s still reporting the same. Do you have any other suggestions? I’m ready to try any anything. Do we have a bad white sensor? If so, can you send me a new replacement.

Listed below the additional info / log.

root@smartkeg:/home/pi/SmartKeg/sc-docs/scripts# cat display_tebh.py

display_tebh.py

This scripts access the tempeture and humidity from the sensor and displays on the screen (updated every few seconds)

import grovepi

sensor = 4 # Connect the DHt sensor to port 4

blue = 4
white = 1

while True:
try:
[temp,humidity] = grovepi.dht(sensor,white)
print (“temp = %.02f C humidity =%.02f%%”%(temp, humidity))

    except IOError:
            print ("Error")

root@smartkeg:/home/pi/SmartKeg/sc-docs/scripts# vi display_tebh.py
root@smartkeg:/home/pi/SmartKeg/sc-docs/scripts# cat display_tebh.py

display_tebh.py

This scripts access the tempeture and humidity from the sensor and displays on the screen (updated every few seconds)

import grovepi

sensor = 4 # Connect the DHt sensor to port 4

blue = 0
white = 1

while True:
try:
[temp,humidity] = grovepi.dht(sensor,white)
print (“temp = %.02f C humidity =%.02f%%”%(temp, humidity))

    except IOError:
            print ("Error")

root@smartkeg:/home/pi/SmartKeg/sc-docs/scripts# python display_tebh.py
temp = nan C humidity =nan%
temp = 27.10 C humidity =40.20%
temp = 27.10 C humidity =40.20%
temp = nan C humidity =nan%
temp = 27.10 C humidity =40.10%
temp = nan C humidity =nan%
temp = 27.10 C humidity =40.10%
temp = 27.10 C humidity =40.10%
temp = nan C humidity =nan%
temp = 27.10 C humidity =40.10%
temp = nan C humidity =nan%
temp = nan C humidity =nan%
temp = 27.10 C humidity =40.10%
^Ctemp = nan C humidity =nan%
temp = nan C humidity =nan%
^CTraceback (most recent call last):
File “display_tebh.py”, line 16, in <module>
[temp,humidity] = grovepi.dht(sensor,white)
File “/usr/local/lib/python2.7/dist-packages/grovepi-0.0.0-py2.7.egg/grovepi.py”, line 290, in dht
time.sleep(.6)
KeyboardInterrupt
root@smartkeg:/home/pi/SmartKeg/sc-docs/scripts#


#14

Hey Billh,
Can you attach a picture of your setup of the GrovePi and the sensor. Also, where did you buy the sensor and the GrovePi from.

-Karan


#15

Hi Karen, Today, I just received my new Grove - Temperature&Humidity Sensor Pro SKU: SEN51035P from SeedStudio. I installed the new sensor and re-booted. It’s reporting the same.

Here’s my reply - Can you attach a picture of your setup of the GrovePi and the sensor. Please explain on how I should provide you the info.
Also, where did you buy the sensor and the GrovePi from. My reply - I’m sorry it took so long - my office person forgot to order the sensor.

Please let me know the next steps to help resolve the issue.

Listed below the message (note: temp = nan C humidity =nan%)
temp = 1.00 C humidity =1.00%
temp = nan C humidity =nan%
temp = nan C humidity =nan%
temp = 1.00 C humidity =1.00%
temp = 29.10 C humidity =35.00%
temp = nan C humidity =nan%
temp = 1.00 C humidity =1.00%
temp = nan C humidity =nan%
temp = 1.00 C humidity =1.00%
temp = 29.20 C humidity =35.00%
temp = nan C humidity =nan%
temp = nan C humidity =nan%
temp = 1.00 C humidity =1.00%
temp = nan C humidity =nan%

====================================

here’s the scripts

root@smartkeg:/home/pi/SmartKeg/sc-docs/scripts# cat display_tebh.py

display_tebh.py

This scripts access the tempeture and humidity from the sensor and displays on the screen (updated every few seconds)

import grovepi

sensor = 4 # Connect the DHt sensor to port 4

blue = 0
white = 1

while True:
try:
[temp,humidity] = grovepi.dht(sensor,blue)
print (“temp = %.02f C humidity =%.02f%%”%(temp, humidity))

    except IOError:
            print ("Error")

==============================================


#16

Just to add to this conversation, I have a similar issue in that the temperature and humidity sensor aren’t reporting sensible values. They tend to stick quite closely to 25C and 40% humidity and drift up and down by +/- 1C and +/- 1% Humidity, when I know the temperature is 18-19C.

I don’t get any NaN though.


#17

Thank you for the feedback. I’m trying to address why the sensors reporting the following.

temp = nan C humidity =nan%
temp = nan C humidity =nan%


#18

Hi Karen, Do you have any updates

Listed below the setup of the GrovePi. Please let me know if you need any additional info.

/$ cat /home/pi/Desktop/bhlog.txt

Check space left

Filesystem Size Used Avail Use% Mounted on
/dev/root 7.2G 2.9G 4.0G 42% /
devtmpfs 428M 0 428M 0% /dev
tmpfs 87M 544K 86M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 173M 0 173M 0% /run/shm
/dev/mmcblk0p1 56M 20M 37M 36% /boot

Check for dependencies

python 2.7.3-4+deb7u1 install ok installed
python-pip 1.1-3 install ok installed
git 1:1.7.10.4-1+wheezy1+rpi2 install ok installed
libi2c-dev 3.1.1+svn-1 install ok installed
python-serial 2.5-2.1 install ok installed
python-rpi.gpio 0.6.1~wheezy-1 install ok installed
i2c-tools 3.1.1+svn-1 install ok installed
python-smbus 3.1.1+svn-1 install ok installed
arduino 1:1.0.1+dfsg-7 install ok installed
minicom 2.6.1-1 install ok installed
scratch 1.4.20131203-2 install ok installed

wiringPi Found
wiringPi Found
I2C already removed from blacklist
SPI already removed from blacklist

Check for addition in /modules

I2C-dev already there
i2c-bcm2708 already there
spi-dev already there

Hardware revision

gpio version: 2.31
Copyright © 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Type: Pi 2, Revision: 01, Memory: 1024MB, Maker: Embest
Device tree is enabled.
This Raspberry Pi supports user-level GPIO access.
-> See the man-page for more details

Check the /dev folder

i2c-1
spidev0.0
spidev0.1
ttyAMA0

USB device status

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 005: ID 0461:4e22 Primax Electronics, Ltd
Bus 001 Device 006: ID 413c:2107 Dell Computer Corp.

/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M
|__ Port 3: Dev 4, If 0, Class=hub, Driver=hub/4p, 480M
|__ Port 1: Dev 5, If 0, Class=HID, Driver=usbhid, 1.5M
|__ Port 2: Dev 6, If 0, Class=HID, Driver=usbhid, 1.5M

Checking for Atmega chip

avrdude: Version 5.10, compiled on Jun 18 2012 at 12:38:29
Copyright © 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright © 2007-2009 Joerg Wunsch

     System wide configuration file is "/etc/avrdude.conf"
     User configuration file is "/root/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : unknown
     Using Programmer              : gpio
     AVR Part                      : ATMEGA328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : GPIO
     Description     : Use sysfs interface to bitbang GPIO lines

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f

avrdude done. Thank you.

Checking I2C bus for devices

Checking I2C bus 0

Error: Could not open file /dev/i2c-0’ or/dev/i2c/0’: No such file or directory

Checking I2C bus 1

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: 03 04 – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- 3e –
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- 62 – -- – -- – -- – -- – -- – -- –
70: – -- – -- – -- – --

Checking for firmware version

(‘GrovePi has firmware version:’, ‘1.2.2’)
200004928@smartkeg:/$


#19

Hi Karen, I just realized, I sent you the old log, please ignore the info listed above. I’m now remote and I can no longer run the GrovePI troubleshooting script to provide you the setup of the GrovePi. I hope taht’s what your looking for. Please advise if that’s correct and can you advice on how I can run GrovePI troubleshooting script via remote.

Thank again for your help and support.


#20

Hey billh,
I haven’t seen a lot of nan’s on this sensor before, but since a couple of people have reported similar problems, I’ll test this sensor along with a couple of other temp sensors in parallel to check if this does report the right values.

-karan