Arduino UART communication with ESP32

Hi guys, i have some troubles with the communication of my Arduino UNO and my ESP32
I want to send data from the ESP to my Arduino using the RX/TX Pins.
But when i test my project without using USB (9V battery for Arduino and 3.3V Arduino's pins for ESP32) This doesn't work only works when i connect the USB to each board

Someone knows why is that?

circuit:

Welcome. You are starting a little bit on the wrong foot.

You are asking a power question without showing the power connections. The diagram you posted is useless because, as you know, it is incomplete. It shows three unlabelled devices and invites the reader to guess what they are.

"The language of electronics is a schematic or circuit diagram. Long descriptions of what is connected to what are generally useless. A schematic is a drawing of what connects to what; please make one and photograph it. We don't mind if it's hand drawn, scruffy and does not use the correct symbols. Please don't post Fritzing diagrams. They may look nice but they are very easy to misinterpret"

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966#schematics-or-circuit-diagrams

Most likely issue is the 9V battery cannot supply sufficient current.

1 Like

The ESP32 needs more juice than a normal Arduino can provide,
regardless of the flimsy 9V battery.

1 Like

any particular reason for using a UNO and ESP32?
if you don't need WiFi or Bluetooth won't the UNO do?
if you need Wifi connect the relay etc to the ESP32?
or are there other components that are not shown on the diagram?

i'll start doing it

thought this is the problem, but if i connect the Arduino using USB and the ESP connected to the 3.3V, it works properly. So looks like the battery can't provide the current that is needed

The arduino is a requirement for the project :frowning:

Try Wi-Fi or BT in that configuration.

It works now because the ESP32 isn't working hard. As soon as you run a wireless stack the 3.3V current will increase.

The ESP32 has a 3.3V voltage regulator on board, you should power it from 5V provided from the Uno.

Is it the VIN-pin of ESP32 (Fig-1) where to connect the 5V of UNO?


Figure-1:

i try using 5V too but it's the same

yes


Don't.

Yes. Vin on the ESP is also 5V in/out. It feeds a 3.3V regulator, so I think you can apply a higher voltage instead, like 9V, but the regulator will run hotter.

1 Like

Because you haven't fixed the battery problem yet.

The following setup works well for me.; where, ESP32 is powered from 3.3V of UNO.


Figure-1: Connection

ESP32 Sender Sketch:

void setup()
{
  Serial.begin(9600);
  Serial2.begin(9600, SERIAL_8N1, 16, 17); //RX2 = GPIO16, TX2 = 17
}

void loop()
{ 
  Serial2.println("Hello!");
  delay(1000);
}

UNO-Receiver Sketch:

#include<SoftwareSerial.h>
SoftwareSerial SUART(10, 11); //SRX = DPin-10, STX = 17

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

void loop()
{
  while (SUART.available() != 0)
  {
    char ch = SUART.read();
    Serial.print(ch);
  }
}

UNO's SM:

Hello!
Hello!
Hello!

It's better to allow the ESP32 to do its own power regulation. The 3.3V supply on the Arduino is barely sufficient to power it. Sometimes insufficient.

1 Like

The post #18 is just a demonstration that ESP32 could be operated using 3.3V supply of UNO (for test purposes). In the field application, your comment of post #19 is to be honored with regards to powering the ESP32 Module.

The official Uno rev 3 spec for the 3.3V supply is 50mA. That is obviously not enough.