kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.99k stars 499 forks source link

Bad Checksum Error when connecting MH-Z19B sensor UART - USB #918

Closed latimer288 closed 3 years ago

latimer288 commented 3 years ago

I am very new to programming and electronics so this is very much a learning process. i have connected the MH-Z19B via UART - USB utilizing mycodo following direction in Kyle Gabriel's hydroponic automation write-up. It appears to be functioning and the operating system is communicating with the sensor however i cannot receive data back to the Pi 4. when reviewing the logs I see the sensor communicating every 15 secs however the error reads bad checksum. Below I have included an example of the log. i believe that is all the info needed as I assume this is a small issue i am over looking.

Thanks for any assistance.

,665 - INFO - mycodo.daemon - All activated Custom controllers started
2021-01-06 11:52:41,925 - INFO - mycodo.controllers.controller_widget - Activated in 259.3 ms
2021-01-06 11:52:42,926 - INFO - mycodo.daemon - Mycodo daemon started in 2.557 seconds
2021-01-06 11:52:42,930 - INFO - mycodo.daemon - 41.80 MB RAM in use
2021-01-06 14:02:12,572 - INFO - mycodo.controllers.controller_input_1f7a8450 - Activated in 268.1 ms
2021-01-06 14:02:12,583 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:02:19,620 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:02:34,561 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:02:49,613 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:03:04,558 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:03:19,602 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:03:34,545 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:03:49,594 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:04:04,637 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:04:19,581 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:04:34,625 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:04:49,568 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:05:04,613 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:05:19,558 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
2021-01-06 14:05:34,606 - ERROR - mycodo.inputs.mh_z19b_1f7a8450 - Bad checksum
kizniche commented 3 years ago

Make sure you have the wires connected properly and are using the correct USB device.

latimer288 commented 3 years ago

hey Kyle, I am using the exact USB device you recommended in your write up. However I had issues wiring the harness from the sensor to the USB device. It didn't seem to work when i mimicked your picture in the write up. So I wired the sensor on a breadboard to the USB device. that got a connection, however also the error.

kizniche commented 3 years ago

Can you write the chip model and also show how you have it wired in order to verify it's correct? There's something wrong with your configuration or there's a hardware issue, but without enough information diagnosis is impossible.

latimer288 commented 3 years ago

re wired the usb device properly and fixed the issue. thanks for the assistance and work you are doing. the write up you did of the hydroponic automation was very inspirational. looking forward to continuing this project.

kizniche commented 3 years ago

Great! Glad to hear. Also check out the forum at kylegabriel.com/forum for any general discussions you want to start, if it's not a software issue.