MHZ19B Sensor - Can't connect to ESP32 on HardwareSerial

Hi there,
I am trying to attach a MHZ19B CO2 sensor to my ESP32 Wroom 32. So far I soldered wires to RX,TX,Vin,GND on the sensor and attached them to the ESP32. RX and TX to the RX0 and TX0 respectively.
However, I get this back (I'm using PlatformIO to build and flash)

Auto-detected: /dev/ttyUSB0
Uploading .pio/build/esp32dev/firmware.bin
esptool.py v4.4
Serial port /dev/ttyUSB0
Connecting......................................
A fatal error occurred: Failed to connect to ESP32: No serial data received.

And when I detach the TX0 connection, it can initialize the serial. Am I being a moron or this is really weird?
Here is the ESP32 pinout map if that helps.


And here is the code I uesd

#include <Arduino.h>
#include "MHZ19.h"
#define RXD0 3
#define TXD0 1
#define BAUDRATE 9600 // Native to the sensor (do not change)

MHZ19 myMHZ19;

unsigned long getDataTimer = 0;

void setup()
{
    delay(10000);
    Serial.begin(115200);

    Serial.println("Setting up Access Point...");
    Serial1.begin(9600, SERIAL_8N1, RXD0, TXD0);

    myMHZ19.begin(Serial1); // *Imporant, Pass your Stream reference

This section is for Nano ESP32
(not "ESP32" from wr00m et al.)

Suggesting that you research -- HardwareSerial.h

I moved your topic to a more appropriate forum category @arianium.

As @runaway_pancake explained already, the Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.

In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.

Thanks in advance for your cooperation.

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