Sending data to SC01Plus from esp32 through SoftwareSerial Function

Hi, hello there, I need some help with my project. If anyone has an idea how to solve this, it would be much help.

I'm doing this project to send data to my SC01 plus from an ESP32 using SoftwareSerial function.

Here's the coding for the SC01 plus:

#define LGFX_USE_V1         // set to use new version of library
#include <LovyanGFX.hpp>    // main library
#include "esp32-hal-psram.h"
#include <WiFi.h>
#include <HTTPClient.h>
#include <SoftwareSerial.h>

//*************** ->   WiFi & HTTP SETUPS  <-***********************//

HTTPClient http;
const char* ssid = "TP-Link_E06C";
const char* password = "70070309";

//******************-> SETTING UP SERIAL PORT  <-***********************//

SoftwareSerial mySerial(10, 11); // RX, TX

//********************->  LGFX SETTINGS  <-*************************//

// Portrait
#define TFT_WIDTH   320
#define TFT_HEIGHT  480

class LGFX : public lgfx::LGFX_Device
{
  lgfx::Panel_ST7796  _panel_instance;  // ST7796UI
  lgfx::Bus_Parallel8 _bus_instance;    // MCU8080 8B
  lgfx::Light_PWM     _light_instance;
  lgfx::Touch_FT5x06  _touch_instance;

public:
  LGFX(void)
  {
    {
      auto cfg = _bus_instance.config();
      cfg.freq_write = 40000000;    
      cfg.pin_wr = 47;             
      cfg.pin_rd = -1;             
      cfg.pin_rs = 0;              

      // LCD data interface, 8bit MCU (8080)
      cfg.pin_d0 = 9;              
      cfg.pin_d1 = 46;             
      cfg.pin_d2 = 3;              
      cfg.pin_d3 = 8;              
      cfg.pin_d4 = 18;             
      cfg.pin_d5 = 17;             
      cfg.pin_d6 = 16;             
      cfg.pin_d7 = 15;             

      _bus_instance.config(cfg);   
      _panel_instance.setBus(&_bus_instance);      
    }

    { 
      auto cfg = _panel_instance.config();    

      cfg.pin_cs           =    -1;  
      cfg.pin_rst          =    4;  
      cfg.pin_busy         =    -1; 

      cfg.panel_width      =   TFT_WIDTH;
      cfg.panel_height     =   TFT_HEIGHT;
      cfg.offset_x         =     0;
      cfg.offset_y         =     0;
      cfg.offset_rotation  =     0;
      cfg.dummy_read_pixel =     8;
      cfg.dummy_read_bits  =     1;
      cfg.readable         =  false;
      cfg.invert           = true;
      cfg.rgb_order        = false;
      cfg.dlen_16bit       = false;
      cfg.bus_shared       = false;

      _panel_instance.config(cfg);
    }

    {
      auto cfg = _light_instance.config();    

      cfg.pin_bl = 45;              
      cfg.invert = false;           
      cfg.freq   = 44100;           
      cfg.pwm_channel = 7;          

      _light_instance.config(cfg);
      _panel_instance.setLight(&_light_instance);  
    }

    { 
      auto cfg = _touch_instance.config();

      cfg.x_min      = 0;
      cfg.x_max      = 319;
      cfg.y_min      = 0;  
      cfg.y_max      = 479;
      cfg.pin_int    = 7;  
      cfg.bus_shared = true; 
      cfg.offset_rotation = 0;

      cfg.i2c_port = 1;//I2C_NUM_1;
      cfg.i2c_addr = 0x38;
      cfg.pin_sda  = 6;   
      cfg.pin_scl  = 5;   
      cfg.freq = 400000;  

      _touch_instance.config(cfg);
      _panel_instance.setTouch(&_touch_instance);  
    }

    setPanel(&_panel_instance); 
  }
};

static LGFX lcd;            // declare display variable

// Variables for touch x,y
static int32_t x,y;

//***********************->  SYSTEM SETUP  <-*************************//

void setup() {
  Serial.begin(115200);
  mySerial.begin(9600);
  lcd.setRotation(1);
  lcd.begin();

  // Clear the display
  lcd.fillScreen(TFT_BLACK);
  lcd.setCursor(0, 0);
  lcd.setTextSize(2);
  lcd.setTextColor(TFT_WHITE);

  // Connect ESP to Wifi
  lcd.println("Connecting to WiFi....");
  WiFi.begin(ssid, password);
  int retries = 0;
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.println("Connecting to WiFi....");
    lcd.print(".");
  }
  if (WiFi.status() == WL_CONNECTED) {
    lcd.println("Connected to WiFi");
    Serial.println("Connected to WiFi");
  } else {
    lcd.println("Failed to connect to WiFi");
    Serial.println("Failed to connect to WiFi");
  }
}

//***********************-> SYSTEM PROCESS*************************//

void CardScanned() {
  lcd.fillScreen(TFT_BLACK);
  lcd.setCursor(100, 100);
  lcd.setTextSize(5);
  lcd.setTextColor(TFT_WHITE);
  lcd.print("Scan your");
  lcd.setCursor(15, 150);
  lcd.setTextSize(5);
  lcd.setTextColor(TFT_WHITE);
  lcd.print("ID Card here ->");

  String receivedData = "";

  if (mySerial.available()) {
    String receivedData = mySerial.readStringUntil('\n');
    lcd.fillScreen(TFT_BLACK);
    lcd.setCursor(20, 130);
    lcd.print("Data Receivied: " + receivedData);
  }
  delay(1000);

If anyone has been through this or has something similar, please do guide. Thanks

what ESP32 are you using?
what is the problem? not compiling? not communicating?
why are you using SoftwareSerial on a ESP32 which has three hardware serial ports?

The problem is that the SC01 Plus is not receiving the data from the ESP32 WROOM 32. Before I've tried the Software/HardwareSerial on ESP32 to ESP32 it can transmit and recieve data smoothly. But when I try it on my SC01 Plus first I thought the ESP32 cannot using data because I'm using SoftwareSerial on the SC so I cahnge from Hadrware to SoftwareSerial but it still can't receivce data. Maybe it's not communicating I'm not quite sure.

maybe the pins you are using ( 10, 11 ) are used for other tasks too ( even if they are available on the expansion port ).
That board has a lot of pins used for,lcd, audio, usb, 485, for example there is no indication in the schematic where lcd1_db9 - lcd1_db15 are connected to ( could be a second function of other pins? ) so check you didn't enable a 16 bit communication with the lcd ( so to be sure not to use these extra pins )
Another option is trying alla the expansion pins: 10-14,21
Another option is to use the 485 pins, but in this case you need a converter rs485/ttl

NOTE
this is the schematic of the board I've found

Ok sure I will try first using the other pin... Thank you btw mr

Already tried the other EXT pin but still the same problem

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.