0

I am trying to connect up to 5 TFT displays to one Arduino Uno R3 and use a multiplexer to control the output to each display. At the moment I am stuck being able to only write to a single one. Every time I try to add a second one I fail.

The displays I am using are here along with the pin allocations. https://www.waveshare.com/wiki/1.69inch_LCD_Module#Arduino

The process I am following is detailed here along with the schematic I am following. https://forum.arduino.cc/t/multiple-tft-displays-with-due-using-multiplexed-spi-cs/917473.

In the schematic you can see they are sharing the one reset pin. Additionally that pin is connected to the Arduino's native Reset pin.

I have copied the same design so that all my pins are shared apart from the CS pin. The CS pin from the Arduino goes to the signal pin of the multiplexer.

I can get that setup to work with a single display. However, as soon as I put the second displays reset pin into the same channel on the breadboard as the first displays pin, both screens no longer work. They are backlit, but there is no text appearing. Pull the second RST pin out again, reset the Arduino, and the first screen outputs text again.

I have taken the code from the example above and modified it a little to suit my displays. Below is the code I am using with comments that I hope explains it adequately.

After the initialization, I am adding a delay of 1000 ms in case the displays needed time to reset. Unfortunately, this didn't help either. I feel that adding the delay inside of the initialization loop won't help because as I understand it, the reset happens when the display gets power.

I am not an electronics person but I am a programmer by trade. So it's the code I understand and can modify. Where I am lacking is in being able to wire this up so that I can have the 5 displays hooked up.

I "think" that if I can solve the RST issue, that I should be able to write to the screens no problem, but right now that's a guess.

#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library
#include <SPI.h>

#define BLACK 0x0000
#define RED 0xF800
#define GREEN 0x07E0
#define WHITE 0xFFFF

// rst is declared as pin 8 but there is no pin in that socket
Adafruit_ST7789 tft = Adafruit_ST7789(10, 7, 8); // 10 = CS, dc, rst

void setup(void)
{    
  // these outputs control the multiplexer chip
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);

  for (int n = 1; n < 3; n++)
  {
    SetDisplay(n); // selects the display
    tft.init(240, 280);

    tft.setTextColor(WHITE);
    tft.setRotation(2); // rotate to portrait

    tft.fillScreen(BLACK);
    tft.setCursor(15, 18);
    tft.print("DISPLAY ");
    tft.print(n);
  }
  delay(1000);
}

int value = 0; // this is what is rendered on screen
void loop()
{
  // Scroll through the two displays
  for (int M = 1; M < 3; M++)
  { 
    SetDisplay(M);
    tft.fillRect(0, 25, 159, 128, BLACK); // fill the variable text area which clears the previous text
    tft.setCursor(15, 50);
    tft.print(String(value));
    value++;
  }
  delay(1000);
}

// This function selects the display by setting two binary outputs to the multiplexer chip
void SetDisplay(int DNo)
{
  if (DNo == 1)
  {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    tft.setTextColor(RED);
  }
  else if (DNo == 2)
  {
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    tft.setTextColor(GREEN);
  }
}
5
  • 1
    Why the downvote? This seems like a pretty legit question with enough detail in it!
    – griegs
    Commented Sep 6, 2023 at 4:13
  • I did not vote down... -- Please edit your question and add the schematic, especially how you wired the CSs and RSTs. The analog multiplexer of the linked forum post is -hrm- not the best solution, as comments there say, too. -- For the given design, you need a voltage meter to measure the level on the RST wire. Measure the voltage for the different situations: 1st display alone, 2nd alone, or both displays, RST applied or not, any combination. You might need to write a simple extra sketch for this. -- What happens if connect the 2nd display just by power and RST, but no communication line? Commented Sep 6, 2023 at 6:18
  • @thebusybee, So you think it might be a power issue by the sounds of it? Let me try your questions later on tonight and get back to you. Thanks for the comment.
    – griegs
    Commented Sep 6, 2023 at 6:28
  • Well, "power" in the sense of existing impedances/resistors. For example, the schematic of the Uno R3 (which one do you use?) has just a 10kOhm pull-up on RESET. Commented Sep 6, 2023 at 7:22
  • 1
    I do have the R3 yes. Let me try those few things you suggested and get back to you likely tomorrow now. Again, thank you
    – griegs
    Commented Sep 6, 2023 at 7:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.