UedaTakeyuki / mh-z19

Read CO2 concentration from mh-z19 sensor on the Raspberry Pi & handle it. Detect Raspberry Pi model automatically and read the value from an appropriate serial device.
MIT License
182 stars 37 forks source link

No Data & Serial Port problems #48

Closed wh1t3chr1s closed 1 year ago

wh1t3chr1s commented 1 year ago

Hallo, I'm very new to all of this, so sorry in advance.

-Raspberry Pi 4 /w MH_Z19C -I installed it via "pip install". -I've enabled the serial port hardware in raspi-config as well as I2C which I need for the other part of my project. -I triple-checked the wiring. -The red led is blinking. -I used "chmod 777" (just in case) for both /dev/ttyS0 and /dev/AMA0 -I disabled bluetooth just like one person of the other issues stated that it worked for them. -After I used _mh_z19.readall() once, it reset all the permissions for ttyS0 back to what it was before. Therefore I get this after using it again: helplol

Help? ^^°

UedaTakeyuki commented 1 year ago

Hi wh1t3chr1s,

Would you please try mh_z19.read_all(True) instead of mh_z19.read_all() and tell me the result, thx!

wh1t3chr1s commented 1 year ago

I don't know WHY, but mh_z19.read_all() works now for some reason as well as the (True) version that you just suggested.

wh1t3chr1s commented 1 year ago

The only thing thats weird is that the temperature doesn't seem to be correct. I have two other ways of getting my temperature, both tell 4 degrees cooler.

UedaTakeyuki commented 1 year ago

The temperature returned by read_all() is just an expedient value, not a universal truth. It's just computed as TT - 40 with undocumented internal value TT which is thought that it might be related to ambient temperature and used sensor internally. Under several environments, -40 works as a good supplement, but if it doesn't fit in your environment, you can use it by adding your complement +4.

UedaTakeyuki commented 1 year ago

5 day no feedback.