UART Connection with ESP32 and Arduino Uno R3

Yeah that looks right. Basically it's UNO-TX -> 1K -> ESP32-RX -> 1K -> 1K -> GND and that reduces 5v to 3.3v which is what is required.

Yes those are the ones.


This is the pinout i use for 30-pin dev-board.

The UNO R3 is probably not required for such a project and needlessly complicating since the ESP32 can handle those tasks, but let's not fuss about it.

I never use json. Mainly i would suggest just looking at the basic examples that come with the ESP32 core for the webserver, although i have of course kept my own. That said, there appear to be some issues with the latest ESP32 core and from what i've heard the last reliable version is 3.0.7 i am still using 2.0.11 though since updating cores always involves all sorts of troubles on existing projects.

This is the basic webserver example from the most recent core

As for UART communication there are of course several options.
You can send raw data, but how is the receiver going to interpret what is what ? If we depend on the sequence of bytes, how will we define which is the first and so on. It is a whole study all by itself. Quite a while ago Robin made This tutorial on the matter and that still shows many of the options and is known to work, though unfortunately not supported by the author anymore on the forum due to health reason i am led to believe.

There are more simple options available. If you clear the ESP32 input buffer, send a request from the ESP32 to the UNO (it can be a single character) and then let the UNO send RAW data back to the ESP, that should work as well.

First thing to do would be to upload a SerialPassthru example onto the ESP32 to confirm your hardware is working properly.

Onto the UNO you can upload.

void setup() {
  Serial.begin(115200);
}
void loop() {
  Serial.println("The UNO says Hi !");
  delay(1000);        
}

and to the ESP32 you can upload

void setup() {
  Serial.begin(115200);
  Serial2.begin(115200);
}
void loop() {
  if (Serial.available()) {    
    Serial2.write(Serial.read());   
  }
  if (Serial2.available()) {     
    Serial.write(Serial2.read());  
  }
}

And the ESP32 should forward whatever comes in on UART2 to it's UART0 which is connected to the USB to TTL converter, and you should be able to see that on the Serial monitor of the ESP32 port. (and on the UNO port btw, but that is just a side effect)