Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By ArjenV
#95397 Dear Forum
Got two different DS18B20 temperature sensors. One is with a 3ft lead that you could emerge in water, the other is just a 3-pin transistor like variant. Got them from ebay or Ali, not sure it was some time ago.

With the exact same sketch i use, the 'transistor-like' sensor takes about 150ms to read a value, the waterproof one takes some 600msec.

Got them both with 9 bit resolution programmed. 4k7 resistor from +Vcc to input. Not parasitic. I address them both with their individual ROM address.

Do others have the these outcomes? What could be the case?

They are probably both fake counterfeits, got them pretty cheap.
User avatar
By Ray Marshall
#95644 The read process is entirely controlled by the master. The DS18B20 can't impact the speed of the read.
There is the reset; followed by the presence detect; then send 2 bytes of data; and receive the 9 byte result.
total time about 7.5mS (This assume skip is used)
The conversion must be started with a start conversion command (reset; presence detect; skip; start conversion) About 2mS.
So when you say 150mS or 600mS, what is that the time for? When do you start measuring and when do you end?
Are you enumerating the network each time you start a conversion?
With different ROM IDs it might take a different ammount of time to seach for all the connected nodes.
if you only have one sensor, then you can use skip ROM.
If you have multiple sensors then search for sensors just once at the start