Introduction: 16x128 Display Showing Date, Time, Temp, Humidity

Picture of 16x128 Display Showing Date, Time, Temp, Humidity

This is my 1st instructable so I hope you find this helpful.

I know the struggles of finding the right code to do what you have planned in your head.

So here is one of my struggles that I have finished!

I am using 2 - 16x64 dot matrix display, 1 - RTCDS3231, 1 - DHT22 Temp Sensor and an Arduino Uno.

I have had these 2 16x64 displays for a while with no real code to run or do what I wanted.

I recently found a piece of code by Phil Kaziewicz and it was a great starting point for this project.

16x64 LED Matrix Display

RTC Module

DHT22 Temp Sensor

I have attached a short video of the scrolling display.

Step 1: Make Your Connections

Picture of Make Your Connections

2x8 Conn on 16x64 display Arduino UNO

Pin 1 ========================== GND (GND)

Pin 2 ==== No Connection (GND)

Pin 3 ==== No Connection (GND)

Pin 4 ========================== DI 2 (EN)

Pin 5 ========================== DI 8 (R1)

Pin 6 ========================== DI 9 (R2)

Pin 7 ==== No Connection (GND)

Pin 8 ==== No Connection (GND)

Pin 9 ========================== DI 10 (SK)

Pin 10 ========================= DI 7 (LT)

Pin 11 ==== No Connection (G2)

Pin 12 ==== No Connection (G1)

Pin 13 ========================= DI 6 (LD)

Pin 14 ========================= DI 5 (LC)

Pin 15 ========================= DI 4 (LB)

Pin 16 ========================= DI 3 (LA)

RTC3231SN Arduino UNO

GND ============================ GND

VCC ============================ 5V

SDA ============================ A4 (SDA)

SCL ============================ A5 (SCL)

SQW ==== No Connection

32K ==== No Connection1

DHT22 Arduino UNO

Pin 1============================== 5V

Pin 2 ============================== DI 11

Pin 3 ==== No Connection

Pin 4 ============================== GND

Also between Pin 1 and Pin 2 is a 10k Resistor!

Step 2: Code for This Project

load the Code and Run it.

Tried to paste code but came out all bunched together...

Maybe next time I will figure it out with some help from the form.

Step 3: About the Code

Here I have 2 displays tied together with cable supplied with purchase of display.

Time will be shown on upper half of left display.

Temperature and Humidity will alternate on upper half of right display.

Lower half of both displays will scroll current date from RTC.

Example: "Today is: Tuesday, 4/26/16"

You can adjust the time by Minutes (A0), Hours (A1), Display 12 or 24 hour format (A2) with Seconds showing during 24 hour format, and Daylight Savings ON/OFF (A3).

Time Adjustments are send and Saved on the RTC Module.

12/24 Hour Display and DST are sent to internal Ram and saved/Recalled if power goes out.

Always wanted to do that as we can adjust anything during the running of a program but if power goes out we get default setting restored so I send those setting to the Atmega328 RAM that gets recalled during "Setup".

Hope this helps many of you out there and feel free to ask any questions or improve any coding.

One thing I did want was a way to "Add" to the scrolling message any user input message and display it after the date, then repeat. I am working on adding a ESP8266 WIFI Module and letting the user set the Time, Date, and add a Message from their phone or tablet.



dancopy (author)2017-09-25


dancopy (author)2017-09-19

Has anyone here had this issue of Number of the Year, rather than 2017, show 2047? Looking forward to an answer.

dancopy (author)2017-08-18

Many thanks for the reply jeffreye!
I have not been able to sort out the part of the code that is showing the Year "47" instead of the Year "17" (ie 2017); I know you're very busy, but if you can give me a suggestion, I thank you very much,

IrfanY3 (author)2017-02-07

help me please

i make error """

'tmElements_t' was not declared in this scope"""

DennisB36 (author)IrfanY32017-07-25

At the beginning of the sketch remove the #include <Time.h> entry, and re-include it. You should then have an "#include <Time.h>" and a "#include <TimeLib.h>". That should take care of the 'tmElements_t' error.

jeffreye (author)IrfanY32017-02-08

check the code, make sure it was not changed or a char "t" was not mistyped in to code.

