{"id":1412,"date":"2016-12-24T00:01:53","date_gmt":"2016-12-23T23:01:53","guid":{"rendered":"http:\/\/iot.fkainka.de\/?p=1412"},"modified":"2018-10-24T16:05:09","modified_gmt":"2018-10-24T15:05:09","slug":"day-24-gift-box","status":"publish","type":"post","link":"https:\/\/iot.fkainka.de\/en\/day-24-gift-box","title":{"rendered":"Day 24: Gift box"},"content":{"rendered":"<p>With the last test in this Advent, we get really Christmasy. We&#8217;re building a reusable gift box with which you can delight your relatives. Every time someone opens the present, the contents are lit up in an individual colour, and a Christmas sound plays.<\/p>\n<p>Behind today&#8217;s door is a retro-reflective sensor. This is actually two components, an IR transmitter diode and a phototransistor. It&#8217;s not very easy to see which way the elements have to be connected in terms of polarity. For this reason, it&#8217;s best if you connect the photoelectric sensor with the connection cables according to the example shown. Then you won&#8217;t be able to switch the polarity as easily.<\/p>\n<div id=\"attachment_1414\" style=\"width: 375px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_2.jpg\"><img aria-describedby=\"caption-attachment-1414\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-1414\" src=\"http:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_2-1024x806.jpg\" alt=\"So schlie\u00dfen Sie die Reflexlichtschranke an\" width=\"365\" height=\"287\" srcset=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_2-1024x806.jpg 1024w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_2-300x236.jpg 300w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_2-768x604.jpg 768w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_2-972x765.jpg 972w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_2.jpg 1116w\" sizes=\"(max-width: 365px) 100vw, 365px\" \/><\/a><p id=\"caption-attachment-1414\" class=\"wp-caption-text\">This is how to connect the retro-reflective sensor<\/p><\/div>\n<p>Today&#8217;s layout contains many components, so it all looks a bit confusing at first glance. In addition to the retro-reflective sensor, which serves as a sensor to detect the opening of the package, the RGB LED and the piezo sound transducer are used.<\/p>\n<div id=\"attachment_1413\" style=\"width: 626px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_Present2_Steckplatine.jpg\"><img aria-describedby=\"caption-attachment-1413\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-1413 size-large\" src=\"http:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_Present2_Steckplatine-1024x816.jpg\" alt=\"day24_present2_steckplatine\" width=\"616\" height=\"491\" srcset=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_Present2_Steckplatine-1024x816.jpg 1024w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_Present2_Steckplatine-300x239.jpg 300w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_Present2_Steckplatine-768x612.jpg 768w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_Present2_Steckplatine-972x774.jpg 972w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_Present2_Steckplatine.jpg 1164w\" sizes=\"(max-width: 616px) 100vw, 616px\" \/><\/a><p id=\"caption-attachment-1413\" class=\"wp-caption-text\">The last layout of the Advent calendar<\/p><\/div>\n<p><iframe loading=\"lazy\" style=\"height: 400px; width: 100%; margin: 10px 0;\" src=\"https:\/\/create.arduino.cc\/editor\/FKainka\/33d9af00-2593-48dd-822b-f490df76546d\/preview?embed\" width=\"300\" height=\"150\" frameborder=\"0\"><\/iframe><br \/>\nAfter you have loaded today&#8217;s programme on the controller, go once more to the <a href=\"http:\/\/www.hivemq.com\/try-out\/\">http:\/\/www.hivemq.com\/try-out\/<\/a> site and connect to the broker <strong>broker.fkainka.de<\/strong>. Once you&#8217;re there, you can now begin to dedicate one topic each to the persons to whom you want to give gifts according to the following model:<\/p>\n<p><strong>NanoESP\/MyMQTTiD\/present\/person\/color<\/strong><\/p>\n<p><strong>NanoESP\/MyMQTTiD\/present\/person\/song<\/strong><\/p>\n<p>where you replace &#8220;MyMQTTiD&#8221; with your personal ID and &#8220;person&#8221; with the person to whom you want to give the present. In the topic &#8220;color,&#8221; publish a colour according to the pattern you already know, rgb(X,X,X), and in the topic &#8220;song&#8221; publish a number between 0 and 5, which stands for a predefined song. Both messages must be equipped with the Retain flag. For three persons, for example, it would look like this:<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"414\"><strong>Topic<\/strong><\/td>\n<td width=\"165\"><strong>Value<\/strong><\/td>\n<td width=\"92\"><strong>Retain<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"414\">NanoESP\/<em>mqttId<\/em>\/present\/mother\/color<\/p>\n<p>&nbsp;<\/td>\n<td width=\"165\">rgb(255,255,0)<\/td>\n<td width=\"92\">X<\/td>\n<\/tr>\n<tr>\n<td width=\"414\">NanoESP\/<em>mqttId<\/em>\/present\/mother\/song<\/p>\n<p>&nbsp;<\/td>\n<td width=\"165\">2<\/td>\n<td width=\"92\">X<\/td>\n<\/tr>\n<tr>\n<td width=\"414\">NanoESP\/<em>mqttId<\/em>\/present\/father\/color<\/p>\n<p>&nbsp;<\/td>\n<td width=\"165\">rgb(0,0,255)<\/td>\n<td width=\"92\">X<\/td>\n<\/tr>\n<tr>\n<td width=\"414\">NanoESP\/<em>mqttId<\/em>\/present\/father\/song<\/p>\n<p>&nbsp;<\/td>\n<td width=\"165\">1<\/td>\n<td width=\"92\">X<\/td>\n<\/tr>\n<tr>\n<td width=\"414\">NanoESP\/<em>mqttId<\/em>\/present\/sister\/color<\/p>\n<p>&nbsp;<\/td>\n<td width=\"165\">rgb(255,0,255)<\/td>\n<td width=\"92\">X<\/td>\n<\/tr>\n<tr>\n<td width=\"414\">NanoESP\/<em>mqttId<\/em>\/present\/sister\/song<\/p>\n<p>&nbsp;<\/td>\n<td width=\"165\">4<\/td>\n<td width=\"92\">X<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>Now you can switch between these persons by publishing the person in the topic<\/p>\n<p><strong>NanoESP\/MyMQTTiD\/present<\/strong><\/p>\n<p>If you enter &#8220;sister&#8221; there, for example (pay attention to exact spelling), the settings for your sister are loaded and are used when the box is opened. After the gift has been removed, put the next one in, close the box again and load the next setting by publishing the next person. For test purposes, you can hold the sensor in front of a white sheet of paper, which simulates the closing of the box. The sensor must thereby be shielded from the residual daylight. When you take the paper away, the box is recognised as opened. See the website for instructions on precisely how to build the box.<\/p>","protected":false},"excerpt":{"rendered":"<p>With the last test in this Advent, we get really Christmasy. We&#8217;re building a reusable gift box with which you can delight your relatives. Every time someone opens the present, the contents are lit up in an individual colour, and&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/iot.fkainka.de\/en\/day-24-gift-box\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":1413,"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":[123,124,311],"tags":[130,20,15],"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 24: Gift box - 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\/day-24-gift-box\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Day 24: Gift box - Internet of Things with the NanoESP\" \/>\n<meta property=\"og:description\" content=\"With the last test in this Advent, we get really Christmasy. We&#8217;re building a reusable gift box with which you can delight your relatives. Every time someone opens the present, the contents are lit up in an individual colour, and...Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/iot.fkainka.de\/day-24-gift-box\" \/>\n<meta property=\"og:site_name\" content=\"Internet of Things with the NanoESP\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-23T23:01:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-24T15:05:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_Present2_Steckplatine.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1164\" \/>\n\t<meta property=\"og:image:height\" content=\"927\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/iot.fkainka.de\/day-24-gift-box\",\"url\":\"https:\/\/iot.fkainka.de\/day-24-gift-box\",\"name\":\"Day 24: Gift box - Internet of Things with the NanoESP\",\"isPartOf\":{\"@id\":\"https:\/\/iot.fkainka.de\/#website\"},\"datePublished\":\"2016-12-23T23:01:53+00:00\",\"dateModified\":\"2018-10-24T15:05:09+00:00\",\"author\":{\"@id\":\"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a\"},\"breadcrumb\":{\"@id\":\"https:\/\/iot.fkainka.de\/day-24-gift-box#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/iot.fkainka.de\/day-24-gift-box\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/iot.fkainka.de\/day-24-gift-box#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/iot.fkainka.de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tag 24: Geschenkbox\"}]},{\"@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 24: Gift box - 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\/day-24-gift-box","og_locale":"en_US","og_type":"article","og_title":"Day 24: Gift box - Internet of Things with the NanoESP","og_description":"With the last test in this Advent, we get really Christmasy. We&#8217;re building a reusable gift box with which you can delight your relatives. Every time someone opens the present, the contents are lit up in an individual colour, and...Read more","og_url":"https:\/\/iot.fkainka.de\/day-24-gift-box","og_site_name":"Internet of Things with the NanoESP","article_published_time":"2016-12-23T23:01:53+00:00","article_modified_time":"2018-10-24T15:05:09+00:00","og_image":[{"width":1164,"height":927,"url":"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day24_Present2_Steckplatine.jpg","type":"image\/jpeg"}],"author":"fk","twitter_card":"summary_large_image","twitter_misc":{"Written by":"fk","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/iot.fkainka.de\/day-24-gift-box","url":"https:\/\/iot.fkainka.de\/day-24-gift-box","name":"Day 24: Gift box - Internet of Things with the NanoESP","isPartOf":{"@id":"https:\/\/iot.fkainka.de\/#website"},"datePublished":"2016-12-23T23:01:53+00:00","dateModified":"2018-10-24T15:05:09+00:00","author":{"@id":"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a"},"breadcrumb":{"@id":"https:\/\/iot.fkainka.de\/day-24-gift-box#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/iot.fkainka.de\/day-24-gift-box"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/iot.fkainka.de\/day-24-gift-box#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/iot.fkainka.de\/"},{"@type":"ListItem","position":2,"name":"Tag 24: Geschenkbox"}]},{"@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\/2016\/09\/Day24_Present2_Steckplatine.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6McI0-mM","_links":{"self":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/1412"}],"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=1412"}],"version-history":[{"count":4,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/1412\/revisions"}],"predecessor-version":[{"id":1845,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/1412\/revisions\/1845"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/media\/1413"}],"wp:attachment":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/media?parent=1412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/categories?post=1412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/tags?post=1412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}