ILI9225 TFT Possible Conflict? SOLVED

Hi all, I’m relatively new to the Arduino platform and I’m trying to make a basic MFD (Multi Function Display) for my project car.
I’ve been hacking examples and code together to make this work.
I don’t have all my sensors yet but I’m having what I believe is a conflict of some sort with my libraries.

I started on an eBay Nano and moved to my eBay Uno for more pins, but I’m using a generic ILI9225 2.2" SPI TFT display plugged into my power and analogue headers and it runs fine using various examples from the TFT_22_ILI9225 library.

I believe my issue starts in my setup where I begin my SSD1306 RTC and BMP180 sensor.
I can comment out everything besides my TFT code and my display runs all my text.
When I add just the Wire and RTC for my sensors, I get a white screen.

I’ve added prints all over to see if something was stopping my code part way but it all prints and loops as it should.
My sensors print fine and don’t seem to be having any issues.

None of my sensors have pull up resistors added by me, I’m not even sure how they work.

Does anyone here have experience with this hardware and have any help they can offer?

Cheers

//TFT Display ili9225
#include <SPI.h>
#include <TFT_22_ILI9225.h>
//RTC DC1307
#include <Wire.h>
#include <RTClib.h>
//Pressure Sensor Atmos
#include <SFE_BMP180.h>

#define TFT_RST A4
#define TFT_RS A3
#define TFT_CS A5 // SS
#define TFT_SDI A2 // MOSI
#define TFT_CLK A1 // SCK
#define TFT_LED 0 // 0 if wired to +5V directly

// Use hardware SPI (faster - on Uno: 13-SCK, 12-MISO, 11-MOSI)
//TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED);
// Use software SPI (slower)
TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_SDI, TFT_CLK, TFT_LED);

RTC_DS1307 RTC;

SFE_BMP180 pressure;

// Setup
void setup() {

Serial.begin(9600);
tft.begin();
tft.clear();
Serial.println(“TFT Load”);
Wire.begin();
Serial.println(“Wire Load”);
RTC.begin();
Serial.println(“RTC Load”);

// Check to see if the RTC is keeping time. If it is, load the time from your computer.
if (RTC.isrunning()) {
Serial.println(“RTC is running!”);
// This will reflect the time that your sketch was compiled
RTC.adjust(DateTime(DATE, TIME));
Serial.println(“RTC is updated”);
}

// Initialize the sensor (it is important to get calibration values stored on the device).

if (pressure.begin())
Serial.println(“BMP180 init success”);
else
{
Serial.println(“BMP180 init fail\n\n”);
while(1); // Pause forever.

{
randomSeed(analogRead(0));
}
}
}

// Loop
void loop() {

double hr;
double mn;

DateTime now = RTC.now();
hr = now.hour();
mn = now.minute();
if (hr<10){ // Add a zero, if necessary, as above
Serial.print(“0”);
}
Serial.print(now.hour());
Serial.print(’:’);
if (mn<10){ // Add a zero, if necessary, as above
Serial.print(“0”);
}
Serial.println(now.minute());

char status;
double T;

status = pressure.startTemperature();
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);

// Retrieve the completed temperature measurement:
// Note that the measurement is stored in the variable T.
// Function returns 1 if successful, 0 if failure.

status = pressure.getTemperature(T);
if (status != 0)
{
// Print out the measurement:
Serial.print(“temperature: “);
Serial.print(T,0);
Serial.println(” deg C”);

}
else Serial.println(“error starting temperature measurement\n”);

}
tft.setBackgroundColor(COLOR_BLACK);
tft.setFont(Terminal12x16);
tft.drawText(0, 10, " Volkswagen", COLOR_WHITE);
tft.drawText(0, 35, " Golf GTI", COLOR_WHITE);

tft.drawText(10, 65, “Boost”, COLOR_WHITE);
tft.drawText(15, 85, “15”, COLOR_RED);

tft.drawText(130, 65, “AFR”, COLOR_WHITE);
tft.drawText(123, 85, “11.0”, COLOR_RED);

tft.drawText(15, 115, “Oil”, COLOR_WHITE);
tft.drawText(15, 135, “90”, COLOR_RED);
tft.drawText(49, 135, “C”, COLOR_WHITE);

tft.drawText(110, 115, “Water”, COLOR_WHITE);
tft.drawText(118, 135, “80”, COLOR_RED);
tft.drawText(152, 135, “C”, COLOR_WHITE);
Serial.println(“Print temps”);
tft.drawChar(2, 200, (hr, “:”, mn, “”), COLOR_WHITE);
tft.drawChar(126, 200, (T,0," C"), COLOR_WHITE);
tft.drawText(160, 200, “C”, COLOR_WHITE);

tft.setFont(Terminal6x8);
tft.drawText(42, 90, “psi”, COLOR_WHITE);
//tft.drawText(42, 130, “o”, COLOR_WHITE);
//tft.drawText(145, 130, “o”, COLOR_WHITE);
//tft.drawText(153, 195, “o”, COLOR_WHITE);
Serial.println(“EOS loop”);

delay(1000);

}


This is a picture of the same display I have.

Hunterbait:
None of my sensors have pull up resistors added by me, I'm not even sure how they work.

