-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
008bcef
commit 4244879
Showing
11 changed files
with
536 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
# Temperature | ||
Arduino library with dewPoint humidex and heatIndex functions. | ||
Arduino library with dewPoint humidex and heatIndex functions. | ||
|
||
## Description | ||
This library contains some weather related functions. These functions | ||
are approximations based on work of NOAA a.o. | ||
|
||
These functions can be used with temperature and humidity sensors e.g. | ||
to make a weather station application. | ||
|
||
|
||
## Operations | ||
|
||
The functions have a limited scope so one cannot use it for all input values possible. | ||
The user should be aware of that. Check the references mentioned in the code and or | ||
wikipedia to confirm the applicability of the values generated. | ||
The functions do not check the inputs. | ||
|
||
See examples for typical usage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// FILE: dewpoint_test.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.0 | ||
// PURPOSE: demo | ||
// DATE: 2020-04-04 | ||
// | ||
|
||
#include "temperature.h" | ||
|
||
uint32_t start; | ||
uint32_t duration1; | ||
uint32_t duration2; | ||
|
||
float maxError; | ||
volatile float dp; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(__FILE__); | ||
Serial.println("takes ~40 seconds"); | ||
|
||
Serial.println(dewPoint(25, 50), 2); | ||
Serial.println(dewPointFast(25, 50), 2); | ||
|
||
Serial.println("\ndewPoint()"); | ||
start = millis(); | ||
for (int cel = -40; cel < 80; cel++) | ||
{ | ||
for (int hum = 1; hum < 100; hum++) | ||
{ | ||
dp = dewPoint(cel, hum); | ||
} | ||
} | ||
duration1 = millis() - start; | ||
Serial.println(duration1); | ||
|
||
Serial.println("\ndewPointFast()"); | ||
start = millis(); | ||
for (int cel = -40; cel < 80; cel++) | ||
{ | ||
for (int hum = 1; hum < 100; hum++) | ||
{ | ||
dp = dewPointFast(cel, hum); | ||
} | ||
} | ||
duration2 = millis() - start; | ||
Serial.println(duration2); | ||
Serial.print("RATIO:\t"); | ||
Serial.println((1.0 * duration1) / duration2, 3); | ||
|
||
|
||
Serial.println("\ndewPointFast() vs dewPoint()"); | ||
for (int cel = -40; cel < 80; cel++) | ||
{ | ||
for (int hum = 1; hum < 100; hum++) | ||
{ | ||
float x = abs(dewPoint(cel, hum) - dewPointFast(cel, hum)); | ||
if (x > maxError) maxError = x; | ||
} | ||
} | ||
Serial.print("ERROR:\t"); | ||
Serial.println(maxError, 3); | ||
|
||
|
||
Serial.print("Done..."); | ||
} | ||
|
||
void loop() | ||
{ | ||
|
||
} | ||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// FILE: heatindexC_table.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.0 | ||
// PURPOSE: demo | ||
// DATE: 2020-04-04 | ||
// | ||
|
||
#include "temperature.h" | ||
|
||
volatile float hi; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(__FILE__); | ||
|
||
Serial.println(); | ||
|
||
for (int t = 25; t <= 45; t += 1) | ||
{ | ||
Serial.print("\t"); | ||
Serial.print(t); | ||
} | ||
Serial.println(); | ||
Serial.println(); | ||
|
||
for (int hum = 40; hum <= 100; hum += 5) | ||
{ | ||
Serial.print(hum); | ||
for (int t = 25; t <= 45; t += 1) | ||
{ | ||
float hi = heatIndexC(t, hum); | ||
Serial.print("\t"); | ||
Serial.print(round(hi)); | ||
} | ||
Serial.println(); | ||
} | ||
Serial.println(); | ||
Serial.println(); | ||
|
||
|
||
Serial.print("Done..."); | ||
} | ||
|
||
void loop() | ||
{ | ||
|
||
} | ||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// FILE: heatindexC_test.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.0 | ||
// PURPOSE: demo | ||
// DATE: 2020-04-04 | ||
// | ||
|
||
#include "temperature.h" | ||
|
||
uint32_t start; | ||
uint32_t duration1; | ||
|
||
volatile float hi; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(__FILE__); | ||
|
||
Serial.println(heatIndexC(25, 50), 2); | ||
Serial.println(heatIndexFastC(25, 50), 2); | ||
|
||
start = millis(); | ||
for (int cel = 10; cel < 80; cel++) | ||
{ | ||
for (int hum = 1; hum < 100; hum++) | ||
{ | ||
hi = heatIndexC(cel, hum); | ||
} | ||
} | ||
duration1 = millis() - start; | ||
Serial.println(duration1); | ||
|
||
|
||
Serial.print("Done..."); | ||
} | ||
|
||
void loop() | ||
{ | ||
|
||
} | ||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// FILE: heatindex_table.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.0 | ||
// PURPOSE: demo | ||
// DATE: 2020-04-04 | ||
// | ||
|
||
#include "temperature.h" | ||
|
||
volatile float hi; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(__FILE__); | ||
|
||
Serial.println(); | ||
|
||
for (int t = 80; t <= 110; t += 2) | ||
{ | ||
Serial.print("\t"); | ||
Serial.print(t); | ||
} | ||
Serial.println(); | ||
Serial.println(); | ||
|
||
for (int hum = 40; hum <= 100; hum += 5) | ||
{ | ||
Serial.print(hum); | ||
for (int t = 80; t <= 110; t += 2) | ||
{ | ||
float hi = heatIndex(t, hum); | ||
Serial.print("\t"); | ||
Serial.print(round(hi)); | ||
} | ||
Serial.println(); | ||
} | ||
Serial.println(); | ||
Serial.println(); | ||
|
||
|
||
Serial.print("Done..."); | ||
} | ||
|
||
void loop() | ||
{ | ||
|
||
} | ||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// FILE: heatIndex_test.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.0 | ||
// PURPOSE: demo | ||
// DATE: 2020-04-04 | ||
// | ||
|
||
#include "temperature.h" | ||
|
||
uint32_t start; | ||
uint32_t duration1; | ||
|
||
volatile float hi; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(__FILE__); | ||
|
||
Serial.println(heatIndex(100, 50), 2); | ||
|
||
start = millis(); | ||
for (int t = 40; t < 110; t++) | ||
{ | ||
for (int hum = 1; hum < 100; hum++) | ||
{ | ||
hi = heatIndex(t, hum); | ||
} | ||
} | ||
duration1 = millis() - start; | ||
Serial.println(duration1); | ||
|
||
|
||
Serial.print("Done..."); | ||
} | ||
|
||
void loop() | ||
{ | ||
|
||
} | ||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// FILE: humidex_table.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.0 | ||
// PURPOSE: demo | ||
// DATE: 2020-04-05 | ||
// | ||
|
||
#include "temperature.h" | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(__FILE__); | ||
|
||
Serial.println(); | ||
|
||
for (int cel = 20; cel < 45; cel++) | ||
{ | ||
Serial.print("\t"); | ||
Serial.print(cel); | ||
} | ||
Serial.println(); | ||
Serial.println(); | ||
|
||
for (int hum = 100; hum > 15; hum -= 2) | ||
{ | ||
Serial.print(hum); | ||
for (int cel = 20; cel < 45; cel++) | ||
{ | ||
float dp = dewPoint(cel, hum); | ||
float hi = humidex(cel, dp); | ||
Serial.print("\t"); | ||
Serial.print(round(hi)); | ||
} | ||
Serial.println(); | ||
} | ||
Serial.println(); | ||
Serial.println(); | ||
|
||
Serial.print("Done..."); | ||
} | ||
|
||
void loop() | ||
{ | ||
|
||
} | ||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// FILE: humidex_test.ino | ||
// AUTHOR: Rob Tillaart | ||
// VERSION: 0.1.0 | ||
// PURPOSE: demo | ||
// DATE: 2020-04-05 | ||
// | ||
|
||
#include "temperature.h" | ||
|
||
uint32_t start; | ||
uint32_t duration1; | ||
|
||
volatile float hi; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(__FILE__); | ||
|
||
Serial.println(humidex(25, 50), 2); | ||
|
||
start = millis(); | ||
for (int t = 25; t <= 45; t++) | ||
{ | ||
for (int hum = 1; hum <= 100; hum++) | ||
{ | ||
float dp = dewPoint(t, hum); | ||
hi = humidex(t, dp); | ||
} | ||
} | ||
duration1 = millis() - start; | ||
Serial.println(duration1); | ||
|
||
|
||
Serial.print("Done..."); | ||
} | ||
|
||
void loop() | ||
{ | ||
|
||
} | ||
|
||
// -- END OF FILE -- |
Oops, something went wrong.