Hello, I recently typed this code and connected it to a Arduino 3.5" tft shield display but it only shows a white screen, I'm not sure if it is the code or connection.
My wiring schematics:
My code:
#include <RTClib.h>
#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);
}
Results after wiring and adding the code in:
Target goal is to display time on the screen like this:
If anyone knows what's the issue or how to make this work please let me know, thanks!
Do the LCD library example sketches for that display work?
You seem to have relocated the shield pins from the standard positions. The shield is designed to plug right into the Uno, no? So why have you done that?
The display uses A4 as a RST (reset) line, that is used for SDA on the I2C bus.
You can usually disconnect the display RST from A4 and rewire it to the RESET pin on the arduino.
Ah, I did not notice your wiring. Of course the display does not work, all you have hooked up are power, the SD card socket, and the RS and RST lines to the display controller. You left all the data lines and most of the control lines for the display un-connected.
Hi David, I have tried directly plugging the display in and still nothing showed on the screen, here is a screenshot to demonstrate what happens when I connect it directly to the Arduino and connect the real time module from under.
It just flickers a black screen for a split second then returns to white. (and repeats when you press the reset button or re-connect power)

the location of the Arduino board of my project which I'm doing cannot have the display be plugged in directly so I need to use jumper wires, regardless, even plugging it in the way it should does not effect and im still greeted with a white screen.
But, shouldn't the jumper wires have a 1-1 correspondence with the pin/sockets that mate the shield to the Arduino? They don't seem to do that, in your diagram..
Have you ever tried just plugging the display into the Arduino, as it was designed?
See post #5. Whenever you use the I2C bus for the RTC, you are resetting the display. The display RST line must be disconnected from A4.
1 Like
On the Uno, the pins SCL/SDA are connected on board directly to A4/A5.
You sure? when the display is placed on top of the Arduino it leaves 2 slots on each side empty, SCL/SDA are vacant and not occupied, even if they were I do have a modified Arduino uno which allows an extra SCL/SDA connection to the board
At this point no matter what I try I can't seem to get any help on how to connect a time module, display and an Arduino uno together to just get a time reading.
When I do search online on other people who did it they ether didn't use my display or board or time module so im kind of stuck alone at this.
I didn't think it would be that complex 
The same one as in your schematic? It has all pins except for SCL/SDA, AREF and GND on the digital pin side, and includes all the analog pins on the other side.
Also you didn't answer the simple questions, did you try plugging it in and did you try library examples? Unless, I missed something...
you say
no matter what I try
but you didn't say what you tried... you should make the display work before you mess with the RTC.
In your diagram, those are connected to the RTC. As I mentioned, anything that is connected to A4 is also connected to SDA, and A5 to SCL, right on the Uno board.
You say you have a 3.7" display but the schematic shows a 3.5" display. Is it a real diagram, or fictitious? Accurate, or an approximation?
Yes! All examples work with me but when it comes to displaying time this is where stuff goes down...

(Here is one example from one of the guides I used to test my display: Absolute Beginner's Guide to TFT LCD Displays by Arduino - ElectroPeak
With or without the RTC connected? Have you run an I2C scanner sketch to see if the RTC is visible on the bus?
Can you make the display work separated with jumpers but with no RTC connected?
Need to go one step at a time...
Also have you taken action on @david_2018 suggestion?
Ignoring the diagram I did, even when I plugin the display on Arduino I get no results.
I utilized the two empty slots on the side rail SCL/SDA and connected power from the 12 hole slots I have in my modified Arduino

also It is 3.5" apologies for the error, I'll fix that
Well that should stop you in your tracks, as far as adding more stuff. Isn't it designed to plug and play in there?
You must be talking about the RTC now. You need to eschew theorizing and do some divide and conquer troubleshooting. So, display ONLY or RTC ONLY FIRST
So, when you say the display doesn't work, is that with or without the RTC connected?
Well I'm not trying to connect the RTC by it self im trying to connect both RTC and Display, my as I mentioned my goal is to simply display time on the screen.