Пример #1
0
logger.addHandler(logFileHandler)

#load parameters from Config.dat
#system parameters
floatID = os.uname()[1]
#floatID = config.getString('System', 'floatID')

dataDir = config.getString('System', 'dataDir')
burst_interval = config.getInt('System', 'burst_interval')
burst_time = config.getInt('System', 'burst_time')
burst_seconds = config.getInt('System', 'burst_seconds')

bad = config.getInt('System', 'badValue')

#IMU parameters
imuFreq = config.getFloat('IMU', 'imuFreq')
imu_samples = imuFreq * burst_seconds
imu_gpio = config.getInt('IMU', 'imu_gpio')

#initialize IMU GPIO pin as modem on/off control
GPIO.setmode(GPIO.BCM)
GPIO.setup(imu_gpio, GPIO.OUT)
#turn IMU on for script recognizes i2c address
GPIO.output(imu_gpio, GPIO.HIGH)
"""
FXOS8700 accelerometer range values
ACCEL_RANGE_2G = 0x00
ACCEL_RANGE_4G = 0x01
ACCEL_RANGE_8G = 0x02

FXAS21002 gyro range values
Пример #2
0
valve1Gnd = config.getInt('Valves', 'Valve1Gnd')
valve2En = config.getInt('Valves', 'Valve2En')
valve2 = config.getInt('Valves', 'Valve2')
valve2Gnd = config.getInt('Valves', 'Valve2Gnd')
valve3En = config.getInt('Valves', 'Valve3En')
valve3 = config.getInt('Valves', 'Valve3')
valve3Gnd = config.getInt('Valves', 'Valve3Gnd')
valve4En = config.getInt('Valves', 'Valve4En')
valve4 = config.getInt('Valves', 'Valve4')
valve4Gnd = config.getInt('Valves', 'Valve4Gnd')

#PRESSURE
recordRate = config.getInt('PressureSensor', 'recordRate')
recordingInterval = 1. / recordRate
diffPressCh = config.getInt('PressureSensor', 'DiffCh')
diffGain = config.getFloat('PressureSensor', 'gain')
adcBus = config.getString('Params', 'ADCBus')
adc = Adafruit_ADS1x15.ADS1115(address=0x48, busnum=adcBus)

#FLOW
flowGPIO = config.getInt('FlowSensor', 'Flow')

#LED
ledGPIO = config.getInt('LED', 'ledGPIO')

#GPIO output
initializeGPIO(ledGPIO, flowGPIO, waterPump, soluPump, valve1En, valve1,
               valve1Gnd, valve2En, valve2, valve2Gnd, valve3En, valve3,
               valve3Gnd, valve4En, valve4, valve4Gnd)
GPIO.setup(primeValve, GPIO.OUT)
Пример #3
0
waterMotorGPIO = config.getInt('Motor', 'sampleMotor')
ethaMotorGPIO = config.getInt('Motor', 'ethanolMotor')

#PRESSURE
targetDepth1 = config.getInt('PressureSensor', 'TargetDepth1')
targetDepth2 = config.getInt('PressureSensor', 'TargetDepth2')
targetDepth3 = config.getInt('PressureSensor', 'TargetDepth3')
recordRate = config.getInt('PressureSensor', 'recordRate')

depthErr = config.getInt('PressureSensor', 'DepthError')
devParam = config.getInt('PressureSensor', 'DevParam')
checkAvgSamples = config.getInt('PressureSensor', 'CheckAvgSamples')

depthCh = config.getInt('PressureSensor', 'DepthCh')
diffCh = config.getInt('PressureSensor', 'DiffCh') 
gain = config.getFloat('PressureSensor', 'gain')

adc = Adafruit_ADS1x15.ADS1115(address=0x48,busnum=adcBus)

#PROGRAM PARAMETERS
#Number of samples to collect
#Note: This is not the only area this needs to change in, more
#samples will need to be added in for loop below 
totalSamples = config.getInt('Params', 'TotalSamples')
totalSamples = (totalSamples + 1)
startSample = config.getInt('Params', 'StartSample')

#BATTERY
bus0= smbus.SMBus(0)
bus1= smbus.SMBus(1)
battAddr = 0x0B
Пример #4
0
#system parameters
dataDir = config.getString('System', 'dataDir')
floatID = os.uname()[1]
#floatID = config.getString('System', 'floatID') 
projectName = config.getString('System', 'projectName')
payLoadType = config.getInt('System', 'payLoadType')
badValue = config.getInt('System', 'badValue')
numCoef = config.getInt('System', 'numCoef')
Port = config.getInt('System', 'port')
payloadVersion = config.getInt('System', 'payloadVersion')
burst_seconds = config.getInt('System', 'burst_seconds')
burst_time = config.getInt('System', 'burst_time')
burst_int = config.getInt('System', 'burst_interval')

#temp configuration
rec_interval = config.getFloat('Temp', 'rec_interval')
temp_samples = int(burst_seconds/rec_interval)

# Software SPI configuration:
CLK  = config.getInt('Temp', 'CLK')
MISO = config.getInt('Temp', 'MISO')
MOSI = config.getInt('Temp', 'MOSI')
CS   = config.getInt('Temp', 'CS')
mcp = Adafruit_MCP3008.MCP3008(clk=CLK, cs=CS, miso=MISO, mosi=MOSI)


def get_temp():

    try:
       adc_0 = mcp.read_adc(0) #read output from ADC channel 0
    except Exception as e:
Пример #5
0
from utils import *

##########################################################################
#Load config file
configDat = sys.argv[1]
configFilename = configDat  #Load config file/parameters needed
config = Config()  # Create object and load file
ok = config.loadFile(configFilename)
if (not ok):
    sys.exit(0)

#voltage parameters
voltFreq = config.getInt('Voltage', 'voltFreq')
numSamplesConst = config.getInt('System', 'numSamplesConst')
voltNumSamples = voltFreq * numSamplesConst
shuntOhms = config.getFloat('Voltage', 'shuntOhms')
maxExpectedAmps = config.getFloat('Voltage', 'maxExpectedAmps')

#when to record accoring to burst int
burstInterval = config.getInt('Iridium', 'burstInt')
burstNum = config.getInt('Iridium', 'burstNum')

#logging params
dataDir = config.getString('LogLocation', 'dataDir')
logDir = config.getString('LogLocation', 'logDir')
floatID = config.getString('System', 'floatID')
bad = config.getInt('System', 'badValue')
projectName = config.getString('System', 'projectName')
recRate = config.getInt('Voltage', 'recRate')
recInterval = 1. / recRate