Example #1
0
    'mo_10', 'te', 'tas606', 'commercial', 'evap'
]

pht_area51 = Phant(publicKey='21mmonra90TYXlx9KL4J',
                   fields=field_name_area51,
                   privateKey='GZGGko8KJWtKaoAYNe5b')

parsed_data_area51 = dict((el, 0.0) for el in field_name_area51)

#-------------------below are preparation for the sensor arduino -----------
port_sensors = 'USB VID:PID=0403:6015 SNR=DN01JJDJ'
#'All,SucHeat,2896,Heating,21.81,21.81,21.94,22.00,22.12,22.25,22.31,22.44,22.50,22.62,22.69,22.75,22.81,22.94,22.94,23.00,23.06,23.12,23.19,23.25,23.31,Dsping,23.31,23.31,23.25,23.19,23.12,23.00,22.94,22.87,22.75,22.75,22.69,22.62,22.56,22.50,22.50,22.44,22.44,22.37,22.37,22.31,22.31,SucHeat,14,Heating,25.68,41.80,42.77,43.26,43.75,44.24,44.73,45.70,45.70,46.19,50.10,46.68,47.17,47.66,47.66,48.14,48.14,48.14,48.63,48.63,48.63,Dsping,32.03,31.05,30.57,30.08,30.08,29.59,29.10,29.10,28.61,28.61,28.12,28.12,27.64,27.64,27.64,27.64,27.64,27.15,27.15,27.15,27.15,SucHeat,19,Heating,26.17,38.38,38.38,38.87,38.87,39.36,40.33,40.33,40.82,41.31,41.31,41.80,41.80,42.29,42.29,42.77,43.26,43.26,43.75,43.75,44.24,Dsping,30.57,30.08,29.59,29.59,29.10,29.10,28.61,28.61,28.12,28.12,28.12,28.12,27.64,27.15,27.15,27.15,27.15,26.66,26.66,26.66,26.66,SaltRH,11,21.50,99.90,SaltRH,2,22.30,96.20,Mo,7,341.86,Mo,8,402.00,Mo,9,319.29,Mo,10,344.00,AllDone\r\n'
#'All,SucHeat,2896,Heating,21.81,21.87,21.94,22.06,22.19,22.31,22.37,22.50,22.56,22.69,22.75,22.81,22.87,22.94,23.06,23.06,23.12,23.19,23.25,23.25,23.31,Dsping,23.37,23.31,23.31,23.19,23.12,23.06,23.00,22.87,22.81,22.75,22.75,22.62,22.62,22.56,22.50,22.44,22.44,22.37,22.37,22.31,22.31,SucHeat,14,Heating,25.68,42.29,42.77,43.26,43.75,44.24,45.21,45.70,45.70,46.19,46.68,46.68,47.66,47.66,47.66,48.14,48.14,48.63,48.63,49.12,49.12,Dsping,31.54,31.05,30.57,30.57,30.08,29.59,29.59,29.10,28.61,28.61,28.12,28.12,28.12,27.64,27.64,27.64,27.15,27.15,27.64,27.15,27.15,SucHeat,19,Heating,25.20,38.38,38.38,38.38,39.36,39.36,39.84,40.33,40.82,40.82,41.31,41.80,41.80,42.29,42.77,42.77,43.26,43.26,43.75,43.75,44.24,Dsping,30.08,29.59,29.59,29.59,29.10,29.10,28.61,28.61,28.12,28.12,27.64,27.64,27.64,27.64,27.15,27.15,27.15,26.66,26.66,26.66,26.66,SaltRH,11,21.50,99.90,SaltRH,2,22.30,96.50,Mo,7,338.71,Mo,8,404.00,Mo,9,318.43,Mo,10,344.43,AllDone\r\n'

# makesure the salinity sensor are well initialized
serial_openlock.get_result_by_input(port=port_sensors, command="SoilSalinity")
time.sleep(3)
serial_openlock.get_result_by_input(port=port_sensors, command="SoilSalinity")
time.sleep(3)

#-------------------below are preparation for the scale arduino -----------
port_loadcell = 'USB VID:PID=0403:6015 SNR=DN01J0QE'

#-------------------below are preparation for the commercial balance -----------
port_balance = 'USB VID:PID=0403:6001'

