Esempio n. 1
0
def checkTemp():
    dataPin = 11
    clkPin = 7
    sht1x = SHT1x(dataPin, clkPin, SHT1x.GPIO_BOARD)
    temp = sht1x.read_temperature_C()
    temp = temp*9/5 + 32        #if you want degrees F
    return temp
Esempio n. 2
0
def read_sensor():
    sht1x = SHT1x(dataPin, clkPin)
    temperature = sht1x.read_temperature_C()
    humidity = sht1x.read_humidity()
    dewPoint = sht1x.calculate_dew_point(temperature, humidity)
    print("Temperature: {} Humidity: {} Dew Point: {}".format(temperature, humidity, dewPoint))  
    time.sleep(0.5)
    return humidity
Esempio n. 3
0
def read_sensor(dataPin):
    thisDataPin = dataPin
    sht1x = SHT1x(thisDataPin, clkPin)
    temperature = sht1x.read_temperature_C()
    humidity = sht1x.read_humidity()
    dewPoint = sht1x.calculate_dew_point(temperature, humidity)
    #print(int(thisDataPin) + str(" sensor reading: "))
    print("Temperature: {} Humidity: {} Dew Point: {}".format(
        temperature, humidity, dewPoint))
    # print('moisture level of sensor: ',sensor_id, " is: ", sensor_moist_val)
    time.sleep(0.5)
    return humidity
Esempio n. 4
0
def sht11_read():
    # roughly the reference implementation:
    # https://pypi.python.org/pypi/rpiSht1x/1.2

    from sht1x.Sht1x import Sht1x as SHT1x
    dataPin = 16
    clkPin = 7

    sht1x = SHT1x(dataPin, clkPin, SHT1x.GPIO_BOARD)

    temp = sht1x.read_temperature_C()
    hum = sht1x.read_humidity()
    T_dew = sht1x.calculate_dew_point(temperature, humidity)

    return (temp, hum, T_dew)
Esempio n. 5
0
def sht11(sensor):
    try:
        warnings.filterwarnings("ignore")
        from sht1x.Sht1x import Sht1x as SHT1x
        dataPin = 5
        clkPin = 3
        sht1x = SHT1x(dataPin, clkPin, SHT1x.GPIO_BOARD)

        if (sensor == "humidity"):
            mesurement = sht1x.read_humidity()
        elif (sensor == "temperature"):
            mesurement = sht1x.read_temperature_C()

        return mesurement
    except:
        return "false"
Esempio n. 6
0
from sht1x.Sht1x import Sht1x as SHT1x
dataPin = "P9_23"
clkPin = "P9_27"
sht1x = SHT1x(dataPin, clkPin)

temperature = sht1x.read_temperature_C()
humidity = sht1x.read_humidity()
dewPoint = sht1x.calculate_dew_point(temperature, humidity)

print("Temperature: {} Humidity: {} Dew Point: {}".format(
    temperature, humidity, dewPoint))
Esempio n. 7
0
# Remove GPIO warnings
GPIO.setwarnings(0)

# Pin outs
# Port1
datas = 23
clks = 18
# Port2
datas2 = 9
clks2 = 10
# Port3
datas3 = 9
clks3 = 10

sht1x = SHT1x(datas, clks, SHT1x.GPIO_BCM)
sht1xB = SHT1x(datas2, clks2, SHT1x.GPIO_BCM)
sht1xC = SHT1x(datas3, clks3, SHT1x.GPIO_BCM)


def READ():
    print("SENSOR1")
    tempC = sht1x.read_temperature_C()
    temp = (9 / 5) * tempC + 32
    print("Temperature: {}".format(tempC))
    hum = sht1x.read_humidity()
    hum = round(hum, 2)
    print("Humidity: {}".format(hum))
    heat_index = -42.379 + (2.04901523 * temp) + (10.14333127 * hum) - (
        0.22475541 * temp * hum) - ((6.83783 * pow(10, -3)) * temp * temp) - (
            (5.481717 * pow(10, -2)) * hum * hum) + (
Esempio n. 8
0
import xively
import time
import datetime

# extract feed_id and api_key from environment variables
FEED_ID = os.environ["FEED_ID"]
API_KEY = os.environ["API_KEY"]

# initialize api client
api = xively.XivelyAPIClient(API_KEY)

# initilalize SHT11 object
from sht1x.Sht1x import Sht1x as SHT1x
dataPin = 11
clkPin = 15
sht1x = SHT1x(dataPin, clkPin, SHT1x.GPIO_BOARD)

# Initialise the BMP085 and use STANDARD mode (default value)
from Adafruit_BMP085.Adafruit_BMP085 import BMP085
bmp = BMP085(0x77)


# function to return a datastream object. This either creates a new datastream,
# or returns an existing one
def get_datastream(feed, datastream_name):
    try:
        datastream = feed.datastreams.get(datastream_name)
        return datastream
    except:
        tag = "{}_01".format(datastream_name.lower().split('_')[0])
        datastream = feed.datastreams.create(datastream_name, tags=tag)
Esempio n. 9
0
def checkHumidity():
    dataPin = 11
    clkPin = 7
    sht1x = SHT1x(dataPin, clkPin, SHT1x.GPIO_BOARD)
Esempio n. 10
0
def checkHumidity():
    dataPin = 11
    clkPin = 7
    sht1x = SHT1x(dataPin, clkPin, SHT1x.GPIO_BOARD)
    humidity = sht1x.read_humidity()
    return humidity
Esempio n. 11
0
import RPi.GPIO as GPIO
from math import exp, expm1
from sht1x.Sht1x import Sht1x as SHT1x
import time
GPIO.setwarnings(0)
datas = 17
clks = 4
sht1x = SHT1x(datas, clks, SHT1x.GPIO_BCM)


def READ():
    tempC = sht1x.read_temperature_C()
    temp = (9 / 5) * tempC + 32
    print("Temperature: {}".format(tempC))
    hum = sht1x.read_humidity()
    hum = round(hum, 2)
    print("Humidity: {}".format(hum))
    heat_index = -42.379 + (2.04901523 * temp) + (10.14333127 * hum) - (
        0.22475541 * temp * hum) - ((6.83783 * pow(10, -3)) * temp * temp) - (
            (5.481717 * pow(10, -2)) * hum * hum) + (
                (1.22874 * pow(10, -3)) * hum * temp * temp) + (
                    (8.5282 * pow(10, -4)) * temp * hum * hum) - (
                        (1.99 * pow(10, -6)) * temp * temp * hum * hum)
    heat_index = round(heat_index, 2)
    print("Heat index: {}".format(heat_index))
    time.sleep(30)


while True:
    READ()
Esempio n. 12
0
#!/usr/bin/python

from sht1x.Sht1x import Sht1x as SHT1x
import time
import sys

dataPin = 11

clkPin = 7

sht1x = SHT1x(11,7)

while True:

	temp=sht1x.read_temperature_C()

	hum=sht1x.read_humidity() 

	temp="{0:0.1f}".format(temp)
	hum="{0:0.1f}".format(hum)
	#print "Temperatura: "+temp
	#print "Humedad: "+hum
	if ((temp!="") and (hum!="")):
	#if hum is not None and temp is not None:
		time.sleep(1)
		f=open("/var/www/web/monitor/application/third_party/scripts/temp2","w")
		f.write(temp)
		f.close()
		f2=open("/var/www/web/monitor/application/third_party/scripts/hum2","w")
		f2.write(hum)
		f2.close()