MHZ-19C

Hi,

Currently I'm trying to print some readings with ESP32 from the MHZ-19C (Co2 and temperature sensor), with a pretty simple program that I feel like should work. But after opening the serial monitor and pressing the reset button, i get something really weird:


Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
Starting...
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400d4150: f2a52163 a18b0cff 4452ffbf
Core 0 register dump:
PC : 0x400d4154 PS : 0x00060133 A0 : 0x800d4666 A1 : 0x3ffbbfc0
A2 : 0x3ffbbb64 A3 : 0x40085048 A4 : 0x00060120 A5 : 0x3ffbb970
A6 : 0x00000000 A7 : 0x3ffbbce0 A8 : 0x800d462e A9 : 0x3ffbbfa0
A10 : 0x3ffbc0e8 A11 : 0x3ffbbfcf A12 : 0x00000001 A13 : 0x00000001
A14 : 0x00060120 A15 : 0x00000000 SAR : 0x00000000 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000

Backtrace: 0x400d4154:0x3ffbbfc0 0x400d4663:0x3ffbbff0 0x400d4b45:0x3ffbc010 0x400899d6:0x3ffbc030 0x400884e5:0x3ffbc050

--------------------- And the Code: -------------------------

#include <SoftwareSerial.h>
#include <MHZ19.h>

MHZ19 mhz(&Serial1);

SoftwareSerial ss(16, 17);

void setup()
{
  Serial.begin(115200);
  Serial.println(F("Starting..."));

  Serial1.begin(9600);
}

void loop()
{
  MHZ19_RESULT response = mhz.retrieveData();
  if (response == MHZ19_RESULT_OK)
  {
    Serial.print(F("CO2: "));
    Serial.println(mhz.getCO2());
    Serial.print(F("Temperature: "));
    Serial.println(mhz.getTemperature());
    Serial.print(F("Accuracy: "));
    Serial.println(mhz.getAccuracy());
  }
  else
  {
    Serial.print(F("Error, code: "));
    Serial.println(response);
  }
  
  delay(15000);
}

Can you try with something simple and then add other things.
Make a sketch that says: "Hello". If that already fails, can you tell which ESP32 board you have and which settings in the menu you use.
Then add a library and test it, then remove it and test the other library, then both, then with the rest of the sketch.

Why do you need a SoftwareSerial port ?
Can you give links to the libraries that you use ? And a link to that sensor.

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