Look at error message, it will give line number in code where error is and should also highlight it.

DennisB36 (author)2017-07-23

Jeffreye, Help! how the heck do you change the year in this sketch. There are a couple of us out here scratching our heads trying to figure out how to change the year. I've uploaded and incorporated your time setting code, and for the most part it works, thanks, but I can not for the life of me change the year in the date line.

dancopy (author)2017-07-17

Could someone tell me how I convert this code, the temperature from Fahrenheit to Celsius? Thank you all

jeffreye (author)dancopy2017-07-18

In void Temp()

float f = dht.readTemperature(true); // Read temperature as Fahrenheit = (true), // //For Deg C >>> float f = dht.readTemperature()... Remove "true" inside braces

dancopy (author)2017-07-13

Hi jeffreye! I'm almost there but I still have three questions:
I still have problems with the configuration of the Data that, even
when configuring in the library that you provided, the year does not
change; Continues to appear 47 at the time of year.
2) What this button necessarily does: A3 = DST Adjust
3) I could not change the temperature from Fahrenheit to Celsius
Thanks and congratulations for the program!

ve3joc (author)2016-09-24

I have built this display on a breadboard to test it out and I have two

1 is that while I have two 64x16 display boards connected together with the
cable supplied, everything is being displayed on only the first display board.

2 The display is in reversed text. (the entire display is lit and the text
is unlit.)

Anyone have any ideas as to why?

Also, is there a way to change the temperature to display in Celsius rather
than Fahrenheit?

Thanks for any help.

ve3joc (author)ve3joc2016-12-09

Nobody has any suggestions on how to get normal text rather than reversed?

I have posted questions on 3 or 4 projects on this site and have never received an answer to any of them.

dancopy (author)ve3joc2017-07-11

In the following lines:
PORTB | =! ((Buffer [index] >> (7-i)) & 0x01) << (data_R1-8); // top set of rows
If (HEIGHT == 32) PORTB | =! ((Buffer [index + 128] >> (7-i)) & 0x01) << (data_R2-8); // bottom set of rows

Try this:
PORTB | =! ((~ Buffer [index] >> (7-i)) & 0x01) << (data_R1-8); // top set of rows
If (HEIGHT == 32) PORTB | =! ((~ Buffer [index + 128] >> (7-i)) & 0x01) << (data_R2-8); // bottom set of rows

That is, add "~" before the words "Buffer" like this: ~Buffer

ve3joc (author)ve3joc2017-02-08

Thanks for the help jeffreye. I'll try your suggestions and let you know what happens.


jeffreye (author)ve3joc2017-02-08

for problem with all text on 1 board I would have to see how you connected your displays. the data lines have to feed the right display and the second display connects via ribbon cable for left side of right display to right side of left display

Text feeds from left to right...

Hope this helps.

Sorry for the delay very busy at work and I have been heavy into ESP8266's building differnt project I hope to put up soon.

jeffreye (author)ve3joc2017-02-08

for inverse text problem look in program for:

void drawChar

comment out line = //if (inverse) charbytes[i] = ~charbytes[i];

jeffreye (author)ve3joc2017-02-08

In void Temp()

float f = dht.readTemperature(true); // Read temperature as Fahrenheit = (true), // //For Deg C >>> float f = dht.readTemperature()... Remove "true" inside braces

dancopy (author)2017-07-11

Hello DennisB36! Did you get anything? In mine also shows the Date on 7/8/47; Although, I have also moved into the configuration library, sent by author Jeffreye; I'm waiting for someone !! Hugs to all

DennisB36 (author)2017-07-07

Okay, I'm into brain meltdown. I cannot adjust the M/D/Y no matter what I set it at in the Set Date/Time module you sent me it refuses to reflect the change.

DennisB36 made it! (author)2017-06-29

I got this working, sort of, I can't set the time, no problem but I cannot set the date. The code makes reference to a pin 12 to set the date(see images below), but there is no reference either in the Instructable, or the Fritz file. Has anyone else seen this or dealt with it?

jeffreye (author)DennisB362017-06-29

My bad. I was playing with the RTC prior to using it in this project so it was already set. I was going to insert a section to run the "RTC Set Date" sketch I had. but I guess I did not finish it...

