TFT Graphics for “Tiny” Microcontrollers
David Johnson-Davies' lightweight TFT graphics library can run on processors such as the ATtiny45, ATtiny402, and ATtiny412.
Running a TFT or OLED display is an important part of many Arduino/microcontroller projects. You might, however, assume that a minuscule processor like the ATtiny45 just doesn’t have the horsepower for such a task. As it turns out, that’s not actually the case, thanks to David Johnson-Davies’ Compact TFT Graphics Library.
This piece of code – avaialble on GitHub – occupies less than 4kB of of memory, meaning that it can reside on the ATtiny45, ATtiny402, ATtiny412, and more. Functionality includes point and line plotting, and the ability to draw rectangles and characters, all in a 16-bit (total) color implementation – five bits for red, five for blue, and six for green. It works with a variety of screens available from Adafruit and AliExpress, and it can be modified to suit other devices as needed.
Screen interface is via SPI, so you’ll need to occupy four of your microcontoller’s pins for the task–as well as voltage and ground. Admittedly, this leaves only a single pin for interface on many miniature eight-pin microcontrollers.
Such a processor could, though, be used as a static display. Or, as noted in the comments on Johnson-Davies' Technoblogy intro, it would also be possible to read an ATtiny402’s internal temperature sensor for charting. A PIR sensor-based display would be another option, and who knows what else industrious hackers will come up with using this library?