MHZ19 sensor working ??

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
vincen
Normal user
Posts: 91
Joined: 26 Jun 2017, 07:15

MHZ19 sensor working ??

#1 Post by vincen » 28 Jun 2017, 16:48

Hi

Trying to interface my MHZ19 sensor I falshed the dev firmware in my ESP. I have then setup it in web interface (not wired sensor yet) and since my ESP reboots automatically nearly all the time ! I can reach it few seconds every 2/3 minutes ! Is the driver unusable in the dev branch ?? or is it because I did not wire sensor first ??

Thanks

Vincèn

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: MHZ19 sensor working ??

#2 Post by LisaM » 28 Jun 2017, 23:32

Which firmware?
Which hardware setup?

If you want help, you need to tell a LOT more!!!

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: MHZ19 sensor working ??

#3 Post by Shardan » 29 Jun 2017, 20:10

LisaM wrote: 28 Jun 2017, 23:32 Which firmware?
Which hardware setup?

If you want help, you need to tell a LOT more!!!
+1 for that.

If the sensor is not connected it's diffucult to say what's going on.
Anyways we need a lot of more info.

Regards
Shardan
Regards
Shardan

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: MHZ19 sensor working ??

#4 Post by grovkillen » 10 Jul 2017, 23:50

Just thought I'd link to this workaround:

https://www.letscontrolit.com/wiki/inde ... th_own_IDX
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: MHZ19 sensor working ??

#5 Post by BertB » 23 Jul 2017, 15:45

I am also testing the plugin, with http to domoticz, no MQTT.
I have connected it to a WEMOS. This is the plugin settings:
MHZ19.png
MHZ19.png (58.68 KiB) Viewed 14275 times
I often get this kind of readings in the serial port:
Any idea why it give a Unstable reading that often?

