{"id":86513,"date":"2019-07-12T12:42:03","date_gmt":"2019-07-12T12:42:03","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=86513"},"modified":"2020-10-14T09:15:06","modified_gmt":"2020-10-14T09:15:06","slug":"micropython-ds18b20-esp32-esp8266","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/micropython-ds18b20-esp32-esp8266\/","title":{"rendered":"MicroPython: DS18B20 Temperature Sensor with ESP32 and ESP8266"},"content":{"rendered":"\n<p>This tutorial shows how to use the DS18B20 temperature sensor with the ESP32 and ESP8266 using <a href=\"https:\/\/randomnerdtutorials.com\/getting-started-micropython-esp32-esp8266\/\">MicroPython firmware<\/a>. You&#8217;ll learn how to read temperature from one DS18B20 sensor and multiple sensors at the same time. You&#8217;ll also build a web server to display your sensor readings.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ds18b20-esp32-esp8266-micropython.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"MicroPython DS18B20 Temperature Sensor with ESP32 and ESP8266 (Single sensor, Multiple sensors and Web Server example)\" class=\"wp-image-86687\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ds18b20-esp32-esp8266-micropython.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ds18b20-esp32-esp8266-micropython.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ds18b20-esp32-esp8266-micropython.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ds18b20-esp32-esp8266-micropython.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<p>You might also like reading other DS18B20 guides:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-ds18b20-temperature-arduino-ide\/\">ESP32 DS18B20 Temperature Sensor with Arduino IDE<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-ds18b20-temperature-sensor-web-server-with-arduino-ide\/\">ESP8266 DS18B20 Temperature Sensor with Arduino IDE<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-multiple-ds18b20-temperature-sensors\/\">ESP32 with Multiple DS18B20 Temperature Sensors<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/guide-for-ds18b20-temperature-sensor-with-arduino\/\">DS18B20 Temperature Sensor with Arduino<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>To follow this tutorial you need MicroPython firmware installed in your ESP32 or ESP8266 boards. You also need an IDE to write and upload the code to your board. We suggest using Thonny IDE or uPyCraft IDE:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Thonny IDE:<ul><li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-thonny-micropython-python-ide-esp32-esp8266\/\">Installing and getting started with Thonny IDE<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/flashing-micropython-firmware-esptool-py-esp32-esp8266\/\">Flashing MicroPython Firmware with esptool.py<\/a><\/li><\/ul><\/li><li>uPyCraft IDE:<ul><li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-micropython-esp32-esp8266\/\">Getting Started with uPyCraft IDE<\/a><\/li><li>Install uPyCraft IDE (<a href=\"https:\/\/randomnerdtutorials.com\/install-upycraft-ide-windows-pc-instructions\/\">Windows<\/a>,&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/install-upycraft-ide-mac-os-x-instructions\/\">Mac OS X<\/a>,&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/install-upycraft-ide-linux-ubuntu-instructions\/\">Linux<\/a>)<\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/flash-upload-micropython-firmware-esp32-esp8266\/\">Flash\/Upload MicroPython Firmware to ESP32 and ESP8266<\/a><\/li><\/ul><\/li><\/ul>\n\n\n\n<p class=\"rntbox rntclblue\">Learn more about MicroPython:&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\">MicroPython Programming with ESP32 and ESP8266 eBook<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introducing DS18B20 Temperature Sensor<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/makeradvisor.com\/tools\/ds18b20-temperature-sensor-2\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">DS18B20 temperature sensor<\/a> is a one-wire digital temperature sensor. This means that it just requires one data line (and GND) to communicate with your ESP32 or ESP8266.<\/p>\n\n\n\n<p>It can be powered by an external power supply or it can derive power from the data line (called &#8220;parasite mode&#8221;), which eliminates the need for an external power supply.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"490\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/DS18B20-tempeature-sensor-pinout.jpg?resize=750%2C490&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Temperature Sensor Pinout Pins\" class=\"wp-image-86735\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/DS18B20-tempeature-sensor-pinout.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/DS18B20-tempeature-sensor-pinout.jpg?resize=300%2C196&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p>Each DS18B20 temperature sensor has a unique 64-bit serial code. This allows you to wire multiple sensors to the same data wire. So, you can get temperature from multiple sensors using just one GPIO.<\/p>\n\n\n\n<p>The DS18B20 temperature sensor is also available in <a href=\"https:\/\/makeradvisor.com\/tools\/ds18b20-digital-temperature-sensor\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">waterproof version<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"421\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ds18b20-waterproof.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Temperature Sensor Waterproof version\" class=\"wp-image-86674\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ds18b20-waterproof.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ds18b20-waterproof.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>Here&#8217;s a summary of the most relevant specs of the DS18B20 temperature sensor:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Communicates over one-wire bus<\/li><li>Power supply range: 3.0V to 5.5V<\/li><li>Operating temperature range: -55\u00baC to +125\u00baC<\/li><li>Accuracy +\/-0.5 \u00baC (between the range -10\u00baC to 85\u00baC)<\/li><\/ul>\n\n\n\n<p>For more information consult the <a href=\"https:\/\/datasheets.maximintegrated.com\/en\/ds\/DS18B20.pdf\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">DS18B20 datasheet<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parts Required<\/h2>\n\n\n\n<p>To follow this tutorial you need the following parts:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\">ESP32 <\/a>or <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/esp8266-esp-12e-nodemcu-wi-fi-development-board\/\" target=\"_blank\">ESP8266 <\/a>(read <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/esp32-vs-esp8266\/\" target=\"_blank\">ESP32 vs ESP8266<\/a>)<\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/ds18b20-temperature-sensor-2\/\" target=\"_blank\">DS18B20 temperature sensor<\/a> (one or multiple sensors) \u2013&nbsp;<a href=\"https:\/\/makeradvisor.com\/tools\/ds18b20-digital-temperature-sensor\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">waterproof version<\/a> <\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/resistors-kits\/\" target=\"_blank\">4.7k Ohm resistor<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\">Jumper wires<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\">Breadboard<\/a><\/li><\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Schematic &#8211; ESP32<\/h2>\n\n\n\n<p>As mentioned previously, the DS18B20 temperature sensor can be powered through the VDD pin (<strong>normal mode<\/strong>), or it can derive its power from the data line (<strong>parasite mode<\/strong>). You can chose either modes.<\/p>\n\n\n\n<p>If you&#8217;re using an ESP32, follow one of these two schematic diagrams.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Parasite Mode<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp32_single_parasite_bb.png?resize=563%2C612&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Temperature Sensor with ESP32 Parasite Mode Wiring Schematic Diagram\" class=\"wp-image-86564\" width=\"563\" height=\"612\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp32_single_parasite_bb.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp32_single_parasite_bb.png?resize=276%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 276w\" sizes=\"(max-width: 563px) 100vw, 563px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Normal Mode<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp32_single_normal.png?resize=563%2C612&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Temperature Sensor with ESP32 Normal Mode Wiring Schematic Diagram\" class=\"wp-image-86565\" width=\"563\" height=\"612\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp32_single_normal.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp32_single_normal.png?resize=276%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 276w\" sizes=\"(max-width: 563px) 100vw, 563px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Schematic &#8211; ESP8266<\/h2>\n\n\n\n<p>If you&#8217;re using an ESP8266, follow one of these two schematic diagrams.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Parasite mode<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_single_parasite.png?resize=419%2C572&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Temperature Sensor with ESP8266 Parasite Mode Wiring Schematic Diagram\" class=\"wp-image-86568\" width=\"419\" height=\"572\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_single_parasite.png?w=558&amp;quality=100&amp;strip=all&amp;ssl=1 558w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_single_parasite.png?resize=219%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 219w\" sizes=\"(max-width: 419px) 100vw, 419px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Normal mode<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_single_normal_F.png?resize=419%2C572&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Temperature Sensor with ESP8266 Normal Mode Wiring Schematic Diagram\" class=\"wp-image-86567\" width=\"419\" height=\"572\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_single_normal_F.png?w=559&amp;quality=100&amp;strip=all&amp;ssl=1 559w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_single_normal_F.png?resize=220%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 220w\" sizes=\"(max-width: 419px) 100vw, 419px\" \/><\/figure><\/div>\n\n\n\n<p class=\"rntbox rntclblue\"><strong>Note: <\/strong> in this tutorial we&#8217;re connecting the DS18B20 data line to GPIO 4, but you can use any other suitable GPIO.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Code (Single DS18B20)<\/h2>\n\n\n\n<p>Copy the following code to the <em>main.py<\/em> file and upload it to your board. This code simply gets temperature from the DS18B20 temperature sensor and displays the readings on the shell.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Complete project details at https:\/\/RandomNerdTutorials.com\n\nimport machine, onewire, ds18x20, time\n\nds_pin = machine.Pin(4)\nds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin))\n\nroms = ds_sensor.scan()\nprint('Found DS devices: ', roms)\n\nwhile True:\n  ds_sensor.convert_temp()\n  time.sleep_ms(750)\n  for rom in roms:\n    print(rom)\n    print(ds_sensor.read_temp(rom))\n  time.sleep(5)\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP-MicroPython\/esp_ds18b20.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>This code works both with the EPS32 and ESP8266 and works whether you&#8217;re using one or multiple DS18B20 temperature sensors.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How the code works<\/h2>\n\n\n\n<p>Import the <span class=\"rnthl rntliteral\">machine<\/span> module to interact with the GPIOs, the <span class=\"rnthl rntliteral\">onewire<\/span> and the <span class=\"rnthl rntliteral\">ds18x20<\/span> modules to interact with the DS18B20 temperature sensor and the <span class=\"rnthl rntliteral\">time<\/span> module to add delays.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>import machine, onewire, ds18x20, time<\/code><\/pre>\n\n\n\n<p>Create a variable called <span class=\"rnthl rntliteral\">ds_pin<\/span> that refers to <span class=\"rnthl rntclblue\">GPIO 4<\/span>, the pin the data wire of the DS18B20 temperature sensor is connected to.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>ds_pin = machine.Pin(4)<\/code><\/pre>\n\n\n\n<p>Here, we&#8217;re reading the temperature from <span class=\"rnthl rntclblue\">GPIO 4<\/span>, but you can use any other suitable GPIO. You can check the best GPIOs to use on the following articles:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-pinout-reference-gpios\/\">ESP32 Pinout Reference: Which GPIO pins should you use?<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-pinout-reference-gpios\/\">ESP8266 Pinout Reference: Which GPIO pins should you use?<\/a><\/li><\/ul>\n\n\n\n<p>Then, create a <span class=\"rnthl rntliteral\">ds18x20<\/span> object called <span class=\"rnthl rntliteral\">ds_sensor<\/span> on the <span class=\"rnthl rntliteral\">ds_pin<\/span> defined earlier. If you want to read the sensor using a different pin, you need to modify the previous line.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>ds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin))<\/code><\/pre>\n\n\n\n<p>The DS18B20 communicates via one-wire communication protocol and each sensor has a unique 64-bit serial code. This means you can read several temperature sensors wired on the same GPIO. <\/p>\n\n\n\n<p>The following line uses the <span class=\"rnthl rntliteral\">scan()<\/span> function to scan for DS18B20 sensors. The addresses found are saved on the <span class=\"rnthl rntliteral\">roms<\/span> variable (the <span class=\"rnthl rntliteral\">roms<\/span> variable is of type list).<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>roms = ds_sensor.scan()<\/code><\/pre>\n\n\n\n<p>Print the address of each sensor to the shell:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>print('Found DS devices: ', roms)<\/code><\/pre>\n\n\n\n<p>Then, there&#8217;s a <span class=\"rnthl rntliteral\">while<\/span> loop that gets the temperature from the DS18B20 sensor(s) every 5 seconds.<\/p>\n\n\n\n<p>You need to call the <span class=\"rnthl rntliteral\">convert_temp()<\/span> function on the <span class=\"rnthl rntliteral\">ds_sensor<\/span> object each time you want to sample temperature.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>ds_sensor.convert_temp()<\/code><\/pre>\n\n\n\n<p>Add a delay of 750 ms to give enough time to convert the temperature:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>time.sleep_ms(750)<\/code><\/pre>\n\n\n\n<p>After that, we can read the temperature on the addresses found earlier by using the <span class=\"rnthl rntliteral\">read_temp()<\/span> method and passing the address as argument as shown in the following line of code.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>print(ds_sensor.read_temp(rom))<\/code><\/pre>\n\n\n\n<p>Because you can add multiple sensors to the same data line, we have a <span class=\"rnthl rntliteral\">for<\/span> loop that goes through all the addresses and prints the temperature for each of them:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>for rom in roms:\n  print(rom)\n  print(ds_sensor.read_temp(rom))<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Demonstration<\/h2>\n\n\n\n<p>After uploading the code to your board, you should get new temperature readings every 5 seconds.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"642\" height=\"261\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20-readings-micropython.png?resize=642%2C261&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Temperature readings MicroPython with ESP32 and ESP8266\" class=\"wp-image-86573\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20-readings-micropython.png?w=642&amp;quality=100&amp;strip=all&amp;ssl=1 642w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20-readings-micropython.png?resize=300%2C122&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Getting Temperature from Multiple DS18B20 Temperature Sensors<\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"421\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-ds18b20-multiple-sensors.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Multiple Sensors with ESP8266\" class=\"wp-image-86688\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-ds18b20-multiple-sensors.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-ds18b20-multiple-sensors.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>To get temperature from multiple DS18B20 temperature sensors, you can use the same previous script. You just need to wire more DS18B20 sensors. These sensors share the same data line &#8211; in this case, all sensors are wired to <span class=\"rnthl rntclblue\">GPIO 4<\/span>.<\/p>\n\n\n\n<p>If you&#8217;re using an ESP32, you can follow the next schematic diagram. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"561\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp32_multiple.png?resize=750%2C561&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Multiple Temperature Sensors with ESP32 Wiring Schematic Diagram\" class=\"wp-image-86569\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp32_multiple.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp32_multiple.png?resize=300%2C224&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>If you&#8217;re using an ESP8266, follow the next schematic diagram instead.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"806\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_multiple_bb.png?resize=1020%2C806&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Multiple Temperature Sensors with ESP8266 Wiring Schematic Diagram\" class=\"wp-image-86571\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_multiple_bb.png?w=1020&amp;quality=100&amp;strip=all&amp;ssl=1 1020w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_multiple_bb.png?resize=300%2C237&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20_esp8266_multiple_bb.png?resize=768%2C607&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1020px) 100vw, 1020px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Code (Multiple DS18B20s)<\/h3>\n\n\n\n<p>After uploading the code, you should get all temperature readings displayed in the Shell.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Complete project details at https:\/\/RandomNerdTutorials.com\n\nimport machine, onewire, ds18x20, time\n\nds_pin = machine.Pin(4)\nds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin))\n\nroms = ds_sensor.scan()\nprint('Found DS devices: ', roms)\n\nwhile True:\n  ds_sensor.convert_temp()\n  time.sleep_ms(750)\n  for rom in roms:\n    print(rom)\n    print(ds_sensor.read_temp(rom))\n  time.sleep(5)\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP-MicroPython\/esp_ds18b20.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"642\" height=\"262\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20-readings-multiple-sensors.png?resize=642%2C262&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Multiple DS18B20 Temperature readings MicroPython with ESP32 and ESP8266\" class=\"wp-image-86572\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20-readings-multiple-sensors.png?w=642&amp;quality=100&amp;strip=all&amp;ssl=1 642w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ds18b20-readings-multiple-sensors.png?resize=300%2C122&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Display DS18B20 Temperature Readings on Web Server<\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"420\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP32-ESP8266-DS18B20-Temperature-Sensor-MicroPython-Web-Server.jpg?resize=750%2C420&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Display DS18B20 Temperature Readings on Web Server MicroPython\" class=\"wp-image-87105\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP32-ESP8266-DS18B20-Temperature-Sensor-MicroPython-Web-Server.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP32-ESP8266-DS18B20-Temperature-Sensor-MicroPython-Web-Server.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>Now that you know how to get temperature and humidity from DS18B20 sensors, we\u2019ll display the readings on a web server that you can access on your local network. <\/p>\n\n\n\n<p>For this example, you need two files:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><em>boot.py<\/em><\/strong>: runs when the device starts and sets up several configuration options like your network credentials, importing libraries, setting the pins, etc.<\/li><li><strong><em>main.py<\/em><\/strong>: this is the main script where we\u2019ll handle the web server. It executes immediately after the&nbsp;<em>boot.py<\/em>.<\/li><\/ul>\n\n\n\n<p class=\"rntbox rntclblue\"><strong>Note:&nbsp;<\/strong>it is a good practice to include the <em>boot.py<\/em> and <em>main.py<\/em> files. However, if you prefer, you can include all the code in the <em>main.py<\/em> file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">boot.py (DS18B20 web server)<\/h3>\n\n\n\n<p>Create a new file in your IDE called&nbsp;<em>boot.py<\/em>&nbsp;and copy the following code.<br><\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Complete project details at https:\/\/RandomNerdTutorials.com\n\ntry:\n  import usocket as socket\nexcept:\n  import socket\n  \nfrom time import sleep\nfrom machine import Pin\nimport onewire, ds18x20\n\nimport network\n\nimport esp\nesp.osdebug(None)\n\nimport gc\ngc.collect()\n\nds_pin = Pin(4)\nds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin))\n\nssid = 'REPLACE_WITH_YOUR_SSID'\npassword = 'REPLACE_WITH_YOUR_PASSWORD'\n\nstation = network.WLAN(network.STA_IF)\n\nstation.active(True)\nstation.connect(ssid, password)\n\nwhile station.isconnected() == False:\n  pass\n\nprint('Connection successful')\nprint(station.ifconfig())\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP-MicroPython\/esp_ds18b20_web_server_boot.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>This file imports the required libraries, sets up the DS18B20 sensor and connects to your network.<\/p>\n\n\n\n<p>Here, we&#8217;re setting the DS18B20 data pin on <span class=\"rnthl rntclblue\">GPIO 4<\/span> but you can use any other suitable pin:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>ds_pin = Pin(4)\nds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin))<\/code><\/pre>\n\n\n\n<p>You should insert your network credentials in the following variables so that the ESP is able to connect to your network.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>ssid = 'REPLACE_WITH_YOUR_SSID'\npassword = 'REPLACE_WITH_YOUR_PASSWORD'<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">main.py (DS18B20 web server) <\/h3>\n\n\n\n<p>In the&nbsp;<em>main.py<\/em>&nbsp;file is where we\u2019ll create the web server and handle the requests. Copy the following code to your&nbsp;<em>main.py<\/em>&nbsp;file. <\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Complete project details at https:\/\/RandomNerdTutorials.com\n\ndef read_ds_sensor():\n  roms = ds_sensor.scan()\n  print('Found DS devices: ', roms)\n  print('Temperatures: ')\n  ds_sensor.convert_temp()\n  for rom in roms:\n    temp = ds_sensor.read_temp(rom)\n    if isinstance(temp, float):\n      msg = round(temp, 2)\n      print(temp, end=' ')\n      print('Valid temperature')\n      return msg\n  return b'0.0'\n  \ndef web_page():\n  temp = read_ds_sensor()\n  html = &quot;&quot;&quot;&lt;!DOCTYPE HTML&gt;&lt;html&gt;&lt;head&gt;\n  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;\n  &lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/use.fontawesome.com\/releases\/v5.7.2\/css\/all.css&quot; integrity=&quot;sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr&quot; crossorigin=&quot;anonymous&quot;&gt;\n  &lt;style&gt; html { font-family: Arial; display: inline-block; margin: 0px auto; text-align: center; }\n    h2 { font-size: 3.0rem; } p { font-size: 3.0rem; } .units { font-size: 1.2rem; } \n    .ds-labels{ font-size: 1.5rem; vertical-align:middle; padding-bottom: 15px; }\n  &lt;\/style&gt;&lt;\/head&gt;&lt;body&gt;&lt;h2&gt;ESP with DS18B20&lt;\/h2&gt;\n  &lt;p&gt;&lt;i class=&quot;fas fa-thermometer-half&quot; style=&quot;color:#059e8a;&quot;&gt;&lt;\/i&gt; \n    &lt;span class=&quot;ds-labels&quot;&gt;Temperature&lt;\/span&gt;\n    &lt;span id=&quot;temperature&quot;&gt;&quot;&quot;&quot; + str(temp) + &quot;&quot;&quot;&lt;\/span&gt;\n    &lt;sup class=&quot;units&quot;&gt;&amp;deg;C&lt;\/sup&gt;\n  &lt;\/p&gt;\n    &lt;p&gt;&lt;i class=&quot;fas fa-thermometer-half&quot; style=&quot;color:#059e8a;&quot;&gt;&lt;\/i&gt; \n    &lt;span class=&quot;ds-labels&quot;&gt;Temperature&lt;\/span&gt;\n    &lt;span id=&quot;temperature&quot;&gt;&quot;&quot;&quot; + str(round(temp * (9\/5) + 32.0, 2)) + &quot;&quot;&quot;&lt;\/span&gt;\n    &lt;sup class=&quot;units&quot;&gt;&amp;deg;F&lt;\/sup&gt;\n  &lt;\/p&gt;&lt;\/body&gt;&lt;\/html&gt;&quot;&quot;&quot;\n  return html\n\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\ns.bind(('', 80))\ns.listen(5)\n\nwhile True:\n  try:\n    if gc.mem_free() &lt; 102000:\n      gc.collect()\n    conn, addr = s.accept()\n    conn.settimeout(3.0)\n    print('Got a connection from %s' % str(addr))\n    request = conn.recv(1024)\n    conn.settimeout(None)\n    request = str(request)\n    print('Content = %s' % request)\n    response = web_page()\n    conn.send('HTTP\/1.1 200 OK\\n')\n    conn.send('Content-Type: text\/html\\n')\n    conn.send('Connection: close\\n\\n')\n    conn.sendall(response)\n    conn.close()\n  except OSError as e:\n    conn.close()\n    print('Connection closed')\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP-MicroPython\/esp_ds18b20_web_server_main.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Reading the DS18B20 Sensor<\/h4>\n\n\n\n<p>The code starts by creating a function called <span class=\"rnthl rntliteral\">read_ds_sensor()<\/span> that gets the temperature from the DS18B20 temperature sensor. If you&#8217;ve followed the previous section, you should be familiar with the methods used here.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>def read_ds_sensor():\n  roms = ds_sensor.scan()\n  print('Found DS devices: ', roms)\n  ds_sensor.convert_temp()\n  for rom in roms:\n    temp = ds_sensor.read_temp(rom)\n    if isinstance(temp, float):\n      temp = round(temp, 2)\n      print('Valid temperature')\n      return temp\n  return '0'<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Web Page<\/h4>\n\n\n\n<p>The <span class=\"rnthl rntliteral\">web_page()<\/span> function returns the HTML page with the latest temperature readings.<\/p>\n\n\n\n<p>We&#8217;ve built a similar web page on a previous tutorial. So, if you want to learn how this HTML works, you can read this article: <a href=\"https:\/\/randomnerdtutorials.com\/micropython-esp32-esp8266-dht11-dht22-web-server\/\">MicroPython: ESP32\/ESP8266 with DHT11\/DHT22 Web Server<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"> Creating the web server<\/h4>\n\n\n\n<p>After that, make the usual procedures to create a socket server.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>while True:\n  try:\n    if gc.mem_free() &lt; 102000:\n      gc.collect()\n    conn, addr = s.accept()\n    conn.settimeout(3.0)\n    print('Got a connection from %s' % str(addr))\n    request = conn.recv(1024)\n    conn.settimeout(None)\n    request = str(request)\n    print('Content = %s' % request)\n    response = web_page()\n    conn.send('HTTP\/1.1 200 OK\\n')\n    conn.send('Content-Type: text\/html\\n')\n    conn.send('Connection: close\\n\\n')\n    conn.sendall(response)\n    conn.close()\n  except OSError as e:\n    conn.close()\n    print('Connection closed')<\/code><\/pre>\n\n\n\n<p>For an in-depth explanation of this procedure,&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-micropython-web-server\/\">refer to this tutorial<\/a>. <\/p>\n\n\n\n<p>Basically, when the ESP receives a request, we send the web page with the latest readings as a response:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>response = web_page()\nconn.send('HTTP\/1.1 200 OK\\n')\nconn.send('Content-Type: text\/html\\n')\nconn.send('Connection: close\\n\\n')\nconn.sendall(response)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Web Server Demonstration<\/h2>\n\n\n\n<p>After uploading the <em>boot.py<\/em> and <em>main.py<\/em> files to your board. Click the ESP RST button to run the code.<\/p>\n\n\n\n<p>Then, open your browser and type the ESP IP address. You should access the web page with the latest sensor readings in Celsius and Fahrenheit degrees: <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"687\" height=\"461\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/DS18B20-Web-Server.png?resize=687%2C461&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"DS18B20 Temperature Readings on ESP32 ESP8266 Web Server\" class=\"wp-image-86800\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/DS18B20-Web-Server.png?w=687&amp;quality=100&amp;strip=all&amp;ssl=1 687w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/DS18B20-Web-Server.png?resize=300%2C201&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 687px) 100vw, 687px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>We hope you&#8217;ve found this MicroPython guide about the DS18B20 temperature sensor with the ESP32 and ESP8266 useful. We have other projects with the ESP and MicroPython that you may like:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-bme280-esp32-esp8266\/\">MicroPython: BME280 with ESP32 and ESP8266 (Pressure, Temperature, Humidity)<\/a><br><a href=\"https:\/\/randomnerdtutorials.com\/micropython-esp32-esp8266-dht11-dht22-web-server\/\">MicroPython: ESP32\/ESP8266 with DHT11\/DHT22 Web Server<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-mqtt-esp32-esp8266\/\">MicroPython: Getting Started with MQTT on ESP32\/ESP8266<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/low-power-weather-station-datalogger-using-esp8266-bme280-micropython\/\">Low Power Weather Station Datalogger using ESP8266 and BME280 with MicroPython<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-oled-display-esp32-esp8266\/\">MicroPython: OLED Display with ESP32 and ESP8266<\/a><\/li><\/ul>\n\n\n\n<p class=\"rntbox rntclblue\">Learn more about MicroPython with ESP32 and ESP8266 with our eBook: <a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\"><strong>MicroPython Programming with ESP32 and ESP8266<\/strong><\/a><\/p>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to use the DS18B20 temperature sensor with the ESP32 and ESP8266 using MicroPython firmware. You&#8217;ll learn how to read temperature from one DS18B20 sensor and multiple &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"MicroPython: DS18B20 Temperature Sensor with ESP32 and ESP8266\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/micropython-ds18b20-esp32-esp8266\/#more-86513\" aria-label=\"Read more about MicroPython: DS18B20 Temperature Sensor with ESP32 and ESP8266\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":86687,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[310,309,264],"tags":[],"class_list":["post-86513","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-micropython","category-0-esp32-micropython","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ds18b20-esp32-esp8266-micropython.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/86513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=86513"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/86513\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/86687"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=86513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=86513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=86513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}