Zonnestroompanelen in Nederland

duurzaamheid achter de meter

(16) – Connecting a 130×130 pixel TFT display – SSD1283A controller to an Arduino

by Floris Wouterlood – February 14, 2020

Summary
The SSD1283A is a relatively rare controller in the repertoire of Arduino compatible displays. Here we connect a 130×130 TFT display equipped with this controller to an Arduino Nano. I use a Nano here because they are small whilst still 100% Arduino Uno pin-compatible. A display-to-Arduino Nano pin mapping table is presented. Two sketches for the Arduino are provided. One is a graphics demo while the other provides a retro-analog looking temperature gauge. Both use the <LCDWIKi_GUI.h> and <LCDWIKI_SPI.h> libraries that can be downloaded from a repository at GitHub.

Introduction
Square displays can be interesting, for instance if one wants to mimic an analog watch or meter. A display with 130 pixels in x and as many pixels in y may be interesting in this respect. Most Arduino compatible displays possess pixel dimensions that are a multiple of 8, e.g., 128×64, 128×160, 240×320 or 320×480. These displays inevitably have rectangular shapes. For some applications one might favor a square display with sufficient pixel resolution. The 130×130 pixel TFT display breakout board described here is sold by several Chinese vendors. The on board controller is a SSD1283A chip. Screen diagonal is a comfortable 40 mm (1.6 inch) while the breakout board dimensions are 54×35 mm.

Wiring
Here we stick the breakout 130×130 TFT display onto a breadboard with an Arduino Nano and bring it to life. The compilation of Arduino sketch instructions to machine language that can be uploaded requires the libraries. <LCDWIKI_SPI.h> and <LCDWIKI_GUI.h>. These libraries and their user documentation can be found at GitHub (https://github.com).

figure 1: Schematic connectivity for a 130×130 pixel SPI TFT display with SSD1283A driver. The breakout TFT board has eight pins: LED, SCK, SDA, A0, RST, CS, GND and VCC. The display is a 16-bit color transflective TFT. Here the graphical demo is pictured.

figure 1: Schematic connectivity for a 130×130 pixel SPI TFT display with SSD1283A driver. The breakout TFT board has eight pins: LED, SCK, SDA, A0, RST, CS, GND and VCC. The display is a 16-bit color transflective TFT. Here the graphical demo is pictured.

Pin mapping table

on TFT breakout board pin on Arduino also indicated as:
LED 5V LED
SCL 13 SCLK
SDA 11 MOSI
A0 9 DC
RST 8 RES
CS 10 CS
VCC 5V Vcc
GND GND GND

3.3V or 5V?
This TFT breakout board is advertised by the vendor as a 3.3V device. Connected to the Arduino with all wires except GND equipped with a 220 Ω resistor in series to reduce voltage, the TFT tested here produces dim colors and a dark background. Color contrast and luminosity are much better with 5V power supplied by the Nano instead of 3.3V and controlled via the 5V pin signal outpout of the Nano. This means that this display can be connected with the any Arduino-type microcontroller board without bothering too much about voltages. This is in conflict with the vendor specifications and for that matter your own risk.

Electronics and supplies
1x Arduino Nano microcontroller board, breadboard, jumper wires, 130×130 breakout TFT display. Additional: DS18B20 sensor, 4.7 k Ω resistor.

Figure 2: The 130×130 TFT display at work with an Arduino Nano that here receives on its pin D4 data from a DS18B20 temperature sensor. Very straightforward.

Sketches
Two sketches are supplied here: a demo showing graphics that can be programmed, and a sketch that reads temperature from a DS18B20 sensor and displays the temperature on a retro-analog gauge type of meter. Both sketches need the libraries LCDWIKi_GUI.h> and <LCDWIKI_SPI.h>. The LCDWIKIs can be downloaded from repositories at GitHub (https://github.com/lcdwiki/LCDWIKI_gui) (https://github.com/lcdwiki/LCDWIKI_SPI)

Graphic functions demo sketch: nano_130x130_TFT_SSD1283A_graphic_functions.ino
– download at the end of this paper

// nano_130x130_TFT_SSD1283A_graphic_functions
// Floris Wouterlood
// 14 february 2020
// see: https://github.com/gitcnd/LCDWIKI_GUI/blob/master/Document/LCDWIKI%20GUI%20lib%20Manual.pdf
// demo of several functions suppied by the LCDWIKI.GUI
// public domain

#include <LCDWIKI_GUI.h>     // core graphics library
#include <LCDWIKI_SPI.h>    // hardware-specific library

//parameters define
#define MODEL SSD1283A
#define CS 10
#define CD 9
#define SDA 11
#define MOSI SDA
#define SCK 13
#define RST 8
#define LED -1     //if you don’t need to control the LED pin,you should set it to -1 and set it to 3.3V

LCDWIKI_SPI mylcd (MODEL,CS,CD, MISO, MOSI, RST, SCK, LED);

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

void setup()
{
mylcd.Init_LCD ();
mylcd.Fill_Screen (BLACK);
}

void loop ()
{
mylcd.Set_Text_Mode (0);

mylcd.Fill_Screen (0x0000);
mylcd.Set_Text_colour (RED);
mylcd.Set_Text_Back_colour (BLACK);
mylcd.Set_Text_Size (2);
mylcd.Print_String (“Hello World!”, 0, 0);

mylcd.Fill_Rect (20,20,20,20,YELLOW);
mylcd.Set_Draw_color (YELLOW);
mylcd.Draw_Round_Rectangle (70,70,100,100,6);
mylcd.Set_Draw_color (GREEN);

mylcd.Draw_Fast_VLine (80,80,30);
mylcd.Draw_Fast_HLine (80,80,30);

mylcd.Draw_Line (125,125,20,70);

mylcd.Draw_Circle (70,40,16);
mylcd.Draw_Circle (70,39,17);
mylcd.Draw_Circle (105,40,16);
mylcd.Draw_Circle (105,39,17);
mylcd.Set_Draw_color (WHITE);
mylcd.Fill_Circle (73,46,6);
mylcd.Fill_Circle (102,46,6);

mylcd.Set_Draw_color (CYAN);
mylcd.Draw_Triangle (5,110, 15,120,50,16);

mylcd.Set_Draw_color (MAGENTA);
mylcd.Fill_Triangle (90,125, 20,120,50,99);

mylcd.Print_String (“Hi!”,40,70);
delay (2000);
}

Temperature display sketch:
nano_DS18B20_130x130_TFT_SSD1283A.ino
too long to print here – download at the end of this paper

Discussion
The 130×130 SSD1283A TFT display performs well with an Arduino Nano. It runs on 3.3V and on 5V power supply. For the purpose of displaying temperature every pair of seconds or so the refresh speed is more than sufficient. One disadvantage of this particular TFT display is its low luminosity, making it useless in sunlight conditions.

Sketches:

nano_130x130_TFT_SSD1283A_graphic_functions.ino

nano_DS18B20_130x130_TFT_SSD1283A.ino