Friday, September 6, 2019

Playing with Arduino LCD Shields

A friend wants me to make a multi screen LCD display that looks like old fashioned VU meters.  I have developed the software but am trying to determine the best LCD screen for the task.  I have the 2.4 inch, 3.2 inch and 3.5 inch LCD screens to try out.

This picture compares the sizes of the screens.

This is the 2.4 inch screen.  It has some sort of push button switch.  

This is the 3.2 inch screen.  It uses a totally different pin arrangement. Why?  I do not know!  

This is the 3.5 inch LCD screen.  On this LCD pin A4 is the LCD Reset pin so it has to be disconnected and pulled high with a resistor in order to use A4 for the MSGEQ7.

The 2.4 inch and 3.5 inch LCD screens both work with the Adafruit ILI9341 driver.  You can use   uint16_t identifier = 0x9341; or tft.begin(0x9341); to set it up.  

The screen size needs to be manually changed in the Adafruit library.  The "Adafruit_TFTLCD" file is changed like the following for the 3.5 inch screen:

// Manually overide size
#define TFTWIDTH   320
#define TFTHEIGHT  480

//#define TFTWIDTH   240
//#define TFTHEIGHT  320

Now the 3.2 inch screen is more complicated to get working.  In the Adafruit library the file "pin_magic" needs to have these lines changed to designate the correct data pins as follows:

 #else // Uno w/Breakout board
  #define write8inline(d) {                          \
    PORTD = (PORTD & B00101111) | ((d) & B11010000); \
    PORTB = (PORTB & B11010000) | ((d) & B00101111); \
    WR_STROBE; }
  #define read8inline(result) {                       \
    RD_ACTIVE;                                        \
    DELAY7;                                           \
    result = (PIND & B11010000) | (PINB & B00101111); \
    RD_IDLE; }
  #define setWriteDirInline() { DDRD |=  B11010000; DDRB |=  B00101111; }
  #define setReadDirInline()  { DDRD &= ~B11010000; DDRB &= ~B00101111; }

However the colors are not correct and text is backwards.....  A easier solution is to download and use the OPENSMART_TFT LCD driver.

No comments: