Some difference between ESP32 Rover and ESP32 Wroom when using second serial port?

I have a project that pulls data from a solar charge controller using the controller's RS232 port and modbus. It works great on an ESP32 Wroom. But oddly it won't work on any of my ESP32 Rovers.

I'm using the same wiring, same RS232 to TTL board (exact same board, not an identical one), same everything.

It uses a second serial port, on pins 16 and 17, which on the Wroom are labelled RX2 and TX2.

I don't imagine anyone has any theories, or ways to get the Rover to work?

Here's my sketch if needed:

https://github.com/wrybread/ESP32ArduinoRenogy/blob/main/renology_rs232.ino

Here's my wiring if needed, but I don't think that's the issue since it works perfectly with the ESP32 Wroom:

Thanks for any help.

On a WROVER, I setup the serial ports

#include <HardwareSerial.h>
HardwareSerial GPSSerial ( 1 );
HardwareSerial LIDARSerial ( 2 );

voided setup()
{
  LIDARSerial.begin ( SerialDataBits, SERIAL_8N1, 26, 25 );
  GPSSerial.begin ( GPS_DataBits, SERIAL_8N1, 2, 15 ); // begin GPS hardware serial

}

Still not working for me. I tried:


#include <HardwareSerial.h>
HardwareSerial MySerial2 (1);

#define RXD2 16 
#define TXD2 17 

void setup()
{
  Serial.begin(115200);
  Serial.println("Started!");

  // create a second serial interface for modbus
  //Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2); 
  MySerial2.begin(9600, SERIAL_8N1, RXD2, TXD2); 

  int modbus_address = 255; // my Renogy Wanderer has an (slave) address of 255! Not in docs???
  //node.begin(modbus_address, Serial2); 
  node.begin(modbus_address, MySerial2); 

}

I'm courious if you tried HardwareSerial MySerial2 (2);?

Have you tried different pins?

1 Like

I tried 0 through 2, no change there. Trying different pins now.

Uisng MySerial(0) will cause trouble,

Did you try a loop back test?

Well I'm embarassed to admit that changing the pins fixed it for me. Oops, I definitely should have tried that. And thank you.

I used pins 13 and 14, which works on both my Wroom and Rover boards with no other mods to my original code.

#define RXD2 13
#define TXD2 14 

void setup()
{
  Serial.begin(115200);
  Serial.println("Started!");

  // create a second serial interface for modbus
  Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2); 

  int modbus_address = 255; // my Renogy Wanderer has an (slave) address of 255! Not in docs???
  node.begin(modbus_address, Serial2); 

}

I don't have an Arduino board to test with at the moment, any thoughts on whether this would/should work on an Arduino Uno for example?

1 Like

A Uno is not a ESP32.

You mean to send/receive between a ESP32 and a Uno? Level shifters will be needed.

I use these


as level shifters.

1 Like

Sorry I should have given more details. I mean will it work to read from the solar charge controller over RS232 using modbus.

Here's a wiring diagram (though I'm now using different pins on the ESP32):

I'm wondering if an Arduino Uno would be able to use Serial for serial monitor, and a second serial interface for RS232/modbus (as I'm currently doing with an ESP32).

I guess you can get a Uno to work, good luck.

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