{"id":2535,"date":"2018-12-14T00:00:12","date_gmt":"2018-12-13T23:00:12","guid":{"rendered":"https:\/\/iot.fkainka.de\/?p=2535"},"modified":"2018-11-21T12:42:09","modified_gmt":"2018-11-21T11:42:09","slug":"day14-2018","status":"publish","type":"post","link":"https:\/\/iot.fkainka.de\/en\/day14-2018","title":{"rendered":"Day 14: Smart Lights"},"content":{"rendered":"<p>The door of day 14 reveals another LED. Now we have two LEDs with resistors and two buttons and <strong>14. Tag <\/strong>cables, enough to build a complex lighting system. We will use the following setup:<\/p>\n<div id=\"attachment_2536\" style=\"width: 492px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day14_2LED_2Btn_4tch_Steckplatine.png\"><img aria-describedby=\"caption-attachment-2536\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-2536\" src=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day14_2LED_2Btn_4tch_Steckplatine-790x1024.png\" alt=\"Der Aufbau mit vier losen Kabeln (gelb) als Touch-Buttons\" width=\"482\" height=\"625\" data-id=\"2536\" srcset=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day14_2LED_2Btn_4tch_Steckplatine-790x1024.png 790w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day14_2LED_2Btn_4tch_Steckplatine-231x300.png 231w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day14_2LED_2Btn_4tch_Steckplatine-768x996.png 768w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/Day14_2LED_2Btn_4tch_Steckplatine.png 879w\" sizes=\"(max-width: 482px) 100vw, 482px\" \/><\/a><p id=\"caption-attachment-2536\" class=\"wp-caption-text\">Setup with four loose cables (yellow) as touch buttons<\/p><\/div>\n<p>Enable today\u2019s program and install today\u2019s flow. Don\u2019t forget, replace <strong>[PID]<\/strong> with your personal ID and the easiest way is using the trick with the Editor.<\/p>\n<p>The LEDs in the program you just enabled are set as PWM LEDs. This means that you can change the brightness of the LEDs. The values range from 0 to 255. Beside that however, you can still switch LEDs on or off like digital outputs. Use the following commands:<\/p>\n<table width=\"729\">\n<tbody>\n<tr>\n<td width=\"280\"><strong>Command in topic<\/strong><\/td>\n<td width=\"450\"><strong>Settings<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"280\">{&#8220;cmd&#8221;:&#8221;set_pwm_state&#8221;, &#8220;LED1&#8221;:255}<\/td>\n<td width=\"450\">The LED is set to maximum brightness. You can see it only when the LED is on.<\/td>\n<\/tr>\n<tr>\n<td width=\"280\">{&#8220;cmd&#8221;:&#8221;set_pwm_state&#8221;, &#8220;LED1&#8221;:0}<\/td>\n<td width=\"450\">The LED is set to the minimum brightness (the LED is not on).<\/td>\n<\/tr>\n<tr>\n<td width=\"280\">{&#8220;cmd&#8221;:&#8221;set_pwm_state&#8221;, &#8220;LED1&#8221;:true}<\/td>\n<td rowspan=\"2\" width=\"450\">The LED is activated and the last brightness is set. You will immediately notice any changes in brightness.<\/td>\n<\/tr>\n<tr>\n<td width=\"280\">{&#8220;cmd&#8221;:&#8221;set_pwm_state&#8221;, &#8220;LED1&#8243;:&#8221;ON&#8221;}<\/td>\n<\/tr>\n<tr>\n<td width=\"280\">{&#8220;cmd&#8221;:&#8221;set_pwm_state&#8221;, &#8220;LED1&#8221;:false}<\/td>\n<td rowspan=\"2\" width=\"450\">The LED is deactivated. You will notice a change in brightness only after activating the LED again.<\/td>\n<\/tr>\n<tr>\n<td width=\"280\">{&#8220;cmd&#8221;:&#8221;set_pwm_state&#8221;, &#8220;LED1&#8243;:&#8221;off&#8221;}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>These status changes can be sent via the <strong>out<\/strong> topic or <strong>NodeESP\/[PID]\/pwm\/state\/set<\/strong>. In case of a status change, the current state will also be published via the topic<\/p>\n<p><strong>NodeESP\/[PID]\/pwm\/state\/get\/out<\/strong><\/p>\n<p>In today\u2019s program we have two buttons and four touch buttons activated, which function according to the method we already know. The Node-RED flow today is a bit bigger, because we have an UI button for every button and every setting.<\/p>\n<div id=\"attachment_2537\" style=\"width: 519px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14UI.png\"><img aria-describedby=\"caption-attachment-2537\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-2537\" src=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14UI.png\" alt=\"Das Userinterface des heutigen Programms\" width=\"509\" height=\"265\" data-id=\"2537\" srcset=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14UI.png 509w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14UI-300x156.png 300w\" sizes=\"(max-width: 509px) 100vw, 509px\" \/><\/a><p id=\"caption-attachment-2537\" class=\"wp-caption-text\">User interface of the program today<\/p><\/div>\n<p>The user interface already provides some hints how the experiment today will work. The two LEDs simulate two dimmable lamps in a home. They are switched on or off with the two buttons on the board or via the web interface. The brightness can be adjusted using the UI controls. The buttons below are used to change the brightness by +10 or -10. The touch buttons have the same function. If you touch the wire pictured on the left in the setup figure, you will decrease the brightness of the LED on the left-hand side over time. The wire on the very the right increases the brightness. The two remaining wires work for the right LED in the same way. You can also change the brightness, if the LED is not on. The change will become noticeable only after you turn the LED on. The function is still very useful in case, you want to adjust the brightness of the lamp depending on the time of day, for example<\/p>\n<div id=\"attachment_2538\" style=\"width: 626px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14Flow.png\"><img aria-describedby=\"caption-attachment-2538\" decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-2538\" src=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14Flow-1024x316.png\" alt=\"Der Flow des Tages\" width=\"616\" height=\"190\" data-id=\"2538\" srcset=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14Flow-1024x316.png 1024w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14Flow-300x93.png 300w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14Flow-768x237.png 768w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14Flow-972x300.png 972w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14Flow.png 1225w\" sizes=\"(max-width: 616px) 100vw, 616px\" \/><\/a><p id=\"caption-attachment-2538\" class=\"wp-caption-text\">The flow today<\/p><\/div>\n<p><iframe style=\"border: none; width: 100%;\" src=\"https:\/\/pastebin.com\/embed_iframe\/4pBGSMqz\"><\/iframe><\/p>","protected":false},"excerpt":{"rendered":"<p>The door of day 14 reveals another LED. Now we have two LEDs with resistors and two buttons and 14. Tag cables, enough to build a complex lighting system. We will use the following setup: Enable today\u2019s program and install&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/iot.fkainka.de\/en\/day14-2018\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":2537,"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 14: Smart Lights - 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\/en\/day14-2018\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Day 14: Smart Lights - Internet of Things with the NanoESP\" \/>\n<meta property=\"og:description\" content=\"The door of day 14 reveals another LED. Now we have two LEDs with resistors and two buttons and 14. Tag cables, enough to build a complex lighting system. We will use the following setup: Enable today\u2019s program and install...Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/iot.fkainka.de\/en\/day14-2018\" \/>\n<meta property=\"og:site_name\" content=\"Internet of Things with the NanoESP\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-13T23:00:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-21T11:42:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14UI.png\" \/>\n\t<meta property=\"og:image:width\" content=\"509\" \/>\n\t<meta property=\"og:image:height\" content=\"265\" \/>\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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/iot.fkainka.de\/en\/day14-2018\",\"url\":\"https:\/\/iot.fkainka.de\/en\/day14-2018\",\"name\":\"Day 14: Smart Lights - Internet of Things with the NanoESP\",\"isPartOf\":{\"@id\":\"https:\/\/iot.fkainka.de\/#website\"},\"datePublished\":\"2018-12-13T23:00:12+00:00\",\"dateModified\":\"2018-11-21T11:42:09+00:00\",\"author\":{\"@id\":\"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a\"},\"breadcrumb\":{\"@id\":\"https:\/\/iot.fkainka.de\/en\/day14-2018#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/iot.fkainka.de\/en\/day14-2018\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/iot.fkainka.de\/en\/day14-2018#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/iot.fkainka.de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Day 14: Smart Lights\"}]},{\"@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 14: Smart Lights - 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\/en\/day14-2018","og_locale":"en_US","og_type":"article","og_title":"Day 14: Smart Lights - Internet of Things with the NanoESP","og_description":"The door of day 14 reveals another LED. Now we have two LEDs with resistors and two buttons and 14. Tag cables, enough to build a complex lighting system. We will use the following setup: Enable today\u2019s program and install...Read more","og_url":"https:\/\/iot.fkainka.de\/en\/day14-2018","og_site_name":"Internet of Things with the NanoESP","article_published_time":"2018-12-13T23:00:12+00:00","article_modified_time":"2018-11-21T11:42:09+00:00","og_image":[{"width":509,"height":265,"url":"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2018\/11\/T14UI.png","type":"image\/png"}],"author":"fk","twitter_card":"summary_large_image","twitter_misc":{"Written by":"fk","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/iot.fkainka.de\/en\/day14-2018","url":"https:\/\/iot.fkainka.de\/en\/day14-2018","name":"Day 14: Smart Lights - Internet of Things with the NanoESP","isPartOf":{"@id":"https:\/\/iot.fkainka.de\/#website"},"datePublished":"2018-12-13T23:00:12+00:00","dateModified":"2018-11-21T11:42:09+00:00","author":{"@id":"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a"},"breadcrumb":{"@id":"https:\/\/iot.fkainka.de\/en\/day14-2018#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/iot.fkainka.de\/en\/day14-2018"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/iot.fkainka.de\/en\/day14-2018#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/iot.fkainka.de\/"},{"@type":"ListItem","position":2,"name":"Day 14: Smart Lights"}]},{"@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\/T14UI.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6McI0-ET","_links":{"self":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/2535"}],"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=2535"}],"version-history":[{"count":2,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/2535\/revisions"}],"predecessor-version":[{"id":2540,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/2535\/revisions\/2540"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/media\/2537"}],"wp:attachment":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/media?parent=2535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/categories?post=2535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/tags?post=2535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}