Here is a sketch to set the time and date in the RTC.



#include "Wire.h"
#define DS3231_I2C_ADDRESS 0x68
// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
return( (val/10*16) + (val%10) );
// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
return( (val/16*10) + (val%16) );
void setup()


// set the initial time here:
// DS3231 seconds, minutes, hours, day, date, month, year
// setDS3231time(02,32,23,7,9,04,16); //Uncomment this line and replace numbers with date format as above line states. Run Once! Then comment out!

void setDS3231time(byte second, byte minute, byte hour, byte dayOfWeek, byte
dayOfMonth, byte month, byte year)
// sets time and date data to DS3231
Wire.write(0); // set next input to start at the seconds register
Wire.write(decToBcd(second)); // set seconds
Wire.write(decToBcd(minute)); // set minutes
Wire.write(decToBcd(hour)); // set hours
Wire.write(decToBcd(dayOfWeek)); // set day of week (1=Sunday, 7=Saturday)
Wire.write(decToBcd(dayOfMonth)); // set date (1 to 31)
Wire.write(decToBcd(month)); // set month
Wire.write(decToBcd(year)); // set year (0 to 99)
void readDS3231time(byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year)
Wire.write(0); // set DS3231 register pointer to 00h
Wire.requestFrom(DS3231_I2C_ADDRESS, 7);
// request seven bytes of data from DS3231 starting from register 00h
*second = bcdToDec( & 0x7f);
*minute = bcdToDec(;
*hour = bcdToDec( & 0x3f);
*dayOfWeek = bcdToDec(;
*dayOfMonth = bcdToDec(;
*month = bcdToDec(;
*year = bcdToDec(;
void displayTime()
byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
// retrieve data from DS3231
readDS3231time(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month,
// send it to the serial monitor
Serial.print(hour, DEC);
// convert the byte variable to a decimal number when displayed
if (minute<10)
Serial.print(minute, DEC);
if (second<10)
Serial.print(second, DEC);
Serial.print(" ");

Serial.print(month, DEC);
Serial.print(dayOfMonth, DEC);
Serial.print(year, DEC);

Serial.print(" Day of week: ");
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
void loop()
displayTime(); // display the real-time clock data on the Serial Monitor,
delay(1000); // every second


DennisB36 (author)2017-06-02

Hey, great, thanks for the fast response.

jeffreye (author)2017-06-01

Here is a better link...

3.75 Unit Board 64 16 Dot Matrix LED Display Screen F3.75 Module 304 76mm

jeffreye (author)2017-06-01

displays are from ebay.

New link =

DennisB36 (author)2017-06-01

Where did you find the 16x 64 displays? All I can find are 16x32. Thanks

IrfanY3 (author)2017-02-10

hi again.i loaded arduino ide old version and it is work now. but i have 1 16x64 matrix display. how can i see temperatur and hum. on second line .i see day and date.

jeffreye (author)IrfanY32017-02-10

This was built for using 2 displays.
You would have to edit the code and choose to either display temp and hum or day and date.

In "void sevenseg(int input_number)"

edit lines below in code,
after "drawChar(" 1st number is column location...
change this to match location you want it displayed.
Widths are in sets of 8 as in = 0,8,16,24,32,40...ect
study code for day and time to see location numbers.
Make a " if " statement or use an input, timer counter or something to select either date/time or temp/hum to display in same location.

if (count5<25){ //Display Temperature
if (Temp1000>=1){
drawChar(64,0,' ',0,false);
drawChar(112,0,' ',0,false);
drawChar(120,0,' ',0,false);

if(count5>25&&count5<40){ //Display Humidity
if (Hum1000>=1){
drawChar(64,0,' ',0,false);

Hope this helps...

I have not rebuilt this to see if it works on the newer version of the Arduino program. I believe I was using version 1.6 when this was built.


IrfanY3 (author)2017-02-08

help me please

gada888 (author)2016-04-26


TheThinker (author)2016-04-26


tomatoskins (author)2016-04-26

Very cool project! Congratulations on your first instructable!

About This Instructable




More by jeffreye:16x128 display showing Date, Time, Temp, Humidity
Add instructable to: