arduino:displays_for_classic_arduinos:1.8_and_1.44_tft_displays_and_classic_arduinos
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
arduino:displays_for_classic_arduinos:1.8_and_1.44_tft_displays_and_classic_arduinos [2018/01/28 01:54] – [Arduino TFT library] mithat | arduino:displays_for_classic_arduinos:1.8_and_1.44_tft_displays_and_classic_arduinos [2018/01/31 04:53] – mithat | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Summary evaluation ===== | ===== Summary evaluation ===== | ||
- | Small 1.8" (160x128) and 1.44" (128x128) TFT displays with ST7735 controllers have been available for a while now. They are only slightly more expensive than the very inexpensive [[arduino: | + | Small 1.8" (160x128) and 1.44" (128x128) TFT displays with ST7735 controllers have been [[https:// |
- | One of the concerns with with TFT displays is that they are data gluttons, | + | One of the concerns with with TFT displays is that they are data gluttons, |
Unfortunately, | Unfortunately, | ||
Line 11: | Line 11: | ||
The results are a bit of a disappointment because the displays are otherwise incredibly charming. | The results are a bit of a disappointment because the displays are otherwise incredibly charming. | ||
- | ===== Libraries | + | ===== Tests ===== |
- | These are the libraries I know of that let you interface to a ST7735-based display. | + | I ran a number of tests using all the libraries I know of that let you interface to a ST7735-based display. |
==== Ucglib ==== | ==== Ucglib ==== | ||
Line 34: | Line 34: | ||
=== Transparent font rendering === | === Transparent font rendering === | ||
- | {{youtube> | + | {{youtube> |
{{youtube> | {{youtube> | ||
Line 59: | Line 59: | ||
The Adafruit library with its default font performs and looks almost the same as the Arduino TFT library. | The Adafruit library with its default font performs and looks almost the same as the Arduino TFT library. | ||
- | FIXME video | + | {{youtube> |
- | <file c++ display_st7735_1.44_adafruit_st7735.ino> | + | [[display_st7735_1.44_adafruit_st7735.ino |
- | /* | + | |
- | * display_st7735_1.44_adafruit_st7735.ino | + | |
- | | + | |
- | * Test screen update speed with large default fonts on | + | |
- | * a 128x128 TFT screen that uses the ST7735 chip. | + | |
- | * | + | |
- | * Consumes 26% of program storage space and | + | |
- | * 6% of dynamic memory on a Pro Mini. | + | |
- | * | + | |
- | * Mithat Konar | + | |
- | */ | + | |
- | + | ||
- | #include < | + | |
- | #include < | + | |
- | #include < | + | |
- | + | ||
- | /* | + | |
- | * Pin assignments: | + | |
- | * RST: 8 | + | |
- | * CE/CS/SCE: 10 | + | |
- | * DC/" | + | |
- | * DIN/ | + | |
- | * CLK/ | + | |
- | * VCC: 3.3V | + | |
- | * LIGHT/LED: ground through 1 ohm resistor (yields about 20mA) | + | |
- | * GND: ground | + | |
- | */ | + | |
- | + | ||
- | const unsigned int CLOCK_PIN = 13, | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | const unsigned int TOP_MARGIN = 32; // number of pixels you need to shift for 128x128 screen | + | |
- | + | ||
- | // Use hardware SPI. | + | |
- | Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, | + | |
- | unsigned int counter = 80; | + | |
- | + | ||
- | void setup(void) { | + | |
- | // mfk note: neither initializer below works for the 128x128 | + | |
- | tft.initR(INITR_BLACKTAB); | + | |
- | // tft.initR(INITR_144GREENTAB); | + | |
- | + | ||
- | tft.fillScreen(ST7735_BLACK); | + | |
- | tft.setTextWrap(false); | + | |
- | + | ||
- | tft.setCursor(0, | + | |
- | tft.setTextSize(1); | + | |
- | tft.setTextColor(ST7735_WHITE); | + | |
- | tft.setTextWrap(true); | + | |
- | tft.print(" | + | |
- | } | + | |
- | + | ||
- | void loop() { | + | |
- | tft.setTextSize(7); | + | |
- | + | ||
- | // draw over what you wrote last time | + | |
- | tft.setCursor(0, | + | |
- | tft.setTextColor(ST7735_BLACK); | + | |
- | tft.print(counter); | + | |
- | + | ||
- | // update and draw something new | + | |
- | counter++; | + | |
- | tft.setCursor(0, | + | |
- | tft.setTextColor(ST7735_WHITE); | + | |
- | tft.print(counter); | + | |
- | + | ||
- | // inherent frame rate of this loop is about 15 fps w/o added delay (8 MHz processor). | + | |
- | delay(500); | + | |
- | } | + | |
- | + | ||
- | </ | + | |
=== Fancy large font === | === Fancy large font === | ||
Line 141: | Line 67: | ||
When a large fancy font is used, the performance between the Adafruit library and Uclib narrows. I suspect that with a font as large as that used in the Uclib examples, the results would be close to identical. Which is to say, not fast (or light?) enough. | When a large fancy font is used, the performance between the Adafruit library and Uclib narrows. I suspect that with a font as large as that used in the Uclib examples, the results would be close to identical. Which is to say, not fast (or light?) enough. | ||
- | FIXME video | + | {{youtube>6VZFaBHWOzE? |
- | + | ||
- | <file c++ display_st7735_1.44_adafruit_st7735_fonts.ino> | + | |
- | /* | + | |
- | * display_st7735_1.44_adafruit_st7735_fonts.ino | + | |
- | | + | |
- | * Test screen update speed with large fancy font on | + | |
- | * a 128x128 TFT screen that uses the ST7735 chip. | + | |
- | * | + | |
- | * Consumes 53% of program storage space and | + | |
- | * 6% of dynamic memory on a Pro Mini. | + | |
- | * | + | |
- | * Mithat Konar | + | |
- | */ | + | |
- | + | ||
- | #include < | + | |
- | #include < | + | |
- | #include < | + | |
- | #include < | + | |
- | + | ||
- | /* | + | |
- | * Pin assignments: | + | |
- | * RST: 8 | + | |
- | * CE/CS/SCE: 10 | + | |
- | * DC/" | + | |
- | * DIN/ | + | |
- | * CLK/ | + | |
- | * VCC: 3.3V | + | |
- | * LIGHT/LED: ground through 1 ohm resistor (yields about 20mA) | + | |
- | * GND: ground | + | |
- | */ | + | |
- | + | ||
- | const unsigned int CLOCK_PIN | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | const unsigned int TOP_MARGIN = 32; // number of pixels you need to shift for 128x128 screen | + | |
- | + | ||
- | // Use hardware SPI. | + | |
- | Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, | + | |
- | unsigned int counter = 80; | + | |
- | + | ||
- | void setup(void) { | + | |
- | // mfk note: neither initializer below works for the 128x128 | + | |
- | tft.initR(INITR_BLACKTAB); | + | |
- | // tft.initR(INITR_144GREENTAB); | + | |
- | + | ||
- | tft.fillScreen(ST7735_BLACK); | + | |
- | tft.setTextWrap(false); | + | |
- | + | ||
- | tft.setCursor(0, TOP_MARGIN); | + | |
- | tft.setTextSize(1); | + | |
- | tft.setTextColor(ST7735_WHITE); | + | |
- | tft.setTextWrap(true); | + | |
- | tft.print(" | + | |
- | + | ||
- | tft.setFont(& | + | |
- | } | + | |
- | + | ||
- | void loop() { | + | |
- | // draw over what you wrote last time | + | |
- | tft.setCursor(0, | + | |
- | tft.setTextColor(ST7735_BLACK); | + | |
- | tft.print(counter); | + | |
- | // update and draw something new | + | [[display_st7735_1.44_adafruit_st7735_fonts.ino | source code]] |
- | counter++; | + | |
- | tft.setCursor(0, | + | |
- | tft.setTextColor(ST7735_WHITE); | + | |
- | tft.print(counter); | + | |
- | + | ||
- | // inherent frame rate of this loop is about 2.5 fps w/o added delay (8 MHz processor). | + | |
- | delay(500); | + | |
- | } | + | |
- | </ |
arduino/displays_for_classic_arduinos/1.8_and_1.44_tft_displays_and_classic_arduinos.txt · Last modified: 2018/01/31 04:55 by mithat