BayEOSArduino Library
SensorCalc.h
1 #ifndef SENSORCALC_H
2 #define SENSORCALC_H
3 
4 #include <math.h>
5 
6 float ntc10_20(int adc){
7  float t,res;
8  t=adc;
9  res=8.195548e+01-2.523585e-01*t;
10  t*=adc;
11  res+=3.121114e-04*t;
12  t*=adc;
13  res+=-1.842112e-07*t;
14  return res;
15 }
16 
17 
18 float hit503x(int adc,float T){
19  return ((((float) adc)/1023-0.1515)/0.00636)/(1.0546-0.00216*T);
20 }
21 
22 float hr202l_100(int adc,float T){
23  float a,b,c;
24  float tt=T*T;
25  a=112.016090 - 0.360150168*T + 1.156667e-03*tt;
26  b=-12.725041 - 0.066866381*T - 1.365699e-04*tt;
27  c=0.373017 - 0.006363128*T + 5.289157e-05*tt;
28  float logR;
29  logR=log((float)100/((float)1023/((float) adc) - 1));
30  return a+b*logR+c*logR*logR;
31 }
32 
33 //avarage wind direction
34 /*
35  * N: 0 10000
36  * NO: 7071 7071
37  * O 10000 0
38  * SO: 7071 -7071
39  * S 0 -10000
40  * SW -7071 -7071
41  * W -10000 0
42  * NW -7071 7071
43  *
44  *
45  *
46  */
47 
48 
49 #endif