Only receive data when I turn off the esp32 APC220

Hi everyone, I have connnected an apc220 to an esp32-Wroom and another apc220 to the Uno. But it has 1 problem: I only receive data when I turn off the esp32.
On the esp32 I have this code:

#include <HardwareSerial.h>
HardwareSerial mySerial(2);

int number = 0;

void setup() {

Serial.begin(9600);
  mySerial.begin(9600, SERIAL_8N1, 16, 17);

}

void loop() {
(number ++);
Serial.println(number);
mySerial.println(number);
delay(1000);
}

It sends a number to mySerial wich I have connected to the HardwareSerial 2 (RXD2 = GPIO16 and TXD2 = GPIO 17). The apc220 RX is connected to GPIO17 and TX is connected to GPIO16.
This is the code I run on the Uno:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); 

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

void loop() {
  if(mySerial.available()){
    String input = mySerial.readString();
    Serial.println(input);    
  }
  delay(25);
}

When I run the code on the esp32, this comes in the Serial monitor:
gif1

I expect to receive the numbers on the Uno like this, but instead I get nothing.
But when I unplug the esp32 it does this:
gif
It just prints all the data that is send.
I don't know what the problem is. But if I add this to the code on the esp32 in the loop() function: Serial.println(mySerial.readString()); it does work but very slow.

try

String input = mySerial.readStringUntil('\n');

Nope still does the same thing. Only when i power the esp32 off, it sends the data.

For sure Esp doesn't send anything when you power it off.
Do you have other pins than tx/rx (like enable) wired to your Esp?

No i haven't. I only have the RX and TX pins connect and the VCC and GND.

How is your setup powered?
Did you "experiment" with the module settings?

I have changed the module settings so they're the same: 433100 3 9 3 0. The esp32 is powered by a breadboard power supply with 3.3v. But I get the same problem by powering the esp32 with a usb-c.

When you say that you are "turning off" the ESP32, how are you doing that? Turning off the power to the breadboard?

Yeah so i got the elegoo breadboard power supply and there is like a button next to the dc in.

So is apc powered from esp like you wrote or directly from this "psu"?

At the start of your post you say that you are "turning off" the ESP32, but later on where you post the Serial Monitor output you say "when I unplug the esp32", so which is it? If unplug, then where from?

From the esp32 3.3v


I got it like this

It's kinda both. So when it is connected to the breadboard power supply, it has a button where I turn it on and off.
But the same problem occurs when the esp32 is unplugged from the usb-c.
And you're right because it is a bit confusing if I keep switching the statements.

Well it might confuse things if you have both power sources connected at the same time. I was trying to establish whether the ESP was really being powered down or whether it was inadvertently receiving power from somewhere else. You see, as kmon said, if you power off the ESP, then it can no longer be transmitting, so from where are you still getting numbers on the UNO receiver?

Thanks for posting the breadboard layout btw.

That's what i thought when I first got this problem, like it only recieves the input if the esp32 is off.
Maybe it has something to do with the Uno's code? But to me it looks right.

Btw thanks for helping me and for your ideas.

What I was thinking when I asked about power supply, if you had power on APC still when disconnecting Esp, maybe APC transmitted what it had in buffer. But according to your wiring that's not possible...

That's true. Maybe the esp32 is broken, i will try another one tomorrow.

Can't be esp32.
Either transmitting APC sends the whole buffer when you disconnect power or receiving APC gives the whole buffer to Uno when the transmitter stops transmitting....
Doesn't sound like normal behavior.
You could connect enable pins to high.

Have you measured something to ensure that the button actually turns the power on and off?

Okay i will try that. So to connect enable pins to high means that i would connect the EN pin on the apc220 to the 3.3v?