Pull up (or down) resistors work to pull the input to a known state, usually opposite the state that the sensor would pull the input. For example, if I had a switch connecting an input on the Arduino to ground, I would want to have a 1K pull up resistor connecting the input to +5 Volts (or the same potential as the positive input on the Arduino). This way, I know that when I read the input from my sensor, I am going to get 1 of 2 values, HIGH or LOW, not somewhere in-between or random fluctuation between the two. Think of it like the spring that pushes the switch up to off when you take your finger off the button. A stronger spring will require more force to actuate the switch. A resistor with less resistance will require more opposite potential to pull the input in the opposite direction.

I ended up making everything work, I tweaked code for a few hours and ran my screen through hardware SPI.
I had issues where I’d tried to use drawChar instead of changing my doubles to strings and printing them as text.
Besides that I just had to fiddle a little with how I’d declared my strings and doubles.

Hopefully this helps someone in the future.

//TFT Display ili9225
#include <SPI.h>
#include <TFT_22_ILI9225.h>
//RTC DC1307
#include <Wire.h>
#include “RTClib.h”
//Pressure Sensor Atmos
#include <SFE_BMP180.h>

/*#define TFT_RST A4
#define TFT_RS A3
#define TFT_CS A5 // SS
#define TFT_SDI A2 // MOSI
#define TFT_CLK A1 // SCK
#define TFT_LED 0 // 0 if wired to +5V directly
*/

#define TFT_RST 8
#define TFT_RS 9
#define TFT_CS 10 // SS
#define TFT_SDI 11 // MOSI
#define TFT_CLK 13 // SCK
#define TFT_LED 3 // 0 if wired to +5V directly

// Use hardware SPI (faster - on Uno: 13-SCK, 12-MISO, 11-MOSI)
TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED);
// Use software SPI (slower)
//TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_SDI, TFT_CLK, TFT_LED);

RTC_DS1307 rtc;

SFE_BMP180 pressure;

// Setup
void setup() {

Serial.begin(9600);
tft.begin();
Wire.begin();
rtc.begin();

// Check to see if the RTC is keeping time. If it is, load the time from your computer.
if (rtc.isrunning()) {
Serial.println(“RTC is running!”);
// This will reflect the time that your sketch was compiled
rtc.adjust(DateTime(DATE, TIME));
Serial.println(“RTC is updated”);
}

// Initialize the sensor (it is important to get calibration values stored on the device).

if (pressure.begin())
Serial.println(“BMP180 init success”);
else
{
Serial.println(“BMP180 init fail\n\n”);
while(1); // Pause forever.

{
randomSeed(analogRead(0));
}
}
}

// Loop
void loop() {

DateTime now = rtc.now();

if (now.hour()<10){ // Add a zero, if necessary, as above
Serial.print(“0”);

}
Serial.print(now.hour());
Serial.print(’:’);
if (now.minute()<10){ // Add a zero, if necessary, as above
Serial.print(“0”);
}
Serial.println(now.minute());

char status;
double T;
double hr(now.hour());
double mn(now.minute());
String hrS(hr,0);
String mnS(mn,0);
String tS(T,0);

status = pressure.startTemperature();
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);

// Retrieve the completed temperature measurement:
// Note that the measurement is stored in the variable T.
// Function returns 1 if successful, 0 if failure.

status = pressure.getTemperature(T);
if (status != 0)
{
// Print out the measurement:
Serial.print(“temperature: “);
Serial.print(T,0);
Serial.println(” deg C”);

}
else Serial.println(“error starting temperature measurement\n”);

}
tft.setBackgroundColor(COLOR_BLACK);
tft.setFont(Terminal12x16);
tft.drawText(0, 10, " Volkswagen", COLOR_WHITE);
tft.drawText(0, 35, " Golf GTI", COLOR_WHITE);

tft.drawText(10, 65, “Boost”, COLOR_WHITE);
tft.drawText(15, 85, “15”, COLOR_RED);

tft.drawText(130, 65, “AFR”, COLOR_WHITE);
tft.drawText(123, 85, “11.0”, COLOR_RED);

tft.drawText(15, 115, “Oil”, COLOR_WHITE);
tft.drawText(15, 135, “90”, COLOR_RED);
tft.drawText(49, 135, “C”, COLOR_WHITE);

tft.drawText(110, 115, “Water”, COLOR_WHITE);
tft.drawText(118, 135, “80”, COLOR_RED);
tft.drawText(152, 135, “C”, COLOR_WHITE);

tft.setFont(Terminal6x8);
tft.drawText(42, 90, “psi”, COLOR_WHITE);
tft.drawText(42, 130, “o”, COLOR_WHITE);
tft.drawText(145, 130, “o”, COLOR_WHITE);
tft.drawText(154, 194, “o”, COLOR_WHITE);

tft.setFont(Terminal12x16);
tft.drawText(3, 200, (hrS), COLOR_WHITE);
tft.drawText(29, 200, (":"), COLOR_WHITE);
tft.drawText(41, 200, (mnS), COLOR_WHITE);
tft.drawText(126, 200, (tS), COLOR_WHITE);
tft.drawText(160, 200, “C”, COLOR_WHITE);

delay(1000);
//while(true);

}

Do you have any videos or diagrams of your setup?

What vw is it in? Cheers!!
Gavin