# make a good initialization
b = serial_openlock.get_result_by_input(port=port_balance,
                                        command='IP\n\r',
                                        initialize=False)
time.sleep(2)
Example #2
0
            log_attempts+=1
            time.sleep(30)
            continue

while True: 
    ### --------------------------- bwlow is to processing data from column sensor--------------------------
    #[port_sensor_isopen, sensor_fid]=serial_openlock.open_port(port_sensor)
    #while port_sensor_isopen == False:
    #    [port_sensor_isopen, sensor_fid]=serial_openlock.open_port(port_sensor)
    #    time.sleep(10)
    #serial_openlock.initialize(sensor_fid)
    #sensor_fid.write("All") # either "Solar", "Soil" or "All"
    #msg = sensor_fid.readline()
    #port_sensor_isopen=serial_openlock.close_port(sensor_fid)
    
    msg=serial_openlock.get_result_by_input(port=port_sensor,command="All")
    # save to file it needs to be done immediately after read so that bugs could be found during parsing
    time_now=time.strftime("%d/%b/%Y %H:%M:%S")
    if screen_display: print time_now,delimiter,msg.rstrip()
    if save_to_file: fid.write(time_now+delimiter+msg)

    current_read=msg.split(',')[0:-1]
    # parse tp result
    tp_ind=[i for i,x in enumerate(current_read) if x == 'Tp']
    for i in tp_ind:
        parsed_data['tp'+current_read[i+1].lower()]=float(current_read[i+2])
    # parse moisture data
    mo_ind=[i for i,x in enumerate(current_read) if x == 'Mo']
    for i in mo_ind:
        parsed_data['mo'+current_read[i+1]]=float(current_read[i+2])
    # parse mps2 data
Example #3
0
# the delimiter between files, it is prefered to use ',' which is standard for csv file
delimiter = ','

__author__ = 'chenming'

if save_to_file: fid = open(file_name, 'a', 0)

while True:
    # ------------------------------- below goes to electrochem_o2  --------------------------------------------

    if screen_display: print strftime("%Y-%m-%d %H:%M:%S", gmtime())
    if save_to_file: fid.write(strftime("%Y-%m-%d %H:%M:%S", gmtime()))

    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command="fred,C824B9E0,dgin,13,snpw,6,htpw,22,itv,12000,otno,5",
        initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
    qal_mo_su['tmp0'] = float(current_read[2])
    qal_mo_su['su0'] = float(current_read[7]) - float(current_read[2])

    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command="fred,C1C1BCFF,dgin,13,snpw,6,htpw,24,itv,12000,otno,5",
        initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
    qal_mo_su['tmp1'] = float(current_read[2])
Example #4
0
#            time.sleep(30)
#            continue

while True:

    #    time_now=time.strftime("%d/%b/%Y %H:%M:%S")
    #    if screen_display: print time_now,delimiter,weight_scale1.rstrip(),delimiter,weight_scale2.rstrip(),delimiter,weight_scale3.rstrip(),delimiter,weight_scale4.rstrip(),delimiter,weight_scale5.rstrip(),delimiter,weight_scale6.rstrip()
    #    if save_to_file: fid.write(time_now+delimiter+weight_scale1+delimiter+weight_scale2+delimiter+weight_scale3+delimiter+weight_scale4+delimiter+weight_scale5+delimiter+weight_scale6+'\n\r')
    if screen_display: print strftime("%Y-%m-%d %H:%M:%S", localtime())
    if save_to_file: fid.write(strftime("%Y-%m-%d %H:%M:%S", localtime()))

    #-----------------Setup1--------------------------

    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command=
        "dht22,5,power,35,points,2,dummies,1,interval_mm,2000,debug,1,timeout,60",
        initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
    scales_partha['temperature_1'] = float(current_read[-2])
    scales_partha['humidity_1'] = float(current_read[-1])
    sleep(5)

    #ard=serial.Serial(port_sensor)
    #msg=ard.write("dht22,5,power,35,points,2,dummies,1,interval_mm,2000,debug,1,timeout,60")
    #sleep(1)
    #msg=ard.readline()
    #sleep(2)
    #ard.close()
