RoadTest: TI HDC1000EVM Sensor Evaluation Module
Author: wymand
Creation date:
Evaluation Type: Evaluation Boards
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?: null
What were the biggest problems encountered?: Lack of communications protocol or software for applications
Detailed Review:
NOTE!!! After 7 months the sensor has died.
The first symptoms were very erratic readings
which could be corrected by unplugging and
restarting the sensor that worked for a while but it is now dead.
Sorry but I will stick to the cheap ones that have worked for years.
The location for this road test is a small homestead on the side of Tiger Mountain in Washington State USA.
The place is wooded with many predators. So the coop is outfitted with a Raspberry PI and cameras.
The Raspberry Pi sends data to a MySQL database and the data is available on a web page
As you may see, the Raspberry Pi controls exterior lights and the coop door. The lights come on for
5 minutes if the PIR detectors see something.
Also available are daily and weekly graphs of the temperatures recorded by a DHT22.
The intent of the road test was to compare these temperatures with the temperature of a nest box to see if a hen is brooding. With a brooding hen
on the nest, that temperature will rise while she is on the nest.
I wrote a Python3 program to record the temperature and humidity and call it as a cron job on the Raspberry.
The deadline for submitting the report was coming up and fate and chicken temperament stepped in and they tore up the
nesting boxes for rebuilding of the nests which they do every now and then so the following comparison chart is ambient
temperature. The DHT22 as I have it in the coop has a large thermal mass while the TI is much more sensitive to fluctuation
as this comparison chart shows:
Below is the Python3 code
#!/usr/bin/python
# coding=latin-1
import serial
import binascii
import httplib2
ser = serial.Serial()
#ser.port = "/dev/ttyUSB0"
#ser.port = "COM4:"
#ser.port = "/dev/ttyACM1"
#ser.port = "/dev/serial/by-path/platform-bcm2708_usb-usb-0:1.2:1.0"
ser.port = "/dev/serial/by-id/usb-Texas_Instruments_MSP430-USB_Example_E89A816F1C000500-if00"
ser.baudrate = 115200
ser.bytesize = serial.EIGHTBITS #number of bits per bytes
ser.parity = serial.PARITY_NONE #set parity check: no parity
ser.stopbits = serial.STOPBITS_ONE #number of stop bits
ser.timeout = 2 #timeout block read
ser.xonxoff = False #disable software flow control
ser.rtscts = False #disable hardware (RTS/CTS) flow control
ser.dsrdtr = False #disable hardware (DSR/DTR) flow control
ser.writeTimeout = 2 #timeout for write
humidity = None
temperature = None
try:
ser.open()
except Exception as e:
humidity = None
celsius = None
if ser.isOpen():
try:
ser.flushInput() #flush input buffer, discarding all its contents
ser.flushOutput()#flush output buffer, aborting current output
#and discard all that is in buffer
ser.write(serial.to_bytes([0x4C,0x33,0x01,0x00,0x03,0x40,0x00,0x02,0x87]))
response = ser.readline()
tmpval = (int(response[7])*256) + int(response[8])
celsius = str(("{0:.2f}".format(((float(tmpval)/float(65536)) * 165) -40)))
fahrenheit = str(("{0:.2f}".format((((((float(tmpval)/float(65536)) * 165) -40) * 9) / 5) + 32)))
print(str(("{0:.2f}".format(((float(tmpval)/float(65536)) * 165) -40))) + str("°C"))
print(str(("{0:.2f}".format((((((float(tmpval)/float(65536)) * 165) -40) * 9) / 5) + 32))) + str("°F"))
ser.write(serial.to_bytes([0x4C,0x33,0x01,0x00,0x03,0x40,0x01,0x02,0x92]))
response = ser.readline()
tmpval = (int(response[7])*256) + int(response[8])
humidity = str(("{0:.2f}".format((float(tmpval)/float(65536)) * 100)))
print(humidity + "%")
except Exception as e1:
print ("error " + str(e1))
if humidity is not None and celsius is not None:
h = httplib2.Http()
myStr = 'Nest Temp = ' + fahrenheit + 'F ' + celsius + "c Humidity =" + humidity + "%"
print(myStr)
myStr = myStr.replace(' ','%20')
resp, content = h.request("http://192.168.0.159/wd-db.php?sqlcmd=UPDATE%20WD_Master%20SET%20Char_Value%20=%20'" + myStr + "',Last_Active%20=%20NOW()%20,LastCheck%20=%20NOW()%20WHERE%20Equipment=%20'Coop_RPI'%20and%20System%20%20=%20'Coop_Temp_Nest'", "GET")
#print ("http://192.168.0.159/wd-db.php?sqlcmd=UPDATE%20WD_Master%20SET%20Char_Value%20=%20'" + myStr + "',Last_Active%20=%20NOW()%20,LastCheck%20=%20NOW()%20WHERE%20Equipment=%20'Coop_RPI'%20and%20System%20%20=%20'Coop_Temp_Nest'")
reqstr = "http://192.168.0.159/wd-db.php?sqlcmd=INSERT%20INTO%20Environment%20(`Sensor`,%20`datetime`,%20`Temperature`,%20`Humidity`)%20VALUES%20('2',%20NOW(),%20'" + format(str(fahrenheit)) +"',%20'" + str(humidity) + "')"
resp, content = h.request(reqstr , "GET")
print(reqstr.replace("%20", " "))
else:
h = httplib2.Http()
print ('Failed to get reading. Try again!')
resp, content = h.request("http://192.168.0.159/wd-db.php?sqlcmd=UPDATE%20WD_Master%20SET%20Char_Value%20=%20'Fail_to_Read',Last_Active%20=%20NOW()%20,LastCheck%20=%20NOW()%20WHERE%20Equipment=%20'Coop_RPI'%20and%20System%20%20=%20'Coop_Temp_Nest'", "GET")
When the module was originally received, I had to write code to read the device. I have done most everything on the RPi in Python so I loaded the pyserial
module and realized that there was no documentation on the communications protocol with the module. Reviving my intercept lust, I pried into the
way the demo program communicated with the module. I found that the series of bytes to send the module to recover the temperature was
ser.write(serial.to_bytes([0x4C,0x33,0x01,0x00,0x03,0x40,0x00,0x02,0x87]))
The two bytes of temperature are returned in bytes 7 and 8 of the response. Using those two bytes the temperature can be displayed or stored with
response = ser.readline()
tmpval = (str(binascii.hexlify(response[7])) + str(binascii.hexlify(response[8])))
print(" Temperature: " + str(("{0:.2f}".format(((float(int(tmpval,16))/float(65536)) * 165) -40)))+ u"\u00B0" + "C")
print(" Temperature: " + str(("{0:.2f}".format((((((float(int(tmpval,16))/float(65536)) * 165) -40) * 9) / 5) + 32)))+ u"\u00B0" + "F")
To read the humidity register send
ser.write(serial.to_bytes([0x4C,0x33,0x01,0x00,0x03,0x40,0x01,0x02,0x92]))
The same two bytes 7 & 8 return the hex values of the humidity register and can be displayed or stored with
response = ser.readline()
tmpval = (str(binascii.hexlify(response[7])) + str(binascii.hexlify(response[8])))
print("Relative Humidity: " + str(("{0:.2f}".format((float(int(tmpval,16))/float(65536)) * 100)))+ "%")
There was enough available for the roadtest report to be of value so I offer it and the code in my blogs on the subject.
HDC1000EVM Python code for Raspberry Pi
Texas Instrument has a good device here. I would rather the i2c of the RPi be available for other duties and use this TI device.
From the looks of the protocol it would seem that more than one
i2c device might well be connected to this. I hope TI publishes the complete protocol soon.
Thanks to Element14 for allowing me to take part in this.)