{"id":2463,"date":"2018-12-05T00:00:49","date_gmt":"2018-12-04T23:00:49","guid":{"rendered":"https:\/\/iot.fkainka.de\/?p=2463"},"modified":"2018-11-19T16:33:04","modified_gmt":"2018-11-19T15:33:04","slug":"day5-2018","status":"publish","type":"post","link":"https:\/\/iot.fkainka.de\/en\/day5-2018","title":{"rendered":"Day 5: Node-RED"},"content":{"rendered":"<p>Behind the fifth door of the Advent calendar is a button and we are going to use it today in our experiment instead of the boot button. We will connect the button to pin 18 and GND in such a way that when pressed, it will pull the pin to ground, thus to LOW. If you have selected the program of the day and you press the button, a message is sent via UDP.<\/p>\n<div id=\"attachment_2464\" style=\"width: 526px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day5_Button1_Steckplatine.png\"><img aria-describedby=\"caption-attachment-2464\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-2464\" src=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day5_Button1_Steckplatine-827x1024.png\" alt=\"Versuchsaufbau\" width=\"516\" height=\"638\" data-id=\"2464\" srcset=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day5_Button1_Steckplatine-827x1024.png 827w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day5_Button1_Steckplatine-242x300.png 242w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day5_Button1_Steckplatine-768x951.png 768w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day5_Button1_Steckplatine.png 879w\" sizes=\"(max-width: 516px) 100vw, 516px\" \/><\/a><p id=\"caption-attachment-2464\" class=\"wp-caption-text\">Breadboard Construction<\/p><\/div>\n<p>Today, you will become familiar with the <strong>Node-RED<\/strong> program and learn how to create your own little programs and automate tasks. Node-RED is free software and allows us to link together different devices, online services and APIs (programming interfaces) through a simple graphical interface. The links are called flows and are simply drawn by mouse click.<\/p>\n<p>Node-RED is available for Linux, Windows and macOS. It would also make sense to use a Raspberry Pi, as it can be left on, it does not need much power and that is in line with the idea of the Smarthome. Besides, Node-RED is already preinstalled under Raspbian.<\/p>\n<p>I will demonstrate the installation for Windows 10 as an example. Most of these commands can be used with other systems.<\/p>\n<p>First <strong>Node.js<\/strong> must be installed. This software is available along with a detailed installation manual from the website <strong>https:\/\/nodejs.org<\/strong>\/. Double-click and install the 16 MB MSI file. To make sure that everything installs properly, open the Windows terminal, also called command line or shell (Windows key + [R] and then enter <strong>cmd<\/strong>), and type<strong> node &#8211;version &amp;&amp; npm \u2013version<\/strong><\/p>\n<p>You will see something like <strong>v8.10.0<\/strong> and <strong>5.6.0<\/strong>, or maybe you already have a newer version. In the command line enter the command that will install NodeRED:<\/p>\n<p><strong>npm install -g &#8211;unsafe-perm node-red<\/strong><\/p>\n<p>This may take a while. Then use the command line to start Node-RED: <strong>node-red<\/strong><\/p>\n<div id=\"attachment_2465\" style=\"width: 626px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2NodeInstall2.png\"><img aria-describedby=\"caption-attachment-2465\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-2465\" src=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2NodeInstall2-1024x597.png\" alt=\"Die Firewall meldet sich. Im Hintergrund startet Node-RED in der Konsole\" width=\"616\" height=\"359\" data-id=\"2465\" srcset=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2NodeInstall2-1024x597.png 1024w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2NodeInstall2-300x175.png 300w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2NodeInstall2-768x448.png 768w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2NodeInstall2-972x566.png 972w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2NodeInstall2.png 1668w\" sizes=\"(max-width: 616px) 100vw, 616px\" \/><\/a><p id=\"caption-attachment-2465\" class=\"wp-caption-text\">Firewall request. In der console Node-RED starts in the background<\/p><\/div>\n<p>Firewall immediately acts and wants to know how to proceed with this new connection. Now it is essential to select <strong>Private networks<\/strong> and <strong>Allow access<\/strong>. Only then Node-RED will function properly. Also, it is important that you do not close the terminal at this stage as this would also terminate Node-RED.<\/p>\n<p>Now you have installed and launched Node-RED.\u00a0 But except a few lines in the terminal you haven\u2019t seen anything useful yet. The user interface of the software is opened via the browser. Thus, open t by using the address <strong>http:\/\/127.0.0.1:1880<\/strong>\/. This is the localhost address that you use to address your machine. The number 1880 is the port through which you reach Node-RED. Note here, if you want to access NodeRED from another machine, you will have to use the machine\u2019s proper IP. But right here you see the Node-RED interface with the flow area in the middle, with nodes on the left and information on the right.<\/p>\n<div id=\"attachment_2466\" style=\"width: 626px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2Node2.png\"><img aria-describedby=\"caption-attachment-2466\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-2466\" src=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2Node2-1024x544.png\" alt=\"Einstellungen und eine empfangene Nachricht\" width=\"616\" height=\"327\" data-id=\"2466\" srcset=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2Node2-1024x544.png 1024w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2Node2-300x159.png 300w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2Node2-768x408.png 768w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2Node2-972x516.png 972w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T2Node2.png 1920w\" sizes=\"(max-width: 616px) 100vw, 616px\" \/><\/a><p id=\"caption-attachment-2466\" class=\"wp-caption-text\">Settings and a message received<\/p><\/div>\n<p>The <strong>Input<\/strong> section on the left has a node called <strong>udp<\/strong>. Drag it into the free area in the middle. A bit further down under the <strong>output<\/strong> is <strong>debug<\/strong>. Drag this node also into the area. Link the two nodes by clicking and dragging with the mouse. Then double click the UDP node to open the settings. Enter everything exactly as shown in the picture above. Confirm with <strong>Done<\/strong>. Start by clicking the <strong>Deploy<\/strong> button in the top right corner. The message <strong>Successfully deployed<\/strong> appears briefly. The new flow is now active. As a final step, select the <strong>debug<\/strong> tab on the very right and then press the button on the breadboard. The <strong>debug<\/strong> window will show a message in the familiar JSON format: <strong>{&#8220;cmd&#8221;: &#8220;btn1_pressed&#8221;}<\/strong>. The connection to Node-RED has been established.<\/p>\n<p>Note<strong>:<\/strong> Counting the board pins can be tiresome. Therefore, we have provided a stencil on our Board page under <strong>Pinout<\/strong>, which you can print out, cut and place on the board.<\/p>","protected":false},"excerpt":{"rendered":"<p>Behind the fifth door of the Advent calendar is a button and we are going to use it today in our experiment instead of the boot button. We will connect the button to pin 18 and GND in such a&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/iot.fkainka.de\/en\/day5-2018\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":2464,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[315,312,313],"tags":[],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Day 5: Node-RED - Internet of Things with the NanoESP<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/iot.fkainka.de\/day5-2018\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Day 5: Node-RED - Internet of Things with the NanoESP\" \/>\n<meta property=\"og:description\" content=\"Behind the fifth door of the Advent calendar is a button and we are going to use it today in our experiment instead of the boot button. We will connect the button to pin 18 and GND in such a...Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/iot.fkainka.de\/day5-2018\" \/>\n<meta property=\"og:site_name\" content=\"Internet of Things with the NanoESP\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-04T23:00:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-19T15:33:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day5_Button1_Steckplatine.png\" \/>\n\t<meta property=\"og:image:width\" content=\"879\" \/>\n\t<meta property=\"og:image:height\" content=\"1089\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"fk\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"fk\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/iot.fkainka.de\/day5-2018\",\"url\":\"https:\/\/iot.fkainka.de\/day5-2018\",\"name\":\"Day 5: Node-RED - Internet of Things with the NanoESP\",\"isPartOf\":{\"@id\":\"https:\/\/iot.fkainka.de\/#website\"},\"datePublished\":\"2018-12-04T23:00:49+00:00\",\"dateModified\":\"2018-11-19T15:33:04+00:00\",\"author\":{\"@id\":\"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a\"},\"breadcrumb\":{\"@id\":\"https:\/\/iot.fkainka.de\/day5-2018#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/iot.fkainka.de\/day5-2018\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/iot.fkainka.de\/day5-2018#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/iot.fkainka.de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tag 5: Node-RED\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/iot.fkainka.de\/#website\",\"url\":\"https:\/\/iot.fkainka.de\/\",\"name\":\"Internet of Things with the NanoESP\",\"description\":\"The webpage for the Arduino compatible WiFi-Board\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/iot.fkainka.de\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a\",\"name\":\"fk\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/iot.fkainka.de\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/141cf958a831e66efabf9674e117e8d9?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/141cf958a831e66efabf9674e117e8d9?s=96&d=identicon&r=g\",\"caption\":\"fk\"},\"url\":\"https:\/\/iot.fkainka.de\/en\/author\/fk\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Day 5: Node-RED - Internet of Things with the NanoESP","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/iot.fkainka.de\/day5-2018","og_locale":"en_US","og_type":"article","og_title":"Day 5: Node-RED - Internet of Things with the NanoESP","og_description":"Behind the fifth door of the Advent calendar is a button and we are going to use it today in our experiment instead of the boot button. We will connect the button to pin 18 and GND in such a...Read more","og_url":"https:\/\/iot.fkainka.de\/day5-2018","og_site_name":"Internet of Things with the NanoESP","article_published_time":"2018-12-04T23:00:49+00:00","article_modified_time":"2018-11-19T15:33:04+00:00","og_image":[{"width":879,"height":1089,"url":"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day5_Button1_Steckplatine.png","type":"image\/png"}],"author":"fk","twitter_card":"summary_large_image","twitter_misc":{"Written by":"fk","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/iot.fkainka.de\/day5-2018","url":"https:\/\/iot.fkainka.de\/day5-2018","name":"Day 5: Node-RED - Internet of Things with the NanoESP","isPartOf":{"@id":"https:\/\/iot.fkainka.de\/#website"},"datePublished":"2018-12-04T23:00:49+00:00","dateModified":"2018-11-19T15:33:04+00:00","author":{"@id":"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a"},"breadcrumb":{"@id":"https:\/\/iot.fkainka.de\/day5-2018#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/iot.fkainka.de\/day5-2018"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/iot.fkainka.de\/day5-2018#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/iot.fkainka.de\/"},{"@type":"ListItem","position":2,"name":"Tag 5: Node-RED"}]},{"@type":"WebSite","@id":"https:\/\/iot.fkainka.de\/#website","url":"https:\/\/iot.fkainka.de\/","name":"Internet of Things with the NanoESP","description":"The webpage for the Arduino compatible WiFi-Board","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/iot.fkainka.de\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a","name":"fk","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/iot.fkainka.de\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/141cf958a831e66efabf9674e117e8d9?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/141cf958a831e66efabf9674e117e8d9?s=96&d=identicon&r=g","caption":"fk"},"url":"https:\/\/iot.fkainka.de\/en\/author\/fk"}]}},"jetpack_featured_media_url":"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day5_Button1_Steckplatine.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6McI0-DJ","_links":{"self":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/2463"}],"collection":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/comments?post=2463"}],"version-history":[{"count":4,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/2463\/revisions"}],"predecessor-version":[{"id":2470,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/2463\/revisions\/2470"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/media\/2464"}],"wp:attachment":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/media?parent=2463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/categories?post=2463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/tags?post=2463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}