Go Down

Topic: dual displays (Read 1 time) previous topic - next topic

altermontrealiste

Hi ; I would like to put another st7735 tft (spi) on my project...

I figure if it's spi, miso and mosi would be the same pin, cs evidently would not, but don't know about the others...

That is if the library supports it / if it's possible to instantiate 2 tft...

Any info on that would be appreciated

david_prentice

You can put as many devices on the SPI bus as you like.

I think someone showed an example of multiple ST7735 or ILI9163 displays.
I would be wary of bit-bashed SPI but the hardware SPI should be fine.

David.

altermontrealiste

Thanks David  :)

Continued googling around to find out more... posted an "issue" on https://github.com/adafruit/Adafruit-ST7735-Library/issues/30 (it's really more of a question as I love what they have done)...

Maybe using 2 different sceens (with 2 different libraries) could be a way...

altermontrealiste

https://learn.adafruit.com/animated-electronic-eyes-using-teensy-3-1?view=all

this site has some good info about dual displays ; will take a closer look at it...

spicifically, I want to display battery info and power usage on a e-bike...

altermontrealiste

#4
Feb 29, 2016, 02:19 pm Last Edit: Feb 29, 2016, 02:26 pm by altermontrealiste
from https://learn.adafruit.com/animated-electronic-eyes-using-teensy-3-1?view=all



Gnd to GND
SCK to SPI CLK
SI to SPI MOSI
TCS to Digital Pin 9 (left TFT) or 10 (right TFT)
RST to Digital Pin 8
D/C to Digital Pin 7

that settles the hardware / wiring part ; only CS has to be different :)

david_prentice

When did anyone suggest otherwise?

You can put as many devices on the SPI bus as you like.   Only one device can be active at any one time.   e.g. only one CS is active.

Provide proper 3.3V logic levels and everything will work fine.

David.

TFTLCDCyg

#6
Feb 29, 2016, 10:20 pm Last Edit: Feb 29, 2016, 10:20 pm by TFTLCDCyg
Steps:

1 Define one instance for each TFT

2 Separate wiring for each CS-pin

For example:
Board: teensy 3.2 or arduino Due

Code: [Select]
#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

#define TFT_DC 9
#define TFT_CS 10
#define TFT_CS2 21

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
Adafruit_ILI9341 tft2 = Adafruit_ILI9341(TFT_CS2, TFT_DC);


Video: Two ILI9341 on teensy 3.2



ft81xmania.com/comunidad/

jxid

#7
Jan 27, 2020, 07:53 pm Last Edit: Jan 27, 2020, 08:12 pm by jxid
Looking for answer to my question i found this thread.
So i ask you:
I want to use 2 ST7735 displays with an arduino Nano.
I want to print different data to each display at the same time.
So far i have manage to have same data on 2 displays.
I read that i have to define different CS pin for each display and all other pins mus be the same.
So here is my code.

Code: [Select]
#include <TFT_ST7735.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include "RTClib.h"
#include <Wire.h>
#include <Adafruit_GFX.h>

#define TFT_CS1 6
#define TFT_DC  8
#define TFT_CS  9

#define ST7735_TFTWIDTH  128
#define ST7735_TFTHEIGHT 128


#define TFT_BLACK 0x0000
#define TFT_RED 0x001F
#define TFT_GREEN 0x07E0
#define TFT_WHITE 0xFFFF
#define TFT_BLUE 0xF800
#define TFT_YELLOW 0x07FF
#define TFT_CYAN 0xFFE0
#define TFT_MAGENTA 0xF81F

TFT_ST7735 tft = TFT_ST7735(TFT_CS,TFT_DC);
TFT_ST7735 tft1 = TFT_ST7735(TFT_CS1,TFT_DC);  
Adafruit_BME280 bme;
RTC_DS3231 rtc;


char daysOfTheWeek[7][12] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
char dtBuffer[12];
char Day[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
const char * months[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

void setup()
{
  rtc.begin();
  //rtc.adjust(DateTime(F(__DATE__),F(__TIME__))); //Set Date and Time from PC
  //rtc.adjust(DateTime(2019, 10, 27, 23, 21, 40));  //Set Date and Time Manually
  bme.begin(0x76);
  tft.init();
  tft1.init();
  tft.setRotation(0);
  tft1.setRotation(0);
  tft.fillScreen(TFT_BLACK);
  tft1.fillScreen(TFT_BLACK);
  tft.drawRect(0,2,128,128,TFT_CYAN);  
}

void loop()
{  
//Print Temperature  
  tft.setTextColor(TFT_RED, TFT_BLACK);
  tft.drawString("Temperature",27,3,2);
  tft.setCursor(20,20,4);
  tft.print(bme.readTemperature(),1);
  tft.setCursor(90,5);
  tft.drawString("*C", 75,22,2);  // print degree symbol and C
  tft.drawFastHLine(0,46,tft.width(),TFT_CYAN);  
//Print Humidity
  tft.setTextColor(TFT_GREEN, TFT_BLACK);
  tft.drawString("Humidity",35,48,2);
  tft.setCursor(35,63);  
  tft.print(bme.readHumidity(),1);  
  tft.drawString("%",90,63,2);
  tft.drawFastHLine(0,86,tft.width(),TFT_CYAN);  
//Print Pressure
  tft.setTextColor(TFT_YELLOW, TFT_BLACK);
  tft.drawString("Pressure",35,87,2);
  tft.setCursor(12,101,4);  
  tft.print((bme.readPressure() / 100) , 1);  
  tft.drawString(" hPa",91,105,2);

//Time from RTC
  DateTime now = rtc.now();
  sprintf(dtBuffer,"%02u : %02u : %02u ",now.hour(),now.minute(),now.second());  
  tft1.setTextColor(TFT_WHITE,TFT_BLACK);
  tft1.drawString(dtBuffer,25,90,2);
//Date from RTC
  sprintf(dtBuffer,"%02u/%02u/%02u ",now.day(),now.month(),now.year());  
  tft1.setTextColor(TFT_WHITE,TFT_BLACK);
  tft1.drawString(dtBuffer,41,104,2);
//Day Of Week from RTC
  tft1.setCursor(7,104,2);
  tft1.print(daysOfTheWeek[now.dayOfTheWeek()]);  
          
delay(1000);
}


I have declared tft as first display and tft1 as the second.
Can anyone help me?Thank you.

jxid

My problem solved.
I found the solution in a post from bodmer.
For any one that may interesting

https://forum.arduino.cc/index.php?topic=589346.0

Go Up