Arduino with a LGDP4535 TFT LCD Touch Screen

Posted by:

Parts Needed

Fritzing Schematic

Well, it is a shield, not a breakout board. All you need to do is align the pins and plugged in. Here it is anyway.

tft-lcd_bb.png

The changes needed to make with Ceez code

  1. Download library from: ceez blog Modify pin configration for this TFTLCD.

  2. Upload TSCalibration.ion and calibrate to fit your LCD

    1. use stylus to slide as indicated.

    tftlcd-calib2.JPG

    1. Repeat and touch until you are content with alignment.

    tftlcd-calib1.JPG

    1. In my case, I use following setting.

  3. and, uncomment this line :

    update: NOT needed in ztouchscreen library, usage as following (in readme file), ts.InitVariable(0, 240, 320, TS_MINX, TS_MAXX, TS_MINY, TS_MAXY, MINPRESSURE, MAXPRESSURE);

  4. A couple of screen shots:

    arduino-tft-paint.JPG

    arduino-tft-cal.JPG

To work with mega board

uncomment line 14 of file LGDP4535.cpp

and, comment the line 15

The Coordinate for LCD Display (tft) and Touch Screen (ts)

It sounds crazy and dump, but this is the way it is. As shown in following, the cordinates for LCD display and Touch screen are different [UPDATE:see next session]. Top left is the USB port.

tft-lcd-coordinate.JPG

To convert LCD coordinate (x,y) and Touch Screen coordinate (p.x, p.y), using following: p.y=x and p.y=240-x. Of course, p.x and p.y are remapped to LCD resolution.

Use following to define the touch area:

Sync the LCD display (tft) and touch screen (ts) coordinates [UPDATE:11/16/2015]

It took me a while, but I figured out that it is quite easy to synchronize the TFT display and the touch-screen (ts) coordinates with ceez’s zTouchScreen library.

  1. Rotate the tft to whatever orientation you like, landscape in following case.

  2. Match the touchscreen orientation same as the TFT LCD display. The first arg is for rotation config (1=90deg)).

  3. Here it is! No need of convoluted transformations. Green dot is the ts with its coordinates (13,223).

    tft-lcd-ts-coordinate-sync.JPG

To work with JOS Menu library

  1. Download code from here, and video demo and explaination here.
  2. LCD displays ok, debug mode needs to be set ON and Off as following in order to debug touch screen.

  3. Turn On and then Off the Sleep and backlight settings saved in EEPROM (NB: The brightness of TFT is not adustable; and I have to repeat this many times before it works.)

    arduino-jos-1.JPG

    arduino-jos-2.JPG

  4. If you want to make your own GUI, use Illustrator or Inkscape. See my other post here.
1
  Related Posts

Comments

  1. taner  May 10, 2016

    is there a way to use it on raspberry pi?

    reply

Add a Comment