After not doing any Arduino fiddling for quite a while I have finally started a small project again. I have made a small weather station for measuring temperature and humidity levels in my home.
The setup is based on an Arduino Uno with the standard Ethernet Shield (because it has an SD card reader) and a DHT-22 sensor that is connected as follows (following the docs):
- Leg 1 (from the left) –> +5V
- Leg 2 –> pin 2 (data input)
- Leg 3 –> not connected
- Leg 4 –> GND
- 10k OHM resistor between +5V and data pin 2.
The code is pretty standard, a mixture of the SD library and DHT library code examples … not really interesting. However, I have added a bit of code to calculate the dew point based on formulas I found on the web, which may be worth sharing here:
// Compute dew point (formula taken from here: http://www.wettermail.de/wetter/feuchte.html
// You need to include the math.h library
float temperature = 20.0; // Set to current temperature in *C (>= 0).
float humidity = 50.0; // Set to current % of relative humidity.
float a = 7.5; // For temperatures >= 0 *C.
float b = 237.3; // For temperatures >= 0 *C.
float sdd = 6.1078 * pow(10, (a * temperature) / (b + temperature));
float dd = humidity / 100 * sdd;
float v = log10(dd / 6.1078);
float dewpoint = b * v / (a – v);
So far the setup seems to work well, but the sensor readings regarding the temperature look a bit high (maybe influenced by the Arduino which gets warm over time … its probably better to place the sensor away from the board, and not right on top of it).
Edit: In case you are interested, you can find the code of the project here: https://bitbucket.org/snippets/boden/xr746 (without the dewpoint computation).