{"id":73094,"date":"2018-09-19T10:01:30","date_gmt":"2018-09-19T10:01:30","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=73094"},"modified":"2019-04-02T10:23:19","modified_gmt":"2019-04-02T10:23:19","slug":"esp8266-multisensor-shield-with-node-red","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp8266-multisensor-shield-with-node-red\/","title":{"rendered":"ESP8266 Multisensor Shield with Node-RED"},"content":{"rendered":"<p>In this project you\u2019ll discover how integrate the <a href=\"https:\/\/randomnerdtutorials.com\/esp8266-multisensor-shield\/\">ESP8266 Multisensor Shield<\/a> for the Wemos D1 Mini board with Node-RED. The\u00a0ESP8266 Multisensor Shield will establish an MQTT connection with a Raspberry Pi running Node-RED and Mosquitto MQTT broker.<!--more--><\/p>\n<p><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-73123\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/ESP8266_Multisensor_Shield_NodeRED_Thumbnail.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1200\" height=\"675\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/ESP8266_Multisensor_Shield_NodeRED_Thumbnail.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/ESP8266_Multisensor_Shield_NodeRED_Thumbnail.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/ESP8266_Multisensor_Shield_NodeRED_Thumbnail.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/ESP8266_Multisensor_Shield_NodeRED_Thumbnail.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<h2>Project Overview<\/h2>\n<p><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-multisensor-shield\/\">The Multisensor shield<\/a> consists of a temperature sensor, a motion sensor, an LDR, and a 3 pin socket where you can connect any output, like a relay module for example.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-72389\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/multisensor-shield-labeled.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"421\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/multisensor-shield-labeled.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/multisensor-shield-labeled.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>We&#8217;ll use the <a href=\"https:\/\/randomnerdtutorials.com\/how-to-install-mosquitto-broker-on-raspberry-pi\/\">Mosquitto broker installed<\/a> on the same Raspberry Pi running Node-RED. The broker is responsible for receiving all messages, filtering the messages, decide who is interested in them and publishing the messages to all subscribed clients. To learn more about MQTT, you can read:\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/what-is-mqtt-and-how-it-works\/\" target=\"_blank\" rel=\"noopener noreferrer\">What is MQTT and How It Works<\/a>.<\/p>\n<p>The following figure shows an overview of what we\u2019re going to do in this tutorial.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/MQTT-diagram.png?quality=100&#038;strip=all&#038;ssl=1\" target=\"_blank\" rel=\"noopener noreferrer\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter wp-image-73117 size-full\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/MQTT-diagram.png?resize=1154%2C689&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1154\" height=\"689\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/MQTT-diagram.png?w=1154&amp;quality=100&amp;strip=all&amp;ssl=1 1154w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/MQTT-diagram.png?resize=300%2C179&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/MQTT-diagram.png?resize=768%2C459&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/MQTT-diagram.png?resize=1024%2C611&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1154px) 100vw, 1154px\" \/><\/a><\/p>\n<ul>\n<li>The Node-RED application publishes messages (&#8220;<strong>on<\/strong>&#8221; or &#8220;<strong>off<\/strong>&#8220;) in the topic <strong>esp8266\/output<\/strong>. The ESP8266 is subscribed to that topic. So, it receives the message with &#8220;on&#8221; or &#8220;off&#8221; to turn the output on or off.<\/li>\n<li>The ESP8266 publishes temperature on the <strong>esp8266\/temperature<\/strong> topic and the luminosity on the <strong>esp8266\/ldr<\/strong>\u00a0topic. The Node-RED application is subscribed to those topics. So, it receives temperature and luminosity readings that are displayed on a chart and gauge.<\/li>\n<li>Node-RED is subscribed to the topic <strong>esp8266\/motion<\/strong>. The ESP8266 publishes on that topic when motion is detected. When motion is detected the message &#8220;MOTION DETECTED!&#8221; is displayed for 10 seconds in the Node-RED Dashboard text widget.<\/li>\n<\/ul>\n<p><strong>Recommended reading:<\/strong>\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/esp32-mqtt-publish-subscribe-arduino-ide\/\">ESP32 MQTT \u2013 Publish and Subscribe with Arduino IDE<\/a><\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-multisensor-shield\/\">Design and build the Multisensor Shield for ESP8266<\/a><\/li>\n<li>You should be familiar with the Raspberry Pi \u2013\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-raspberry-pi\/\" target=\"_blank\" rel=\"noopener noreferrer\">read Getting Started with Raspberry Pi<\/a>.<\/li>\n<li>You should have the Raspbian operating system installed in your Raspberry Pi \u2013\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/installing-raspbian-lite-enabling-and-connecting-with-ssh\/\">read Installing Raspbian Lite, Enabling and Connecting with SSH<\/a>.<\/li>\n<li>Learn\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/what-is-mqtt-and-how-it-works\/\" target=\"_blank\" rel=\"noopener noreferrer\">what&#8217;s MQTT and how it works<\/a>.<\/li>\n<li>You need to have installed in your Raspberry Pi:\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-on-raspberry-pi\/\">Node-RED,<\/a>\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-dashboard\/\">Node-RED Dashboard<\/a>, and <a href=\"https:\/\/randomnerdtutorials.com\/how-to-install-mosquitto-broker-on-raspberry-pi\/\">Mosquitto MQTT broker<\/a>.<\/li>\n<\/ul>\n<p>If you like home automation and you want to learn more about Node-RED, Raspberry Pi, ESP8266 and Arduino, we recommend that you download our course:\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/build-a-home-automation-system-for-100\/\" target=\"_blank\" rel=\"noopener noreferrer\">Build a Home Automation System with Node-RED, ESP8266 and Arduino<\/a>.<\/p>\n<h2>Resources<\/h2>\n<p>You can find all the resources needed to build this project in the links below (or you can visit the <a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub project<\/a>):<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\/tree\/master\/Code\/NodeRED_ESP8266_Multisensor_Shield\" target=\"_blank\" rel=\"noopener noreferrer\">ESP8266 with MQTT for Node-RED (for Arduino IDE)<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\/tree\/master\/Images\" target=\"_blank\" rel=\"noopener noreferrer\">Schematic diagram<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\/raw\/master\/KiCad_PCB_ESP8266_Multisensor_Shield\/GERBERS\/WemosD1MiniShield.zip\" target=\"_blank\" rel=\"noopener noreferrer\">Gerber files<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\/tree\/master\/KiCad_PCB_ESP8266_Multisensor_Shield\" target=\"_blank\" rel=\"noopener noreferrer\">KiCad project to edit the PCB<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\/tree\/master\/3D_Enclosure\" target=\"_blank\" rel=\"noopener noreferrer\">3D Printer Enclosure (STL files and SketchUp Project)<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\/archive\/master.zip\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Click here to download all the files<\/strong><\/a><\/li>\n<\/ul>\n<h2>Schematic<\/h2>\n<p>You can build the multisensor shield on a PCB, or you can build the multisensor shield circuit on a breadboard.<\/p>\n<p>Here&#8217;s a list of parts you need to build the circuit:<\/p>\n<ul>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/esp8266-wemos-d1-mini-wi-fi-board\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESP8266 Wemos D1 Mini<\/a>\u00a0\u2013 read\u00a0<a href=\"https:\/\/makeradvisor.com\/best-esp8266-wi-fi-development-board\/\" target=\"_blank\" rel=\"noopener noreferrer\">Best ESP8266 Wi-Fi Development Board<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/3mm-5mm-leds-kit-storage-box\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x 5mm LED<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/resistors-kits\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x 330 Ohm resistor<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/ds18b20-temperature-sensor-2\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x DS18B20 temperature sensor<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/mini-hc-sr505-pir-motion-sensor\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x mini PIR motion sensor<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/photoresistor-light-dependent-resistor-ldr\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x light dependent resistor<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/resistors-kits\/\">2x 10k Ohm resistor<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/5v-2-channel-relay-module-optocoupler\/\" target=\"_blank\" rel=\"noopener noreferrer\">1x relay module<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\" rel=\"noopener noreferrer\">Breadboard<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jumper wires<\/a><\/li>\n<\/ul>\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<p>After gathering all the needed parts, assemble the circuit by following the next schematic diagram:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-72400\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/wemos_shield_fritzing_diagram.jpg?resize=750%2C657&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"657\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/wemos_shield_fritzing_diagram.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/wemos_shield_fritzing_diagram.jpg?resize=300%2C263&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Here&#8217;s how the circuit looks like on a breadboard:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-72399\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/multisensor-shield-breadboard.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"421\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/multisensor-shield-breadboard.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/multisensor-shield-breadboard.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Alternatively, you can build a PCB for the WeMos D1 Mini (learn how to\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/esp8266-multisensor-shield\/\">Build a Multisensor Shield for ESP8266<\/a>):<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-72578\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/Build-ESP8266-WeMos-D1-Mini-Multisensor-Shield.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"422\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/Build-ESP8266-WeMos-D1-Mini-Multisensor-Shield.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/Build-ESP8266-WeMos-D1-Mini-Multisensor-Shield.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/Build-ESP8266-WeMos-D1-Mini-Multisensor-Shield.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/Build-ESP8266-WeMos-D1-Mini-Multisensor-Shield.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Here&#8217;s how the circuit looks like using the PCB shield with a 3D printed enclosure:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-72430\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/multisensor-shield-relay.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"421\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/multisensor-shield-relay.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/multisensor-shield-relay.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2>Preparing the Arduino IDE<\/h2>\n<p>We&#8217;ll program the ESP8266 using the Arduino IDE. In order to upload code to your ESP8266 using the Arduino IDE, you need to install the ESP8266 add-on (<a href=\"https:\/\/randomnerdtutorials.com\/how-to-install-esp8266-board-arduino-ide\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to Install the ESP8266 Board in Arduino IDE<\/a>). You&#8217;ll also need to install three additional libraries to run the code on the ESP8266.<\/p>\n<p><strong>Installing the PubSubClient Library<\/strong><\/p>\n<p>The <a href=\"https:\/\/github.com\/knolleary\/pubsubclient\" target=\"_blank\" rel=\"noopener noreferrer\">PubSubClient<\/a> library provides a client for doing simple publish\/subscribe messaging with a server that supports MQTT (basically allows your ESP8266 to talk with Node-RED).<\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/knolleary\/pubsubclient\/archive\/master.zip\" target=\"_blank\" rel=\"noopener noreferrer\">Click here to download the PubSubClient library<\/a>. You should have a <em>.zip<\/em> folder in your Downloads folder<\/li>\n<li>Unzip the <em>.zip<\/em> folder and you should get <strong>pubsubclient-master<\/strong> folder<\/li>\n<li>Rename your folder from<del><strong> pubsubclient-master<\/strong><\/del> to <strong>pubsubclient<\/strong><\/li>\n<li>Move the <strong>pubsubclient<\/strong> folder to your Arduino IDE installation <strong>libraries<\/strong> folder<\/li>\n<\/ol>\n<p><strong>OneWire library<\/strong><\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/PaulStoffregen\/OneWire\/archive\/master.zip\" target=\"_blank\" rel=\"noopener noreferrer\">Click here to download the OneWire\u00a0library<\/a>. You should have a .zip folder in your Downloads<\/li>\n<li>Unzip the\u00a0<em>.zip<\/em>\u00a0folder and you should get\u00a0<strong>OneWire-master\u00a0<\/strong>folder<\/li>\n<li>Rename your folder from\u00a0<del><strong>OneWire-master<\/strong><\/del>\u00a0to<strong>\u00a0OneWire<\/strong><\/li>\n<li>Move the\u00a0<strong>OneWire\u00a0<\/strong>folder to your Arduino IDE installation\u00a0<strong>libraries\u00a0<\/strong>folder<\/li>\n<\/ol>\n<p><strong>Dallas Temperature library<\/strong><\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/milesburton\/Arduino-Temperature-Control-Library\/archive\/master.zip\" target=\"_blank\" rel=\"noopener noreferrer\">Click here to download the DallasTemperature\u00a0library<\/a>. You should have a .zip folder in your Downloads<\/li>\n<li>Unzip the\u00a0<em>.zip<\/em>\u00a0folder and you should get\u00a0<strong>Arduino-Temperature-Control-Library-master\u00a0<\/strong>folder<\/li>\n<li>Rename your folder from\u00a0<del><strong>Arduino-Temperature-Control-Library-master<\/strong><\/del>\u00a0to\u00a0<strong>DallasTemperature<\/strong><\/li>\n<li>Move the\u00a0<strong>DallasTemperature<\/strong><strong>\u00a0<\/strong>folder to your Arduino IDE installation\u00a0<strong>libraries\u00a0<\/strong>folder<\/li>\n<li>Finally, re-open your Arduino IDE<\/li>\n<\/ol>\n<h3>Uploading Code<\/h3>\n<p><span style=\"font-weight: 400;\">Copy the following code to the Arduino IDE.\u00a0<\/span>The code is well commented on where you need to make changes.\u00a0<strong>You need to edit the code with your own SSID, password and MQTT Broker IP Address (Raspberry Pi IP Address).<\/strong><\/p>\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*********\n  Rui Santos\n  Complete project details at https:\/\/randomnerdtutorials.com  \n*********\/\n\n\/\/ Load libraries\n#include &lt;ESP8266WiFi.h&gt;\n#include &lt;PubSubClient.h&gt;\n#include &lt;OneWire.h&gt;\n#include &lt;DallasTemperature.h&gt;\n\n\/\/ Replace with your network credentials\nconst char* ssid     = &quot;REPLACE_WITH_YOUR_SSID&quot;;\nconst char* password = &quot;REPLACE_WITH_YOUR_PASSWORD&quot;;\n\n\/\/ Change the variable to your Raspberry Pi IP address, so it connects to your MQTT broker\nconst char* mqtt_server = &quot;REPLACE_WITH_YOUR_MQTT_BROKER&quot;;\n\/\/ MQTT Broker IP example\n\/\/const char* mqtt_server = &quot;192.168.1.144&quot;;\n\n\/\/ Initializes the espClient. You should change the espClient name if you have multiple ESPs running in your home automation system\nWiFiClient espClient;\nPubSubClient client(espClient);\n\n\/\/ Variable to hold the temperature reading\nString temperatureString = &quot;&quot;;\n\n\/\/ Set GPIOs for: output variable, status LED, PIR Motion Sensor, and LDR\nconst int output = 15;\nconst int statusLed = 12;\nconst int motionSensor = 5;\nconst int ldr = A0;\n\/\/ Store the current output state\nString outputState = &quot;off&quot;;\n\n\/\/ GPIO where the DS18B20 is connected to\nconst int oneWireBus = 4;          \n\/\/ Setup a oneWire instance to communicate with any OneWire devices\nOneWire oneWire(oneWireBus);\n\/\/ Pass our oneWire reference to Dallas Temperature sensor \nDallasTemperature sensors(&amp;oneWire);\n\n\/\/ Timers - Auxiliary variables\nunsigned long now = millis();\nunsigned long lastMeasure = 0;\nboolean startTimer = false;\nunsigned long currentTime = millis();\nunsigned long previousTime = 0; \n\n\/\/ Don't change the function below. \n\/\/ This function connects your ESP8266 to your router\nvoid setup_wifi() {\n  delay(10);\n  \/\/ We start by connecting to a WiFi network\n  Serial.println();\n  Serial.print(&quot;Connecting to &quot;);\n  Serial.println(ssid);\n  WiFi.begin(ssid, password);\n  while (WiFi.status() != WL_CONNECTED) {\n    delay(500);\n    Serial.print(&quot;.&quot;);\n  }\n  Serial.println(&quot;&quot;);\n  Serial.print(&quot;WiFi connected - ESP IP address: &quot;);\n  Serial.println(WiFi.localIP());\n}\n\n\/\/ This functions is executed when some device publishes a message to a topic that your ESP8266 is subscribed to\n\/\/ Change the function below to add logic to your program, so when a device publishes a message to a topic that \n\/\/ your ESP8266 is subscribed you can actually do something\nvoid callback(String topic, byte* message, unsigned int length) {\n  Serial.print(&quot;Message arrived on topic: &quot;);\n  Serial.print(topic);\n  Serial.print(&quot;. Message: &quot;);\n  String messageTemp;\n  \n  for (int i = 0; i &lt; length; i++) {\n    Serial.print((char)message[i]);\n    messageTemp += (char)message[i];\n  }\n  Serial.println();\n\n  \/\/ Feel free to add more if statements to control more GPIOs with MQTT\n  \/\/ If a message is received on the topic esp8266\/output, you check if the message is either on or off. \n  \/\/ Turns the output according to the message received\n  if(topic==&quot;esp8266\/output&quot;){\n    Serial.print(&quot;Changing output to &quot;);\n    if(messageTemp == &quot;on&quot;){\n      digitalWrite(output, LOW);\n      Serial.print(&quot;on&quot;);\n    }\n    else if(messageTemp == &quot;off&quot;){\n      digitalWrite(output, HIGH);\n      Serial.print(&quot;off&quot;);\n    }\n  }\n  Serial.println();\n}\n\n\/\/ This functions reconnects your ESP8266 to your MQTT broker\n\/\/ Change the function below if you want to subscribe to more topics with your ESP8266 \nvoid reconnect() {\n  \/\/ Loop until we're reconnected\n  while (!client.connected()) {\n    Serial.print(&quot;Attempting MQTT connection...&quot;);\n    \/\/ Create a random client ID\n    String clientId = &quot;ESP8266Client-&quot;;\n    clientId += String(random(0xffff), HEX);\n    \/\/ Attempt to connect\n    if (client.connect(clientId.c_str())) {\n      Serial.println(&quot;connected&quot;);  \n      \/\/ Subscribe or resubscribe to a topic\n      \/\/ You can subscribe to more topics (to control more outputs)\n      client.subscribe(&quot;esp8266\/output&quot;);  \n    } else {\n      Serial.print(&quot;failed, rc=&quot;);\n      Serial.print(client.state());\n      Serial.println(&quot; try again in 5 seconds&quot;);\n      \/\/ Wait 5 seconds before retrying\n      delay(5000);\n    }\n  }\n}\n\n\/\/ Checks if motion was detected and the sensors are armed. Then, starts a timer.\nICACHE_RAM_ATTR void detectsMovement() {\n  Serial.println(&quot;MOTION DETECTED!&quot;);\n  client.publish(&quot;esp8266\/motion&quot;, &quot;MOTION DETECTED!&quot;);\n  previousTime = millis();\n  startTimer = true;\n}\n\nvoid setup() {\n  \/\/ Start the DS18B20 sensor\n  sensors.begin();\n\n  \/\/ Serial port for debugging purposes\n  Serial.begin(115200);\n\n  \/\/ PIR Motion Sensor mode, then set interrupt function and RISING mode\n  pinMode(motionSensor, INPUT_PULLUP);\n  attachInterrupt(digitalPinToInterrupt(motionSensor), detectsMovement, RISING);\n  \n  \/\/ Initialize the output variable and the LED as OUTPUTs\n  pinMode(output, OUTPUT);\n  pinMode(statusLed, OUTPUT);\n  digitalWrite(output, HIGH);\n  digitalWrite(statusLed, LOW);\n  \n  setup_wifi();\n  client.setServer(mqtt_server, 1883);\n  client.setCallback(callback);\n}\n\nvoid loop() {\n  if (!client.connected()) {\n    reconnect();\n  }\n  client.loop();\n  \n  \/\/ Timer variable with current time\n  now = millis();\n\n  \/\/ Publishes new temperature and LDR readings every 30 seconds\n  if (now - lastMeasure &gt; 30000) {\n    lastMeasure = now;\n    sensors.requestTemperatures(); \n    \/\/ Temperature in Celsius degrees\n    temperatureString = String(sensors.getTempCByIndex(0));\n    \/\/ Uncomment the next line for temperature in Fahrenheit degrees\n    \/\/temperatureString = String(sensors.getTempFByIndex(0));\n    \/\/ Publishes Temperature values\n    client.publish(&quot;esp8266\/temperature&quot;, temperatureString.c_str());\n    Serial.println(&quot;Temperature published&quot;);\n    \n    \/\/ Publishes LDR values\n    client.publish(&quot;esp8266\/ldr&quot;, String(analogRead(ldr)).c_str());\n    Serial.println(&quot;LDR values published&quot;);    \n  }\n  \/\/ After 10 seconds have passed since motion was detected, publishes a &quot;No motion&quot; message\n  if ((now - previousTime &gt; 10000) &amp;&amp; startTimer) { \n    client.publish(&quot;esp8266\/motion&quot;, &quot;No motion&quot;);\n    Serial.println(&quot;Motion stopped&quot;);\n    startTimer = false;\n  }\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\/raw\/master\/Code\/NodeRED_ESP8266_Multisensor_Shield\/NodeRED_ESP8266_Multisensor_Shield.ino\" target=\"_blank\">View raw code<\/a><\/p>\n<p><span style=\"font-weight: 400;\">This code is quite long to explain, so you can simply replace the following three variables with your details and the code will work straight away.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const char* <strong>ssid<\/strong> = \"\";<\/span>\r\n<span style=\"font-weight: 400;\">const char* <strong>password<\/strong> = \"\";\r\nconst char* <strong>mqtt_server<\/strong> = \"\";\r\n<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">If you want to learn how this code works, continue reading.<\/span><\/p>\n<p><strong>callback()<\/strong><\/p>\n<p>In the\u00a0<em>callback()<\/em> function when a new message is received on the topic <strong>esp8266\/output<\/strong>, you check if the message is either <strong>on<\/strong> or <strong>off<\/strong> to turn the output on or off accordingly.<\/p>\n<pre>if(topic==\"esp8266\/output\"){\r\n  Serial.print(\"Changing output to \");\r\n  if(messageTemp == \"on\"){\r\n    digitalWrite(output, LOW);\r\n    Serial.print(\"on\");\r\n  }\r\n  else if(messageTemp == \"off\"){\r\n    digitalWrite(output, HIGH);\r\n    Serial.print(\"off\");\r\n  }\r\n}<\/pre>\n<p><strong>Publishing temperature and LDR readings<\/strong><\/p>\n<p>This section of code\u00a0publishes new temperature and LDR readings every 30 seconds. The temperatures readings are published on the <strong>esp8266\/temperature<\/strong> topic. The luminosity readings are published on the <strong>esp8266\/ldr<\/strong> topic.<\/p>\n<pre>if (now - lastMeasure &gt; 30000) {\r\n  lastMeasure = now;\r\n  sensors.requestTemperatures(); \r\n  \/\/ Temperature in Celsius degrees\r\n  temperatureString = String(sensors.getTempCByIndex(0));\r\n  \/\/ Uncomment the next line for temperature in Fahrenheit degrees\r\n  \/\/temperatureString = String(sensors.getTempFByIndex(0));\r\n  \/\/ Publishes Temperature values\r\n  client.publish(\"esp8266\/temperature\", temperatureString.c_str());\r\n  Serial.println(\"Temperature published\");\r\n\r\n  \/\/ Publishes LDR values\r\n  client.publish(\"esp8266\/ldr\", String(analogRead(ldr)).c_str());\r\n  Serial.println(\"LDR values published\"); \r\n}<\/pre>\n<p><strong> Note:<\/strong>\u00a0the temperature is being published in Celsius degrees, but you can uncomment the following line for temperature in Fahrenheit degrees:<\/p>\n<pre><strong>temperatureString = String(sensors.getTempFByIndex(0));<\/strong><\/pre>\n<p><strong>Motion detection<\/strong><\/p>\n<p>When motion is detected it calls the\u00a0<em>detectsMovement()<\/em> function, publishes the message &#8220;MOTION DETECTED!&#8221; on the <strong>esp8266\/motion<\/strong> topic, and starts a timer:<\/p>\n<pre>void detectsMovement() {\r\n  Serial.println(\"MOTION DETECTED!\");\r\n  client.publish(\"esp8266\/motion\", \"MOTION DETECTED!\");\r\n  previousTime = millis();\r\n  startTimer = true;\r\n}<\/pre>\n<p>If motion is not detected for more than 10 seconds, a new message is published in the\u00a0<strong>esp8266\/motion<\/strong> with the text &#8220;No motion&#8221;:<\/p>\n<pre> \/\/ After 10 seconds have passed since motion was detected, publishes a \"No motion\" message\r\nif ((now - previousTime &gt; 10000) &amp;&amp; startTimer) { \r\n  client.publish(\"esp8266\/motion\", \"No motion\");\r\n  Serial.println(\"Motion stopped\");\r\n  startTimer = false;\r\n}<\/pre>\n<p>Those are the main sections of code that you need to worry about. You can modify the messages, subscribe to more topics to control more outputs, or publish other sensor readings.<\/p>\n<h3>Testing the connection<\/h3>\n<p>Upload the code to your board. After uploading it, and with the Raspberry Pi running your Node-RED application and the Mosquitto broker, open the Arduino IDE serial monitor at a baud rate of 115200 and see what\u2019s happening in real time.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-73110\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/Arduino-IDE-serial-port-node-red-esp8266-mqtt.png?resize=756%2C484&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"756\" height=\"484\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/Arduino-IDE-serial-port-node-red-esp8266-mqtt.png?w=756&amp;quality=100&amp;strip=all&amp;ssl=1 756w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/Arduino-IDE-serial-port-node-red-esp8266-mqtt.png?resize=300%2C192&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/p>\n<p>This is helpful to check if the ESP8266 has established a successful connection to your router and with the Mosquitto broker.<\/p>\n<h2>Creating the Node-RED Flow<\/h2>\n<p>Before creating the flow, you need to have installed in your Raspberry Pi:<\/p>\n<ul>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-on-raspberry-pi\/\">Node-RED<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-dashboard\/\">Node-RED Dashboard<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/how-to-install-mosquitto-broker-on-raspberry-pi\/\">Mosquitto Broker<\/a><\/li>\n<\/ul>\n<h3>Importing the Node-RED flow<\/h3>\n<p>To import the provided Node-RED flow, go to the<span style=\"color: #000000;\">\u00a0<a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\/raw\/master\/Code\/NodeRED_ESP8266_Multisensor_Shield\/NodeRED_Config_Example.txt\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub repository<\/a><\/span>\u00a0or click the figure below to see the raw file, and copy the code provided.<\/p>\n<p><a href=\"https:\/\/github.com\/RuiSantosdotme\/ESP8266-Multisensor-Shield\/raw\/master\/Code\/NodeRED_ESP8266_Multisensor_Shield\/NodeRED_Config_Example.txt\" target=\"_blank\" rel=\"noopener noreferrer\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-73098\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-flow-raw-download-github.png?resize=987%2C89&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"987\" height=\"89\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-flow-raw-download-github.png?w=987&amp;quality=100&amp;strip=all&amp;ssl=1 987w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-flow-raw-download-github.png?resize=300%2C27&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-flow-raw-download-github.png?resize=768%2C69&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-flow-raw-download-github.png?resize=975%2C89&amp;quality=100&amp;strip=all&amp;ssl=1 975w\" sizes=\"(max-width: 987px) 100vw, 987px\" \/><\/a><\/p>\n<p>Next, in the Node-RED window, at the top right corner, select the menu, and go to\u00a0<strong>Import\u00a0<\/strong>\u00a0&gt;\u00a0<strong>Clipboard<\/strong>.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-45987\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes.png?resize=523%2C291&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"523\" height=\"291\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes.png?w=523&amp;quality=100&amp;strip=all&amp;ssl=1 523w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes.png?resize=300%2C167&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><\/p>\n<p>Then, paste the code provided and click\u00a0<strong>Import<\/strong>.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-73111\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-import-flow.png?resize=501%2C336&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"501\" height=\"336\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-import-flow.png?w=501&amp;quality=100&amp;strip=all&amp;ssl=1 501w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-import-flow.png?resize=300%2C201&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 501px) 100vw, 501px\" \/><\/p>\n<p>Here\u2019s the imported flow that controls the ESP8266 and displays the published sensor readings.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-73095\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-flow-esp8266-multisensor-shield.png?resize=397%2C298&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"397\" height=\"298\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-flow-esp8266-multisensor-shield.png?w=397&amp;quality=100&amp;strip=all&amp;ssl=1 397w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/node-red-flow-esp8266-multisensor-shield.png?resize=300%2C225&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 397px) 100vw, 397px\" \/><\/p>\n<h2>Node-RED UI<\/h2>\n<p>After making all the necessary changes, click the\u00a0<strong>Deploy<\/strong>\u00a0button to save all the changes.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-40013 size-full\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/06\/11_deploy_button.png?resize=138%2C40&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"138\" height=\"40\" \/><\/p>\n<p>Now, your Node-RED application is ready. To access Node-RED UI and see how your application looks, access any browser in your local network and type:<\/p>\n<pre>http:\/\/<span style=\"color: #ff0000;\"><strong>Your_RPi_IP_address:1880<\/strong><\/span>\/ui<\/pre>\n<p>Your application should look as in the following figure.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-73096\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/1-ESP8266-multisensor-node-red.png?resize=589%2C741&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"589\" height=\"741\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/1-ESP8266-multisensor-node-red.png?w=589&amp;quality=100&amp;strip=all&amp;ssl=1 589w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/1-ESP8266-multisensor-node-red.png?resize=238%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 238w\" sizes=\"(max-width: 589px) 100vw, 589px\" \/><\/p>\n<p>When motion is detected, it prints the message &#8220;MOTION DETECTED!&#8221; in the PIR Status field:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-73097\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/2-ESP8266-multisensor-node-red-motion-detected.png?resize=589%2C741&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"589\" height=\"741\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/2-ESP8266-multisensor-node-red-motion-detected.png?w=589&amp;quality=100&amp;strip=all&amp;ssl=1 589w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/2-ESP8266-multisensor-node-red-motion-detected.png?resize=238%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 238w\" sizes=\"(max-width: 589px) 100vw, 589px\" \/><\/p>\n<h2>Wrapping Up<\/h2>\n<p>That\u2019s it for this project. We hope you\u2019ve found this project useful and you\u2019re able to integrate the Multisensor Shield with your own home automation system using Node-RED.<\/p>\n<p>If you like this project, you may also like our other projects:<\/p>\n<ul>\n<li><strong><a href=\"https:\/\/randomnerdtutorials.com\/home-automation-using-esp8266\/\">Home Automation Using ESP8266 Course<\/a><\/strong><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-multisensor-shield\/\">Build a Multisensor Shield for ESP8266<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/build-an-all-in-one-esp32-weather-station-shield\/\" target=\"_blank\" rel=\"noopener noreferrer\">Build an All-in-One ESP32 Weather Station Shield<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-web-server-with-bme280-mini-weather-station\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESP32 Web Server with BME280 \u2013 Mini Weather Station<\/a><\/li>\n<\/ul>\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project you\u2019ll discover how integrate the ESP8266 Multisensor Shield for the Wemos D1 Mini board with Node-RED. The\u00a0ESP8266 Multisensor Shield will establish an MQTT connection with a Raspberry &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP8266 Multisensor Shield with Node-RED\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp8266-multisensor-shield-with-node-red\/#more-73094\" aria-label=\"Read more about ESP8266 Multisensor Shield with Node-RED\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":73123,"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":[265,214,246,300,240,282,283,284,273,264,268],"tags":[],"class_list":["post-73094","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp8266-project","category-esp8266","category-esp8266-arduino-ide","category-0-esp8266","category-esp8266-projects","category-mqtt","category-mqtt-broker","category-mqtt-client","category-node-red","category-project","category-raspberry-pi-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/09\/ESP8266_Multisensor_Shield_NodeRED_Thumbnail.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\/73094","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=73094"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/73094\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/73123"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=73094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=73094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=73094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}