Open mayjack0312 opened 4 months ago
This is not a library problem.
If you only want the middle section, just put you start and end timing around the getTempC() part.
If you need to dig deeper, you have to measure the underlying oneWire calls.
Definitely outside this library.
Just curious, what do you want to achieve with these measurements?
This is not a library problem.
If you only want the middle section, just put you start and end timing around the getTempC() part.
If you need to dig deeper, you have to measure the underlying oneWire calls.
Definitely outside this library.
Just curious, what do you want to achieve with these measurements?
Following the new question in the post below
After delving deeper and studying, I found that it is not that easy to achieve.
https://github.com/cpetrich/counterfeit_DS18B20/issues/38
The main goal is to achieve batch detection of the relevant data in the table below.
The main goal is to achieve batch detection of the relevant data in the table below.
The milliseconds conversion time is no problem for microprocessors. To get accurate timing in the microsecond level you need a processor with a very fast IO and clock e.g. ESP32. For sub-microsecond measurements, you have to look at a red-pitaya or so.
My assumption is that a ESP32 at 240 MHz will be capable of measuring these values with reasonable repeatability and accuracy. An Arduino UNO or MEGA at 16 MHz has a micros resolution of 4 us so it can not measure below 50 us (unless an error of ~10% is acceptable).
So your setup should involve at least 2 processors.
Not trivial but certainly doable.
The main goal is to achieve batch detection of the relevant data in the table below.
The milliseconds conversion time is no problem for microprocessors. To get accurate timing in the microsecond level you need a processor with a very fast IO and clock e.g. ESP32. For sub-microsecond measurements, you have to look at a red-pitaya or so.
My assumption is that a ESP32 at 240 MHz will be capable of measuring these values with reasonable repeatability and accuracy. An Arduino UNO or MEGA at 16 MHz has a micros resolution of 4 us so it can not measure below 50 us (unless an error of ~10% is acceptable).
So your setup should involve at least 2 processors.
- one that interacts with the DS18B20 and sends a variety of commands including temperature measurements etc.
- The second processor (ESP32) monitors the signals on the oneWire bus and analyzes them.
- The second triggers the first one to start a test e.g. a byte over serial indicating which test to do)
- The first one signals the second sensor that it is ready with a test step (same byte over Serial)
- The second needs to handle time out of the running test.
- The second processor does the test e.g. 100 times to get an estimate of the mean and standard deviation of the timing.
Not trivial but certainly doable.
Thank you for the insights. I hadn't considered the processor performance issues before. It looks like I'll have to keep working with the ESP32.
This issue is still a timing logic problem. My code is as follows:
The current measurement results include the start and stop commands, but I only want the times for the Data:0x00 operations in the middle section of the loop.