Skip to content

Archive for May, 2015

15
May

Arduino TFT

As of late I seem to be back working with TFT displays for my Arduino projects. From the 1.8″ up to the 2.4″.

The most common sizes, small enough to work on SPI with an UNO are 1.8″, 2.2″ and 2.4″.

TFT 1.8″

These TFT’s give you 128 x 160 resolution in reasonably good colour. An ST7735 driver chip is the work horse for the display. Adafruit’s library works just peachy.

The major benefit for the 1.8″ TFT is you don’t need logic level shifting and it runs off 5V perfectly. I usually run a 39 ohm resistor from 5V VCC to the LED. However, as mentioned no logic level converters are required.

TFT 2.2 and 2.4″

Resolution for these is the same, 240 x 320. Just the physical size of the display changes. Controller is ILI9341.

The larger TFT’s are different animals. They are designed to run off 5V because there is an on board regulator to drop to 3.3V. And 3.3V is where these displays are designed to work. Thus, if you do what I did and just plug them into a 5V Arduino, you won’t see smoke, but you won’t see any image and you’ll cook the controller. That’s what I did with my first one. Sigh…:-)

The majority of the inexpensive ones I use all look like the photo below. Some are labeled QVGA. You can see in the photo that some have a touch screen option, but look closely and you’ll notice the IC for the touch portion is missing (top left side).

If you buy one off eBay and the listing photo shows the IC in place, don’t assume that the one you get will indeed have the touch screen. I’ve gotten some with the chip, but none, unless clearly stated in the listing, have come with the front touch membrane.

IMG 0023

Working with TFT’s

If you’ve never used one before, they work with SPI and there’s a couple of libraries for them. One is the Adafruit library and the other is a super speed version of the Adafruit Library you can see here in action:

FAST ILI9341 Library for UNO

While the 1.8″ is pretty much wire and go, the 2.2 and 2.4 aren’t. You need logic level converters.

Originally I was using CD4050’s to do the job and a nice job they do. Excellent waveform from them. But the Arduino isn’t really a speedster any way and I noted that some of the knowledgeable Arduino users were simply using a resistor divider. So I decided to give it a try.

Here’s my first attempt and on the top you see 2K7 1/4W resistors. Right side connectors go to the Arduino, left side connects to the TFT (first 8 pins; but you only use the first seven). You can see my 39Ohm resistor feeding from 5Vcc to the LED pin.

IMG 0026

Underneath is a 4K7 common resistor. An octal version here with some pins cut off because I only needed 5 resistors.

IMG 0025

So what you have a simple voltage divider to take 5V down to 3.1, 5 copies of them:

Divider

The wiring is standard SPI and I used UNO pins 8,9,10,11, 13. Note you don’t need to wire up the SDOK (MISO) pin, it’s not used. If you need to use the SD card slot, I found it’s 5V friendly and you can just parallel up the same pins (SD_MISO–>MISO, SD_MOSI–>MOSI, SD_CLK–>SCK) except for the SD_CS, that needs to be a pin of it’s own.

After running the 2.4″ display for a few days to make sure everything was going to work fine, I could see that a smaller converter board would be nice. Sure a little more difficult to make, but nice just the same. Maybe even SMT.

I started searching for something that would work and found a breakout PCB on eBay that looked promising. A little pricey for shipping but what the heck.

IMG 0630

I got them quite quickly and found they would work very nicely. At first I tried to use my hot air rework station to solder the resistors on and that didn’t work. Even with the fan on a lower speed it blew those little resistors all over. And these are double sided boards so when one side soldered the other side fell off…LOL

Using SMT solder paste and a normal temp controlled iron worked perfectly. The bottom where the 4K7’s commoned are.

IMG 0647

And the top, compared to the original test one I built.

IMG 0027

Quite a bit smaller. If you check the video link for the super speed library, you’ll see just how fast the TFT can be. Of course, it’s not super speed for everything but it is significantly quicker, albeit it does take more memory on the Arduino.

I should mention that when you first run the demo that really shows the speed, it’ll use up 21K of your flash memory. If you go into the library and look for the fonts.h file, you’ll find the writer is using a custom font. You can default back to Adafruit’s GLCD font and save a pile of memory if you want. I did.