Projects / Heat index and comfort display

Heat index and comfort display

Beginner1 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANODHT22USB29.3°C

    Wire the sensor

    DHT22 data on D2, add a 10 kΩ pull-up if your sensor is a bare four-pin part.

  2. NANOHelloPCF8574

    Wire the LCD

    I2C on A4 and A5. Adjust the contrast trimmer if the text is faint.

  3. NANO19.1 mA

    Wire the LED

    Each leg through 220 Ω, common cathode to GND.

  4. NANO

    Upload and read

    Temperature, humidity and heat index appear.

  5. NANO

    Test levels

    Breathe on the sensor to raise humidity and see the level change.

  6. NANO

    Place it in the shade

    Put it where you work, out of direct sun.

In short

How do you build a heat index and comfort display?

A DHT22 works out the heat index (how hot it feels) and tells you when it is dangerous to work outside in an Indian summer. You need Arduino Nano, DHT22 Sensor, 16x2 LCD with I2C backpack (PCF8574), RGB LED 5 mm common cathode, Resistor 220 Ω × 3, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data). It takes 6 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
DHT22 VCC and GNDNano 5V and GNDSensor supply (module with built-in pull-up; a bare sensor needs 10 kΩ from DATA to VCC)
DHT22 DATANano D2Data
LCD SDA and SCLNano A4 and A5I2C display
LCD VCC and GNDNano 5V and GNDSupply
RGB LED red, green, blueNano D9, D10, D11 through 220 Ω eachLevel colour
RGB LED common cathodeNano GNDCommon cathode type

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "DHT sensor library" and "Adafruit Unified Sensor" from Adafruit, and "LiquidCrystal I2C". The heat index uses the standard NOAA regression inside the library. The level cut-offs follow common guidance but are not medical advice, so treat the display as a prompt to rest, shade and drink water.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <DHT.h>
#include <LiquidCrystal_I2C.h>

DHT dht(2, DHT22);
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte R = 9, G = 10, B = 11;
unsigned long lastDrink = 0;

void colour(byte r, byte g, byte b) { analogWrite(R, r); analogWrite(G, g); analogWrite(B, b); }

void setup() {
  dht.begin();
  lcd.init(); lcd.backlight();
  pinMode(R, OUTPUT); pinMode(G, OUTPUT); pinMode(B, OUTPUT);
}

void loop() {
  float t = dht.readTemperature(), h = dht.readHumidity();
  if (isnan(t) || isnan(h)) { delay(2000); return; }
  float hi = dht.computeHeatIndex(t, h, false);     // heat index in Celsius

  const char *level;
  if (hi < 27)      { level = "Comfortable";    colour(0, 120, 0); }
  else if (hi < 32) { level = "Caution";        colour(150, 120, 0); }
  else if (hi < 41) { level = "Extreme caution"; colour(255, 60, 0); }
  else              { level = "DANGER";         colour(255, 0, 0); }

  lcd.clear();
  lcd.setCursor(0, 0); lcd.print(t, 1); lcd.print("C "); lcd.print(h, 0); lcd.print("% HI "); lcd.print(hi, 0);
  lcd.setCursor(0, 1);
  if (hi >= 32 && millis() - lastDrink > 1200000UL) {      // every 20 minutes when it is hot
    lcd.print("Drink water!"); lastDrink = millis();
  } else lcd.print(level);
  delay(2000);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Room at 28 °C and 50 percentHeat index near 29, Caution
Breath on the sensorHumidity jumps, heat index rises briefly
Heat index above 41DANGER and a red LED
Every 20 minutes when hotA drink water message

If it does not work

Readings are NaN

Check DATA pin and the pull-up, and that the library is installed.

Display shows boxes

Adjust the LCD contrast trimmer or check the address 0x27 or 0x3F.

Temperature reads high

The sensor is in sun or near the board. Move it away.

Colours wrong

A common anode LED needs inverted values.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the heat index and comfort display?

Arduino Nano, DHT22 Sensor, 16x2 LCD with I2C backpack (PCF8574), RGB LED 5 mm common cathode, Resistor 220 Ω × 3, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data).

How long does the heat index and comfort display take to build?

About 60 minutes for a beginner maker, in 6 steps.

How do I know the heat index and comfort display works?

Room at 28 °C and 50 percent: Heat index near 29, Caution. Breath on the sensor: Humidity jumps, heat index rises briefly. Heat index above 41: DANGER and a red LED.

Readings are NaN: what should I check?

Check DATA pin and the pull-up, and that the library is installed.

Display shows boxes: what should I check?

Adjust the LCD contrast trimmer or check the address 0x27 or 0x3F.

Temperature reads high: what should I check?

The sensor is in sun or near the board. Move it away.

Colours wrong: what should I check?

A common anode LED needs inverted values.