Is there anything faster than: requestTemperatures();

Hi. I am writing code that needs to update really fast (It's measuring speed of propeller ). And I also need to get temperature out of DS18B20. Unfortunately when it comes to requestTemperatures(). It freezes a little. I suppose it's beacouse of command just takes a while to execute because I haven't conected anything else to code yet. Is there a way to make it happen faster? Thanks in advance.

Welcome to the forum.

The one wire library has delays in it. Its the drawback of creating cheap protocols without hardware support.

Maybe this library can help limit the amount of blocking in your sketch. I have not tested it myself. Just looked for non blocking DS18B20.

celerkiss:
Unfortunately when it comes to requestTemperatures(). It freezes a little.

Use the DS18B20 asynchronously.

sensors.setWaitForConversion(false); // search for more info in the examples

Leo..

I think you are on the wrong tram altogether, your real problem is with your propeller code, and you are probably just kidding yourself about reading the DS18B20 anyway. But who would ever know? and how would anybody venture an opinion?, as your code is clearly a secret. The first thing you might consider is just how frequently you seriously expect to need to read the temperature, and how you will read it (also currently a secret).

Yes, wiring and code should be part of a post for a complete answer.
But this is a new member with only one post. Give him/her some slack.

@ celerkiss, please read the "how to post" thread.

A search for "DS18B20 asynchronous" should get you started if you prefer to solve this on your own.
Leo..

A suggestion take temperature readings less frequently or use a different sensor. An option is to request the temperature then do something else until it is ready. If you look at this link it shows how to do it by issuing a read sensor and doing something else until it is ready. This is how that was done. 1) start a new reading. (requestTemperatures) do something
2) read the new reading. (getTempCByIndex) then start new reading immediately. Here is a link https://forum.arduino.cc/index.php?topic=157137.0

Ok. I managed to solve it. Thanks everyone for help.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.