One of the very exciting possibilities when using an MCU is driving an LCD, OLED or TFT display module. In the recent years, the industry has produced a growing kind of modules:

Narrow with OLED lines

Narrow with 0.49″ OLED

  • LCD, OLED, TFT, E-paper
  • I2C or SPI interface
  • Power supply in 5V, 3.3V or both
  • From 0.49″ up to 12″, from 64×32 pixels to 800×600 pixels, and more
  • Very compact, light weighted.

So there really is nothing more attractive than adding one of these modules to a project. One downside is that most MCUs were not conceived for this highly memory consuming application. But, fortunately the Atmega644 and Atmeg1284 are the 8 bits high end devices offering a sizeable quantity of memory, and thus are appropriate to drive such colour displays up to 240×240 pixels and more.

In this tutorial, we will present 3 possible implementations.

Prerequisite to using an OLED or TFT module

The problem of using such displays can be broken down into

  • Physical connections between the MCU/board and the display module

    • When using I2C, the display will be connected to
      • GND
      • VCC: 5V or 3.3V depending on the module specifications. Most modules will be 3.3V and 5V tolerant.
      • SCL: the I2C clock, that must be pulled-up to VCC with an appropriate 1KOhm to 10 KOhm resistor. These resistors are often already implemented on the module. For a theoretical explanation, see
      • SDA: the I2C data line. Must be pulled-up to VCC

Usually I2C lines will be connected to hardware I2C pins of the MCU but software I2C might also be used. If the display is not powered at the same voltage as the MCU/Board, it might be necessary to add a level shifter. See

    • When using SPI, the display will be connected with
      • GND
      • VCC: 5V or 3.3V depending on the module specifications. Most modules will be 3.3V and 5V tolerant
      • SCK: often marked “SCL” (or maybe CK etc) on the module. It usually will be connected to the SPI SCK hardware pin for best performance, or another digital I/O pin if the driver supports software SPI.
      • MOSI: often marked “SDA”. It can be connected to hardware or software SPI MOSI pin of the MCU.
      • RES: reset
      • DC: data/command
      • CS: chip select. SPI does not use a logic address to identify the peripheral but one line per device. On some modules this pin is omitted (see after the 1.3″ 240×240 module)
      • BLK: backlight. Unconnected or pulled up to VCC will enable the rendering. Putting to low renders the device black
  • Hardware support library (driver)

You will need a specific driver to communicate with the graphic chip implemented on the module. Most modules are using the same chips but you will need to check it on the product description or the datasheet. In the next examples the TFT module is driven by an ST7789 chip and the OLED is driven by an SSD1306 chip.

You will probably find an appropriate driver on

  • Graphic class library

Then you will need a library that exposes a graphic class to allow you to print things easily with commands like

tft.print(“The text I always wanted to print”)

Some libraries will include the driver and the graphic class all in one.

Text and shape drawing using Adafruit libraries, 644 Narrow board and a 240×240 1.3″ colour TFT display.

Following the theory exposed above:

  • The 1.3″ 240×240 colour TFT modules with 7 pins (8 pins modules are also available) must be connected to:
    • GND: to one of the “GN” board pin
    • VCC: to the “5V” pin
    • SCL: to the SCK pin (ICSP connector pin 3). You can also use a software SPI pin
    • SDA: to the MOSI pin (ICSP connector pin 4). You can also use a software SPI pin
    • RES: to pin 14 (or any other digital I/O pin to #define in the sketch)
    • DC: to pin 13 (or another I/O)
    • BLK: left floating or connected to VCC

Narrow TFT connection

  • You have to install in the Arduino IDE these libraries
      • “Adafruit ST7735 and ST7789 Library”
      • “Adafruit GFX Library”

You should get this


Advanced text rendering on a tiny 0.49″ 64×32 OLED using SSD1306Ascii library by greiman and a 1284 Narrow board

Here we will use a 0.49″ 64×32 OLED soldered on the Narrow board. So you don’t have to worry about the physical connection to the board.

  1. Simply install the library SSD1306Ascii by Bill Greiman from the Arduino IDE. This library includes both the driver and the graphic class. Being specialized for the SSD1306, it implements all its text rendering functionalities and is lighter and faster than other libraries. So it is particularly suited if you need to print only text but would like to have a lot of control over text rendering and save resources.
  2. Load to your board the sketch with comments Graphicstest_SSD1306Ascii_Narrow_OLED_0.49.ino

You should get this


Heavy bitmap rendering on a 240×240 1.3″ colour TFT display using ST7789_Fast library by cbm80amiga and a 1284 Narrow board

balloon 145

In this example we will show the memory capabilities of Narrow boards. Since Arduino arrays can’t be bigger than 32 KB, we have prepared this bitmap that stores on a little more than 31 KB of flash. It was saved in .bmp 16 bits “R5 G6 B5” format and transformed into an array of 16 bits hexadecimal data with the software The array was saved in the file “bitmap.h” referenced in the script.

This sketch uses an optimised driver and the Adafruit GFX graphics class. So you will need to

You should get this

You can see how fast the image is displayed. The smooth scrolling is because the library exploits the hardware scrolling capabilities. There isn’t any data sent from the MCU while scrolling.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *