Communication Between Arduino R3 and ESP32-Wroom 32D

Hello,
I have posted this before too I guess.
I am having trouble in order to establish communication between Arduino Uno R3 and ESP32-Wroom-32D. I have connected the Rx pin of Arduino to the Tx pin of Esp32 and the Tx of Arduino to Rx pin of Esp32 via a voltage divider circuit, using 3 10 K ohm resistors.
I have checked the voltage drop across the resistors which is exactly 3.3V as required by Esp32.
The problem is when I upload the code to Esp32 it gives me the following error: Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 115200, None"

Sketch uses 204570 bytes (15%) of program storage space. Maximum is 1310720 bytes.

Global variables use 13416 bytes (4%) of dynamic memory, leaving 314264 bytes for local variables. Maximum is 327680 bytes.

esptool.py v3.0-dev

Serial port COM5

Connecting......................................_____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

I tried holding down the 'BOOT' button when uploading the sktech to Esp32 but I found no luck in that, also held the EN button or both but it did not work at all.

Further, I removed the Rx pin of Arduino connected to Tx pin of Esp32 and it worked but it only showed me the 'Serialprint' argument in the serial monitor.

I will publish my both codes here:
For Arduino:
// the setup function runs once when you press reset or power the board
#include <HardwareSerial.h>
void setup() {
// initialize digital pin LED_BUILTIN as an output.
Serial.begin(9600);
}

// the loop function runs over and over again forever
void loop() {
Serial.println("100");
delay(1500);

}

For Esp32:
#include <HardwareSerial.h>
void setup() {
// put your setup code here, to run once:

Serial.begin(115200);

}

void loop() {
Serial.print("Data Received: ");
Serial.readStringUntil('/r');
delay(200);
// put your main code here, to run repeatedly:

}

I hope someone can help me or tell me what or where I am going wrong in it?
I just want to establish a simple communication between the two microcontrollers where the Arduino sends data and Esp32 receives it and Esp32 just gives a feedback to arduino that the data has been received, thats why I am using both Tx and Rx pins on the two microcontrollers.

Thanks

I don't know anything about the ESP32. But if it is anything like the Arduino Uno, the RX and TX are shared with the USB chip; in which case I suspect that the Arduino interferes with the upload to the ESP32; the same will happen the other way around when you try to upload to the Arduino.

Disconnect the two boards from each other and try the upload.

The thing is that I want to establish UART communication between the two boards which is only possible when the boards are connected to each other.

Maybe I should have been a little clearer, sorry. Disconnect during upload, reconnect after that.

check out the circuits here for ESP32 Serial1 and Serial2 that leave the USB serial free.
Arduino to Arduino/PC There are some example sketches as well.
They are in the process of being simplified. See this post for the simplified code.

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