Example #5
0
        if save_to_file: fid.write(delimiter+msg1.rstrip())
        upload_msg=msg1.rstrip()
        #current_read=msg1.split(',')[0:-1]
        current_read=upload_msg.split()[0]
        kathy_tensiometer['pressure2']=float(current_read) 
        
    
        if screen_display: print msg2.rstrip()
        if save_to_file: fid.write(delimiter+msg2.rstrip())
        upload_msg=msg2.rstrip()
        #current_read=msg2.split(',')[0:-1]
        current_read=upload_msg.split()[0]
        kathy_tensiometer['temp2_tensiometer']=float(current_read)
    
        sleep(5)   
        msg=serial_openlock.get_result_by_input(port=port_sensor2,command="dht22,10,power,48,points,1,dummies,1,interval_mm,200,debug,0",initialize=False,match_existing_ports=False)         
        #ard=serial.Serial(port_sensor2,timeout=20)
        #msg=ard.write("dht22,10,power,48,points,1,dummies,1,interval_mm,200,debug,0")            
        #sleep(10)
        #        
        #msg=ard.readline()
        #    
        #sleep(5)
        #ard.close()
        #    
        if screen_display: print msg.rstrip()
        if save_to_file: fid.write(delimiter+msg)
        current_read=msg.split(',')[0:-1]
        kathy_tensiometer['dhthum']=float(current_read[-1])
        kathy_tensiometer['dhttemp']=float(current_read[-2])
Example #6
0
        #
        #
        # sleep(2)
        # msg=serial_openlock.get_result_by_input(port=port_sensor,command="dht22,3,power,8,points,2,dummies,1,interval_mm,200,debug,1",initialize=False)
        # if screen_display: print msg.rstrip()
        # if save_to_file: fid.write(delimiter+msg.rstrip())
        # current_read=msg.split(',')[0:-1]
        # bacteria_mo_su_sali['tmp2']=float(current_read[-1])
        # bacteria_mo_su_sali['hum2']=float(current_read[-2])

        # voltage measurement
        # power,43,analog,15,point,3,interval_mm,200,debug,1
        #--------------for suction sensors---------------------
        sleep(2)
        msg = serial_openlock.get_result_by_input(
            port=port_sensor,
            command="fred9,9FEA989F,dgin,50,snpw,42,htpw,35,itv,24000,otno,5",
            initialize=True)
        if screen_display: print msg.rstrip()
        if save_to_file: fid.write(delimiter + msg.rstrip())
        current_read = msg.split(',')[0:-1]
        basin_test_wenqiang_mo_su['tempa1_a'] = float(current_read[2])
        basin_test_wenqiang_mo_su['tempa1_b'] = float(current_read[7])
        basin_test_wenqiang_mo_su['sua1'] = float(current_read[7]) - float(
            current_read[2])

        msg = serial_openlock.get_result_by_input(
            port=port_sensor,
            command="fred9,927098DF,dgin,50,snpw,42,htpw,37,itv,24000,otno,5",
            initialize=False)
        if screen_display: print msg.rstrip()
        if save_to_file: fid.write(delimiter + msg.rstrip())
Example #7
0
        try:
            ##pht.log(iter([ parsed_data[key] for key in pht.fields]))
            # http://stackoverflow.com/questions/43414407/iterate-at-a-function-input-in-python/43414660#43414660
            pht.log(*[parsed_data[key] for key in pht.fields])
            if screen_display: print "uploaded"
            break
        except:  # catch all errors
            if screen_display: print "upload failed at attempt", log_attempts
            log_attempts += 1
            time.sleep(30)
            continue


while True:

    msg_aster = serial_openlock.get_result_by_input(port=port_aster,
                                                    command="All")

    current_read_aster = msg_aster.split(',')[1:-1]
    # parse moisture data
    mo_ind = [i for i, x in enumerate(current_read_aster) if x == 'Mo']
    for i in mo_ind:
        parsed_data_aster['mo' + current_read_aster[i + 1]] = float(
            current_read_aster[i + 2])
    ### --------------------------- above is to processing data from column sensor--------------------------

    ### --------------------------- bwlow is to processing data for campbell scientific-------------------------

    msg_campbell = csv_tools.tail(fn_camp, 1)
    current_read_campbell = msg_campbell.split(',')[0:-1]
    parsed_data_campbell = {}
    for i, key in enumerate(current_read_campbell[::2]):
