Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Diffrent scan intervals to save on power for SR50a


bjstarr Oct 29, 2020 08:01 AM

Good morning,

I have a number of basic weather stations.  These station measure AT, RH, PRECIP, and SNO DEPTH.  The program scan interval is 30 sec and the data output interval is 10 min.  At this time the SR50a is clicking away taking a measurement every 30 secs.  All I need is to have the SR50a take a point measurement sample once every 10 min.  I am hoping this will help with battery life through the long dark winter.  

AT, RH, PRECIP - scan interval 30 secs, table output 10 min average.

SNO DEPTH - scan interval 10 min, table output 10 min sample.

Can you explain how I can do this?

Program attached below.

'CR1000 FCA met 8-10-20 by Starr

'Declare Variables and Units
Public BattV
Public PTemp_C
Public AirTC
Public RH
Public load_mv, load_mv2, precip_g, precip_mm
Public SR50A(2)
Public TCDT
Public DBTCDT

Alias SR50A(1)=DT
Alias SR50A(2)=Q

Units BattV=Volts
Units PTemp_C=Deg C
Units AirTC=Deg C
Units RH=%
Units precip_mm=mm

'Define Data Tables
DataTable(met,True,-1)
DataInterval(0,10,Min,10)
Sample(1,BattV,FP2)
Average(1,AirTC,FP2,False)
Sample(1,RH,FP2)
Average (1,precip_mm,FP2,False)
Sample(1,DT,FP2)
Sample(1,Q,FP2)
Sample(1,TCDT,FP2)
Sample(1,DBTCDT,FP2)

EndTable

'Main Program
BeginProg
'Main Scan
Scan(30,Sec,1,0)
'Default CR1000 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default CR1000 Datalogger Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,_60Hz)
'HMP50/HMP60 Temperature & Relative Humidity Sensor measurements 'AirTC' and 'RH'
VoltSE(AirTC,1,mV2500,1,0,0,_60Hz,0.1,-40)
VoltSE(RH,1,mV2500,2,0,0,_60Hz,0.1,0)
If (RH>100) AND (RH<108) Then RH=100
'Generic Full Bridge measurements 'FullBR'
BrFull(load_mv,1,mV25,2,1,1,2500,True,True,0,_60Hz,1,0)
'load cell calibration SLOPE
load_mv2 = load_mv * 4862.5
'load cell calibration Y-INTERCEPT
precip_g = load_mv2 + -693.2
'load cell conversion g to cm
precip_mm = precip_g * 0.03083
'SR50A Sonic Ranging Sensor (SDI-12 Output) measurements 'DT' and 'Q' and calculations 'TCDT' and 'DBTCDT'
SDI12Recorder(SR50A(),1,"0","M1!",1,0,-1)
DT=DT*100
TCDT=DT*SQR((AirTC+273.15)/273.15)
DBTCDT=317.5-TCDT
'Call Data Tables and Store Data
CallTable met
NextScan
EndProg


nsw Oct 30, 2020 02:57 AM

The simplest way to do this is use the "IfTime" instruction which returns True or False, as follows:-

If IfTime (0,10,Min) Then
  'SR50A Sonic Ranging Sensor (SDI-12 Output) measurements 'DT' and 'Q' and calculations 'TCDT' and 'DBTCDT'
  SDI12Recorder(SR50A(),1,"0","M1!",1,0,-1)
  DT=DT*100
  TCDT=DT*SQR((AirTC+273.15)/273.15)
  DBTCDT=317.5-TCDT
EndIf

This results in that measurement and other instructions inside the If/EndIf section only happening every 10min. The time needs to be a multiple of the scan time, otherwise it may never occur.

Have a look in CRBasic Help at the "IfTime" instruction for more details and Examples.

Log in or register to post/reply in the forum.