Posted on

KNACRO 2.2-inch Arduino module LCD color screen TFT SPI serial interface module, support UNO, R3 development board

  • Support all kinds of Arduino microcontroller line, without any wiring.
  • The integrated voltage regulator IC, supports 5V or 3.3V power supply
  • On-board level translation programs truly perfectly compatible 5V / 3.3V IO level, supports a variety of single-chip IO connection.
  • The integrated backlight control circuit, can be controlled on-off or PWM dimming.
  • The integrated SD card expansion circuit,Reserved SPI FLASH font circuits to facilitate the expansion application.

BUY LINK:

KNACRO 2.2-inch Arduino module LCD color screen TFT SPI serial interface module, support UNO, R3 development board
KNACRO 2.2-inch Arduino module LCD color screen TFT SPI serial interface module, support UNO, R3 development board

DOWNLAOD:Library

Support all kinds of Arduino microcontroller line, without any wiring.
The integrated voltage regulator IC, supports 5V or 3.3V power supply.
On-board level translation programs truly perfectly compatible 5V / 3.3V IO level, supports a variety of single-chip IO connection.
The integrated backlight control circuit, can be controlled on-off or PWM dimming.
The integrated SD card expansion circuit,Reserved SPI FLASH font circuits to facilitate the expansion application.
Screen size:: 2.2 inch .
Resolution: 176 * 220.
Driver IC: ILI9225.
Size:68 * 42 * 12 mm / 2.68 * 1.67 * 0.47 in ( L * W * H).
Weight:20g/0.7oz.
Integrated voltage regulator IC, support 3.3V / 5V power supply.
Integrated level converter IC, compatible with 3.3V / 5V data levels.
Integrated SD card and SPI FLASH extended data.
Integrated backlight control circuit.

ARDUINO CODE:

#include <SD.h>
#include <UTFT.h>
/*
* LCD Setup
* KNACRO 2.2-inch Arduino module LCD color screen
* TFT SPI serial interface module, support UNO,
* R3 development board
* B01GFSWW9C
* Driver IC: ILI9225.
* SD card with arduino dashboard using SPI bus connection
* MOSI – to pin 11 UNO
* MISO – to pin 12 UNO
* CLK – to pin 13 UNO
* CS – to pin 4 UNO
* Due to the fact Storage is only 32256 bytes on this board
* we use a slimed down version of UTFT
* as such any updated libs that rely on the complete UTFT lib will not compile
*
* Pins for ELEGOO UNO R3 to pins for KNACRO 2.2-inch Arduino module LCD color screen
* This board plugs directly into UNO R3 using power and analog (A0-A5)
* pin 1 VCC to UNO 5v
* pin 2 GND to UNO GND[0] (next to 5v)
* pin 3 GND to UNO GND[1] (next to above GND
* pin 4 to UNO VIN
* pin 5 (free pin no connections)
* pin 6 to UNO A0
* pin 7 to UNO A1
* pin 8 to UNO A2
* pin 9 to UNO A3
* pin 10 to UNO A4
* pin 11 to UNO A5
* )
*/
#define SD_CHIP_SELECT 4 // SD_CS to pin 4 UNO
// Global vars here total 2048 memory allowed
// Declare which fonts we will be using
extern uint8_t SmallFont[];
//QD220A is for QDtech 2.2inch SPI LCD Module,Driver IC:ILI9225
UTFT myGLCD(QD220A,A2,A1,A5,A4,A3);   // Remember to change the model parameter to suit your display module!
byte _top = 0;
byte _left = 0;
byte _width;
byte _height;
byte _fontWidth;
byte _fontHeight;
byte _hudDescHeight = 13;
byte _lastPrintLine;
byte _indent = 3;
byte _lastLineWritten = _hudDescHeight + 6;
byte _backGround[] = {0, 0, 0};
byte _textColor[] = {255, 255, 255};
File root;
// End Global vars
// Remainder of program total memory use allowed 32256
void setup() {
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);

// Gather the font and screen data
_fontWidth = myGLCD.getFontXsize();
_fontHeight = myGLCD.getFontYsize();
_width = myGLCD.getDisplayXSize();
_height = myGLCD.getDisplayYSize();
_lastPrintLine = 161 – _fontHeight;

Clear();
DrawPrintBorder(255, 255, 255);

Serial.begin(9600);
pinMode(10, OUTPUT);
PrintLine(“LCD Init : Success”, CENTER);

if(SdIsPresent())
{
root = SD.open(“/”);
PrintLine(“SD Card Init : Success”, CENTER);
}
else PrintLine(“SD Card Init : Failed”, CENTER);
}
void loop() {
}
void PrintLine(const char* msg, int align, int lineNum)
{
myGLCD.print(msg, align, lineNum);
}
void PrintLine(const char* msg, int align)
{
// first calculate the next line to print on
byte lineNum = _lastLineWritten + _fontHeight;
if(lineNum < _hudDescHeight)
lineNum = _hudDescHeight + 6;

if(lineNum >= _lastPrintLine)
{
ClearPrintArea(0,0,0);
lineNum = _hudDescHeight + 6;
}

myGLCD.setBackColor(_backGround[0], _backGround[1], _backGround[2]);
myGLCD.setColor(_textColor[0],_textColor[1], _textColor[2]);
myGLCD.print(msg, align, lineNum);
_lastLineWritten += _fontHeight;
if(_lastLineWritten > _lastPrintLine)
_lastLineWritten = _hudDescHeight + 6;
}
void Clear()
{
// Setup the LCD
myGLCD.clrScr();
// Draw Hud
ClearHUDInfoArea(80, 80, 80);
// Lines to print on 1 – 163 1 being top, 163 being bottom of LCD
PrintLine(“** DRONE LCD HUD DISPLAY **”, CENTER, 1);
DrawContactArea(0, 64, 64);
}
void DrawPrintBorder(byte r, byte g, byte b)
{
myGLCD.setColor(r, g, b);
myGLCD.drawRect(0, 14, 219, 161);
}
void DrawContactArea(byte r, byte g, byte b)
{
myGLCD.setColor(r,g,b);
PrintLine(“> [e-mail address removed] <“, CENTER, 163);
}
void ClearHUDInfoArea(byte r, byte g, byte b)
{
myGLCD.setColor(r, g, b);
myGLCD.fillRect(0, 0, _width, _hudDescHeight);
}
void ClearContactArea(byte r, byte g, byte b)
{
myGLCD.setColor(r,g,b);
myGLCD.fillRect(0, 162, 219, 175);
}
void ClearPrintArea(byte r, byte g, byte b)
{
myGLCD.setColor(r, g, b);
myGLCD.fillRect(1, 15, 218, 160);
}
bool SdIsPresent()
{
return SD.begin(SD_CHIP_SELECT);
}

Leave a Reply

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