Main Site Documentation

Performance of OneWire temp sensor


I have been reading some of the example code on reading the a OneWire Temp senor, and each one seems to put a wait of 1 second to read the temp. That seems pretty slow.

How fast can I read a OneWire Temp sensor? If I have 5 sensors, can I read them all independantly or do I have to read them in serial? ( I understand that distance is also a factor in speed, but lets just assume 2 feet is the distance between each sensor, in series)

I have some sensors in the mail, I’m just curious on the performance I can expect (speed wise).


If you read the specs on a DS18B20 for instance, you’ll see the conversion time. If you only want 9-bit resolution, then the conversion time is 93.75msec, but if you want the full 12-bit resolution then it’s 750msec. You decide how much data you want…

If you look at the OneWire protocol, you can issue a command to a specific sensor by issuing a 0x55, ROMAddress, 0x44 sequence. At that point you have to wait for conversion to finish then you read the value generated. It sounds like you’ll want to start the conversion on all sensors at once, so you ussye the command sequence with SkipROM, so 0xcc, 0x44, then wait for conversion to finish and read in all the temperatures.


Thanks Brett,
I tried reading the OneWire Protocol a few weeks ago, but I think at the time there were way too many things i didn’t understand and I was just getting confused. I think sometime in the near future I may be try bashing my protocol against my head again.

Thanks for your response. It gave me more insight into how things could work for my little project.


The questrion I would ask is how fast do you really need to read them? Temperature usally does not change very rapidly so reading the temp once a second may be much faster than you really need.


Yes, once per second is more than I need.

I was thinking if every read required 1 second, and I had 10 thermometers, thats 10seconds per read. If I wanted to do a little averaging (to reduce quick temp flucuations) that could mean a lot of time…

that is all, nothing big. I was just curious.


If you need to read lots of temperatures, you could always use >1 OneWire bus. All the GPIOs are OneWire capable.


please excuse my ignorance, but by this

do you mean having more than 1 bus (or i think OneWire refers to these as branches), it seems the performance gain of this would be trivial.

But I do not need to be able to read temps faster than 1/second.


What Godefroi was saying is that you can have more than one, one-wire bus. The benefit is that instead of pausing for the conversion to happen, you start the conversion on another of your one-wire chains, and loop around them; that means the time between starting the conve3rsion and the time the conversion is complete is not “idle” but is in fact used doing other “active” work.

As you say, it’s not actually an issue in your scenario now you have the understanding that you can start mass conversions and that it doesn’t stretch your timeframes out excessively


Thanks Brett, I finally had some time to go through my code an implement your idea about sending the broadcast “begin calculation” and then individually getting the reading from each of the sensors. With only 4 sensors hooked up on my network right now, i can already see a marge increase in performance (not that it is needed)