Two-digit Display Using Single 8x8 Led Matrix
by hkayir in Circuits > Arduino
2306 Views, 1 Favorites, 0 Comments
Two-digit Display Using Single 8x8 Led Matrix
Here I would like to built an temperature and humidity indicator for my room. I used single 8x8 LED Matrix for displaying two-digit numbers, and I think that part of the project became more useful. I boxed the final built using a cardboard box, painted like wood.
Supplies
- Arduino Nano x1
- DHT11 Temperature and Humidity Sensor x1
- 8x8 LED matrix with MAX7219 x1
- 10K resistor x1
- Header wires
- 5V power supply x1
- Cardboard box (4x8x13 cm)
Schematic
DHT11 digital temperature & humidity sensor delivers temperatures between 0 - 50°C and humidity between 20% to 90%. The temperature accuracy is ±2°C (maximum) and humidity accuracy is ±5%.
DHT11 also provides dew point values. The dew point is the temperature to which air must be cooled to become saturated with water vapor. When further cooled, the airborne water vapour will condense to form liquid water.
Wiring & Boxing
First I painted the cardboard box using acrylic paint and after drying for 1 day I finished with a hairspray. I made a square window for LED display on the front cover. Also I opened a small rectangle hole for Arduino Nano power supply and put several holes near the DHT11 sensor.
I fixed the Arduino in the corner of the main box using small box and hot silicon.
I placed the LED matrix in the window using transparent tape strips. Here it is important to place it with a 90° counter-clockwise rotation because the code will use the upper 4 rows for tens digit and the lower 4 rows for unit digits. For the module I used the side with MAX7219 should be on the base side.
Because I placed Arduino and sensor at the closing side of the box I could not fully closed it 🤦. You better select the other side :).
Code
First upload the library for DHT11 (https://github.com/adidax/dht11) and LED matrix (https://github.com/wayoda/LedControl) if you do not have already.
The code use the first 4 row of the LED matrix as tens and the last 4 rows as units. Thus for example if you check the code for "one" you will see "11" as rotated 90° clockwise. If you want to change these codes please take care of that detail.
byte one[] = {B00000000,B01000100,B01111100,B01000000,B00000000,B01000100,B01111100,B01000000};
The codes for getting the digits from the sensor reading are:
units = humid % 10;
tens = (humid /10) % 10;
For tens digit the for loop runs as follows:
if (tens == 1) {
for (int c=0;c<4;c++) { lc.setRow(0,c,one[c]); }
For units digit the for loop runs as follows:
if (units == 1) {
for (int c=4;c<8;c++) { lc.setRow(0,c,one[c]); }
The display order is in loop as follows:
"°C" -> temperature -> "hum" -> humidity -> "dp" -> dew point -> meaning of dew point (explained below)
I have some info about how people feel the weather according to the dew point and put that info into the code as follows:
dp < 10 : dry
9 < dp < 15: good (g..d)
14 < dp < 18 : Sweltry (sw)
17 < dp < 24 : Sweltry plus (sw +)
dp > 23 : wet
The display for these words are not good but still understandable for a single 8x8 display