element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Displaying time on an Arduino TFT display using a RTC 3231
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 28 replies
  • Subscribers 390 subscribers
  • Views 3954 views
  • Users 0 members are here
  • arduino uno
  • tft display
  • learning
  • DS3231 clock module
Related

Displaying time on an Arduino TFT display using a RTC 3231

Adam_A
Adam_A over 2 years ago

Hi, I was recently working on a new project which displayed time from a real time module to a Arduino TFT display using an Arduino UNO as the main board, however I'm still having trouble with it displaying anything on the screen as when I wire everything up and power the Arduino it just displays a white blank screen,

For the wiring I've made this diagram, (all parts in this diagram represent what I have):

image

And for the code I've added this: 
I have double checked that the library's do work with my display. 

#include <Wire.h>
RTC_DS3231 rtc;
char t[32];
#include "Adafruit_GFX.h"
#include "MCUFRIEND_kbv.h"
MCUFRIEND_kbv tft;

#include "Fonts/FreeSans9pt7b.h"
#include "Fonts/FreeSans12pt7b.h"
#include "Fonts/FreeSerif12pt7b.h"
#include "FreeDefaultFonts.h"

#define PI 3.1415926535897932384626433832795
#define WHITE 0xFFFF

int col[8];

void showmsgXY(int x, int y, int sz, const GFXfont *f, const char *msg)
{
  int16_t x1, y1;
  uint16_t wid, ht;


  tft.setFont(f);
  tft.setCursor(x, y);
  tft.setTextColor(0x0000);
  tft.setTextSize(sz);
  tft.print(msg);
}
void setup()
{
  Serial.begin(9600);
  Wire.begin();
  rtc.begin();
  rtc.adjust(DateTime(F(__DATE__),F(__TIME__)));
  //rtc.adjust(DateTime(2019, 1, 21, 5, 0, 0));
   tft.reset();
  uint16_t ID = tft.readID();
  tft.begin(ID);
  tft.setRotation(1);
  tft.invertDisplay(true);
  tft.fillScreen(0xffff);
}
void loop()
{
  DateTime now = rtc.now();
  sprintf(t, "%02d:%02d:%02d %02d/%02d/%02d", now.hour(), now.minute(), now.second(), now.day(), now.month(), now.year());  
  Serial.print(F("Date/Time: "));
  Serial.println(t);
  showmsgXY(170, 250, 2, &FreeSans9pt7b, t);
  delay(1000);
}


I personally think that the issue is with the wiring however again I'm not sure if it is the code or wiring which I'm messing up, as when I wire everything up it just displays a blank screen like this:

image

Final goal target to be displayed on the screen:

image

If anyone has worked with such displays and knows what's the issue any help would be highly apricated, thanks! 


  • Sign in to reply
  • Cancel

Top Replies

  • dougw
    dougw over 2 years ago in reply to Adam_A +2
    I presume the text libraries only overwrite the character pixels so previous pixels do not get blanked. I always write a blank before the update but it can flicker as the character momemtarily goes blank…
  • Andrew J
    Andrew J over 2 years ago in reply to shabaz +2
    Once you’ve got it working in the simplest, easiest case you could look at getting more complex: only print what changes. The date only changes as midnight; the hour once every 60 mins etc. So print the…
  • javagoza
    javagoza over 2 years ago +1
    There are many such modules. If you can add a reference to the spec sheet or where you bought it they may help you better. I have used several of these modules as in this project Arduino UNO Chess Clock…
  • javagoza
    javagoza over 2 years ago

    There are many such modules. If you can add a reference to the spec sheet or where you bought it they may help you better.
    I have used several of these modules as in this project

     Arduino UNO Chess Clock TFT LCD Virtual Clock Display Library 

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

    Other posts I've made

    https://www.hackster.io/javagoza/arduino-touch-breakout-game-eda113

    https://www.hackster.io/javagoza/2-4-tft-lcd-touch-display-road-test-89f51b

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Adam_A
    Adam_A over 2 years ago in reply to javagoza

    Sure, here is the purchase link: https://a.co/d/bZsHpU0

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 2 years ago

    I think you've got the wrong sort of TFT display. It supports parallel connections (the serial connections are for sending static images perhaps). In any case, it's the wrong display for the code you're using. The display needs a more powerful board than Arduino Uno, if you wish to use graphics and text commands - I think.

    It's better to follow examples such as the one javagoza refers to, with the same TFT screen. You can't mix them, they have different driver chips.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • javagoza
    javagoza over 2 years ago in reply to shabaz

    Those connections that he is using are not for communicating with the TFT display but for the SD card reader included in the display.

    These displays, as shabaz says, are for parallel communication and are prepared to be coupled with the board as a sandwich.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Adam_A
    Adam_A over 2 years ago in reply to javagoza

    Thanks for the reply's, however even with plugging it in directly im still getting a sort of black screen directly for a split second then a white screen.. at this point im just trying to display time on my display but im finding no article which actually works with my display no matter what I do, all posts including the ones javagoza referred to does not mention my display. 



    There are ones which use my display but are for Arduino DUE which is discontinued and would set be back almost $85 if i were to buy one, plus im not trying to have any animations of some sort, I simply need the time displayed on my screen. :/ 

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 2 years ago in reply to Adam_A

    It is what it is I'm afraid. You purchased a display which is not practically drivable with the Arduino Uno, because (repeating myself) it's a parallel interface, and your code isn't for that sort of display. 

    You could investigate storing static time representations on the storage card and then control via serial (perhaps) but that's a completely different project, and you're unlikely to find much help in this area, because it's a weird way of doing it, and no-one normally would do that (if it even works). You'd be pretty much on your own, no-one is likely to have done it that way.

    Anyway, a TFT display is not $85. You can get smaller cheap ones for $10-$15 or so, that are compatible with Arduino Uno. Search for ones with I2C or SPI interface.

    Also, another option is to use a 16x2 LCD character display, if all you want is text. They are really low-cost too.  There is a ton of Arduino examples for the 16x2 displays, so you will have plenty of code to experiment with.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw over 2 years ago

    https://www.youtube.com/watch?v=RG6aejGy3Z0&ab_channel=GadgetReboot

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Adam_A
    Adam_A over 2 years ago in reply to shabaz

    What surprises me the most is im actually able to run complex programs (from example codes) like paint which you could draw on the display using its touch screen with all colors, calculator, draw complex shape and animations, etc, but I have yet to find anyone who used my display to make a single text displaying time Face palm‍♂️

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Adam_A
    Adam_A over 2 years ago in reply to dougw

    Yeah I saw this, I had no issues running these programs however when it came to simply displaying time from a real time module thats where everything got complex
    there is also this video which goes over on how to, when I used his code it actually displayed the digits on my screen however it wasn't syncing with the time model. 
    https://www.youtube.com/watch?v=WhfvWn5oli8&t=169s 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 2 years ago in reply to Adam_A

    Could you show a photo of that? Showing the example running when connected to the Arduino? 

    Because it looks impossible. I'd like to see how they did that, and then I can learn something too.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube