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