Temperature and Humidity (HDC1000) Problem[SOLVED]

Hi Karen, Thank you for the update.

Additional info - You replied on April 7, 2016 at 4:54 am (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.

Can you verify if you have a register issue / etc.

I would like really like to have the following code

Listed below the py script that I would like to run “ with out” reporting the following temp = nan F humidity = nan %

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”

Hi Karen, Any update - did you get a chance to test this sensor along with a couple of other temp sensors in parallel to check if this does report the right values?

As requested, here’s an updated TS log. Thank again for your help and support.

/home/pi/Desktop# cat log.txt

Check space left

Filesystem Size Used Avail Use% Mounted on
/dev/root 7.2G 2.9G 4.1G 42% /
devtmpfs 428M 0 428M 0% /dev
tmpfs 87M 552K 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’)

I just tested the sensor and it was indeed reporting bad values. The code has been updated and you can find the updated code here: https://github.com/DexterInd/GrovePi/tree/master/Software/Python/grove_i2c_temp_hum_hdc1000.

Also, when you run i2cdetect -y 1, the sensor should show up on address 0x40. Can you doublecheck that before starting (0x04 is GrovePi, 0x08 is GoPiGo).

-Karan

Karan, Nice job and Thank you.

Hi Karen. I’m working with billh on the same hardware. I tried your modified code but I’m having trouble getting it to work. When I run the example script, it calls the HDC1000() class with the hdc.Config() line. Within the HDC1000() class, I get an error on line 57:

Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
File “grove_i2c_temp_hum_hdc1000.py”, line 57, in Config
bus.write_byte_data(self.I2C_ADDR, 0x02, 0x30)
IOError: [Errno 5] Input/output error

I’ve attached the output of the i2cdetect -y 1 command.

What am I doing wrong?

Todd

Hey Todd,
Can you doublecheck the connections on the HDC1000 sensor. It should show up on address 0x40 unless you solder the jumpers: http://www.seeedstudio.com/wiki/Grove_-Temperature&Humidity_Sensor(HDC1000). It also looks like there are other sensors on the GrovePi. Can you send a picture of your setup too and any description about the sensors you have there.

-Karan

My sensor looks different from the picture of the HDC1000. I’ve attached a picture of my sensor connected to the GrovePi and the output from i2cdetect. It is the only sensor plugged in to the GrovePi (on port 4) and still gets “nan” readings most of the time.

Hi akasper,
The sensor you have is the Grove DHT sensor pro and the example for it is here: https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_dht_pro.py. Make sure that the sensor is connected to port 4 (defined on line 42) and change the parameter in line 53 to white from blue and it should work for you.

Do let us know if this works for you.

-Karan

Still same problem. It works about half the time.

pi@smartkeg:~/Desktop/GrovePi/Software/Python $ python grove_dht_pro.py
temp = nan C humidity =nan%
temp = 24.50 C humidity =48.00%
temp = nan C humidity =nan%
temp = 24.50 C humidity =48.00%
temp = 24.40 C humidity =48.00%
temp = nan C humidity =nan%
temp = 24.40 C humidity =48.00%
temp = 24.40 C humidity =48.00%
temp = nan C humidity =nan%
temp = 24.40 C humidity =48.00%
temp = nan C humidity =nan%

Hey akasper,
Not really sure why the sensor is throwing that many nan errors. Can you try using the another port and see if its any better. Also, you should be able to add a check to neglect all the values which are nan. Here is a way to do that: http://stackoverflow.com/questions/944700/how-to-check-for-nan-in-python.

-Karan

Karen, Who and why did someone to close this case and report the problem solved. I’m sorry, I don’t understand. Can you please re-open the case and can you please help us resolve the issue. (it seems you keep asking the same questions over and over and no one can provide a solution to resolve the issue.)

Still same problem. It works about half the time.

pi@smartkeg:~/Desktop/GrovePi/Software/Python $ python grove_dht_pro.py
temp = nan C humidity =nan%
temp = 24.50 C humidity =48.00%
temp = nan C humidity =nan%
temp = 24.50 C humidity =48.00%
temp = 24.40 C humidity =48.00%
temp = nan C humidity =nan%
temp = 24.40 C humidity =48.00%
temp = 24.40 C humidity =48.00%
temp = nan C humidity =nan%
temp = 24.40 C humidity =48.00%
temp = nan C humidity =nan%

Hey @billh, Karan will be right back with you, he’s on vacation this week. The name though is “Karan”, not “Karen”.

Hi John, Thanks you for the response. Do you know if Karan back from vacation?

Hey billh,
Sorry for closing the post before your problem was resolved. I have posted a program which should help you catch the nan problem and raise an exception here: http://www.dexterindustries.com/topic/temperature-and-humidity-hdc1000-reporting-problems/#post-99030. Can you check that post and let us know if that would work for you. Also, can you double-check the sensor you are using. It should be a DHT sensor and not HDC1000.

-Karan