Hi,
I have this CO2 sensor, datasheet: here
I'm trying to get with wemos d1 mini v3.0 the values of ppm and temp out of the sensor but i just can't get it to work.
I have found some one who sais he has i running. this is his blog: here
and the corresponding github files: here
Difference is that he has MHZ-19 and i have MHZ-19B sensor.
Where the TX and RX are on different pins.
My wiring:
VCC: to external 5 volt
GND: to externa GND (grounds of sensor and external vcc NOT connected)
RX to D3 on wemos d1 mini
TX to D4 on wemos d1 mini
Wemos to USB -> PC
The problem is that when i power everything the arduino serial console seem to see the sensor but i just get this:
MH-Z19 now warming up... status:-1
MH-Z19 now warming up... status:-1
MH-Z19 now warming up... status:-1
MH-Z19 now warming up... status:-1
MH-Z19 now warming up... status:-1
MH-Z19 now warming up... status:-1
co2: -1
temp: -1
co2: -1
temp: -1
co2: -1
temp: -1
co2: -1
temp: -1
co2: -1
temp: -1
co2: -1
This is the simple test scatch that i have now:
/*----------------------------------------------------------
MH-Z19 CO2 sensor SAMPLE
----------------------------------------------------------*/
#include <MHZ19_uart.h>
const int tx_pin = D3; //Serial tx pin no
const int rx_pin = D4; //Serial rx pin no
MHZ19_uart mhz19;
/*----------------------------------------------------------
MH-Z19 CO2 sensor setup
----------------------------------------------------------*/
void setup() {
Serial.begin(9600);
mhz19.begin(rx_pin, tx_pin);
mhz19.setAutoCalibration(false);
while( mhz19.isWarming() ) {
Serial.print("MH-Z19 now warming up... status:");Serial.println(mhz19.getStatus());
delay(1000);
}
}
/*----------------------------------------------------------
MH-Z19 CO2 sensor loop
----------------------------------------------------------*/
void loop() {
int co2ppm = mhz19.getPPM();
int temp = mhz19.getTemperature();
Serial.print("co2: "); Serial.println(co2ppm);
Serial.print("temp: "); Serial.println(temp);
delay(5000);
}
This is the liberary that i use: here
Has anyone have this configuration running?
Whats is wrong?
Why are all values -1??
hope someone can help me.
tnx