OneWire question

I got the Dallas temperature sensor to work. (Finally.) I am working to trim down the overhead of the functions in the “demo software” which is available for the chip.

My application is time critical so one place I want to cheat a bit is as follows. I will have only one device on the OneWire pin. If you have more than one device and you want to service/use them all, one typically uses the .search function to “find the next device”. My intent is to do this one time only and when I have found the Dallas sensor, to never again do a search.

Instead I will leave the driver set to talk to that one device, the Dallas temperature sensor.

So here’s my question, if the sensor itself or the driver ever gets confused or loses state information that THIS device is selected, things will fail. That’s because I only do the search one time. My application will start up and run for several hours outside, powered by batteries.

How “reliable” is the OneWire? Do things ever glitch?

I wouldn’t do a search at all in the code that you’re going to use in the field. You can use the example code in the library to do the search, and print out your address. Once you have that, hard code it into your actual application, and you can get rid of all the search code.

I can confirm that this works quite well and is far simpler and more reliable than the search code.

Uhhh. What do you mean by “more reliable than the search code”?

If you don’t use the search code, there’s no chance of it failing to find the sensor. It’s just one less thing to worry about.

1 Like