This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HTU21D humidity value
#1
I still have a lot of fun with openplotter. Now I'm using it for a new project (creating mine own drying place for meat).  I allready have tried a lot, but I don't have a solution yet. So if anyone can help me it would be great.

The action/triggers are not a solution because I need to combine several input before I do an action.


I need the output of the humidity from the HTU21D. When I use it with openplotter I see the NMEA sentence with the correct value. So I extracted the code from the i2c.py file with that what I think need.

Why don't get I the humidity?

--------------------------------

import socket, time, pynmea2, RTIMU, math, csv

SETTINGS_FILE3 = "RTIMULib3"
s3 = RTIMU.Settings(SETTINGS_FILE3)
humidity_val = RTIMU.RTHumidity(s3)
humidity_val.humidityInit()
humidity_val_b = True

humidity=''

humidity=read[1]

hum=round(humidity,1)

print hum

humidity=''


-------------------------------

Kind regards
Reply
#2
Please, I need to see that meat dryer when is done Huh

Your code should look like this:


Code:
import RTIMU, time

SETTINGS_FILE3 = "RTIMULib3"
s3 = RTIMU.Settings(SETTINGS_FILE3)
humidity_val = RTIMU.RTHumidity(s3)
humidity_val.humidityInit()

humidity=''
temperature_h=''

#here starts the bucle
while True:
    time.sleep(1)#here you can define the frequency in seconds
    read=humidity_val.humidityRead()
    if read:
        if (read[0]):
            humidity=read[1]
        if (read[2]):
            temperature_h=read[3]

   print humidity
   print temperature_h

Not tested but it should work, let me know if you get some error.
And please when you are done please publish something in Brag Board subforum.

Should I add Meat Dryer as OpenPlotter feature? Tongue
Reply
#3
(2016-03-22, 06:35 PM)Sailoog Wrote: Please, I need to see that meat dryer when is done Huh

Your code should look like this:


Code:
import RTIMU, time

SETTINGS_FILE3 = "RTIMULib3"
s3 = RTIMU.Settings(SETTINGS_FILE3)
humidity_val = RTIMU.RTHumidity(s3)
humidity_val.humidityInit()

humidity=''
temperature_h=''

#here starts the bucle
while True:
    time.sleep(1)#here you can define the frequency in seconds
    read=humidity_val.humidityRead()
    if read:
        if (read[0]):
            humidity=read[1]
        if (read[2]):
            temperature_h=read[3]

   print humidity
   print temperature_h

Not tested but it should work, let me know if you get some error.
And please when you are done please publish something in Brag Board subforum.

Should I add Meat Dryer as OpenPlotter feature? Tongue

Thanks a lot. Change the code a bit to:


Code:
import RTIMU, time

SETTINGS_FILE3 = "RTIMULib3"
s3 = RTIMU.Settings(SETTINGS_FILE3)
humidity_val = RTIMU.RTHumidity(s3)
humidity_val.humidityInit()

humidity=''
temperature_h=''

#here starts the bucle
while True:
   time.sleep(0.5)#here you can define the frequency in seconds
   read=humidity_val.humidityRead()
   if read:
       if (read[0]):
           humidity=read[1]
           print humidity

But the strange thing is that every 4th value is a strange value:

46.4964027405
46.4964027405
46.4964027405
2.17024011051e+33
46.4582557678
46.4582557678
46.4582557678
2.17024011051e+33
46.4277381897
46.4277381897
46.4277381897
2.17024011051e+33
46.4369735718
46.4369735718
Reply
#4
(2016-03-22, 09:42 PM)Swokey Wrote:
(2016-03-22, 06:35 PM)Sailoog Wrote: Please, I need to see that meat dryer when is done Huh

Your code should look like this:


Code:
import RTIMU, time

SETTINGS_FILE3 = "RTIMULib3"
s3 = RTIMU.Settings(SETTINGS_FILE3)
humidity_val = RTIMU.RTHumidity(s3)
humidity_val.humidityInit()

humidity=''
temperature_h=''

#here starts the bucle
while True:
    time.sleep(1)#here you can define the frequency in seconds
    read=humidity_val.humidityRead()
    if read:
        if (read[0]):
            humidity=read[1]
        if (read[2]):
            temperature_h=read[3]

   print humidity
   print temperature_h

Not tested but it should work, let me know if you get some error.
And please when you are done please publish something in Brag Board subforum.

Should I add Meat Dryer as OpenPlotter feature?[emoji14]

Thanks a lot. Change the code a bit to:


Code:
import RTIMU, time

SETTINGS_FILE3 = "RTIMULib3"
s3 = RTIMU.Settings(SETTINGS_FILE3)
humidity_val = RTIMU.RTHumidity(s3)
humidity_val.humidityInit()

humidity=''
temperature_h=''

#here starts the bucle
while True:
   time.sleep(0.5)#here you can define the frequency in seconds
   read=humidity_val.humidityRead()
   if read:
       if (read[0]):
           humidity=read[1]
           print humidity

But the strange thing is that every 4th value is a strange value:

46.4964027405
46.4964027405
46.4964027405
2.17024011051e+33
46.4582557678
46.4582557678
46.4582557678
2.17024011051e+33
46.4277381897
46.4277381897
46.4277381897
2.17024011051e+33
46.4369735718
46.4369735718
I was wondering what would happen if you slowed down the query rate. The data that I read on that sensor says that it takes 5-10 seconds to reach and report the new temperature. Some sensors don't like to be polled often (DHT11?). I couldnt find anything mention of that for this sensor, just thinking out loud.

Sent from my SM-G900V using Tapatalk
Reply
#5
Try what Vamonos suggests and if this doesn't work, add this command


Code:
del read


after


Code:
print humidity
Reply
#6
Sad 
Thanks guys for your replies.

First tried to set the time to 5 sec, than I got the same output. 
Changed it to 10 sec, than I got more often then strange value.

So tried to add del read, from sailoog.

Also that didn't changed anything to the output.  Huh
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)