Example #8
0
        vis+=sensor.readVisible()
        time.sleep(1)
        ir+=sensor.readIR()
        time.sleep(1)
        uv+=sensor.readUV()
        time.sleep(sleep_time_s)
    vis/=float(number_readings)
    ir/=float(number_readings)
    uv/=float(number_readings)
    #sensor=SI1145.SI1145_RESET
    return vis,ir,uv

# initialize the weather station data
# it is found that all the first readings from weather station would give 0 atmosphere reading. call this 
# function is to discard the first reading
msg_weather=serial_openlock.get_result_by_input(port=port_weather,command="Weather")
time.sleep(3)
msg_weather=serial_openlock.get_result_by_input(port=port_weather,command="Weather")

while True: 
    
    msg_sensor=serial_openlock.get_result_by_input(port=port_sensor,command="All")

    current_read_sensor=msg_sensor.split(',')[1:-1]
    # parse moisture data
    mo_ind=[i for i,x in enumerate(current_read_sensor) if x == 'Mo']
    for i in mo_ind:
        parsed_data_sensor['mo'+current_read_sensor[i+1]]=float(current_read_sensor[i+2])
    # parse "SucHeat"
    sucheat_ind=[i for i,x in enumerate(current_read_sensor) if x == 'SucHeat']
    for i in sucheat_ind:
Example #9
0
    #GPIO.output(25, 1)         # set GPIO24 to 1/GPIO.HIGH/True
    #sleep(5)
    #GPIO.output(26, 1)         # set GPIO24 to 1/GPIO.HIGH/True
    #sleep(5)

    #GPIO.output(24, 1)         # set GPIO24 to 1/GPIO.HIGH/True
    #sleep(2)
    #GPIO.output(24, 0)         # set GPIO24 to 1/GPIO.HIGH/True
    #sleep(10) # change 2 to 10

    # voltage measurement
    # power,43,analog,15,point,3,interval_mm,200,debug,1

    sleep(2)
    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command="fred9,26E39767,dgin,50,snpw,42,htpw,35,itv,24000,otno,5",
        initialize=True)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
    amphiroll_tank1['tempa0'] = float(current_read[2])
    amphiroll_tank1['tempb0'] = float(current_read[7])
    amphiroll_tank1['su0'] = float(current_read[7]) - float(current_read[2])

    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command="fred9,3041992B,dgin,50,snpw,42,htpw,37,itv,24000,otno,5",
        initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
Example #10
0
    if save_to_file: fid.write(strftime("%Y-%m-%d %H:%M:%S", gmtime())  )
    
    #### below is for pressure 
#    GPIO.output(25, 1)         # set GPIO24 to 1/GPIO.HIGH/True  
#    sleep(5)
#    GPIO.output(26, 1)         # set GPIO24 to 1/GPIO.HIGH/True  
#    sleep(5)

#    GPIO.output(24, 1)         # set GPIO24 to 1/GPIO.HIGH/True  
#    sleep(2)
#    GPIO.output(24, 0)         # set GPIO24 to 1/GPIO.HIGH/True  
#    sleep(10) # change 2 to 10


    # possible update: set time out for send result
    msg=serial_openlock.get_result_by_input(port=port_sensor,command="9548,2,type,5803,dummies,1,power,37,debug,1,points,1",initialize=True)

    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter+msg.rstrip())
    current_read=msg.split(',')[0:-1]
    try:
        sali_gs3_p['pre0']=float(current_read[-1])
        sali_gs3_p['pretmp0']=float(current_read[-2])
    except Exception, e:
        if screen_display: print '5803 ,2, does not get results'
        pass
        #continue

#    GPIO.output(24, 1)         # set GPIO24 to 1/GPIO.HIGH/True  
#    sleep(2)
#    GPIO.output(24, 0)         # set GPIO24 to 1/GPIO.HIGH/True  
Example #11
0
file_name = 'Grange_a.csv'

sleep_time_seconds = 45 * 60

# the delimiter between files, it is prefered to use ',' which is standard for csv file
delimiter = ','

__author__ = 'chenming'

if save_to_file: fid = open(file_name, 'a', 0)

