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 3978 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…
Parents
  • phoenixcomm
    phoenixcomm over 2 years ago

    imageIn the Smarthab project, I used a TI Stellaris LM4F120 LaunchPad, with a 32-bit CPU, and an EB-LM4F120-L35,  BosterPack. It has a 1/4 SVA LCD with Touch Sence as well and has a huge graphics library. I used the TI CSS (code composer) C compiler, but today I would instead use the Eclipse IDE. BTW you can get the display for $35 at Newark. Right parts for the right job.

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

    imageIn the Smarthab project, I used a TI Stellaris LM4F120 LaunchPad, with a 32-bit CPU, and an EB-LM4F120-L35,  BosterPack. It has a 1/4 SVA LCD with Touch Sence as well and has a huge graphics library. I used the TI CSS (code composer) C compiler, but today I would instead use the Eclipse IDE. BTW you can get the display for $35 at Newark. Right parts for the right job.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
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