• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP32 MicroPython Course

Q&A Forum › Category: ESP32 › ESP32 MicroPython Course
0 Vote Up Vote Down
Hans Haerdtle asked 3 years ago

Hi,
I have done the course (V1.3). I love the really very well written tutorial and course. I have completed the project as described from page 304, MQTT with Node Red and DS18B20. Worked very well from the onset however after some time (can be more than an hour or shorter) the ESP stops sending temperature data and I see a CRC error in the Thonny shell window. 
I’m also seeing “0” readings every so often. I have changed the sensor and also adjusted the intervall from the initial 5 seconds to different values but still the same.
What might be the reason?
Hans

6 Answers
0 Vote Up Vote Down
Hans Haerdtle answered 3 years ago

I’ve added a snapshot of the error after about 30 minutes
Found DS devices: [bytearray(b'(^}\xf7C \x01\x1f’)]
Temperatures:
23.875 Valid temperature
Published: b’23.9′
Found DS devices: [bytearray(b'(^}\xf7C \x01\x1f’)]
Temperatures:
23.875 Valid temperature
Published: b’23.9′
Found DS devices: [bytearray(b'(^}\xf7C \x01\x1f’)]
Temperatures:
23.875 Valid temperature
Published: b’23.9′
Found DS devices: [bytearray(b'(^}\xf7C \x01\x1f’)]
Temperatures:
Traceback (most recent call last):
File “main.py”, line 50, in <module>
File “main.py”, line 10, in read_ds_sensor
File “ds18x20.py”, line 40, in read_temp
File “ds18x20.py”, line 30, in read_scratch
Exception: CRC error
MicroPython v1.18 on 2022-01-17; ESP32 module with ESP32
Type “help()” for more information.
MicroPython v1.18 on 2022-01-17; ESP32 module with ESP32
Type “help()” for more information.
>>>

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
 
I found this suggestion: https://forum.micropython.org/viewtopic.php?f=16&t=2564&sid=0aaedba78f89641e442f8ec90438e620&start=10
In that case, the error happens in a different scenario. But the suggestion might work for your case. If you add an error handling routine as described, the code will not crash and will proceed to the other sections of code when the issue is solved.
 
Regards,
Sara

0 Vote Up Vote Down
Hans Haerdtle answered 3 years ago

Hi Sara,
thanks for your response. I’ve done more tests and research and ultimately modified the code and using Robert-hh’s drivers The assert raising the CRC error is in onewire.py. That is caught in DS18B20.py (both are loaded to the ESP32) and I can deal with the AssertionError. I can disconnect the sensor and reconnect and don’t break the code. The original ds18x20.py would not deal with a CRC error. 
Many thanks again for the lead.
Hans
 

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
That’s great. Definitely a better option.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

0 Vote Up Vote Down
Hans Haerdtle answered 3 years ago

Thanks Sara. 
I think some of these issues also stem from very different and varying qualities of the DS18B20 sensor, especially the CRC error. I tried several of them and don’t even use long leads. Just breadboard assembly. 

The original MicroPython driver is not having a lot of options for error handling.
Hans

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Yes. You are right, I wasn’t aware of that issue, because my DS18B20 sensors never got that error.
But the other driver you mentioned is definitely a better option.
I’ll close this issue now.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.