January 30

Jewelry Box: New 2.8″ TFT Display Attempt

One step forward, and two steps back. Due to all the issues with the Seeed Studio 2.8″ TFT display, I moved on to a different unit, and from Adafruit. I did my research, and found their documentation, libraries, and support forums to be exceptional, especially for the occasional DIYer like myself.

Adafruit 2.8″ TFT display

This new display will also work better for my intention of a thin backing, due to the lack of header pins. While they did come with the display, they weren’t permanently attached; you have to solder them yourself. I’ll solder cables, instead of header pins, since I’d end up removing the header pins later. After reading the Adafruit documentation (which I did before purchasing this TFT display), I’d only use a few pins, anyways.

 

 

Enable SPI Mode

The board has two pin sides: 8-bit mode, and SPI mode. Since I will be using it to display BMP images, I must use SPI mode, as it is not supported in 8-bit mode. To enable SPI mode, I need to solder 3 jumpers together, found on the back of the board: IM1, IM2, and IM3.

Top center: Close IM1/IM2/IM3 for SPI

Located at the top center of the board, there are 4 jumpers: IM0, IM1, IM2, and IM3. For SPI mode, we only need to solder IM1-IM3. DO NOT SOLDER IM0. This is what it should look like once the correct jumpers are soldered closed:

IM1-IM3 jumpers soldered for SPI mode

 

 

SPI Connections

SPI Pins

Facing the TFT display upright (portrait), the SPI pins will be on the bottom of the board. There are IM0-IM3 pins, in case I preferred to use a breakout board, instead of soldering the jumpers.

SPI pins on the bottom of the board

 

Soldering the Cables

In total, there will be 8 cables which will be soldered to the board. From left to right: GND, Vin, CLK, MISO, MOSI, CS, D/C, and CCS.

Required SPI pins for the project are soldered

 

TFT Pin Name Arduino Pin
GND Ground GND
Vin Voltage in 5v
CLK Serial Clock D13
MISO Master In Slave Out D12
MOSI Master Out Slave In D11
CS Card Select D10
D/C Data/Command selector D9
CCS Card Chip Selector D4

 

 

 

Image Preparation

The Flip Side

The Adafruit TFT display should be ready to go, once connected to the Uno R3, and can be verified using the graphicstest example sketch from their Adafruit_ILI9341 library. Since I already had the BMP images from the previous TFT display I was using, there was only one thing I had to undo: mirroring (vertical flip). The images were now simply rotated 90°, from their original orientation. Referring to the convert command from ImageMagick, I’ll only be removing -flip from the command on new edits, but using it to undo the change on the current images.

convert -flip old.bmp new.bmp

 

Seems a Bit Sketchy

To test the images on Adafruit’s TFT display, I’ll be using the spitftbmp example sketch from their Adafruit_ILI9341 library. The images must be in the root directory of the microSD card, which they were from the previous testing, but it was not displaying my image. I ensured that the filename was correct in the sketch (updated from ‘purple.bmp’), and was in fact on the microSD card. I made the -flip edit on the images on the microSD card itself, and they loaded successfully on my computer. I moved on to the next image filename, and updated the example sketch. This time, it worked, and the image was properly displayed: landscape, and not mirrored.

The quickest way to see the image settings is through exiftool, which shows the exif data of an image. I spotted the issue: no Pixels Per Meter (PPM) value. I don’t know why or how this happened, but using the convert command once again, I can set the units and its density. The working image has a density of 2834 PPM. While the units may be Pixels Per Meter, and the density is entered as meters, the value is shown as centimeters: 28.34m == 2834cm.

convert -set units PixelsPerMeter -density 28.34 old.bmp new.bmp

Once entered, it will show the PPM as 2834 for both X and Y. This is the exif data output on the example image, purple.bmp, from exiftool:

ExifTool Version Number         : 10.23 
File Name                       : purple.bmp 
Directory                       : . 
File Size                       : 225 kB 
File Modification Date/Time     : 2017:01:27 21:19:13-08:00 
File Access Date/Time           : 2017:01:28 00:07:21-08:00 
File Inode Change Date/Time     : 2017:01:27 21:19:31-08:00 
File Permissions                : rw-rw-r-- 
File Type                       : BMP 
File Type Extension             : bmp 
MIME Type                       : image/bmp 
Image Width                     : 240 
Image Height                    : 320 
Planes                          : 1 
Bit Depth                       : 24 
Compression                     : None 
Image Length                    : 230400 
Pixels Per Meter X              : 2833 
Pixels Per Meter Y              : 2833 
Num Colors                      : Use BitDepth 
Num Important Colors            : All 
Image Size                      : 240x320 
Megapixels                      : 0.077

PPM for purple.bmp is 2833, but my own working images had 2834; majority wins for consistency. Luckily, only 3 of my images were lacking density information, but I could batch them all as I did the first time I converted these images to BMP format.

 

 

Conclusion

My images work. They are displayed properly, and I can cycle through them, using Adafruit’s example sketch. The Adafruit TFT display is also better for this project, as I’ll be needing a thin working space as I can get; header pins add unnecessary depth. Now, I can move on to repeating the previous step, and ensuring that all components can talk to each other.

Image displayed on the Adafruit TFT display

Tags: , , , ,
Copyright 2025. All rights reserved.

Posted 2017-01-30 by Draik in category "Arduino", "Jewelry Box