while True:
    # ------------------------------- below goes to electrochem_o2  --------------------------------------------

    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command="o2_ana_ay,1,power,6,point,3,interval_mm,2000,debug,0",
        initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
    ele_o2['wtp0'] = float(current_read[2])
    ele_o2['wtp1'] = float(current_read[5])
    ele_o2['wtp2'] = float(current_read[8])
    ele_o2['wtp3'] = float(current_read[11])
    ele_o2['wtp4'] = float(current_read[14])
    ele_o2['wtp5'] = float(current_read[17])

    ele_o2['wox0'] = float(current_read[4])
    ele_o2['wox1'] = float(current_read[7])
    ele_o2['wox2'] = float(current_read[10])
    ele_o2['wox3'] = float(current_read[13])
Example #12
0
sleep_time_seconds = 45 * 60

# the delimiter between files, it is prefered to use ',' which is standard for csv file
delimiter = ','

__author__ = 'chenming'

if save_to_file: fid = open(file_name, 'a', 0)

while True:
    if screen_display: print strftime("%Y-%m-%d %H:%M:%S", gmtime())
    if save_to_file: fid.write(strftime("%Y-%m-%d %H:%M:%S", gmtime()))
    # ------------------------------- below goes to electrochem_o2  --------------------------------------------

    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command="fred,166F9644,dgin,50,snpw,44,htpw,32,itv,1000,otno,5",
        initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
    grange_5_mo_su['tmp0'] = float(current_read[2])
    grange_5_mo_su['su0'] = float(current_read[7]) - float(current_read[2])

    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command="fred,BCF79459,dgin,50,snpw,44,htpw,30,itv,1000,otno,5",
        initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
    grange_5_mo_su['tmp1'] = float(current_read[2])
Example #13
0
        client.username_pw_set(credential['access_token'])
        client.connect(credential['thingsboard_host'], 1883, 60)
        client.loop_start()
        break
    except Exception, e:
        time.sleep(60)

try:

    while True: 
    
        if screen_display: print strftime("%Y-%m-%d %H:%M:%S", gmtime())
        if save_to_file: fid.write(strftime("%Y-%m-%d %H:%M:%S", gmtime())  )
    # ------------------------------- below goes to electrochem_o2  --------------------------------------------
        # ds18b20_search,50,power,44
        msg=serial_openlock.get_result_by_input(port=port_sensor,command="fred,46AB9657,dgin,50,snpw,44,htpw,32,itv,12000,otno,5",initialize=False) 
        if screen_display: print msg.rstrip()
        if save_to_file: fid.write(delimiter+msg)
        current_read=msg.split(',')[0:-1]
        grange_4_mo_su['tmp0']=float(current_read[2])
        grange_4_mo_su['su0']=float(current_read[7])-float(current_read[2])
        
        
        
        #msg=serial_openlock.get_result_by_input(port=port_sensor,command="fred,E703BA53,dgin,50,snpw,42,htpw,37,itv,1000,otno,5",initialize=False)
        #msg=serial_openlock.get_result_by_input(port=port_sensor,command="fred,E703BA53,dgin,50,snpw,44,htpw,30,itv,12000,otno,5",initialize=False)
        #if screen_display: print strftime("%Y-%m-%d %H:%M:%S", gmtime())+msg.rstrip()
        #if save_to_file: fid.write(delimiter+msg)
        #current_read=msg.split(',')[0:-1]
        #grange_4_mo_su['tmp1']=float(current_read[2])
        #grange_4_mo_su['su1']=float(current_read[7])-float(current_read[2])
Example #14
0
sleep_time_seconds=45*60

# the delimiter between files, it is prefered to use ',' which is standard for csv file
delimiter=','

__author__ = 'chenming'


if save_to_file: fid= open(file_name,'a',0)



while True: 
# ------------------------------- below goes to electrochem_o2  --------------------------------------------
    
    msg=serial_openlock.get_result_by_input(port=port_sensor,command="o2_ana_ay,1,power,6,point,3,interval_mm,2000,debug,0",initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter+msg.rstrip())
    current_read=msg.split(',')[0:-1]
    ele_o2['wtp0']=float(current_read[2])
    ele_o2['wtp1']=float(current_read[5])
    ele_o2['wtp2']=float(current_read[8])
    ele_o2['wtp3']=float(current_read[11])
    ele_o2['wtp4']=float(current_read[14])
    #ele_o2['wtp6']=float(current_read[17])

    ele_o2['wox0']=float(current_read[4])
    ele_o2['wox1']=float(current_read[7])
    ele_o2['wox2']=float(current_read[10])
    ele_o2['wox3']=float(current_read[13])
    ele_o2['wox4']=float(current_read[16])
