Wireless/one sensor/resistance converted to temperature

CRBasic Example: Wireless-One sensor

'This is an example of a program used by a CR1000X and AVW206 to one Geokon 4450

'VW displacement sensor. The sensor provides a frequency, which is converted to

'displacement, and resistance, which is converted to temperature. Polynomial Gage

'Factors used in this example were taken from the calibration sheets of the 4450

'sensor. The coefficients used to convert resistance to temperature are from the

'Steinhart-Hart equation.

 

'The CR1000X communicates with the remote AVW206 through an RF401A radio attached

'to the logger's CS/IO port in SDC7 mode.

'The Pakbus address of the AVW206 used in this example is 15.

 

Public batt_volt,Ptemp

Public VWvalues(6)

Public VWResults

Public Psi,Temp

 

Alias VWvalues(1) = Freq

Alias VWvalues(2) = Amp

Alias VWvalues(3) = Sig2Noise

Alias VWvalues(4) = NoiseFreq

Alias VWvalues(5) = DecayRatio

Alias VWvalues(6) = Therm

 

Dim Digits

 

'Below are coefficients for Steinhart-Hart equation used to convert resistance

'to Temp

Const A=.0014051

Const B=.0002369

Const C=.0000001019

 

BeginProg

 

  Scan (10,Sec,0,0)

    PanelTemp (Ptemp,60)

    Battery (batt_volt)

 

    AVW200(VWResults,ComSDC7,0,15,VWvalues(1),1,1,1,1000,2500,2,_60Hz,1,0)

    Digits = (Freq/1000)^2 * 1000 'Convert frequency to Digits

 

    'Convert resistance to temp F.

    Temp = (1/(A + B*LN(Therm) + C*(LN(Therm))^3)-273.15)*1.8+32

 

    'Calculate displacement (inches) from Digits and calibration polynomial

    Psi=2.49866e-10*Digits^2 + 8.716e-5*Digits + -.2

 

  NextScan

EndProg