iotempire / iotempower

IoTempower is a framework and environment for making the Internet of Things (IoT) accessible for everyone
MIT License
24 stars 18 forks source link

MH-Z19 (PWM) CO2 sensor support package #135

Open mbz4 opened 3 days ago

mbz4 commented 3 days ago

This item focuses on building a support package for the MH-Z19 CO2 sensor using PWM protocol.

Testing w/ this PWM Async library:

No results so far: Image

Tried several wiring configs: Image

Useful docs here:

Pin Definition
Vin Vin
GND GND
Vo Analog output (0.4~2 V) or (0~2.5V)
PWM PWM
HD HD (zero calibration, low level lasting for over 7s under low level is effective)
Rx UART (RXD) TTL Level data input
Tx UART (TXD) TTL Level data output
mbz4 commented 3 days ago

PWM Async example working: Image

Testing w/ exhale on-to sensor: Image

On to preparing iotempower driver draft...

ulno commented 3 days ago

What prevents you from using the built-in pwm functionality of IoTempower? This would then allow to run on all esp32 and esp8266 platforms?

mbz4 commented 3 days ago

What prevents you from using the built-in pwm functionality of IoTempower? This would then allow to run on all esp32 and esp8266 platforms?

not sure mhz19 supports writing over pwm docs show this PWM output definition for ppm measurements: Image

will test w/ native iotemp pwm library first, setup.cpp: pwm(CO2, D2, 2000); ... again, doubt it supports writing over pwm unless undocumented

ulno commented 3 days ago

ah it is for reading pwm - not writing Reading might be impossible until the buffered async reader works - so you might need to help me fix that one first. But all depends on timing.

So the serial communication port is just bogus and useless?

Message ID: @.***>

mbz4 commented 3 days ago

@ulno pwm(CO2, D2, 2000); gave this:

Image

ah it is for reading pwm - not writing Reading might be impossible until the buffered async reader works - so you might need to help me fix that one first. But all depends on timing. So the serial communication port is just bogus and useless?

ok

i figured i'd try w/ PWM since serial also unsupported guess one thing at a time, will push back to Todo/Backlog

Do you have an open issue already for async pwm reader?