Commit graph

18 commits

Author SHA1 Message Date
牧羊犬真Q
7be7cf0f22
fixed typoes in readme and fixed error in MHZ.cpp files (#24)
* correct the type of sensor in readme

* fix overflow in int datatype in arduino Uno.
In Uno, it's 16 bits in int variable. So I add a explicit type cast in MHZ.cpp file

* fix the warning of implicit convert from hex to char.
I change the data type to unit_8t, and it also helps to unify the datatype of these cmd arrays.
2021-09-28 10:15:22 +02:00
4m1g0
d2dbf58947
Move global variables to class atributes to make it possible to define 2 sensors running independantly (#20) 2021-01-22 18:49:45 +01:00
Christoph Schultz
8a063e7c27
Add support for setting the range and autocalibration. Closes #1.
* added possibility to set Range, to enable/disable Autocalibrate and to calibrate maually ( see Datasheet v 1.2 : https://www.winsen-sensor.com/d/files/MH-Z14A.pdf

* Update MHZ.cpp

* Update MHZ.cpp

* Update MHZ.h

added calibrate Span, for complete functionality but commented out , due to professional use (req. constant atmosphere with 2k, 5k or 10k ppm CO2.).
corrected the bugs in MHZ.cpp also.

* Update MHZ.cpp

Added comments for  Sensors with specific firmware.

Co-authored-by: Christoph Schultz <christoph@schultz1-christoph.de>
2021-01-14 22:28:47 +01:00
Daniel Hirscher
d79581a1e1
added upper L for Arduino Uno to preheating time
The literals for the preheating time are interpreted as int.
On Arduino Uno an int is 2 bytes in size, ranging from -32,768 to 32,767. Therefore, the calculated number of 3*60*1000=180000 does not fit in.
Added upper L to force the literal to long.
2020-11-26 16:25:17 +01:00
Portagoras
093774f701
Correction
The datasheet clearly says that the CO2 level is 2000x(th-2ms)/(th+tl+4ms), so I think here it should say 2000 too. At least that resulted in way better results for me.
2020-07-01 22:57:48 +02:00
Tobias Schürg
af5c565990
Make times unsigned long to avoid overlow
on 16 bit architectures. Closes #10
2019-09-08 11:21:55 +02:00
Andreas Horn
253f8ae7d1 implements various small fixes and improvements
* the preheating time is now a constant variable too
* it is no possible to initialize the senor without PWM xor without (Soft-)Serial
*
2019-06-08 13:37:21 +02:00
Andreas Horn
8d677f5dce fixes wrong responsetimes for the sensors, it is seconds, not milliseconds according to the datasheet. 2019-06-08 11:11:46 +02:00
Vladimir Kozlov
03d8500042 Added support of generic streams instead of software serial. 2018-12-31 10:04:11 +02:00
mariusebastian
f96cf2abc6
Debug info and temperature update
Prevent "...Status maybe not OK.." from always being printed when debug is on.
Changed the is !isReady check to isPreHeating when getting the latest temperature. The isReady check prevents the function from returing the pre stored temperature within MHZxxx_RESPONSE_TIME after the UART data has been requested. This is an unnecessary restriction.
2018-09-24 12:12:02 +02:00
flatsiedatsie
7e401b4625
Save some memory
Instead of just creating an issue that the library uses a lot of memory,  I wanted to save you some work instead.

I have not tested this code, but i have double checked it.
2018-09-10 20:41:05 +02:00
Tobias Schürg
252266c130 Extracted response times. 2018-09-04 22:33:00 +02:00
Tobias Schürg
83ba964a90 Implemented isPreHeating and isReady. 2018-07-07 16:05:40 +02:00
Tobias Schürg
99729af090 Added isPreheating and isReady to MHZ.h and reformatted. 2018-07-07 12:59:32 +02:00
Tobias Schürg
7158f63459 Introduced status codes as return values. 2018-07-04 23:20:12 +02:00
Tobias Schürg
a66da23b89 Changed status handling as it seems as if the mhz19B returns 0 instead of 0x40 like the mhz19. 2018-06-24 14:38:42 +02:00
Tobias Schürg
29ea8e92bc Added a debug mode and improved log messages. 2018-06-24 12:22:50 +02:00
Tobias Schürg
ddef5ff84f Extracted MHZ logic into its own class. 2018-06-23 14:32:55 +02:00
Renamed from MH-Z19B-LCD/MH-Z19B-LCD.ino (Browse further)