|
|
@@ -48,7 +48,7 @@ FsFile file; |
|
|
|
const char software_name[] = "Software: Teensy_datalog V.2"; |
|
|
|
const int min_voltage_batterie = 13; |
|
|
|
|
|
|
|
const int power_Temp_sensor = 34, power_Windfahne = 36, LED_Fail = 24, R_Temp_fix = 13000, |
|
|
|
const int power_Temp_sensor = 34, power_Windfahne = 36, LED_Fail = 24, |
|
|
|
LED_Write = 5, LED_Normal = 6, LED_Batterie = 7, Grenz_U_Batterie = 13, |
|
|
|
taster_manuell_speichern = 28, Windfahne = 20, T_sensor_input = 17, Batterie_input = 38; |
|
|
|
|
|
|
@@ -142,18 +142,21 @@ public: |
|
|
|
/*if (reed_contact.update() && reed_contact.fallingEdge()) { |
|
|
|
count_per_second++; |
|
|
|
}*/ |
|
|
|
if(digitalRead(anemometer_pin) == HIGH){ |
|
|
|
this_signal = 1; |
|
|
|
} |
|
|
|
else{ |
|
|
|
this_signal = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if(this_signal != last_signal){ |
|
|
|
if(this_signal == 1){ |
|
|
|
count_per_second++; |
|
|
|
short int milli = millis(); |
|
|
|
if(last_milli != milli){ |
|
|
|
if(digitalRead(anemometer_pin) == HIGH){ |
|
|
|
this_signal = 1; |
|
|
|
} |
|
|
|
last_signal = this_signal; |
|
|
|
else{ |
|
|
|
this_signal = 0; |
|
|
|
} |
|
|
|
if(this_signal != last_signal){ |
|
|
|
if(this_signal == 1){ |
|
|
|
count_per_second++; |
|
|
|
} |
|
|
|
last_signal = this_signal; |
|
|
|
} |
|
|
|
last_milli = milli; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -193,6 +196,7 @@ private: |
|
|
|
int this_signal = 0; |
|
|
|
float wind_speed_per_second[60]; |
|
|
|
int anemometer_pin; |
|
|
|
int last_milli; |
|
|
|
|
|
|
|
//Bounce reed_contact = Bounce(2, 1); |
|
|
|
|
|
|
@@ -204,30 +208,29 @@ struct temp_sensor{ |
|
|
|
private: |
|
|
|
float U_Temp; |
|
|
|
float R_Temp; |
|
|
|
const float R_Temp_fix = 13000.0; |
|
|
|
int saved_minutes = 0; |
|
|
|
float Temp[60]; |
|
|
|
float NTC[60]; |
|
|
|
short int array_Temp_datenblatt[20] = { -30, -20, -10, 0, 10, 20, 25, 30, 40, 50, |
|
|
|
391, 424, 460, 498, 538, 581, 603, 626, 672, 722}; |
|
|
|
176807, 97008, 55304, 32651, 19903, 12493, 10000, 8056, 5325, 3601}; |
|
|
|
public: |
|
|
|
void measure() { |
|
|
|
digitalWrite(power_Temp_sensor, LOW); |
|
|
|
U_Temp = analogRead(T_sensor_input); |
|
|
|
digitalWrite(power_Temp_sensor, HIGH); |
|
|
|
|
|
|
|
|
|
|
|
/*for (int t = 0; t < 9; t++) { |
|
|
|
if ((R_Temp >= array_Temp_datenblatt[t + 10]) && (R_Temp <= array_Temp_datenblatt[t + 11])) { |
|
|
|
Temp[saved_minutes] = array_Temp_datenblatt[t] + ((R_Temp - array_Temp_datenblatt[t + 10]) * (array_Temp_datenblatt[t + 1] - array_Temp_datenblatt[t]) / (array_Temp_datenblatt[t + 11] - array_Temp_datenblatt[t + 10])); |
|
|
|
R_Temp = ((1023 / U_Temp) - 1) * R_Temp_fix; |
|
|
|
NTC[saved_minutes] = R_Temp; |
|
|
|
for (int t = 0; t < 9; t++) { |
|
|
|
if ((R_Temp <= array_Temp_datenblatt[t + 10]) && (R_Temp >= array_Temp_datenblatt[t + 11])) { |
|
|
|
Temp[saved_minutes] = array_Temp_datenblatt[t] + ((array_Temp_datenblatt[t + 10] - R_Temp) * (array_Temp_datenblatt[t + 1] - array_Temp_datenblatt[t]) / (array_Temp_datenblatt[t + 10] - array_Temp_datenblatt[t + 11])); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
Temp[saved_minutes] = R_Temp_fix * ((1023 / U_Temp) - 1); |
|
|
|
} |
|
|
|
saved_minutes++; |
|
|
|
} |
|
|
|
|
|
|
|
void file_print() { |
|
|
|
file.printf("\nWiderstand NTC:\n"); |
|
|
|
file.printf("\nWiderstand NTC:\tTemperatur:\n"); |
|
|
|
for (int i = 0; i < saved_minutes; i++) { |
|
|
|
file.printf("%.2f Ohm\n", Temp[i]); |
|
|
|
file.printf("%.2f Ohm\t%.2f °C\n", NTC[i], Temp[i]); |
|
|
|
} |
|
|
|
saved_minutes = 0; |
|
|
|
} |
|
|
@@ -384,6 +387,7 @@ void setup() |
|
|
|
pinMode(LED_Batterie, OUTPUT); |
|
|
|
pinMode(power_Temp_sensor, OUTPUT); |
|
|
|
pinMode(power_Windfahne, OUTPUT); |
|
|
|
digitalWrite(power_Temp_sensor, LOW); |
|
|
|
|
|
|
|
setSyncProvider(getTeensy3Time); |
|
|
|
|