EVENT: Clock#Time=Sun,15:38
FF 86 5 47 3F 4 2A 3F 82
MHZ19: Unstable reading, ignoring! PPM value: 1351 Temp/S/U values: 23/4/10815.00
EVENT: Clock#Time=Sun,15:39
WD : Uptime 1 ConnectFailures 0 FreeMem 18240
WD : Uptime 1 ConnectFailures 0 FreeMem 18264
FF 86 4 B1 3F 4 2A 3F 19
MHZ19: Unstable reading, ignoring! PPM value: 1201 Temp/S/U values: 23/4/10815.00
EVENT: Clock#Time=Sun,15:40
WD : Uptime 2 ConnectFailures 0 FreeMem 18264
IMPT : [MQTT#Solar] : 1428.00
EVENT: MQTT#Solar=1428.00
WD : Uptime 2 ConnectFailures 0 FreeMem 18392
FF 86 4 90 3F 8 2A 3F 36
MHZ19: Unstable reading, ignoring! PPM value: 1168 Temp/S/U values: 23/8/10815.00
EVENT: Clock#Time=Sun,15:41
WD : Uptime 3 ConnectFailures 0 FreeMem 18416

I modified the code a bit, so it now accepts commands like mhzreset. I use in the serial port: MHZ19,mhzreset etc.
The software now also prints the Hex codes of the input stream.

This is what I changed in the WRITE part:
case PLUGIN_WRITE:
{
String tmpString = string;
int argIndex = tmpString.indexOf(',');
if (argIndex)
tmpString = tmpString.substring(0, argIndex);
if (tmpString.equalsIgnoreCase(F("MHZ19")))
{
success = true;
argIndex = string.lastIndexOf(',');
tmpString = string.substring(argIndex + 1);



// String command = parseString(string, 1);
Serial.print("MHZ: ");Serial.println(tmpString);
if (tmpString.equalsIgnoreCase(F("mhzcalibratezero")))
{
Plugin_049_SoftSerial->write(mhzCmdCalibrateZero, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Calibrated zero point!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzreset")))
{
Plugin_049_SoftSerial->write(mhzCmdReset, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent sensor reset!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzabcenable")))
{
Plugin_049_SoftSerial->write(mhzCmdABCEnable, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent sensor ABC Enable!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzabcdisable")))
{
Plugin_049_SoftSerial->write(mhzCmdABCDisable, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent sensor ABC Disable!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzmeasurementrange1000")))
{
Plugin_049_SoftSerial->write(mhzCmdMeasurementRange1000, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent measurement range 0-1000PPM!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzmeasurementrange2000")))
{
Plugin_049_SoftSerial->write(mhzCmdMeasurementRange2000, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent measurement range 0-2000PPM!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzmeasurementrange3000")))
{
Plugin_049_SoftSerial->write(mhzCmdMeasurementRange3000, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent measurement range 0-3000PPM!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzmeasurementrange5000")))
{
Plugin_049_SoftSerial->write(mhzCmdMeasurementRange5000, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent measurement range 0-5000PPM!"));
success = true;
}
break;
}
}


case PLUGIN_READ:

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: MHZ19 sensor working ??

#6 Post by BertB » 23 Jul 2017, 22:01

Every time, after a few hours, the MHZ19 starts to show:

EVENT: Clock#Time=Sun,21:57
WD : Uptime 177 ConnectFailures 0 FreeMem 18392
WD : Uptime 178 ConnectFailures 0 FreeMem 18416
FF 86 0 15 40 40 2D 89 2F
MHZ19: PPM value: 21 Temp/S/U values: 24/64/11657.00
EVENT: CO2#PPM=21.00
EVENT: CO2#Temperature=24.00
EVENT: CO2#U=11657.00
EVENT: Clock#Time=Sun,21:58
WD : Uptime 178 ConnectFailures 0 FreeMem 18392
WD : Uptime 179 ConnectFailures 0 FreeMem 18296
FF 86 0 15 40 40 2D 89 2F
MHZ19: PPM value: 21 Temp/S/U values: 24/64/11657.00
EVENT: CO2#PPM=21.00
EVENT: CO2#Temperature=24.00
EVENT: CO2#U=11657.00
EVENT: Clock#Time=Sun,21:59

Any idea?

LouiS22
Normal user
Posts: 2
Joined: 20 Aug 2017, 20:57

Re: MHZ19 sensor working ??

#7 Post by LouiS22 » 23 Aug 2017, 19:06

BertB wrote: 23 Jul 2017, 15:45 I am also testing the plugin, with http to domoticz, no MQTT.
I have connected it to a WEMOS. This is the plugin settings:
MHZ19.png

I often get this kind of readings in the serial port:
Any idea why it give a Unstable reading that often?

EVENT: Clock#Time=Sun,15:38
FF 86 5 47 3F 4 2A 3F 82
MHZ19: Unstable reading, ignoring! PPM value: 1351 Temp/S/U values: 23/4/10815.00
EVENT: Clock#Time=Sun,15:39
WD : Uptime 1 ConnectFailures 0 FreeMem 18240
WD : Uptime 1 ConnectFailures 0 FreeMem 18264
FF 86 4 B1 3F 4 2A 3F 19
MHZ19: Unstable reading, ignoring! PPM value: 1201 Temp/S/U values: 23/4/10815.00
EVENT: Clock#Time=Sun,15:40
WD : Uptime 2 ConnectFailures 0 FreeMem 18264
IMPT : [MQTT#Solar] : 1428.00
EVENT: MQTT#Solar=1428.00
WD : Uptime 2 ConnectFailures 0 FreeMem 18392
FF 86 4 90 3F 8 2A 3F 36
MHZ19: Unstable reading, ignoring! PPM value: 1168 Temp/S/U values: 23/8/10815.00
EVENT: Clock#Time=Sun,15:41
WD : Uptime 3 ConnectFailures 0 FreeMem 18416

I modified the code a bit, so it now accepts commands like mhzreset. I use in the serial port: MHZ19,mhzreset etc.
The software now also prints the Hex codes of the input stream.

This is what I changed in the WRITE part:
case PLUGIN_WRITE:
{
String tmpString = string;
int argIndex = tmpString.indexOf(',');
if (argIndex)
tmpString = tmpString.substring(0, argIndex);
if (tmpString.equalsIgnoreCase(F("MHZ19")))
{
success = true;
argIndex = string.lastIndexOf(',');
tmpString = string.substring(argIndex + 1);



// String command = parseString(string, 1);
Serial.print("MHZ: ");Serial.println(tmpString);
if (tmpString.equalsIgnoreCase(F("mhzcalibratezero")))
{
Plugin_049_SoftSerial->write(mhzCmdCalibrateZero, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Calibrated zero point!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzreset")))
{
Plugin_049_SoftSerial->write(mhzCmdReset, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent sensor reset!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzabcenable")))
{
Plugin_049_SoftSerial->write(mhzCmdABCEnable, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent sensor ABC Enable!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzabcdisable")))
{
Plugin_049_SoftSerial->write(mhzCmdABCDisable, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent sensor ABC Disable!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzmeasurementrange1000")))
{
Plugin_049_SoftSerial->write(mhzCmdMeasurementRange1000, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent measurement range 0-1000PPM!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzmeasurementrange2000")))
{
Plugin_049_SoftSerial->write(mhzCmdMeasurementRange2000, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent measurement range 0-2000PPM!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzmeasurementrange3000")))
{
Plugin_049_SoftSerial->write(mhzCmdMeasurementRange3000, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent measurement range 0-3000PPM!"));
success = true;
}

if (tmpString.equalsIgnoreCase(F("mhzmeasurementrange5000")))
{
Plugin_049_SoftSerial->write(mhzCmdMeasurementRange5000, 9);
addLog(LOG_LEVEL_INFO, F("MHZ19: Sent measurement range 0-5000PPM!"));
success = true;
}
break;
}
}


case PLUGIN_READ:
I also got Unstable reading almost all the time and can't figure it out why? Could it be a wrong soldering?

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: MHZ19 sensor working ??

#8 Post by LisaM » 23 Aug 2017, 22:52

LouiS22 wrote: 23 Aug 2017, 19:06 I also got Unstable reading almost all the time and can't figure it out why? Could it be a wrong soldering?
Pics!

Xent
Normal user
Posts: 3
Joined: 02 Oct 2017, 21:41

Re: MHZ19 sensor working ??

#9 Post by Xent » 02 Oct 2017, 21:47

I have the same problem.
I always get Unstable Reading ...

33093152 : MHZ19: Unstable reading, ignoring! PPM value: 350 Temp/S/U values: 24/0/0.00

I think the wiring isn't the problem as it's really simple.

I'm using the latest dev Version from Github.

Any tipps?

TD-er
Core team member
Posts: 6354
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MHZ19 sensor working ??

#10 Post by TD-er » 03 Oct 2017, 15:16

Xent wrote: 02 Oct 2017, 21:47 I have the same problem.
I always get Unstable Reading ...

33093152 : MHZ19: Unstable reading, ignoring! PPM value: 350 Temp/S/U values: 24/0/0.00

I think the wiring isn't the problem as it's really simple.

I'm using the latest dev Version from Github.

Any tipps?
You have the new "B" version.
There is already a pull request for this.
The problem is that the current MH-Z19 plugin is only accepting S-values of 64, where you have a 0.
The old sensor had always 1 bit active for that value (64 = good reading, 32/16/8/4 = unstable reading, 1 = init after boot).
So a simple patch for you would be to allow all S-values equal to either 0 or 64.

Xent
Normal user
Posts: 3
Joined: 02 Oct 2017, 21:41

Re: MHZ19 sensor working ??

#11 Post by Xent » 04 Oct 2017, 11:39

Yes thats correct.
I removed the stability check myself.

Now it's reporting the values to MQTT.


I calibrated the sensor after I put it outdoor for an hour and it showed about 400ppm.
But when I take it inside it always reports about 900 and above even when I open all windows for some time.
Is this normal?
Now I calibrated it indoor after all windows have been opened for some time.
I will look over time if the values are now plausible.

TD-er
Core team member
Posts: 6354
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MHZ19 sensor working ??

#12 Post by TD-er » 04 Oct 2017, 13:31

I would advice not to calibrate it yourself.
Perhaps have the ABC on (default setting) and let it rest for a day or two in a well ventilated room, or at least a room which is not populated by humans/animals for a longer time.

Also make sure your sensor is not exposed to direct sunlight. The sensor operates on IR light absorption.
And the CO2 measurement is also temperature and humidity dependent.

It is best to let the sensor hang in stable air, not in turbulent air. I saw higher reported values when the sensor was in the opening of a door to the garden. Perhaps all CO2 from our living room passed the sensor :)

Xent
Normal user
Posts: 3
Joined: 02 Oct 2017, 21:41

Re: MHZ19 sensor working ??

#13 Post by Xent » 04 Oct 2017, 14:09

I read that you could calibrate it outdoor as outdoor is always around 400ppm.
I already noticed that i get higher readings when there was an airflow at the sensor.

Now i put it into an enclosure to prtotect it from airflows and other light.
Maybe the indirect light on my table was causing this.
I will have an eye on the values as i don't need exact values.
Plausible ones are enough to determine when to open the windows ;-)

TD-er
Core team member
Posts: 6354
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MHZ19 sensor working ??

#14 Post by TD-er » 04 Oct 2017, 22:22

Since you did some manual calibration yourself, please leave the ABC enabled for a few days to let it reset itself to some sensible levels.

vincen
Normal user
Posts: 91
Joined: 26 Jun 2017, 07:15

Re: MHZ19 sensor working ??

#15 Post by vincen » 10 Oct 2017, 10:30

Just flashed my ESP with the rev 12 of 2.0.0 ESPEasy and now it reads values of my MHZ but still sees them all as invalid in logs. I have let the ABC in Normal. Should I just let the sensor in my living for a while and it'll then stabilize and starts to work correctly ??

Update: I had to wait just few minutes and now I have some values that sounds logical ;) What is U by the way reported by the sensor ??

Thanks

timbiker
Normal user
Posts: 29
Joined: 09 Nov 2017, 11:37

Re: MHZ19 sensor working ??

#16 Post by timbiker » 10 Dec 2017, 14:51

Hi guys

I am just having the same issue :

Unstable reading, ignoring! PPM value: 715 Temp/S/U values: 21/0/0.00

I am running with v2.0.0-dev12. So I supposed that I have the B version of the sensor. Do you know if the modification has been implemented in the Dev 12 version or not ?

By the way, I've just received the sensor so what are you advising me with the ABC ? Should I disable it or leave it to normal ?

Many thanks

TD-er
Core team member
Posts: 6354
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MHZ19 sensor working ??

#17 Post by TD-er » 10 Dec 2017, 18:44

The last version of the source in the V2.0 branch will have a fix for this.
And this will be released in dev-13.
You can also build yourself from GitHub and then also choose the mega branch, which will add even more filtering options.

About the ABC.
If you just connected the sensor for the first time (within 24h of operations), I advice you to set ABC disabled.
Then you can see if the room will be ventilated enough (reaching close to 400 ppm), based on the factory calibration.
ABC enabled (the default) will ruin this option, since the sensor will set the lowest measured value as being 400 ppm and if you're not ventilating enough, then the values shown will be too low after a while.

timbiker
Normal user
Posts: 29
Joined: 09 Nov 2017, 11:37

Re: MHZ19 sensor working ??

#18 Post by timbiker » 10 Dec 2017, 19:24

TD-er wrote: 10 Dec 2017, 18:44 The last version of the source in the V2.0 branch will have a fix for this.
And this will be released in dev-13.
You can also build yourself from GitHub and then also choose the mega branch, which will add even more filtering options.

About the ABC.
If you just connected the sensor for the first time (within 24h of operations), I advice you to set ABC disabled.
Then you can see if the room will be ventilated enough (reaching close to 400 ppm), based on the factory calibration.
ABC enabled (the default) will ruin this option, since the sensor will set the lowest measured value as being 400 ppm and if you're not ventilating enough, then the values shown will be too low after a while.
That is a very usefull answer thank you very much !!!

Stupid me, I did not think about the mega branch... Now I just have to figure out why I can't compil it with the Arduino IDE... :evil:

Thanks !!!

timbiker
Normal user
Posts: 29
Joined: 09 Nov 2017, 11:37

Re: MHZ19 sensor working ??

#19 Post by timbiker » 14 Dec 2017, 09:35

As a follow up, it is working like a charm.

I do have another problem but I'll open a new topic

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest