Go Down

Topic: UTFT library with R61581 and 3.6" TFT 400x270 (Read 658 times) previous topic - next topic

George Matthews

Feb 21, 2015, 06:26 pm Last Edit: Feb 21, 2015, 08:34 pm by George Matthews
Empty as prior draft was posted as well as latest draft that follows.

George Matthews

I recently purchased a 400x270 3.6" TFT display shield for Mega2560.
It uses a R61581 driver chip. Be aware that others have found different driver chips installed.

After reading many threads, and trying many settings, it became obvious that the UTFT library was not setup for this board. The screen was mirror inverted, and flickered horribly.
I have managed to get the display to work properly... except it is not bright enough.
The hardware brightness using PWM is not used on this display shield.

When I upload new code to my mega2560, the white screen presented during reset is about four times brighter. This leads me to believe there is something not right with the UTFT  myGLCD.clrScr(); and or the RGB layers added to a base brightness value.

Anyone have similar experience?

I found a data sheet for the R61581 here, and used it to modify the r61581/initlcd.h file.
This link to Dropbox is the modified UTF Library.

Code: [Select]

// UTFT_Demo

// This demo was made for modules with a screen resolution
// of 400x270 pixels.
// This program requires the attached UTFT library.

#include <Arduino.h>
#include <Streaming.h>   // Serial.print alternative

#include <UTFT.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];
// extern uint8_t LargeFont[];
// extern uint8_t hallfetica_normal[];

// Set the pins to the correct ones for your development shield
// ------------------------------------------------------------

// Arduino Mega:
// -------------------
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Mega      : <display model>,38,39,40,41
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(R61581,38,39,40,41);

//Don't need these
#define DISABLE_HX8347A
#define DISABLE_HX8352A
#define DISABLE_ILI9327
#define DISABLE_SSD1289
#define DISABLE_ILI9325C
#define DISABLE_ILI9325D
#define DISABLE_ILI9325D_ALT
#define DISABLE_HX8340B_8
#define DISABLE_HX8340B_S
#define DISABLE_ST7735
#define DISABLE_ST7735_ALT
#define DISABLE_S1D19122
#define DISABLE_PCF8833
#define DISABLE_SSD1963_480
#define DISABLE_SSD1963_800
#define DISABLE_SSD1963_800_ALT
#define DISABLE_S6D1121
#define DISABLE_ILI9481
#define DISABLE_S6D0164
#define DISABLE_ST7735S
#define DISABLE_ILI9341_S4P
#define DISABLE_ILI9341_S5P
#define DISABLE_ILI9486
#define DISABLE_HX8353C

void setup()
// Setup the LCD

  //Serial <<  R61581_ALT << endl;
  //Serial <<  myGLCD.getDisplayXSize() << endl;
  //Serial <<  myGLCD.getDisplayYSize() << endl;
 // Serial <<  myGLCD.getxFerMode() << endl;
 // Clear the screen and draw the frame

//  myGLCD.lcdOff();
//  myGLCD.setBrightness(255);
//  myGLCD.lcdOn();
  myGLCD.print("1234567890123456789012345", LEFT, 224);

void loop()
  // Do nothing


Feb 22, 2015, 08:53 pm Last Edit: Feb 22, 2015, 08:59 pm by avr_fred Reason: added link
What leads you to believe is is 400x270?  I'd bet it is anything but.

400x240 or 480x320 are the two different resolutions that board has appeared in. The R61581 version is typically 480x320 and can usually be identified by counting the resistor sip packs on the back of the board - IIRC it has 8 10k sips. The 400x240 has an ili9327 chip with 6 each 10k resistor sip packages on the back of the board.

The 480x320 display is setup with a 16 bit data path, the 400x240 is 8 bit which explains why the 480x320 board needs two extra resistor packs as there are 4 resistors per pack, all in series with the data lines. In either case UTFT will need mods to work correctly with the boards. I have a modified version of UTFT that works with the 400x240 board, you can find a copy on a previous thread about these boards. http://forum.arduino.cc/index.php?topic=282144.msg1982590#msg1982590

George Matthews

My board has 7 10k packs in a row and two others off to the side.
The seller says it is 400x270, but I now know from drawing rectangles it is definitely 400x240.

I definitely have the R61581 chip and 16 bit. It is the only init that would work at all.
I initially tried your modified UTFT but as I said it is not a ILI93278.

My remaining problem is a very dim display.


Also bought the same board lately. I tested with some libraries available on the internet, however I did not succeed with any of them.

George Matthews

rdinallo  Did you try the library I linked to in my second message?


I tried, however also did not work. The screen is all white.

Some display problems were caused by insufficient power supply, probably you've tried that already?


Apr 14, 2015, 02:32 pm Last Edit: Apr 15, 2015, 07:54 am by biablo
George Matthews!  I bought   R61581 and 3.6" 400x270 TFT   LCD from this link http://www.aliexpress.com/item/Free-shipping-LCD-module-TFT-3-5-inch-TFT-LCD-screen-for-Arduino-MEGA2560-Board/1766509567.html?spm=

It was developed by www.mcufriend.com
It's not officially supported by UTFT.
It arrives at home in 24 hours. I will test it tommorow.  I will test it soon.


Apr 15, 2015, 07:49 am Last Edit: Apr 15, 2015, 08:16 am by biablo
In my case when I run example code with "UTFT myGLCD(R61581,38,39,40,41); //modified code", it flickers too much.
I read some threads and I use  "UTFT myGLCD(ILI9327,38,39,40,41); //modified code", it never flickers. works perfact .  I used origial UTFT library from http://www.RinkyDinkElectronics.com/

it seems that my lcd's controller is ILI9327 not R61581. Screen no more flickers, background is black, not white.

I ignored seller's spec, and believed  manufacturer's spec.
It's resolution was 400,240.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131