Comments on: ESP32 with Multiple DS18B20 Temperature Sensors https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Sun, 21 Dec 2025 14:10:13 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Paul https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-1140803 Sun, 21 Dec 2025 14:10:13 +0000 http://randomnerdtutorials.com/?p=66986#comment-1140803 Great tutorial!

I’m new to this, having just built my first esp32 bluetooth proxy to use on Home Assistant via ESPhome.

I’d like to add six DS18B20s to the same esp32wroom I use for the BT proxy and have the temperature from each sensor available in Home Assistant.

Can the above approach be adapted to add DS18B20s to the BT proxy esp32 or is there a better way to achieve this?

]]>
By: Oliver Dyar https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-1130716 Wed, 03 Dec 2025 15:50:09 +0000 http://randomnerdtutorials.com/?p=66986#comment-1130716 In reply to Sara Santos.

Hi,

Many thanks for these excellent tutorials. Today I’ve seen that -127 can also result from putting an incorrect sensor address in the code.

Best wishes

]]>
By: Jon https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-895426 Thu, 29 Feb 2024 02:16:45 +0000 http://randomnerdtutorials.com/?p=66986#comment-895426 In reply to mrspeed.

Try pdfserv.maximintegrated.com/en/an/AN148.pdf

]]>
By: Roger https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-877101 Sun, 10 Dec 2023 23:01:45 +0000 http://randomnerdtutorials.com/?p=66986#comment-877101 There is a down side to having multiple DS18B20s on one line. First, you don’t know which sensor is which when the app prints out the temperature. Second, when a sensor fails, the new sensor can be in any order in the detection, so if your system depends on knowing the location of the reported data, the Dallas() function isn’t helpful until you physically nail down the locations. Third, the Dallas() function takes time to detect each sensor, and then adds an addition 850 ms minimum for each sensor’s conversion time. You can speed things up by starting the conversion, then go do something for 850+ ms, then come back and read the data and start another conversion. The following code is very fast, where X is the GPIO pin (or pins):

// — Dallas reader ————————————–
int dallas(int x) {
OneWire ds(x) ;
byte data0 ;
byte data1 ;
long result ;

ds.reset() ;
ds.write(0xCC) ; // skip command
ds.write(0xBE) ; // Read first 2 bytes of Scratchpad
data0 = ds.read() ;
data1 = ds.read() ;
result = (data1 << 8) | data0 ;
// round up (add 1/2 bit) and convert to degrees F times 100
result = (((result * 90) + 0x04) >> 3 ) + 3200 ; // F x 100
ds.reset() ;
ds.write(0xCC) ; // skip command
ds.write(0x44,1) ; // start conversion
return result ;

}
// —————– end of readtemps() ——————-

]]>
By: mrspeed https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-833354 Thu, 04 May 2023 18:40:45 +0000 http://randomnerdtutorials.com/?p=66986#comment-833354 In reply to Hans.

link does not work

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-832226 Thu, 27 Apr 2023 08:44:55 +0000 http://randomnerdtutorials.com/?p=66986#comment-832226 In reply to Viren.

Hi.
To display readings from all sensors in a web server you can take a look at our ESP-NOW Web Server project (it gathers and displays data from different boards): https://randomnerdtutorials.com/esp-now-auto-pairing-esp32-esp8266/
For logging all data in excel, we have this tutorial: https://randomnerdtutorials.com/esp32-esp8266-publish-sensor-readings-to-google-sheets/
For other data logging solutions, we have this compilation: https://randomnerdtutorials.com/esp32-how-to-log-data/
Regards,
Sara

]]>
By: Viren https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-832019 Wed, 26 Apr 2023 00:53:12 +0000 http://randomnerdtutorials.com/?p=66986#comment-832019 Hi,
I am looking for a solution to monitor / log temperature data of all the cooling devices in my departmental store / supermarket which has about 30 fridges & freezers distributed in ~150 sqmtr area. I want to use One wire sensors (DS18B20) network of clusters, i.e. max 4 to 5 sensors in a cluster physicall connected with an ESP board, and about 5 different clusters (ESP Boards) further connected wireless (either using Wifi or ESP NOW) with the ESP or Arduino Board (could be ESP32, NodeMCU or Arduino UNO).. Hence want to keep a log of all the temperature sensors in an excel file as well as able to monitor the temperature on web server!

can you pls help me with this project as need some adv on how to design this solution!

thanks

]]>
By: jovo0911 https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-830664 Mon, 17 Apr 2023 21:02:54 +0000 http://randomnerdtutorials.com/?p=66986#comment-830664 In reply to jovo0911.

reading and store the sensors is not the problem. Problem is if I change a sensor(damage) the sort order change. So I didn’t know where the sensor (there a 12) was.
i store sensor data in that way Sensor_1 –> DataDB

Sensor_1 = 00:00:00:00:00

so I know every time who is who.

]]>
By: jovo0911 https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-830524 Mon, 17 Apr 2023 07:29:29 +0000 http://randomnerdtutorials.com/?p=66986#comment-830524 Hi,
I search a way to store sensor address in EEPROM. Need this for exactly identify a sensor to store data in a DB. I store data order by sensor_name.

Any good ideas!

JoVo

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-multiple-ds18b20-temperature-sensors/#comment-822574 Thu, 02 Mar 2023 18:46:05 +0000 http://randomnerdtutorials.com/?p=66986#comment-822574 In reply to Pavan.

Hi.
That usually means wrong connections and/or bad signal due to very long cables.
Regards,
Sara

]]>