Exemplo n.º 1
0
    depth_factor = .01
    surface_offset = 10

    # We have to read values from sensor to update pressure and temperature
    if Psensor.read():
        Pres_ini = round((Psensor.pressure() * depth_factor) - surface_offset,
                         3)
    else:
        Pres_ini = "Broken"

    file.write("Pressure(dbar),Temp(C)")

if iniP100 == True:

    Psensor = KellerLD()

    if not Psensor.init():
        print("Failed to initialize P100 sensor!")
        exit(1)

    depth_factor = 10
    surface_offset = 0

    # We have to read values from sensor to update pressure and temperature
    if Psensor.read():
        Pres_ini = round((Psensor.pressure() * depth_factor) - surface_offset,
                         3)
    else:
        Pres_ini = "Broken"
    if not Psensor.init():
        print("Failed to initialize P30 sensor!")
        exit(1)

    # We have to read values from sensor to update pressure and temperature
    if Psensor.read():
        Pres_ini = Psensor.pressure()
    else:
        Pres_ini = "Broken"

    file.write("Pressure(mbar),Temp(C)")

if iniP100 == True:

    Psensor = KellerLD()

    if not Psensor.init():
        print("Failed to initialize P100 sensor!")
        exit(1)
    # We have to read values from sensor to update pressure and temperature
    if Psensor.read():
        Pres_ini = Psensor.pressure()
    else:
        Pres_ini = "Broken"

    file.write("Pressure(mbar),Temp(C)")

if iniTmp == True:

    sensor_temp = tsys01.TSYS01()
Exemplo n.º 3
0
from kellerLD import KellerLD
import time

sensor = KellerLD()

if not sensor.init():
    print("Failed to initialize Keller LD sensor!")
    exit(1)

print("Testing Keller LD series pressure sensor")
print("Press Ctrl + C to quit")
time.sleep(3)

while True:
    try:
        sensor.read()
        print("pressure: %7.4f bar\ttemperature: %0.2f C" %
              (sensor.pressure(), sensor.temperature()))
        time.sleep(0.2)
    except Exception as e:
        print(e)
Exemplo n.º 4
0
debug = False

#Save data in data/pressure
directory = '/home/pi/camtag/tag_data/sensors/'
if not os.path.exists(directory):
    os.makedirs(directory)
text_file = open(directory + str(int(time.time())) + '.txt', 'w')
header = "{0},{1},{2},{3},{4},{5},{6},{7}\n".format('UTC', 'Pressure',
                                                    'Temperature', 'Lux',
                                                    'IR spectrum', 'ax', 'ay',
                                                    'az')
if debug:
    print header
text_file.write(header)

sensor = KellerLD()
if not sensor.init():
    print "Failed to initialize Keller LD sensor!"
    exit(1)

tsl = Tsl2591()  # initialize
mpu = mpu6050(0x68)

while True:
    try:
        sensor.read()
        full, ir = tsl.get_full_luminosity(
        )  # read raw values (full spectrum and ir spectrum)
        lux = tsl.calculate_lux(full, ir)  # convert raw values to lux
        ac = mpu.get_accel_data()
        X = (ac['x'])
Exemplo n.º 5
0
import os
from read_tsl import Tsl2591
from mpu6050 import mpu6050

debug=True

#Save data in data/pressure
directory = '/home/pi/newtest/tag_data/sensors/'
if not os.path.exists(directory):
        os.makedirs(directory)
text_file = open(directory + str(int(time.time())) + '.txt','w')
header="{0},{1},{2},{3},{4},{5},{6},{7}\n".format('UTC','Pressure','Temperature','Lux','IR spectrum','ax','ay','az')
print header
text_file.write(header)

sensor = KellerLD()
if not sensor.init():
        print "Failed to initialize Keller LD sensor!"
        exit(1)

tsl = Tsl2591()  # initialize

mpu = mpu6050(0x68)

while True:
        try:
                sensor.read()
                full, ir = tsl.get_full_luminosity()  # read raw values (full spectrum and ir spectrum)
        	lux = tsl.calculate_lux(full, ir)  # convert raw values to lux
		ac = mpu.get_accel_data()
		X=(ac['x'])
Exemplo n.º 6
0
from kellerLD import KellerLD
import time

sensor = KellerLD()

if not sensor.init():
	print "Failed to initialize Keller LD sensor!"
	exit(1)

print "Testing Keller LD series pressure sensor"
print "Press Ctrl + C to quit"
time.sleep(3)

while True:
	try:
		sensor.read()
		print("pressure: %7.4f bar\ttemperature: %0.2f C") % (sensor.pressure(), sensor.temperature())
		time.sleep(0.2)
	except Exception as e:
		print e