ILI9163C 128x128 TFT driver

Status
Not open for further replies.
Hey guys! after messing around with the library and the code quite a bit I got the TFT working with an Arduino Nano. I have a eBay $4 knockoff Arduino Nano and the red version of the TFT.

Pins : (TFT => Arduino)

SCK => 13 (D13),
SDA => 11 (D11),

CS => 7 (D7),
DC => 9 (D9),
RST => 8 (D8),

I also changed this line:

TFT_ILI9163C tft = TFT_ILI9163C(__CS, __DC, 23);

to

TFT_ILI9163C tft = TFT_ILI9163C(__CS, __DC, __RST);

and used

#define __RST 8

Other than those pins I just used 3v3 for power and LED (LED w/ resistor).

I hope this helps anyone who is having issues getting it working! This setup should apply exactly the same for any Arduino with the ATmega328 chips (Nano, Uno, Pro Mini etc).
Email me if you have any questions! Thanks!
 
even though this thread is kinda old, i have got this library to work natively with the teensy audio library! :)

portable media player anyone? :D
 
Last edited:
Thank You - This new library port is appreciated.

I wonder if there could possibly be a typo in your readme.md in the "Pay Attention to connections" section.

You say
"- Teensy 3 and LC cannot use any pin for CS and RS(DC) but should be choosen as follows:

pins:2,6,9 or 10,15 or 20,13 for CS and RS."

Since pin 13 is usually SPI SCK... Perhaps you intended to say ... "20,21 for CS and RS." ?????
 
even though this thread is kinda old, i have ported this library to work natively with the teensy audio library! (example included)

An PJRC Audio board compatible version, updated and faster version (even SPI transaction compatible) than old one exist already:

Link

UPDATE
Looking your ported library, it's looks the same link above, bit per bit...





 
Last edited:
well, somehow mine didn't work, i had to replace these functions:

writecommand_cont
writedata8_cont
writedata16_cont

writecommand_last
writedata8_last
writedata16_last

note that i'm using the sd and tft on the same spi line.
 
Starting and stopping SPI transactions for each piece of data is probably much less efficient than starting before an entire command and ending afterwards.
 
It's possible, you have to modify all SPI functions to parallel. Did you consider buy an SPI version from china market? Have seen as low as 3US time ago! Probably it cost 1 US more than a shift register...
 
those spi based ones are as low as 3.19USD (free international shipment)

ebay link: ebay.com/itm/141196897388
 
I might try getting this one working. I didn't even realize the incompatibility when I researched the part; I just found lcd with controller 'x' and googled library for controller 'x' and thought, "perfect."
Looking at the controller's datasheet was a bit of an eye opener for me.

I'm definitely going to purchase an SPI version, it seems there's loads available from aliexpress as well: aliexpress.com/wholesale?catId=0&initiative_id=SB_20151126093518&SearchText=ILI9163C
 
Hi sumotoy,

I am planning to get the TFT LCD and links it with a temperature sensor using an Arduino UNO. Can the LCD reads and displays the reading collected from the temperature sensor? I am not familiar with SPI screen, thanks lot if you could help.
 
20160412_145256.jpg20160412_145248.jpg

I use the same lcd, and the code you have posted here, But i have a problem my lcd is a part where the screen seems like it doesn't work, maybe i have a error with the code?
Could you help me ?
Thanks


Code:
/* Binary sketch size: 10,188 bytes (of a 30,720 byte maximum)
   Tested and documented by M. Ray Burnette 20140812
   Compiled with Arduino 1.0.5 for Arduino Nano (clone)
   WARNING: direct GLCD wiring requires that Arduino run at 3.3 Volts maximum!
*/
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <TFT_ILI9163C.h>

// All wiring required, only 3 defines for hardware SPI on 328P
#define __DC 9
#define __CS 10
// MOSI --> (SDA) --> D11
#define __RST 12
// SCLK --> (SCK) --> D13

// Color definitions
#define	BLACK   0x0000
#define	BLUE    0x001F
#define	RED     0xF800
#define	GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0  
#define WHITE   0xFFFF

TFT_ILI9163C tft = TFT_ILI9163C(__CS, __DC, __RST);

void setup() {
  tft.begin();
}

void loop(){
  testLines(random(0x00ff,0xffff));
  delay(100);
  testText();
  delay(5000);
}


unsigned long testText() {
  tft.fillScreen();
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(WHITE);  
  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(YELLOW); 
  tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(RED);    
  tft.setTextSize(3);
  tft.println(0xDEAD, HEX);
  tft.println();
  tft.setTextColor(GREEN);
  tft.setTextSize(4);
  tft.println("Hello");
  return micros() - start;
  delay(5000);
}

unsigned long testLines(uint16_t color) {
  tft.fillScreen();
  unsigned long start, t;
  int           x1, y1, x2, y2,
  w = tft.width(),
  h = tft.height();
  tft.fillScreen();
  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t     = micros() - start; // fillScreen doesn't count against timing
  tft.fillScreen();
  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;
  tft.fillScreen();
  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;
  tft.fillScreen();
  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  return micros() - start;
}
 
I fixed editing the file TFT_ILI9163C_settings.h and I set #define __144_BLACK_PCB__//128x128

That's all for me.

Thank you again.
 
Ok, looks like a new strain of the Red PCB display it's spreading all over, it looks exact like the old Red PCB one, same text on the back but display has no text around border, it's a bit smaller than common one and it uses yellow pins (but this can change in future). It works in rotation 0,1 but NOT in 2,3 and I even not sure it uses ILI9163C!!! I got one of this display just today but many users complain not working well with current library in rotation 2,3, this is what I want discover in these days.
Some vendor says it's a ST7735, most says ILI9163C and others II9165(!). If you have projects that needs rotation 2 or 3 please consider that I still try to figure out what controller it uses!!!
UPDATE
It doesn't like to use ILI9163C, many commands shows a small offset and react strange on slide, also a couple of commands does nothing (but RED,BLACK,BLUE and old version yes)
 
I solved the problem with thes new RED PCB Yellow Pin display, tomorrow (sunday 17,4,2016) I will post 1.0r6 that include this display and has an updated structure to support easily any type of incoming chinese strain.
 
It's already done, it's a quite large update, there's still some minor tuning on color parameters (different between display's) but today I definetively release it.
 
Version 1.0r6 online, as always Teensy fly with this!
Library mostly redesigned, now display's are in separate files and it's easy to handle any possible future strain.

UPDATE
Paul, can you use the latest 1.0r6 for future Teensyduino releases? It works much better and has support for the new yellow pin display, impossible with old version.
GitHub page
 
Last edited:
Thank's sumotoy I try the new library but I think maybe I have a error . What do you think ? See when make the scroll

 
Easy to fix, just need to know what display you have and if you used the scroll example of the library (and rotation 0?)...
 
Last edited:
Status
Not open for further replies.
Back
Top