Compute Heat Index with Arduino and DHT Sensor

 Author:   Posted on:   Updated on:  2019-06-16T12:50:09Z

The heat index is a parameter that takes into account temperature and relative humidity, to determine the apparent temperature or the human perceived equivalent temperature. Heat index was developed in 1978 by George Winterling and was adopted next year. It is also known as humiture, according to Wikipedia contributors.

To compute this index, you need to know current temperature and relative humidity. An easy way to find both is by using an Arduino development board with a DHT sensor (DHT11, DHT22). These sensors measure temperature and humidity and send it to the microcontroller using a digital protocol. Thus, there is no need for calibration. You can read the values directly from the sensor module. However, you should take into account that the accuracy of these sensors is not the best. DHT11 has an accuracy of +/-5% for humidity and +/-2 degrees Celsius for temperature. DHT22 (AM2302) is slightly better with an accuracy of +/-2% for humidity and +/-0.5 degrees Celsius for temperature. More than that, DHT22 has extended ranges for both temperature and humidity.

Compute Heat Index with Arduino and DHT Sensor

There is also the option to use Bosch BME280 sensor for this purpose. This one is a bit more expensive, but it has better accuracy and can measure atmospheric pressure. A different library is needed and a level shifter is required with 5 V development boards since BME280 is a 3.3 V device. Besides the sensor, you need some way of displaying the heat index value. I used an alphanumeric LCD, but for a test setup, you can send data through serial port. For a quick indication, my circuit also contains three LEDs that turn on depending on heat index value. If you want, you can extend this project by adding a RTC module and SD card to log temperature and humidity data over time. Or you can replace the development board with one that has network (internet) connectivity.

Schematic of humiture calculator with DHT22

Schematic of humiture calculator with DHT22

The LCD is connected to the development board using 4 data wires (D4-D7) and two control signals (E, RS). A trimmer potentiometer is used to adjust contrast and a 220-470 ohms resistor is connected in series with the backlight LED. The sensor is powered from 5 V and its data pin needs to be pulled-up with a resistor. If you're using a module (breakout) with this sensor, the resistor is fitted on the module PCB.

Once you got all this together on the breadboard, you need to program the Arduino. Heat index formula is not that easy. The equations were developed by Rothfusz and Steadman and you can find them at National Weather Service. Luckily, both equations are included in Adafruit DHT library. You can install this library from Arduino IDE using the Library Manager Ctrl+Shift+I. You need Adafruit Unified Sensor too. The code becomes very easy now. At the beginning of the sketch, we declare the sensor and set its data pin and type.

#define SENSOR_PIN   2

DHT sensor(SENSOR_PIN, DHT22);

If using DHT11, replace the second argument of sensor declaration with DHT11. For BME280, a different library is needed. Still, you can use DHT library only for humiture calculation.

  t = sensor.readTemperature(false);
  h = sensor.readHumidity();
  hi = sensor.computeHeatIndex(t, h, false);

The above code gets temperature, humidity and heat index in Celsius degrees. By setting the argument to true, we can get Fahrenheit values from sensor. The sketch displays temperature and humiture in Celsius degrees if #define CELSIUS_DEGREES is found. Delete or comment this line to display Fahrenheit degrees.

There are also three indicator LEDs in this circuit. All LEDs are off as long as heat index is less than 27 degrees Celsius (80 degrees Fahrenheit). The green LED turns on when heat index is below 32 degrees Celsius (90 degrees Fahrenheit) to indicate caution level. When humiture exceeds this, but it is less than 41 degrees Celsius (105 degrees Fahrenheit) extreme caution is indicated by turning on yellow LED. At last, when humiture exceeds 41 degrees Celsius (105 degrees Fahrenheit), the red LED indicates danger. These thresholds can be found on Wikipedia.

Humiture equations can be found in library code (MIT license). Adafruit library implements both Rothfusz regression and Steadman equation.


No comments :

Post a Comment

Please read the comments policy before publishing your comment.