Environmental Dashboards: LED Temp Bar Graph
The Temperature LED Dashboard replaces complex text displays with a bold, instant visual indicator. By mapping the digital reading of a DHT11 sensor to an analog-like array of 10 LEDs, you create an incredibly legible, color-coded room thermometer.

Converting Arrays to Visuals (Map Function)
Wiring 10 LEDs to pins 2 through 11 is tedious, but programming the logic is brilliant.
- The Sensor Read:
float tempC = dht.readTemperature();. (Current room is 26°C). - The Output Array: You want to scale the room.
- 20°C = 0 LEDs on.
- 30°C = 10 LEDs on.
- The Mapping:
int ledLevel = map(tempC, 20, 30, 0, 10);(This mathematically converts the 26°C reading into the raw number6). - The Illumination Loop:
You write a
forloop that cycles from 0 to 10.if(i < ledLevel), it turns that specific LED HIGH! Consequently, 6 LEDs light up simultaneously.
Thermal Color Coding
To make the display truly professional:
- The first 3 LEDs (20-23°C) are BLUE.
- The middle 4 LEDs (24-27°C) are GREEN or YELLOW.
- The final 3 LEDs (28-30°C) are bright RED, warning you immediately from across the room that the A/C has broken!
Requirements
- Arduino Uno/Nano.
- DHT11 / DHT22 Sensor Module.
- 10 x 5mm LEDs (Various Colors) and 10 x Resistors.
- A large breadboard properly utilizing the shared ground rails.