Saturday, October 6, 2018

TFT LCD Touchscreen Display

TFT LCD Screens are great.  They have really good resolution, they can be used as an input device and give you a lot of flexibility in terms of display.  The downside with the cheap chinese versions (like the one shown below), you can't turn the LCD backlight on and off.  So you either have to have it on completely or off completely.


I purchased this one on amazon, and it didn't come with any drivers or instructions, however reviews indicated (and I confirmed) that https://github.com/prenticedavid/MCUFRIEND_kbv this library will make it work.  It still took some tweaking.



Wiring

It stacks well with the Uno as well as other shields.  In the setup below, I have the LCD above an ethernet shield, above an Arduino uno.  The ethernet shield pins don't conflict with the LCD pins, so it works out.


Per the example script, it appears that pins D6, D7 and A1 and A2 are used by the shield.

Code

One of the first examples to run is the TouchScreen_Clibr_native from the MCUFRIEND_kbv library.  This will give you information on how to setup coordinate positions when the screen is touched.  I've found this to be the most refined of the scripts in terms of being able to appropriately detect touch events.  The following has the results of my calibration test.


I created some of my own examples to test both text display and touch input (non-position-specific).

Power

Since you can't turn the backlight off, there is the issue of power.  With the LCD on, the Arduino pulls about 200ma, which in a full day of running would be 4800mAhs.  Given a 5V supply this equates to 24Whs a day.  

According to eia.gov, the average household generates about 30kWhs a day, so 24 is not much, but still would be a better design if you could control the backlight on or off.  The adafruit version has a hack where you can control the backlight via a pin, however, the adafruit version is more than double the cost.

Assuming an average price of 12 cents per killowatt hour,  you would get your money ($23) back with the adafruit on/off approach after about a year.

No comments:

Post a Comment