Node32s connect with tft and max6635

Update: I had removed the LED.

hi everyone,
i got some trouble when connecting 2 spi parts (tft screen,max6635 thermcouple)to arduino board.

After connecting, both parts was not operated: TFT can not show the print, TC only show 0.0

I had reviewed some of information about the spi communication and its seems the chip selecting ( cs ) issue, please help and suggest a solution, many thanks!

#include <SPI.h>
#include "Adafruit_GFX.h"
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include "max6675.h"



#define BLACK       0x0000
#define BLUE        0x001F
#define RED         0xF800
#define GREEN       0x07E0
#define CYAN        0x07FF
#define YELLOW      0xFFE0
#define WHITE       0xFFFF


//TFT setting for NODE32s

#define TFT_DC  4        // register select (stands for Data Control perhaps!)
#define TFT_SCLK 18         // SPI clock
#define TFT_MOSI 23         // SPI Data
#define TFT_CS   16        // Display enable (Chip select), if not enabled will not talk on SPI bus
#define TFT_RST   0         // Display reset pin, you can also connect this to the Arduino reset
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

// MAX6625 setting for node32s
int thermoDO = 19; //MISO


int thermoCS1 = 5;
int thermoCS2 = 17;

MAX6675 thermocouple1(TFT_SCLK, thermoCS1, thermoDO);
MAX6675 thermocouple2(TFT_SCLK, thermoCS2, thermoDO);


void setup() {
  Serial.begin(9600);
  SPI.begin();

  /* pinMode(TFT_CS, OUTPUT);
    pinMode(thermoCS1, OUTPUT);
    pinMode(thermoCS2, OUTPUT);

    digitalWrite (thermoCS1, LOW);
    digitalWrite (thermoCS2, LOW);
    digitalWrite (TFT_CS, LOW);  */

  tft.initR(INITR_BLACKTAB);
  tft.setRotation(3);
}

void loop() {

  ;
  tft.fillScreen(BLACK);
  tft.setTextColor(BLACK, WHITE);
  tft.setTextSize(1);
  tft.setCursor ( 0, 2);

  tft.print ( thermocouple1.readCelsius());
  tft.setCursor ( 0, 3);
  tft.print ( thermocouple2.readCelsius());

  Serial.print("C = ");
  Serial.println(thermocouple1.readCelsius());
  Serial.println(thermocouple2.readCelsius());

  delay(2000);

}

Please post a link to the actual display that you have bought.

Displays vary. I don't want to guess.

A Node32s and a 16x2 with I2C backpack look normal. But there is no harm in providing links.

David.

I am sorry from the description of your issue, I am unable to reproduce your code or draw a schematic of your project. Perhaps you'd be so kind as to post your code IN CODE TAGS, and post a schematic? Please.

posted the code, many thanks!

The posted code, lacks code tags.

Updated , thanks.

By the way, I am looking for solution how to display temperature value on the TFT screen, and I am stuck at SPI setting i think.. hope you can help.

Why do this? The individual drivers will handle CS functions.

Did you get a single max to work before trying to get the 2nd one to work?

You are connecting 3 SPI devices not 2, as a note.

Double entry?
Leaving the other devices connected, if you comment out the TFT code and one t-couple are you able to get prints of the other t-couples data out put?

You do not need that.

What does that mean?

You know the ESP32 has 2 SPI ports? The SPI ports are VSPI and HSPI. You are using VSPI for all 3 devices. You might consider putting the t-couples on the HSPI bus.

I had tried using the above coding, but only get print on TFT or t- couple in serial,

I wondering how to get show on the TFT.

I had tried google " Multi SPI device on arduino", most said device required individual CS pin .

Sorry, I do not not understand your issue. Please restate your issue.

The issue is SPI TFT and SPI thermocouple connect together on ESP32 board, both devices can not operate by using code above.

What does that mean?

Do you get error messages? Be a bit more descriptive of your problem.

Besides the mentions above, I do not see anything glaring obviously wrong with your code. There are a few things I'd do differently, like GPIO pin choices. The pins you used should work fine.

So right now that your code looks good I require more input .

I strongly recommend you use the other SPI buss for the t-couple thingies. I have, in the past, ran into the display units that use extra pins sometimes do not play nice with the SPI buss.

Thanks for the reply,

  1. No error message shown, but the TFT screen and TC did not shown the print on screen , and TC did not show data in Serial

  2. Try using SPI buss later

Cool, things are a lot more clear now.

Just making sure I am understanding correctly you tired to print to the tft and send to the serial monitor at the same time?

Start with not using GPIO_NUM_17 and GPIO_NUM_16 as cs pins. Use GPIO_NUM_26 and GPIO_NUM_27.

Post your code changes/updates in a new post, I cannot read your screen.

YES, keep sending TC temp value to TFT and serial at the same time

Updated the CS pins , but still the same, nothing change


#include <SPI.h>
#include "Adafruit_GFX.h"
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include "max6675.h"



#define BLACK       0x0000
#define BLUE        0x001F
#define RED         0xF800
#define GREEN       0x07E0
#define CYAN        0x07FF
#define YELLOW      0xFFE0
#define WHITE       0xFFFF


//TFT setting for NODE32s

#define TFT_DC  4        // register select (stands for Data Control perhaps!)
#define TFT_SCLK 18         // SPI clock
#define TFT_MOSI 23         // SPI Data
#define TFT_CS   27        // Display enable (Chip select), if not enabled will not talk on SPI bus
#define TFT_RST   0         // Display reset pin, you can also connect this to the Arduino reset
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

// MAX6625 setting for node32s
int thermoDO = 19; //MISO
int thermoCLK = 18;
int thermoCS1 = 5;

MAX6675 thermocouple1(thermoCLK, thermoCS1, thermoDO);



void setup() {
  Serial.begin(9600);


  pinMode(TFT_CS, OUTPUT);
  pinMode(thermoCS1, OUTPUT);

  tft.initR(INITR_BLACKTAB);
}

void loop() {
  digitalWrite (TFT_CS, HIGH);
  
  tft.fillScreen(BLACK);
  tft.setTextColor(BLACK, WHITE);
  tft.setTextSize(1);
  tft.setCursor ( 0, 2);
  delay(2000);
  
  tft.print ( thermocouple1.readCelsius());
  Serial.print("C = ");
  Serial.println(thermocouple1.readCelsius());





}

Hey, thanks for trimming the code down.

as an fyi, use a higher speed.

I doubt it will make a difference but...


If they worked individually but not together, I'd put the TC on the other SPI buss.