'CR1000 Series Datalogger 'Example datalogger program for Apogee Instruments S2-111/112 series NDVI sensors (1 upward and downward facing sensor pair) 'date: August 22 2019 'program author: John Huber 'Wiring: 'White -> High side differential channel (650 nm detector) 'Black -> Low side differential channel (650 nm detector) 'Yellow -> High side differential channel (810 nm detector, different differential channel from 650 nm detector) 'Blue -> Low side differential channel (810 nm detector, different differential channel from 650 nm detector) 'Clear -> Shield ground 'Explanation of Constants and Variables Used in Datalogger Program 'LowMultUp = calibration multiplier for 650 nm detector in upward sensor 'LowMultDn = calibration multiplier for 650 nm detector in downward sensor 'HighMultUp = calibration multiplier for 810 nm detector in upward sensor 'HighMultDn = calibration multiplier for 810 nm detector in downward sensor 'BattV = datalogger battery voltage 'PanelT = datalogger panel temperature 'LowWaveUp = Calibrated detector reading for the 650 nm detector in upward sensor 'LowWaveDn = Calibrated detector reading for the 650 nm detector in downward sensor 'HighWaveUp = Calibrated detector reading for the 810 nm detector in upward sensor 'HighWaveDn = Calibrated detector reading for the 810 nm detector in downward sensor 'LowmVUp = mV output of the 650 nm detector in upward sensor 'LowmVDn = mV output of the 650 nm detector in downward sensor 'HighmVUp = mV output of the 810 nm detector in upward sensor 'HighmVDn = mV output of the 810 nm detector in downward sensor 'LowReflect = Reflectance at 650 nm 'HighReflect = Reflectance at 810 nm 'NDVI = NDVI Reading 'Note that all calibration multipliers are sensor-specific, as well as detector specific; those listed below are examples and must be changed based on the specific sensor being used. 'Declare Public Variables Public BattV, PanelT Public LowWaveUp, LowWaveDn, HighWaveUp, HighWaveDn, LowmVUp, LowmVDn, HighmVUp, HighmVDn, LowReflect, HighReflect, NDVI 'Declare Calibration Coefficients (sensor-specific) 'These variables must be changed to reflect the detector specific multipliers for the sensor(s) being used. Public LowMultUp = 0.1 Public LowMultDn = 0.1 Public HighMultUp = 0.1 Public HighMultDn = 0.1 Units LowWaveUp = Watts/m2 Units HighWaveUp = Watts/m2 Units LowWaveDn = Watts/m2 Units HighWaveDn = Watts/m2 Units LowmVUp = mV Units HighmVUp = mV Units LowmVDn = mV Units HighmVDn = mV 'Define Data Tables DataTable (NDVITable,1,-1) DataInterval (0,1,Min,10) Minimum(1,BattV,IEEE4,0,False) Sample(1,PanelT,IEEE4) Average(1,NDVI,IEEE4,False) Average(1,LowReflect,IEEE4,False) Average(1,HighReflect,IEEE4,False) EndTable 'Main Program BeginProg Scan(1,Sec,0,0) Battery(BattV) PanelTemp(PanelT,_60Hz) 'Upward Facing Sensor 'Measure detector mV signals VoltDiff(HighmVUp,1,mV25,1,True,0,_60Hz,1.0,0) VoltDiff(LowmVUp,1,mV25,2,True,0,_60Hz,1.0,0) 'Downward Facing Sensor 'Measure detector mV signals VoltDiff(HighmVDn,1,mV25,3,True,0,_60Hz,1.0,0) VoltDiff(LowmVDn,1,mV25,4,True,0,_60Hz,1.0,0) 'Apply multipliers HighWaveUp = HighmVUp * HighMultUp LowWaveUp = LowmVUp * LowMultUp HighWaveDn = HighmVDn * HighMultDn LowWaveDn = LowmVDn * LowMultDn 'Calculate Reflectance Values HighReflect = (HighWaveDn / HighWaveUp) LowReflect = (LowWaveDn / LowWaveUp) 'Calculate NDVI NDVI = (HighReflect - LowReflect) / (HighReflect + LowReflect) 'Call Output Tables CallTable NDVITable NextScan EndProg