arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.71k stars 4.72k forks source link

MH-Z19 Does not seem to connect #2237

Closed InvertedMinor closed 6 years ago

InvertedMinor commented 6 years ago

Connected MH-Z19 to Sonoff Basic, the sensor led does flash, but no data is received by the Sonoff. I must be doing something wrong. Any ideas?

screen shot 2018-03-23 at 18 52 54

screen shot 2018-03-23 at 18 56 02

screen shot 2018-03-23 at 19 05 08

Jason2866 commented 6 years ago

Do you have disabled serial logging?

InvertedMinor commented 6 years ago

yes

Jason2866 commented 6 years ago

Try to swap tx and rx. Sometimes it is false labeled.

Jason2866 commented 6 years ago

Do you have connected GND between sonoff and sensor? Is the sensor correct powered? It needs minimal 3.6 Volt Vin and max 5.5 Volt If i see it correct you use the 3.3 Volt power from sonoff. This is under the Vin spec. from the sensor

InvertedMinor commented 6 years ago

Thnx, I will try this

tobox commented 6 years ago

I had a MH-Z14 running with the MH-Z19 settings, and it was running nicely for quite a while. Then it sometimes started to have zero readings, with newer firmwares I always only received zero readings.

I patched the firmware to use hardware serial (with serial.swap) instead of softserial, and now it is working flawlessly. But I would love to see this being fixed in a way so that the standard tasmota firmware continues working with MH-Z19 (and possibly MH-Z14a).

Actually, I was using a Wemos D1 instead of Sonoff, and I see you are already using the hardware serial. So it is possible that the low VCC is causing your problem.

InvertedMinor commented 6 years ago

Followed above comments: MH-Z19 connected to 5V power supply and measured the actual voltage, Gnd MH-Z19 connected to Sonoff, tried to switch rx/tx, .... but no result (values remain at 0).......

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem.

mik13ST commented 1 year ago

I can confirm you need hardware UART for MHZ14 to work as mentioned in https://github.com/arendst/Tasmota/issues/2237#issuecomment-376097913. You don't have to make you own tasmota build thought. If you pick the pins correctly, the MHZ driver will switch to hardware UART on its own, see this source code comment. https://github.com/arendst/Tasmota/blob/c08561f67c722556655da7b8cbe1482d98aecd90/tasmota/tasmota_xsns_sensor/xsns_15_mhz19.ino#L26

This solution is already mentioned on the MHZ19 sensor page in the Wiring section (https://tasmota.github.io/docs/MH-Z19B/#wiring) so if people read the page carefully, unlike I did, resolving this should be straightforward.