Example #15
0
            ##pht.log(iter([ parsed_data[key] for key in pht.fields]))
            # http://stackoverflow.com/questions/43414407/iterate-at-a-function-input-in-python/43414660#43414660
            pht.log(*[parsed_data[key] for key in pht.fields])
            if screen_display: print "uploaded"
            break
        except: # catch all errors
            if screen_display: print "upload failed at attempt",log_attempts
            log_attempts+=1
            time.sleep(30)
            continue



while True: 
    
    msg_bougainvillea=serial_openlock.get_result_by_input(port=port_bougainvillea,command="All")

    current_read_bougainvillea=msg_bougainvillea.split(',')[1:-1]
    # parse moisture data
    mo_ind=[i for i,x in enumerate(current_read_bougainvillea) if x == 'Mo']
    for i in mo_ind:
        parsed_data_bougainvillea['mo'+current_read_bougainvillea[i+1]]=float(current_read_bougainvillea[i+2])
    # log the results to sparkfun
    upload_phant(pht_bougainvillea,parsed_data_bougainvillea,screen_display)
    ### --------------------------- above is to processing data from column sensor--------------------------
    
    ### --------------------------- bwlow is to processing data for weather station-------------------------
    ## get from previous parsing
    #vis_ind=[i for i,x in enumerate(current_read_bougainvillea) if x == 'Vis'] 
    #parsed_data_weather["vis_up"]=float(current_read_bougainvillea[vis_ind[0]+1])
    #ir_ind=[i for i,x in enumerate(current_read_bougainvillea) if x == 'IR'] 
Example #16
0
    #GPIO.output(24, 0)         # set GPIO24 to 1/GPIO.HIGH/True
    #sleep(10) # change 2 to 10

    # possible update: set time out for send result

    #sleep(10)
    #msg=serial_openlock.get_result_by_input(port=port_sensor,command="75,3,clk,4,power,8,debug,1",initialize=True)
    #if screen_display: print msg.rstrip()
    #if save_to_file: fid.write(delimiter+msg.rstrip())
    #current_read=msg.split(',')[0:-1]
    #sali_gs3_p['hum3']=float(current_read[-1])
    #sali_gs3_p['tmp3']=float(current_read[-2])

    sleep(10)
    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command="dht22,4,power,25,points,2,dummies,1,interval_mm,200,debug,1",
        initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
    bacteria_mo_su_sali['tmp0'] = float(current_read[-1])
    bacteria_mo_su_sali['hum0'] = float(current_read[-2])

    #    sleep(5)
    #    msg=serial_openlock.get_result_by_input(port=port_sensor,command="75,5,clk,11,power,9,debug,1",initialize=True)
    #    if screen_display: print msg.rstrip()
    #    if save_to_file: fid.write(delimiter+msg.rstrip())
    #    current_read=msg.split(',')[0:-1]
    #    bacteria_mo_su_sali['tmp1']=float(current_read[-1])
    #    bacteria_mo_su_sali['hum1']=float(current_read[-2])
Example #17
0
file_name = 'Grange_D.csv'

sleep_time_seconds = 45 * 60

# the delimiter between files, it is prefered to use ',' which is standard for csv file
delimiter = ','

__author__ = 'chenming'

if save_to_file: fid = open(file_name, 'a', 0)

while True:
    # ------------------------------- below goes to electrochem_o2  --------------------------------------------

    msg = serial_openlock.get_result_by_input(
        port=port_sensor,
        command="o2_ana_ay,1,power,6,point,3,interval_mm,2000,debug,0",
        initialize=False)
    if screen_display: print msg.rstrip()
    if save_to_file: fid.write(delimiter + msg.rstrip())
    current_read = msg.split(',')[0:-1]
    ele_o2['wtp0'] = float(current_read[2])
    ele_o2['wtp1'] = float(current_read[5])
    ele_o2['wtp2'] = float(current_read[8])
    ele_o2['wtp3'] = float(current_read[11])
    ele_o2['wtp4'] = float(current_read[14])
    ele_o2['wtp6'] = float(current_read[17])

    ele_o2['wox0'] = float(current_read[4])
    ele_o2['wox1'] = float(current_read[7])
    ele_o2['wox2'] = float(current_read[10])
    ele_o2['wox3'] = float(current_read[13])