[{"content":"\nThe Board The NanoESP board has many names. Franzis calls it Pretel Board and Conrad C-Controll IoT WiFi Board. But inside its is all the same: an easy-to-use and Arduino compatible development board in the context of the Internet of Things.\nBy simple AT commands you can e. g. launch a Web server, set the module as an access point or establish connection with your home network.\nBoard Features:\n• Arduino™ compatible\n• Integrated TCP/IP stack, activatable TCP/UDP server\n• Control of the WLAN module by simple AT commands\n• Suitable for WLAN \u0026amp; the module can be used as an access point\nThe Boad is available in one of the following shops:\nThe board at Franzis\nElektor-Shop\nConrad-Shop\nReichelt-Shop\nNEW: Amazon\nNEW: Pollin-Shop\nThemes NanoESP Updaten Library for NanoESP \u0026amp; Pretzel Board Pinout NanoESP \u0026amp; Pretzel Board Fritzing Bauteil - NanoESP \u0026amp; Pretzel Board Beispielprojekt - NanoESP \u0026amp; Pretzelboard Board specifications NanoESP \u0026amp; Pretzel Board Quick Start - NanoESP \u0026amp; Pretzelboard Questions and Answers - NanoESP \u0026amp; Pretzelboard AT Commands -NanoESP \u0026amp; Pretzelboard Driver -NanoESP \u0026amp; Pretzelboard ","permalink":"https://neu-iot.fkainka.de/en/board/","summary":"\u003cp\u003e\u003cimg loading=\"lazy\" src=\"/images/2015/09/Purple.jpg\"\u003e\u003c/p\u003e\n\u003ch3 id=\"the-board\"\u003eThe Board\u003c/h3\u003e\n\u003cp\u003eThe NanoESP board has many names. Franzis calls it Pretel Board and Conrad C-Controll IoT WiFi Board. But inside its is all the same: an easy-to-use and Arduino compatible development board in the context of the Internet of Things.\u003c/p\u003e\n\u003cp\u003eBy simple AT commands you can e. g. launch a Web server, set the module as an access point or establish connection with your home network.\u003c/p\u003e\n\u003cp\u003eBoard Features:\u003cbr\u003e\n• Arduino™ compatible\u003cbr\u003e\n• Integrated TCP/IP stack, activatable TCP/UDP server\u003cbr\u003e\n• Control of the WLAN module by simple AT commands\u003cbr\u003e\n• Suitable for WLAN \u0026amp; the module can be used as an access point\u003c/p\u003e","title":"Everything about the NanoESP WiFi-Board"},{"content":"Das NodeESP Board Das NodeESP Board Der NodeESP ist ein Experimentier- und Entwicklungsboard für den Bereich IoT und Hausautomatisierung. Die vorprogrammierte Firmware mit integrierter Webseite erlaubt es Ihnen, einfache Konfigurationen vorzunehmen und Programme und Anwendungen kinderleicht in einem Menü auszuwählen. So können Sie durch wenige Mausklicks das Board als smarten Schalter, buntes Licht oder Raumklimasensor konfigurieren und mit anderen Geräten in Ihrem Heimnetz verbinden. Für eigene individuelle Projekte lässt sich das Board außerdem über die Arduino IDE programmieren.\nFirmware Neuigkeiten und Bug Report NodeESP Kommandoreferenz NodeESP Technical Specs NodeESP Firmware Reinstallieren ","permalink":"https://neu-iot.fkainka.de/en/das-nodeesp-board/","summary":"\u003ch3 id=\"das-nodeesp-board\"\u003eDas NodeESP Board\u003c/h3\u003e\n\u003cp\u003e\u003cimg loading=\"lazy\" src=\"/images/2018/10/board1.jpg\"\u003e\u003c/p\u003e\n\u003ch3 id=\"das-nodeesp-board-1\"\u003eDas NodeESP Board\u003c/h3\u003e\n\u003cp\u003eDer NodeESP ist ein Experimentier- und Entwicklungsboard für den Bereich IoT und Hausautomatisierung. Die vorprogrammierte Firmware mit integrierter Webseite erlaubt es Ihnen, einfache Konfigurationen vorzunehmen und Programme und Anwendungen kinderleicht in einem Menü auszuwählen. So können Sie durch wenige Mausklicks das Board als smarten Schalter, buntes Licht oder Raumklimasensor konfigurieren und mit anderen Geräten in Ihrem Heimnetz verbinden. Für eigene individuelle Projekte lässt sich das Board außerdem über die Arduino IDE programmieren.\u003c/p\u003e","title":"das-nodeesp-board"},{"content":"Adventskalender Internet of Things 2018: Experimente für Smart Home Dank des Adventskalenders Internet of Things (IoT) muss die Wartezeit bis Weihnachten nicht langweilig werden. Der bereits vorprogrammierte Mikrocontroller in Verbindung mit dem Node-RED Programmier-Tool bietet eine Menge Spielraum für 24 vielfältige und spannende Experimente rund um das Thema Smart Home und Hausautomatisierung.\nInternet of Things und Smarthome beinhalten die automatisierte Erfassung und Steuerung von Sensoren und Aktoren in einem großen Netzwerk. Vom automatisierten Ein- und Ausschalten von LEDs über das Steuern Ihres TVs\nvon irgendwo in der Welt bis hin zur Langzeitüberwachung Ihres Raumklimas, mit einfachen Beispielen werden die verschiedenen Aspekte der Hausautomatisierung praktisch ergründet.\nDay 24: Christmas Tree Lighting Day 23: Alarm System Day 22: Climate Guard Day 21: Piano Player Day 20: Plant Guard Day 19: CheerLights Day 18: Candle Alarm Day 17: Time-controlled Lights Day 16: Universal Remote-Control Day 15: Remote Control Receiver Day 14: Smart Lights Day 13: Smart Switch for Soundboard Day 12: MQTT Button Day 11: MQTT Day 10: Deep Sleep Day 9: A Mood Light Day 8: A Controller Day 7: Stairway Light Tag 6: Touch to Speach Day 5: Node-RED Day 4: UDP and JSON Day 3: UDP and Packet Sender Day 2: OnBoard LED and Update Day 1: The NodeESP Board Tag 0: Alle Flows des Kalenders ","permalink":"https://neu-iot.fkainka.de/en/der-conrad-adventskalender-iot-2018-smarthome-edition/","summary":"\u003ch3 id=\"adventskalender-internet-of-things-2018-experimente-für-smart-home\"\u003eAdventskalender Internet of Things 2018: Experimente für Smart Home\u003c/h3\u003e\n\u003cp\u003e\u003ca href=\"https://www.conrad.de/de/adventskalender-conrad-adventskalender-internet-of-things-1662787.html\"\u003e\u003cimg loading=\"lazy\" src=\"/images/2018/10/bg-2018.jpeg\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eDank des Adventskalenders Internet of Things (IoT) muss die Wartezeit bis Weihnachten nicht langweilig werden. Der bereits vorprogrammierte Mikrocontroller in Verbindung mit dem Node-RED Programmier-Tool bietet eine Menge Spielraum für 24 vielfältige und spannende Experimente rund um das Thema Smart Home und Hausautomatisierung.\u003c/p\u003e\n\u003cp\u003eInternet of Things und Smarthome beinhalten die automatisierte Erfassung und Steuerung von Sensoren und Aktoren in einem großen Netzwerk. Vom automatisierten Ein- und Ausschalten von LEDs über das Steuern Ihres TVs\u003cbr\u003e\nvon irgendwo in der Welt bis hin zur Langzeitüberwachung Ihres Raumklimas, mit einfachen Beispielen werden die verschiedenen Aspekte der Hausautomatisierung praktisch ergründet.\u003c/p\u003e","title":"Advent Calendar IoT - 2018 [Smarthome Edition]"},{"content":"\nSie können das Lernpaket unter anderem hier erwerben:\nDirekt bei Franzis\nBei Amazon.de\nBei Elektor\nBei Conrad\nDas Lernpaket Internet of Things gibt es in mehreren Ausführungen. Es gibt eine Franzis und eine Conrad Version. Beide Lernpakete bringt Ihnen das brandaktuelle Thema IoT anhand von praktischen Beispielen mit ausführlichen Erklärungen näher. Teil des Pakets ist das neue Pretzel Board (NanoESP) mit dem der Einstieg in das komplexe wie spannende Thema spielerisch gelingt.\nIn verschieden Projekten, wie dem Bedienen des Mediacenters Kodi, dem Steuern einer RGB-LED über einen Webserver oder dem Senden und Empfangen von Twitter-Nachrichten lernen Sie sowohl die Grundlagen der Internetkommunikation als auch die Beherrschung des IoT-Boards. Damit steht Ihrem eigenen Internet of Things Projekt nichts mehr im Wege.\nBauteile des Lernpakets:\nWiFi-Controller Pretzel Board (NanoESP) Kabel RGB-LED LED Schalter Poti NTC Fototransitor Und mehr Download Beispielprogramme Diskusionen und Hilfe Driver -NanoESP \u0026amp; Pretzelboard ","permalink":"https://neu-iot.fkainka.de/en/das-lernpaket-iot/","summary":"\u003cp\u003e\u003cimg loading=\"lazy\" src=\"/images/2016/01/IoT-LP3.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eSie können das Lernpaket unter anderem hier erwerben:\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"http://www.franzis.de/elektronik/lernpakete-mikrocontroller/franzis-maker-kit-internet-of-things\"\u003eDirekt bei Franzis\u003c/a\u003e\u003cbr\u003e\n\u003ca href=\"http://www.amazon.de/dp/3645653163\"\u003eBei Amazon.de\u003c/a\u003e\u003cbr\u003e\n\u003ca href=\"https://www.elektor.de/franzis-maker-kit-internet-of-things\"\u003eBei Elektor\u003c/a\u003e\u003cbr\u003e\n\u003ca href=\"https://www.conrad.de/de/lernpaket-conrad-components-profi-lernpaket-internet-of-things-10215-ab-14-jahre-1421380.html\"\u003eBei Conrad\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eDas Lernpaket Internet of Things gibt es in mehreren Ausführungen. Es gibt eine Franzis und eine Conrad Version. Beide Lernpakete bringt Ihnen das brandaktuelle Thema IoT anhand von praktischen Beispielen mit ausführlichen Erklärungen näher. Teil des Pakets ist das neue Pretzel Board (NanoESP) mit dem der Einstieg in das komplexe wie spannende Thema spielerisch gelingt.\u003c/p\u003e","title":"das-lernpaket-iot"},{"content":"\nConrad Shop\nChristmas to arrive. The Arduino compatible microcontroller with integral WLAN module (Pretzelboard) and the included components are perfectly suited for 24 themed, diverse and exciting experiments. Internet of Things includes the communication and control of sensors and actuators in a large network.\nThe various aspects of the IoT theme are explored in practice by using simple examples starting from simply switching an LED on or off with a smartphone, the creation of a Web server or the long-term monitoring by means of sensors. All circuits are put up on a pinboard; no soldering is required.\nThe Advent calendar imparts useful hardware and programming knowledge in a playful way. With the help of the illustrated manual all 24 experiments can be built and tested without prior knowledge. The advent calendar contains a specially designed hardware motherboard with integrated WLAN module that can be programmed by means of the Arduino software.\nCalendar Days Day 24: Fire alarm for the Christmas tree Day 23: Cheerlights Day 22: TalkBack Day 21: Alarm system Day 20: Twitch Day 19: ThingSpeak Day 18: Universal remote control Day 17: IR module Day 16: GPIO Control Day 15: Light sensor Day 14: Webserver for the RGB-LED Day 13: Website with buttons Day 12: Autonomous webserver Day 11: TCP-Webserver Day 10: Temperature display Day 9: TCP time Day 8: A browser Tag 7 (special): Hinweis für Arduino Neulinge - Teil 2 Day 7: Analogous sensor Day 6: UDP-Button Day 5: Switching an LED Day 4: UDP bidirectional Day 3: UDP-Send Day 2: Google Ping Tag 1 - Hinweis für Arduino Neulinge Day 1 - First Steps Day 0: Alternative zum ausverkauften Adventskalender (Spoiler Alert) Day 0: Download all Projects (Spoiler Alert) ","permalink":"https://neu-iot.fkainka.de/en/der-conrad-iot-adventskalender/","summary":"\u003cp\u003e\u003ca href=\"http://www.conrad.de/ce/de/product/1365865/Adventskalender-Conrad-Internet-of-Things-2015-10180\"\u003e\u003cimg loading=\"lazy\" src=\"/images/2015/09/prev2.jpeg\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"http://www.conrad.de/ce/de/product/1365865/Adventskalender-Conrad-Internet-of-Things-2015-10180\"\u003eConrad Shop\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eChristmas to arrive. The Arduino compatible microcontroller with integral WLAN module (Pretzelboard) and the included components are perfectly suited for 24 themed, diverse and exciting experiments. Internet of Things includes the communication and control of sensors and actuators in a large network.\u003c/p\u003e\n\u003cp\u003eThe various aspects of the IoT theme are explored in practice by using simple examples starting from simply switching an LED on or off with a smartphone, the creation of a Web server or the long-term monitoring by means of sensors. All circuits are put up on a pinboard; no soldering is required.\u003c/p\u003e","title":"The Conrad advent calendar Internet of Things"},{"content":"\nShorten the waiting time for Christmas with exciting and enjoyable experiments done with the Internet of things. Thereby send push messages on your smartphone or build an alarm system with a motion sensor that informs you of suspicious movements. Learn how to use various web services, such as Twitter, and use the protocol for the Internet of things: MQTT.\nThe Internet-of-things advent calendar contains all construction pieces for 24 experiments, including a uniquely developed hardware board with integrated WLAN-module which can be progammed via the free Arduino IDE.\nAll circuits are assembled on a breadboard without soldering. At the same time, you get useful hardware and programming knowledge in a playful way. With the help of the illustrated handbook, all 24 experiments can be built and tested without prior knowledge. You do not have to type out the individual source codes, since they are made available for download.\nDay 24: Gift box Day 23: MQTT Climate Day 22: MQTT Cheerlights Day 21: House automation Day 20: MQTT (Message Queue Telemetry Transport) Day 19: Configuration page for the NanoESP Day 18: Weather monitoring Day 17: Wake Up Light Day 16: A web server piano Day 15: A web server Day 14: Long-term temperature measurement Day 13: Alarm system with push messages Day 12: Light monitor Day 11: Day- and nightlight Day 10: Colour mixing Day 9: Brightness of the real LED Day 8: Virtual LEDs Day 7: Analogue write Day 6: The hardware button Day 5: Blynk Day 4: Setting up Internet connection Day 3: The NanoESP in access point mode Day 2: The Arduino IDE Tag 1: Das NanoESP-Board Tag 0: Alle Programm von Kalender 2016 Library for NanoESP \u0026amp; Pretzel Board Infos zum neuen Adventskalender ","permalink":"https://neu-iot.fkainka.de/en/der-conrad-adventskalender-iot-2016/","summary":"\u003cp\u003e\u003ca href=\"https://www.conrad.de/de/conrad-components-internet-of-things-ab-14-jahre-1435475.html\"\u003e\u003cimg loading=\"lazy\" src=\"/images/2016/10/bg-2016.jpg\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eShorten the waiting time for Christmas with exciting and enjoyable experiments done with the Internet of things. Thereby send push messages on your smartphone or build an alarm system with a motion sensor that informs you of suspicious movements. Learn how to use various web services, such as Twitter, and use the protocol for the Internet of things: MQTT.\u003c/p\u003e\n\u003cp\u003eThe Internet-of-things advent calendar contains all construction pieces for 24 experiments, including a uniquely developed hardware board with integrated WLAN-module which can be progammed via the free Arduino IDE.\u003c/p\u003e","title":"der-conrad-adventskalender-iot-2016"},{"content":"The Pretzelboard (NanoESP) needs a driver for the USB-to-Serial Chip CH340G to work properly. You can download the driver here:\nWindows (Windows 98 - Windows 10, 32-Bit/64-Bit)\nLinux Version\nMac Version (Attention: There seems to be a problem with MAC OS Sierra. Bellow are two links with walkthroughs:\nhttps://github.com/jimaobian/CH34x_Install_V1.3/blob/master/CH34x_Install_V1.3.zip\nhttps://github.com/adrianmihalko/ch340g-ch34g-ch34x-mac-os-x-driver )\nAndroid Version\nThere is a Setup.exe file (Windows Version) in the Zip-Folder which needs to be executed. Choose Install in the following Window.\nDie Installation After a short time a message confirm the successful installation. Now you can plug in your Board und the driver will be chosen automatically.\n","permalink":"https://neu-iot.fkainka.de/en/driver/","summary":"\u003cp\u003eThe Pretzelboard (NanoESP) needs a driver for the USB-to-Serial Chip CH340G to work properly. You can download the driver here:\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"/images/2015/09/CH341SER.zip\"\u003eWindows (Windows 98 - Windows 10, 32-Bit/64-Bit)\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"/images/2015/09/CH341SER_LINUX.zip\"\u003eLinux Version\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"/images/2015/08/CH34x_Install.zip\"\u003eMac Version\u003c/a\u003e (\u003cstrong\u003eAttention\u003c/strong\u003e: There seems to be a problem with MAC OS Sierra. Bellow are two links with walkthroughs:\u003cbr\u003e\n\u003ca href=\"https://github.com/jimaobian/CH34x_Install_V1.3/blob/master/CH34x_Install_V1.3.zip\"\u003ehttps://github.com/jimaobian/CH34x_Install_V1.3/blob/master/CH34x_Install_V1.3.zip\u003c/a\u003e\u003cbr\u003e\n\u003ca href=\"https://github.com/adrianmihalko/ch340g-ch34g-ch34x-mac-os-x-driver\"\u003ehttps://github.com/adrianmihalko/ch340g-ch34g-ch34x-mac-os-x-driver\u003c/a\u003e )\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"/images/2015/09/CH341SER_ANDROID.zip\"\u003eAndroid Version\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eThere is a Setup.exe file (Windows Version) in the Zip-Folder which needs to be executed. Choose Install in the following Window.\u003c/p\u003e","title":"Driver -NanoESP \u0026 Pretzelboard"},{"content":"\nghfgh\nLicht, Heizung, Alarm oder Pfl anzenbewässerung: Im vernetzten Heim lassen sich diese und viele weitere Systeme fernsteuern und automatisieren. Steigen Sie mit diesem Maker Kit ein in die Welt des Smart Homes und lernen Sie grundlegende Prozesse und Techniken kennen und selbst anzuwenden. Als Basis für alle Experimente dient Ihnen ein speziell dafür entwickeltes NodeESP-Board, das in diesem Maker Kit enthalten ist.\nHausautomatisierung leicht gemacht\nVom automatisierten Ein- und Ausschalten von LEDs über das Steuern Ihres TVs von irgendwo in der Welt bis hin zur Lang-zeitüberwachung Ihres Raumklimas ergründen Sie die verschiedenen Aspekte der Hausautomatisierung. Alle benötigten Bauteile, darunter ein speziell entwickeltes NodeESP-Board, sind in diesem Maker Kit enthalten es kann sofort losgehen!\n","permalink":"https://neu-iot.fkainka.de/en/maker-kit-fuer-smart-home/","summary":"\u003cp\u003e\u003cimg alt=\"Smarthome Lernpaket\" loading=\"lazy\" src=\"/images/2019/10/smarthome.png\"\u003e\u003c/p\u003e\n\u003cp\u003eghfgh\u003c/p\u003e\n\u003cp\u003eLicht, Heizung, Alarm oder Pfl anzenbewässerung: Im vernetzten Heim lassen sich diese und viele weitere Systeme fernsteuern und automatisieren. Steigen Sie mit diesem Maker Kit ein in die Welt des Smart Homes und lernen Sie grundlegende Prozesse und Techniken kennen und selbst anzuwenden. Als Basis für alle Experimente dient Ihnen ein speziell dafür entwickeltes NodeESP-Board, das in diesem Maker Kit enthalten ist.\u003c/p\u003e\n\u003cp\u003eHausautomatisierung leicht gemacht\u003cbr\u003e\nVom automatisierten Ein- und Ausschalten von LEDs über das Steuern Ihres TVs von irgendwo in der Welt bis hin zur Lang-zeitüberwachung Ihres Raumklimas ergründen Sie die verschiedenen Aspekte der Hausautomatisierung. Alle benötigten Bauteile, darunter ein speziell entwickeltes NodeESP-Board, sind in diesem Maker Kit enthalten es kann sofort losgehen!\u003c/p\u003e","title":"Maker Kit für Smart Home"},{"content":"Last but not least, you will find another programmable RGB-LED behind the door of the Advent calendar. Thus, we have two LEDs which you can interconnect to light your Christmas tree. We will need the following setup today.\nSetup of the Christmas tree light. The longer legs of the LEDs are on the right Activate the program and import the flow of today. Disable all previous flows and change the broadcast IP of the UDP node, if necessary.\nThe last Advent calendar flow The flow contains some user interface elements, among them two colour pickers to control the two LEDs. But there are two more elements, a switch and an element for setting a number. If you press the button, you will see how the two-colour picker elements change. The circle that displays the current colour value is constantly moving in a circle. Likewise, the colours of the two LEDs on the NodeESP board are changing too. You have also the option to change the fade-speed time and thus, the changes become either lower or faster. On top of that is the option to change the colour of an LED during fading. The flow then continues from the new point. Overall this is a cute lighting idea for your Christmas tree. On that note, I wish you all a Merry Christmas.\nUser interface with the two-colour pickers ","permalink":"https://neu-iot.fkainka.de/en/day24-2018/","summary":"\u003cp\u003eLast but not least, you will find another programmable RGB-LED behind the door of the Advent calendar. Thus, we have two LEDs which you can interconnect to light your Christmas tree. We will need the following setup today.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day24_2RGB_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2596\" src=\"/images/2018/11/Day24_2RGB_Steckplatine.png\" alt=\"Der Aufbau des Weihnachtsbaumlichts. Die langen Beinchen der LEDs befinden sich rechts\" width=\"446\" height=\"610\" data-id=\"2596\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eSetup of the Christmas tree light. The longer legs of the LEDs are on the right\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eActivate the program and import the flow of today. Disable all previous flows and change the broadcast IP of the UDP node, if necessary.\u003c/p\u003e","title":"Day 24: Christmas Tree Lighting"},{"content":"The day before last reveals a tilt sensor behind the door of the Advent calendar. The sensor detects, if it is tilted. We will use it today as a sensor for an alarm system. The speaker from two days ago serves us as the signal generator. We will need the following setup.\nAlarm Setup As usual, activate the program of today and install the Node-RED flow into the environment. Also adjust the MQTT topic and disable all previous flows.\nThe alarm system flow The flow now waits for the tilt sensor to be triggered and for a message published under the appropriate topic. This will trigger a trigger node, which will set the payload to TRUE. This is sent back to the board via a topic, which then triggers the alarm. After five seconds the trigger node will send a FALSE that will disable the alarm.\nIn sync with the alarm signal via the board, a number of other nodes located at the top on the right will indicate the alarm. We have got here today the audio-out node to alert us. Then there is a text message popping up on the user interface. Beyond the user interface, you can use email or Twitter to receive information about an alarm. Another option is to install other nodes that will send push messages to your smartphone. Pushbullet is one of these services with a handy app, for example. Your smart home is thus protected against burglary and theft.\n","permalink":"https://neu-iot.fkainka.de/en/day23-2018/","summary":"\u003cp\u003eThe day before last reveals a tilt sensor behind the door of the Advent calendar. The sensor detects, if it is tilted. We will use it today as a sensor for an alarm system. The speaker from two days ago serves us as the signal generator. We will need the following setup.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day23_Speaker_Tilt_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2590\" src=\"/images/2018/11/Day23_Speaker_Tilt_Steckplatine.png\" alt=\"Der Aufbau\" width=\"435\" height=\"664\" data-id=\"2590\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eAlarm Setup\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eAs usual, activate the program of today and install the Node-RED flow into the environment. Also adjust the MQTT topic and disable all previous flows.\u003c/p\u003e","title":"Day 23: Alarm System"},{"content":"The door of day 21 reveals again a sensor, which we will use to measure the humidity level present. With the following circuit we will build a comprehensive indoor climate monitor.\nThe indoor climate monitor circuit Our experiment today uses three sensors: the temperature sensor (NTC), the light sensor (photo transistor) and the humidity sensor. Altogether they deliver a real good impression of the current climate situation in a room. Let’s start the program of today.\nThe program measures all of the values e very 30 seconds and sends them via MQTT, and you will receive something like this:\n{\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;get_hum_state\u0026rdquo;,\u0026ldquo;Light\u0026rdquo;:3903,\u0026ldquo;Temp\u0026rdquo;:368,\u0026ldquo;HUMIDITY\u0026rdquo;:45}\nCopy the flow of today into your Node-RED environment, but remember that you need to adjust your personal topic and disable previous flows. Then on the GUI page you can view the measured values. A function node will also today convert the temperature values accordingly so that you are able to read them. The two potentiometers are used to achieve a more precise calibration, because today you can adjust temperature and ambient brightness values.\nThe flow for the long-term measurement But we also have an additional feature. Every five minutes, the program saves the currently measured values into a file. This is called climadata.txt and you will find it usually in the directory where Node-RED runs. In my case, this was:\nC:\\Users[USERNAME]\n[USERNAME] is your Windows user name. But you could also customize the file path in the node. Data is stored in CSV (comma separated values) format, whereby all values are separated by a comma. It is thus very easy to import the data into Excel and evaluate the spreadsheet. The evaluation of the longterm measurement is very easy.\n","permalink":"https://neu-iot.fkainka.de/en/day22-2018/","summary":"\u003cp\u003eThe door of day 21 reveals again a sensor, which we will use to measure the humidity level present. With the following circuit we will build a comprehensive indoor climate monitor.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day22_Clima_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2584\" src=\"/images/2018/11/Day22_Clima_Steckplatine.png\" alt=\"Die Schaltung des Raumklimawächters\" width=\"451\" height=\"579\" data-id=\"2584\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe indoor climate monitor circuit\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eOur experiment today uses three sensors: the temperature sensor (NTC), the light sensor (photo transistor) and the humidity sensor. Altogether they deliver a real good impression of the current climate situation in a room. Let’s start the program of today.\u003c/p\u003e","title":"Day 22: Climate Guard"},{"content":"The door of day 21 reveals a loudspeaker. We will use it in our experiment today to play some music. We will need a very simple setup for this.\nSetup In our experiment we will connect the speaker to one of the board’s two DAC outputs. DAC means digital/analogue converter and with this we can generate an analogue signal using digital commands. In our experiment today, we will use it to produce sounds, and to be more precise, we are talking about piano sounds. The notes, pauses and keys are sent via UDP by means of an array of numbers.\nCopy the Node-RED flow of today into your environment, but before using it, you must again disable previous ones. You also need to adjust the IP of the UDP node to reflect the broadcast IP of your board. Then choose the program of today and start the flow.\nYou will find already predefined songs that you can play via the user interface. But of course, you also have the option to translate or compose songs yourself. There is a text box for this purpose. Just copy your composition into it.\nThe notes follow the simple note scheme and are entered like this:\nNOTE_C1, NOTE_CS1, NOTE_D1, NOTE_DS1, NOTE_E1, NOTE_F1, NOTE_FS1, NOTE_G1, NOTE_GS1, NOTE_A1, NOTE_AS1, NOTE_B1\nThe number following the note is the octave. You can replace 1 using any number from 1 to 7. You can also specify the note span with the prefix BEAT to make it a half, quarter or eighth note. The BEAT attribute always refers to the preceding note. BEAT_1 is the default, so you do not need to write this before each note. The following note spans are used:\nBEAT_025, BEAT_05, BEAT_075, BEAT_1, BEAT_125, BEAT_15, BEAT_175, BEAT_2, BEAT_25, BEAT_3, BEAT_4, BEAT_5\nFor example, if you want to play the beginning of Beethoven’s famous 5th Symphony, enter the following text into the window:\nNOTE_G5,BEAT_075,NOTE_G5,BEAT_075,NOTE_G5,BEAT_075,NOTE_E5,BEAT_5,\nNOTE_F5,BEAT_075,NOTE_F5,BEAT_075,NOTE_F5,BEAT_075,NOTE_D5,BEAT_5\nYou don’t have to be a musical genius. Just try a few notes and note spansand compose your own song. Or convert a familiar song into this system.\nImagination has no limits.\n","permalink":"https://neu-iot.fkainka.de/en/tag-21-piano-player/","summary":"\u003cp\u003eThe door of day 21 reveals a loudspeaker. We will use it in our experiment today to play some music. We will need a very simple setup for this.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day21_Speaker_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2580\" src=\"/images/2018/11/Day21_Speaker_Steckplatine.png\" alt=\"Versuchsaufbau\" width=\"453\" height=\"691\" data-id=\"2580\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eSetup\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eIn our experiment we will connect the speaker to one of the board’s two DAC outputs. DAC means \u003cstrong\u003edigital/analogue converter\u003c/strong\u003e and with this we can generate an analogue signal using digital commands. In our experiment today, we will use it to produce sounds, and to be more precise, we are talking about piano sounds. The notes, pauses and keys are sent via UDP by means of an array of numbers.\u003c/p\u003e","title":"Day 21: Piano Player"},{"content":"Behind the door is an NTC resistor (Negative Temperature Coefficient) that measures the temperature. Together with the photo transistor and a few wires, we are going to build a plant guard that alerts us, when a plant it is monitoring is exposed to bad conditions. We will use the following setup besides the program of today.\nThe plant guard The two yellow wires are just simple wires that can be inserted into the potting soil. They are used to monitor the level of moisture in the soil. During our initial tests, we will just touch the two wires with a finger.\nThe Flow Today you can import the flow straight into the Node-RED environment, but not without disabling previous ones and adjust the topic. The out topic will receive a JSON string that looks similar to this:\n{\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;get_hum_state\u0026rdquo;,\u0026ldquo;Light\u0026rdquo;:3903,\u0026ldquo;Temp\u0026rdquo;:368,\u0026ldquo;HUMIDITY\u0026rdquo;:45}\nLight, temperature and humidity data are sent. Light here is a relative value in the range of 0 to 4095; the same is true for the humidity measured. Temperature values are also sent using this value range. But because you can’t do anything with this value, we have a function node that converts the values t o Celsius. The values are displayed conveniently in the user interface. Besides the indicator, we also have a few controls there.\nUser interface of the plant guard The controls are used to define the thresholds for measurements. You can define the minimum and the maximum value. In case you don’t want limit values, you can also set the control to an extreme position, which the board will never be able to measure. For example, if you do not want that an alarm is triggered at night because the light intensity is too low, set the minimum control simply to -1.\nIn the case that one of the limits is exceeded, the matching switch node will be triggered and a message is prepared and then output via the UI. Because most of the time these messages are not opened, you can also enter your email data into the email node. This will send an email reminder that you should water the plant or provide better lighting conditions. That’s how you can even turn a simple houseplant into a smart plant.\n","permalink":"https://neu-iot.fkainka.de/en/day20-2018/","summary":"\u003cp\u003eBehind the door is an NTC resistor (\u003cstrong\u003eNegative Temperature Coefficient\u003c/strong\u003e) that measures the temperature. Together with the photo transistor and a few wires, we are going to build a plant guard that alerts us, when a plant it is monitoring is exposed to bad conditions. We will use the following setup besides the program of today.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day20_Plant_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2574\" src=\"/images/2018/11/Day20_Plant_Steckplatine.png\" alt=\"Der Pflanzenwächter\" width=\"486\" height=\"575\" data-id=\"2574\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe plant guard\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eThe two yellow wires are just simple wires that can be inserted into the potting soil. They are used to monitor the level of moisture in the soil. During our initial tests, we will just touch the two wires with a finger.\u003c/p\u003e","title":"Day 20: Plant Guard"},{"content":"Today we have a very special LED waiting behind the door. It is an RGB LED with integrated controller (type PL9823, equivalent to WS2812) and with it you can now connect several LEDs in series and control them individually by means of a protocol. Today we will start by controlling one LED only. Here, an experiment that is almost customary in my Advent calendars fits in handy: the CheerLights project by Hans Schaaler. For all those who do not yet know the project: these are globally linked colourful lights which can be controlled simultaneously via Twitter commands. And here Node-RED fits in very well. The experiment today requires the following setup besides the program of today.\nA proper connected PL9823 (long legs right) The LED is controlled by a set of commands. It is activated by the term Pixel. But first and foremost, we will learn today how we control all LEDs of the same colour as we are dealing with only one LED. In one of the coming experiments we will explain all the commands that can be used for assigning individual colours to the LEDs.\nCommand in topic Settings {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_pixel_hex\u0026rdquo;,\u0026ldquo;value\u0026rdquo;:\u0026quot;#FFFFFF\u0026quot;} Sets all LEDs to the HEX colour value. {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_pixel_rgb\u0026rdquo;,\u0026ldquo;value\u0026rdquo;:\u0026ldquo;rgb(255,255,255)\u0026rdquo;} Sets all LEDs to the RGB colour value. {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_pixel_hsv\u0026rdquo;,\u0026ldquo;value\u0026rdquo;:\u0026ldquo;hsv(120, 100%,100%)\u0026rdquo;} Sets all LEDs to the HSV colour value. {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;get_pixel_hex\u0026rdquo;} Displays current colour in the appropriate format, returns automatically when a colour is set. {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;get_pixel_rgb\u0026rdquo;} {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;get_pixel_hsv\u0026rdquo;} The CheerLights project has a website (https://cheerlights.com/) where you can get some information about the project. Moreover, one of the subpages, Cheerlights API, has a bunch of options of how to obtain the actual colour value. We are using here the interface **http://api.thingspeak.com/channels/1417/field/2/last.json**which offers the current value as JSON value and in HEX format.\nToday\u0026#x27;s Flow In terms of today’s flow, we just need to refresh this page every few seconds and extract the current value. It checks, if the value has changed. If so, the new colour is sent to the board. You can also configure the Twitter node with your Twitter data, if you have a Twitter account. The node will search for tweets with cheerlights text and reads the message to the GUI, where it is displayed.\nBut how can you change the colour? That is simple. Publish a Twitter message and by that change your colour and the colour of all other Cheerlights users. Basically, the message must contain #Cheerlights, @ Cheerlights or just the keyword Cheerlights followed by one of the predefined colours. The predefined colours include:\nred, green, blue, cyan, white, warm white, purple, magenta, yellow, orange, pink\nA tweet could look like this:\nTesting my #cheerlights project on my #NodeESP with the colour blue.\nAnd by that you have just given yourself and the world a new colour.\n","permalink":"https://neu-iot.fkainka.de/en/day19-2018/","summary":"\u003cp\u003eToday we have a very special LED waiting behind the door. It is an RGB LED with integrated controller (type PL9823, equivalent to WS2812) and with it you can now connect several LEDs in series and control them individually by means of a protocol. Today we will start by controlling one LED only. Here, an experiment that is almost customary in my Advent calendars fits in handy: the CheerLights project by Hans Schaaler. For all those who do not yet know the project: these are globally linked colourful lights which can be controlled simultaneously via Twitter commands. And here Node-RED fits in very well. The experiment today requires the following setup besides the program of today.\u003c/p\u003e","title":"Day 19: CheerLights"},{"content":"And today we have a small diode waiting behind the door. We are going to use the diode as temperature sensor for particular high temperatures and with it we will build a small candle guard.\nBreadboard Setup Today’s setup consists of the diode and the potentiometer, which we will use as a 10-kOhm resistor. This resistance is fixed and cannot be adjusted. The board will measure the voltage at the diode and sends the values to Node-RED via MQTT.\nFlow of the candle guard Today’s flow is continually evaluating the measured value. If the value falls below a certain value (the higher the temperature, the lower the measured voltage), an alarm is output in the form of a read-out text message and an info box. You can set a threshold for the alarm in the user interface. Place the diode near the lower part of a candle in such a way that the flame is near to the diode as it burns down and you have got a very handy detector for a candle that has burnt down to the bottom.\n","permalink":"https://neu-iot.fkainka.de/en/day18-2018/","summary":"\u003cp\u003eAnd today we have a small diode waiting behind the door. We are going to use the diode as temperature sensor for particular high temperatures and with it we will build a small candle guard.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day18_Diode_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2562\" src=\"/images/2018/11/Day18_Diode_Steckplatine.png\" alt=\"Versuchsaufbau\" width=\"366\" height=\"453\" data-id=\"2562\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eBreadboard Setup\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eToday’s setup consists of the diode and the potentiometer, which we will use as a 10-kOhm resistor. This resistance is fixed and cannot be adjusted. The board will measure the voltage at the diode and sends the values  to Node-RED via MQTT.\u003c/p\u003e","title":"Day 18: Candle Alarm"},{"content":"The door of day 17 reveals another potentiometer. Now we have one potentiometer for each LED and thus we will develop the program of Day 13, the Smart Lights, so that we will get a more convenient and intuitive dimming feature. We will also learn today how we can start timed events with Node-RED.\nBreadboard Setup Activate today’s program in the web interface. As always disable previous flows and change the MQTT topic to reflect your personal ID and then install today’s flow into the Node-RED environment.\nToday\u0026#x27;s Flow As you know already, you can turn the LEDs on and off via the hardware buttons or via the user interface. The brightness of the individual LEDs is controlled by the potentiometers. As an alternative to the buttons, you have got the injection nodes in the corner bottom left. You can use them to specify the times a command is sent to the board. All you have to do is double-click on the corresponding node and select the time and also the days when the message should be sent. You can use it for example, to set an automatic lamp in a living room or an aquarium or activate special lighting on working days – fully automatically and much like the smart home concept.\n","permalink":"https://neu-iot.fkainka.de/en/day17-2018/","summary":"\u003cp\u003eThe door of day 17 reveals another potentiometer. Now we have one potentiometer for each LED and thus we will develop the program of Day 13, the Smart Lights, so that we will get a more convenient and intuitive dimming feature. We will also learn today how we can start timed events with Node-RED.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day17_Poti2_Button2_LED2_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2556\" src=\"/images/2018/11/Day17_Poti2_Button2_LED2_Steckplatine.png\" alt=\"Versuchsaufbau\" width=\"473\" height=\"585\" data-id=\"2556\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eBreadboard Setup\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eActivate today’s program in the web interface. As always disable previous flows and change the MQTT topic to reflect your personal ID and then install today’s flow into the Node-RED environment.\u003c/p\u003e","title":"Day 17: Time-controlled Lights"},{"content":"The door today reveals the counterpart to yesterday’s component, namely an IR diode. Now you can build a real remote-control for your TV and control it conveniently via smartphone and website. We will use the following setup.\nSetup of remote controls with IR receiver and transmitter diode Select the program for today. The board will start again in headless mode; the board’s website will not be available but you will have the board’s MQTT feature. To switch to default mode, remove the jumper on pin 23 and restart the board.\nThe flow today Our flow today looks rather complicated; however, basically these are just all UI buttons writing to the same topic. But before you import and start the flow, rewrite all topics to your personal topic using the \u0026ldquo;Replace all\u0026rdquo; trick. Again, disable all previous flows. Now start the flow and switch to the UI page. You will see a bunch of buttons that are not yet calibrated to your TV. Go to the second tab labelled Day16 Receive IR Codes. The page looks a bit unexciting because it has only a text box, but it is very useful. Point now a remote control at the receiver and press a key and a text will appear in the window that may look like this:\n{\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;ir_send\u0026rdquo;,\u0026ldquo;type\u0026rdquo;:3,\u0026ldquo;value\u0026rdquo;:551494365,\u0026ldquo;length\u0026rdquo;:32}\nThe text was received by NodeESP/[PID]/ir/recv/out and contains the data of the received code. Very few small things were changed by the flow. On the one hand repetition codes are filtered out and on the other hand, the command was changed from ir_recv to ir_send. This allows you to basically just copy the text and insert it into the payload area of a button. If pressed, the button sends the command with the data of the code to the board at once, which will send the code via IR diode to the TV. Like that you are able to hardcode and create your own remote code by code.\nCommands are saved as payload of the button Note: The GUI layout is based on an average modern remote. Icons on the buttons indicate its function. You can find a list of useful buttons on the website https://klarsys.github.io/angular-materi****al-icons/.\nThe UI ","permalink":"https://neu-iot.fkainka.de/en/day16-2018/","summary":"\u003cp\u003eThe door today reveals the counterpart to yesterday’s component, namely an IR diode. Now you can build a real remote-control for your TV and control it conveniently via smartphone and website.  We will use the following setup.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day16_IRremotefzz_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2548\" src=\"/images/2018/11/Day16_IRremotefzz_Steckplatine.png\" alt=\"Der Aufbau der Fernbedienungen mit IR-Empfänger und Sendediode\" width=\"464\" height=\"574\" data-id=\"2548\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eSetup of remote controls with IR receiver and transmitter diode\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eSelect the program for today. The board will start again in headless mode; the board’s website will not be available but you will have the board’s MQTT feature. To switch to default mode, remove the jumper on pin 23 and restart the board.\u003c/p\u003e","title":"Day 16: Universal Remote-Control"},{"content":"The door reveals a very special component today, namely an infrared receiver module. You can use it to 15. Tag receive customary infrared remote-control signals. We will use the following setup.\nThis is how you properly connect the IR module to the board After the circuit is set up, select today’s program. Please note that you will not be able to reach the board’s website, because it is deactivated for our experiment today. The board works now in headless mode and has no visible interface. If you want to run the website again to activate other programs, for example, you only have to pull out the jumper from pin 23 and restart the board. Everything will run as usual.\nImplement first today’s flow into your Node-RED environment and see, if today’s program is working properly. Do not forget to disable the previous flows and adjust the MQTT topic to your personal topic.\nAs soon as you have activated the flow, you can point a remote control at the receiver. On the GUI page you will then see text sent by the board such as:\n{\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;ir_recv\u0026rdquo;,\u0026ldquo;type\u0026rdquo;:3,\u0026ldquo;value\u0026rdquo;:551489775,\u0026ldquo;length\u0026rdquo;:32}\nImportant here is the value. For example, select the power button on your remote and copy the value received. Enter the value into the switch node. At present you can enter five different values into the switch node, meaning five different remote-control buttons. Each of these keys then leads to a node that sets a text as a payload and forwards it to an audio-out node. The first value in the switch node would be the power button. Therefore, \u0026ldquo;Power\u0026rdquo; is read by the browser. We are using this here only for the purpose of demonstration. As for smart homes, you could easily dim the living room lighting when the TV is switched on. Node-RED makes customization very easy.\nThe flow today ","permalink":"https://neu-iot.fkainka.de/en/day15-2018/","summary":"\u003cp\u003eThe door reveals a very special component today, namely an infrared receiver module. You can use it to \u003cstrong\u003e15. Tag\u003c/strong\u003e receive customary infrared remote-control signals. We will use the following setup.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day15_IRrecv_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2542\" src=\"/images/2018/11/Day15_IRrecv_Steckplatine.png\" alt=\"Versuchsaufbau\" width=\"395\" height=\"488\" data-id=\"2542\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThis is how you properly connect the IR module to the board\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eAfter the circuit is set up, select today’s program. Please note that you will not be able to reach the board’s website, because it is deactivated for our experiment today. The board works now in headless mode and has no visible interface. If you want to run the website again to activate other programs, for example, you only have to pull out the jumper from pin 23 and restart the board. Everything will run as usual.\u003c/p\u003e","title":"Day 15: Remote Control Receiver"},{"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:\nSetup with four loose cables (yellow) as touch buttons Enable today’s program and install today’s flow. Don’t forget, replace [PID] with your personal ID and the easiest way is using the trick with the Editor.\nThe 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:\nCommand in topic Settings {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_pwm_state\u0026rdquo;, \u0026ldquo;LED1\u0026rdquo;:255} The LED is set to maximum brightness. You can see it only when the LED is on. {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_pwm_state\u0026rdquo;, \u0026ldquo;LED1\u0026rdquo;:0} The LED is set to the minimum brightness (the LED is not on). {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_pwm_state\u0026rdquo;, \u0026ldquo;LED1\u0026rdquo;:true} The LED is activated and the last brightness is set. You will immediately notice any changes in brightness. {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_pwm_state\u0026rdquo;, \u0026ldquo;LED1\u0026rdquo;:\u0026ldquo;ON\u0026rdquo;} {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_pwm_state\u0026rdquo;, \u0026ldquo;LED1\u0026rdquo;:false} The LED is deactivated. You will notice a change in brightness only after activating the LED again. {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_pwm_state\u0026rdquo;, \u0026ldquo;LED1\u0026rdquo;:\u0026ldquo;off\u0026rdquo;} These status changes can be sent via the out topic or NodeESP/[PID]/pwm/state/set. In case of a status change, the current state will also be published via the topic\nNodeESP/[PID]/pwm/state/get/out\nIn today’s 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.\nUser interface of the program today 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\nThe flow today ","permalink":"https://neu-iot.fkainka.de/en/day14-2018/","summary":"\u003cp\u003eThe door of day 14 reveals another LED. Now we have two LEDs with resistors and two buttons and \u003cstrong\u003e14. Tag\u003c/strong\u003e cables, enough to build a complex lighting system. We will use the following setup:\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day14_2LED_2Btn_4tch_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2536\" src=\"/images/2018/11/Day14_2LED_2Btn_4tch_Steckplatine.png\" alt=\"Der Aufbau mit vier losen Kabeln (gelb) als Touch-Buttons\" width=\"482\" height=\"625\" data-id=\"2536\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eSetup with four loose cables (yellow) as touch buttons\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eEnable today’s program and install today’s flow. Don’t forget, replace \u003cstrong\u003e[PID]\u003c/strong\u003e with your personal ID and the easiest way is using the trick with the Editor.\u003c/p\u003e","title":"Day 14: Smart Lights"},{"content":"Today we will find again a 1 kOhm resistor hidden behind the door of the Advent calendar. But we are not going to use it today. Instead I would like to show you how you can build a smart touch switch. We will use a simple setup that is made up of four loose hanging wires as touch buttons and a wire jumper to pin 23.\nFour yellow wires serving as touch buttons Our experiment today is special for its program, which you should activate now on the configuration page. Once enabled, you will notice that the status LED flashes briefly and then turns off, because the board is again running in the power-saving deep-sleep mode. It will not wake up after certain time however. It will wake up only, when you touch one of the touch buttons. The board then sends information via the touch button to the broker who triggered the wakeup. It will look something like this:\n{\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;get_touch_state\u0026rdquo;,\u0026ldquo;pin_name\u0026rdquo;:\u0026ldquo;Touch4\u0026rdquo;,\u0026ldquo;pin_id\u0026rdquo;:6,\u0026ldquo;pin_nr\u0026rdquo;:14,\u0026ldquo;pin_state\u0026rdquo;:true}\nWhile the connection is being established, you can see that the status LED is flashing green. Once the data is sent, the LED is lit green, which indicates that sending was successful. If the LED is red, sending did not work. The board goes back into deep-sleep mode immediately after that. The system is very energy efficient so that you could power the board by batteries and place the smart switch anywhere in your flat.\nNote: Simply pull out the wire jumper from pin 23 and reset the board to leave deep-sleep mode and switch to normal mode.\nThe smart switch itself is something special. We are going to connect the switch with Node-RED and an application. We will use the audio-out node once more in today’s Node-RED flow, but this time we need it to play audio files, too. First of all, import today’s flow; and, do not forget, disable previous flows and enter your personal ID instead of the [PID] placeholder.\nToday’s flow Check out and discover the functionalities of the individual buttons. But before that, turn down the volume of your speakers.\n","permalink":"https://neu-iot.fkainka.de/en/day13-2018/","summary":"\u003cp\u003eToday we will find again a 1 kOhm resistor hidden behind the door of the Advent calendar. But we are not going to use it today. Instead I would like to show you how you can build a smart touch switch. We will use a simple setup that is made up of four loose hanging wires as touch buttons and a wire jumper to pin 23.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day13_5tch_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2529\" src=\"/images/2018/11/Day13_5tch_Steckplatine.png\" alt=\"Vier gelbe Drähte als Touch-Buttons\" width=\"499\" height=\"652\" data-id=\"2529\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eFour yellow wires serving as touch buttons\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eOur experiment today is special for its program, which you should activate now on the configuration page. Once enabled, you will notice that the status LED flashes briefly and then turns off, because the board is again running in the power-saving deep-sleep mode. It will not wake up after certain time however. It will wake up only, when you touch one of the touch buttons. The board then sends information via the touch button to the broker who triggered the wakeup. It will look something like this:\u003c/p\u003e","title":"Day 13: Smart Switch for Soundboard"},{"content":"Today we will find again a button hidden behind the door of the Advent calendar. In our experiment today we will continue to cover the MQTT protocol, but this time in conjunction with Node-RED. We will also learn how two buttons can be evaluated simultaneously. The experiment today is structured as follows:\nSetup with two buttons So now we have two buttons that we can use. We activate the program for today. Then we import the Node-RED flow. You need to adapt it slightly by replacing [PID] in the topic with your personal MQTT ID. That’s pretty easy if you use this trick:\nCopy the Node-RED flow into a text editor of your choice such as the Windows Editor for example. Select the Replace option (in Editor under Edit/Replace ([Ctrl + H]). Enter [PID] into the Search for field and enter your personal ID in Replace with. Click Replace All and you have adjusted the flow and are now able to import and start it in Node-RED. But don’t forget to disable previous flows.\nAdjusting the flow using your personal ID is easy In Node-RED go to the Debug tab and press a button on the breadboard. You will see the following message for example:\nThe JSON Message Key cmd will send the command get_button_state. Under value is an array with all buttons and their values. You can identify a button using pin_name, pin_id or pin_no. The first two values are already defined, the third indicates the used IO pin on the board. Pin_state indicates the button’s Boolean value, which is TRUE or FALSE or HIGH or LOW. By the way, if the button is not pressed, the pin value is TRUE, because the pin is pulled to high by means of the internal pull-up resistor and by pressing a button it is pushed too low. The pin_value key indicates an analogue value which is not important for our buttons.\nI pressed Button2 here, and the board instantly sent a message with all enabled buttons and their values to the out topic that is affixed to the debug node and also to the topic\nNodeESP/[PID]/button/state/get/out\nThe latter topic is evaluated in Node-RED. Then there is a JSON node, which converts the plain text into a JSON object. Split node separates the button array into individual elements, which are passed on to the switch node one by one. This node checks the pin name and then determines which one of the two buttons that is. Template node then merely filters the value of the pin_state and sends TRUE or FALSE to the next node. This is a dashboard button that indicates a state, which is on, if the value was FALSE, and vice versa. Here it inverts the value of the button, so to speak.\nIf you switch to the Dashboard, for example by clicking on the Dashboard tab on the right and then click the rectangle with the up arrow, you, too, can see the two buttons. When you release the button, the board immediately informs you about the status change and you can see straight away, which button is pressed and which button is not pressed.\nThe huge advantage of MQTT and using an online broker is that you can assess the buttons from anywhere in the world. You could for example take the board with you to your job, while the Node-RED server is running on a machine at home. And then you could control the lights or the heating when you are on your way home, or you could use speech output to tell your folks at home that you are on your way. And all this you can do with a simple push of a button from anywhere in the world.\n","permalink":"https://neu-iot.fkainka.de/en/day12-2018/","summary":"\u003cp\u003eToday we will find again a button hidden behind the door of the Advent calendar. In our experiment  today we will continue to cover the MQTT protocol, but this time in conjunction with Node-RED. We will also learn how two buttons can be evaluated simultaneously. The experiment today is structured as follows:\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day12_2Button_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2519\" src=\"/images/2018/11/Day12_2Button_Steckplatine.png\" alt=\"Der Aufbau mit zwei Buttons\" width=\"436\" height=\"539\" data-id=\"2519\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eSetup with two buttons\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eSo now we have two buttons that we can use. We activate the program for today. Then we import the Node-RED flow. You need to adapt it slightly by replacing \u003cstrong\u003e[PID]\u003c/strong\u003e in the topic with your personal MQTT ID. That’s pretty easy if you use this trick:\u003c/p\u003e","title":"Day 12: MQTT Button"},{"content":"There is a cable set again hidden behind the door today. We will need it in the next few days when the setups become more complex.\nOver the past few days we have sent most of our data via UDP. This protocol is very convenient; on the one hand it has a small overhead (data is sent in addition to the actual application data) and on the other hand, it is a broadcasting system and can thus send data to several devices simultaneously. But today we will learn about a second protocol that plays a major role in IoT. This is the message protocol MQTT (Message Queue Telemetry Transport) and it was specifically developed for machine-to-machine communication (M2M). The reason that this is such a brilliant protocol is due to its compactness and simplicity when it comes to exchanging data between devices such as control data, measurement data or text. Compared to HTTP, the overhead is very small. That is why embedded devices such as microcontrollers like our NodeESP can process the data well.\nA so-called Broker forms the basis for communication. A broker is a server application that processes all the messages. A device like our NodeESP can connect to the broker and publish messages and also send them to the broker. Another device can then subscribe to certain topics and will instantly receive all new messages from the broker published on these topics.\nThe MQTT broker delivers messages Topics are structured hierarchically, whereby subtopics are separated by /. And then there are the wildcards. You can subscribe to several topics at the same time using the signs + or #. If you subscribed to MyHome/+/Temperature you would receive the topics MyHome/Kitchen/Temperature and MyHome/ Bathroom/Temperature all together for example. \u0026ldquo;Plus\u0026rdquo; will replace only one topic level and \u0026ldquo;hash\u0026rdquo; will replace them all. You would receive all messages posted under all subtopics of MyHome if you subscribed to MyHome/#. A message can be just about anything: from plain text to readings to simple 1/0 light switching commands.\nWe don’t need to set up hardware today. We will start with some basic tests. Go to the settings on the configuration page. Most certainly you have already noticed the area with MQTT Settings. Here you will find already properly preconfigured settings. We have set up a server especially for the Advent calendar project as the broker address, namely broker.fkainka.de. But you can also set up a broker yourself on your Raspberry Pi. I recommend the open-source software Mosquitto. The client ID is generated using the board’s MAC address. This ID is globally assigned to one single device across all servers. As a MAC address should be unique in the world, it is very suitable as an ID here. You don’t need a username and password for the test broker.\nTest the connection by clicking on the Test Connection button below. The colour of the area next to it should change to green, if the connection to the broker was established successfully. If this won’t work, it may be that the server is down and you need to change the broker. An alternative freely available broker is for example broker.mqttdashboard.com.\nOnce you have tested the basic connection, you can now set up the program of today. Then go to the page\nhttps://www.hivemq.com/demos/websocket-client/?\nThe HiveMQ Page and click Try the websocket client. You will see a log on screen to an MQTT broker with WebSocket support. Under Host, enter a broker, here we use broker.fkainka.de, and then connect. The screen you are seeing above opens next. You can now subscribe to your own personal topic by clicking on Add New Topic Subscription. The topic consists of the term NodeESP and the client ID. For my board this was for example:\nNodeESP/240AC48178E4/\nAny MQTT communication from and to the board will start with this topic. From now on I will shorten the client ID part using [PID] which stands for \u0026ldquo;personal ID\u0026rdquo;. Of course, you will need to replace this part with your own client ID. Experiment with receiving all communication from the board using the topic\nNodeESP/[PID]/#\nWhen you reset the board, you will see a message soon after telling you that the board has established a connection to the broker. This message is written to the topic NodeESP/[PID]/status and by subscribing with # you will also receive it. Now you can send your first message to the board. To do this, in the Publish area enter your personal topic plus the subtopic testtopic into the Topic field. In my case:\nNodeESP/[PID]/testtopic\nEnter any message into the Message field. You can also leave the field blank. Then click Publish and a moment later you will receive two messages in the Messages area. One is a welcoming text and was published under the NodeESP/[PID]/testtopic/out topic. The second message is also welcoming text but as JSON string including command key, and was published under the NodeESP/[PID]/out topic.\nThese two messages are the result of the board converting the topics into the known command format and then evaluating them. The answers appear in a topic that is composed of the command out, in our case that is.../testtopic /out and at the same time also in the NodeESP/[PID]/out channel.\nThe equivalent to the out topic is the in topic, where you can directly publish commands in JSON format. For example, if you wrote to the NodeESP/[PID]/ topic the JSON string {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;testtopic\u0026rdquo;}, you would get the same answers as in your first experiment. This means that you can send a command either via a topic or via the in-channel as a JSON object. Don’t be surprised to find out that some well-known commands such get_wifi_status etc. won’t work. The reason is that these commands may contain sensitive data and should not be sent over a public broker.\nThe connection to the board via MQTT is now established. Tomorrow we will take a closer look and learn what we can do with it.\n","permalink":"https://neu-iot.fkainka.de/en/day11-2018/","summary":"\u003cp\u003eThere is a cable set again hidden behind the door today. We will need it in the next few days when the setups become more complex.\u003c/p\u003e\n\u003cp\u003eOver the past few days we have sent most of our data via UDP. This protocol is very convenient; on the one hand it has a small overhead (data is sent in addition to the actual application data) and on the other hand, it is a broadcasting system and can thus send data to several devices simultaneously. But today we will learn about a second protocol that plays a major role in IoT. This is the message protocol MQTT (\u003cstrong\u003eMessage Queue Telemetry Transport\u003c/strong\u003e) and it was specifically developed for machine-to-machine communication (M2M). The reason that this is such a brilliant protocol is due to its compactness and simplicity when it comes to exchanging data between devices such as control data, measurement data or text. Compared to HTTP, the overhead is very small. That is why embedded devices such as microcontrollers like our NodeESP can process the data well.\u003c/p\u003e","title":"Day 11: MQTT"},{"content":"There is a battery compartment for three A batteries (4.5 V) hidden behind the door today that will 10. Tag power the board independently of a power outlet. For economical battery operation, we have the deepsleep mode. This mode allows the board to go into a deep sleep where it uses almost no power at all. After a certain time, the board wakes up, performs a modest task and goes back to sleep shortly after. In this mode a lot of energy is saved due to the long sleep and short wake times and ultimately the batteries will supply power to the board for months. The setup we will use today includes again the light sensor and it gets a wire jumper that connects pin 23 and GND.\nNote the wire jumper at pin 23 Select the program of today. While the board now resets, the status LED will flash briefly green and turns off again. After approximately 20 seconds, the game starts all over, thus the deep-sleep mode is active.\nTodays Flow Today’s flow consists of a gauge and a chart. A chart is used to graphically display several measured values over a certain time. By the way, today we will reverse the readings by means of a range node, so that more light delivers a higher gauge and chart reading. You can now run the Node-RED instance on a machine or Raspberry while placing the board powered by batteries anywhere where it can measure the light over the entire day.\nGauge and chart elements on the Dashboard page Note: Maybe you find it disturbing that the status LED flashes every 20 seconds, for example, if you want to measure the light distribution in your bedroom overnight. You can simply disable the function on the configuration page. And all you have to do to exit deep-sleep mode, remove the wire jumper from pin 23 and reset the board or wait for a deep-sleep cycle.\n","permalink":"https://neu-iot.fkainka.de/en/day10-2018/","summary":"\u003cp\u003eThere is a battery compartment for three A batteries (4.5 V) hidden behind the door today that will     \u003cstrong\u003e10. Tag\u003c/strong\u003e power the board independently of a power outlet. For economical battery operation, we have the deepsleep mode. This mode allows the board to go into a deep sleep where it uses almost no power at all. After a certain time, the board wakes up, performs a modest task and goes back to sleep shortly after. In this mode a lot of energy is saved due to the long sleep and short wake times and ultimately the batteries will supply power to the board for months. The setup we will use today includes again the light sensor and it gets a wire jumper that connects pin 23 and GND.\u003c/p\u003e","title":"Day 10: Deep Sleep"},{"content":"There is a photo transistor hidden behind the door today. We will use it to measure the ambient brightness. The potentiometer is in series with the phototransistor potentiometer in our circuit and you will be able to change the sensor sensitivity with the potentiometer. In this circuit the reading value will increase when dimming the sensor.\nTodays Circuit You will see this happening today in our user interface within the gauge element. But again, you first import and start today’s flow in your Node-RED environment and of course, you have to disable the one from yesterday. Also, do not forget to enable today’s program on the configuration page and adjust the IP of the UDP send node.\nWe will use the on-board LED again and in addition, we will display the measured values. The LED should automatically adapt its colour to the light conditions dependent on the measured value. In full darkness, the LED is supposed to glow red. The colour will change from green to blue in line with increasing brightness. Illuminate your work area in the evenings with a relaxing red, for example, while a strong blue light is lit during the day.\nTodays Flow The range node converts measured values ranging from 0 to 4095 to a range of 240 to 0. This will send the desired LED colour in what is called HSV format. HSV stands for Hue, Saturation and Value, the latter being the brightness value. It is an alternative representation to the RGB model. The HSV model represents the colour hue by an angle of 0° to 360°. Red is 0°, green is 120° and blue is 240°. The reading is thus converted into a value up to 240 here, and covers the entire colour palette from red to blue. The following template node is used to compile the command, which is then sent to the board. For a medium value, the command would be:\n{\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;set_rgb_hsv\u0026rdquo;,\u0026ldquo;value\u0026rdquo;:\u0026ldquo;hsv(120, 100%, 100%)\u0026rdquo;}\nThe percent signs after saturation and brightness could also be omitted. The board changes the colour accordingly and returns the same values with the command get_rgb_hsv as confirmation. Node-RED receives this message, too, and represents it on the interface web page by means of the colour picker. That way you are able to always track the colour the board is currently revealing.\n","permalink":"https://neu-iot.fkainka.de/en/day9-2018/","summary":"\u003cp\u003eThere is a photo transistor hidden behind the door today. We will use it to measure the ambient brightness. The potentiometer is in series with the phototransistor potentiometer in our circuit and you will be able to change the sensor sensitivity with the potentiometer. In this circuit the reading value will increase when dimming the sensor.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day9_LDR_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2498\" src=\"/images/2018/11/Day9_LDR_Steckplatine.png\" alt=\"Versuchsaufbau\" width=\"512\" height=\"633\" data-id=\"2498\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eTodays Circuit\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eYou will see this happening today in our user interface within the gauge element. But again, you first import and start today’s flow in your Node-RED environment and of course, you have to disable the one from yesterday. Also, do not forget to enable today’s program on the configuration page and adjust the IP of the UDP send node.\u003c/p\u003e","title":"Day 9: A Mood Light"},{"content":"Breadboard Construction On the eighth day you will find a potentiometer behind the door. We are going to use it as voltage divider. You can set a voltage between 0 V and 3.3 V, which is measured by the board and sent to NodeRED. On top of to the functions of yesterday’s stairway light, you can also send the measured values.\nThe Flow of Today As usual you can obtain today’s flow from here. Don’t forget to disable yesterday’s flow and you may need to adjust the send-IP. The flow of today also has a new node for the dashboard, namely a gauge to visually display the measured value.\nUser interface of the experiment today. Once you have today’s program enable, you will see a gauge element (a pointer) on the dashboard page that refreshes every two seconds and shows new readings. If you now turn the wheel of the potentiometer, these values will change. This measured value could be used for different applications such as to control the brightness of the LED or to set the lighting time of the staircase lighting; again, a typical smart home application.\nTodays breadboard bonstruction with pin template ","permalink":"https://neu-iot.fkainka.de/en/day8-2018/","summary":"\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day8_Button_LED_ADC_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2490\" src=\"/images/2018/11/Day8_Button_LED_ADC_Steckplatine.png\" alt=\"Versuchsaufbau\" width=\"512\" height=\"633\" data-id=\"2490\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eBreadboard Construction\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eOn the eighth day you will find a potentiometer behind the door. We are going to use it as voltage divider. You can set a voltage between 0 V and 3.3 V, which is measured by the board and sent to NodeRED. On top of to the functions of yesterday’s stairway light, you can also send the measured values.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/T8Flow.png\"\u003e\u003cimg class=\"size-large wp-image-2491\" src=\"/images/2018/11/T8Flow.png\" alt=\"Der Flow des heutigen Tages\" width=\"616\" height=\"154\" data-id=\"2491\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe Flow of Today\u003c/figcaption\u003e\u003c/figure\u003e\n\u003ciframe style=\"border: none; width: 100%;\" src=\"https://pastebin.com/embed_iframe/FNtPZnht\"\u003e\u003c/iframe\u003e\n\u003cp\u003eAs usual you can obtain today’s flow from here. Don’t forget to disable yesterday’s flow and you may need to adjust the send-IP. The flow of today also has a new node for the dashboard, namely a gauge to visually display the measured value.\u003c/p\u003e","title":"Day 8: A Controller"},{"content":"There is a red LED hidden behind the door today. We are going to use this to build a simple stairway light with web interface. We will thus build the following circuit and, of course, activate today’s program.\nBreadboard Construction (short LED pin is up) Locate the Node-RED flow below and import. Deactivate yesterday’s flow after the import to make sure the UDP receive nodes do not get in your way. This time the flow also has a send node besides the receiving node. You may need to adapt the send node to reflect your broadcast IP. A message that arrives at the UDP will be converted back to a JSON object by means of a JSON string, which is pure text. The difference here is that you can now access also individual attributes.\nThe following switch node is comparable to an IF query that checks, if the trigger command was sent. This command is triggered by pressing the button. A trigger node then starts to work. If the trigger node is activated, it sends the light_on command. This message is in JSON format and interpreted by the NodeESP board. The lights are turned on accordingly. Then, after four seconds, the trigger node sends the message: light_off. The board responds accordingly. The off message may be delayed by triggering the trigger node once more. The option to do that has been activated in the module. The trigger node can also be activated via the web UI and you can turn on the stairway light with your smartphone in line with the concept of a smart home.\nFlow of a stairway light Note: In the Node-RED Windows version, the setting broadcast message (send a in node properties) for the UDP send-node did not work. But for the Node-RED version, I have tested on a Raspberry, only this setting worked for sending. This means that Raspberry users may need to adjust their UDP node for sending.\n","permalink":"https://neu-iot.fkainka.de/en/day7-2018/","summary":"\u003cp\u003eThere is a red LED hidden behind the door today. We are going to use this to build a simple stairway light with web interface. We will thus build the following circuit and, of course, activate today’s program.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day7_Button_LED_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2483\" src=\"/images/2018/11/Day7_Button_LED_Steckplatine.png\" alt=\"Versuchsaufbau\" width=\"451\" height=\"558\" data-id=\"2483\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eBreadboard Construction (short LED pin is up)\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eLocate the Node-RED flow below and import. Deactivate yesterday’s flow after the import to make sure the UDP receive nodes do not get in your way. This time the flow also has a send node besides the receiving node. You may need to adapt the send node to reflect your broadcast IP. A message that arrives at the UDP will be converted back to a JSON object by means of a JSON string, which is pure text. The difference here is that you can now access also individual attributes.\u003c/p\u003e","title":"Day 7: Stairway Light"},{"content":"Behind the sixth door of the Advent calendar is a 1 kOhm resistor, which we will use tomorrow. Today we will continue with Node-RED and try out the touch function of the board. As always you will select the program of today. And today we will also build the following circuit. The yellow wires with one free end are the touch sensors.\nBreadboard Construction: Three wires suspended in the air from one end Once set up, you can restart Node-RED using the terminal and the node-red command. Then open the Node-RED editor via http://127.0.0.1:1880/. Today we will install a few nodes. To do this, click on the three dashes in the top right corner where you will see manage palette under which all the installed nodes are listed. Select the Install tab and you will see a large number of different modules that you can install. For today we are searching for the module node-red-dashboard. Click the Install button. A message appears warning you that installation may be difficult at times. Just click Ok, this module is easy to install. After a short while, a success message appears, and the new nodes are now in your node row.\nThe Dashboard Installation The next step involves setting up the flow for today. So that you do not have to do everything yourself, you have the option of importing complete flows into Node-RED. Click the three dashes again and then on Import and next on Clipboard. You can copy the flows into the text field that pops up. You will find today’s flow in the Pastebin Frame below:\nA new tab should appear in the bar at the top after the import. Now you need to deactivate yesterday’s flow as it would listen to the UDP port. Double-click on the Flow tab, change the status from Enabled to Disabled in the Flow menu and confirm with Done. Now you can confirm the new processes with Deploy.\nOpen this page in the browser:\nhttp://127.0.0.1:1880/ui\nThe User Interface What you see now is a user interface (UI), which is often called a dashboard. By installing this new node module, you can to create your own interface\nNote: If wire contact does not trigger a message, adjust the sensitivity of the touch detection on the configuration page. A higher value means that the touch sensitivity of the buttons increases. to control operations. Today’s interface was imported with today’s flow. It is a text box, which shows the UDP messages. But there is a small addition: do not have the volume of your PC turned too high, when you now touch one of the freely dangling wires on the board. The board will automatically detect the contact and will send a UDP message that will be shown in the text box. In addition, there is a text-to-speech node on the dashboard that reads the text value in the JSON object. By that you have successfully created a first voice output – and all this with just a single node.\n","permalink":"https://neu-iot.fkainka.de/en/day6-2018/","summary":"\u003cp\u003eBehind the sixth door of the Advent calendar is a 1 kOhm resistor, which we will use tomorrow. Today we will continue with Node-RED and try out the touch function of the board. As always you will select the program of today. And today we will also build the following circuit. The yellow wires with one free end are the touch sensors.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/Day6_Touch_Steckplatine.png\"\u003e\u003cimg class=\" wp-image-2472\" src=\"/images/2018/11/Day6_Touch_Steckplatine.png\" alt=\"Versuchsaufbau\" width=\"474\" height=\"626\" data-id=\"2472\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eBreadboard Construction: Three wires suspended in the air from one end\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eOnce set up, you can restart Node-RED using the terminal and the \u003cstrong\u003enode-red\u003c/strong\u003e command. Then open the Node-RED editor via \u003cstrong\u003ehttp://127.0.0.1:1880/\u003c/strong\u003e. Today we will install a few nodes. To do this, click on the three dashes in the top right corner where you will see \u003cstrong\u003emanage palette\u003c/strong\u003e under which all the installed nodes are listed. Select the \u003cstrong\u003eInstall\u003c/strong\u003e tab and you will see a large number of different modules that you can install. For today we are searching for the module \u003cstrong\u003enode-red-dashboard\u003c/strong\u003e. Click the \u003cstrong\u003eInstall\u003c/strong\u003e button. A message appears warning you that installation may be difficult at times. Just click \u003cstrong\u003eOk\u003c/strong\u003e, this module is easy to install. After a short while, a success message appears, and the new nodes are now in your node row.\u003c/p\u003e","title":"Tag 6: Touch to Speach"},{"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 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.\nBreadboard Construction Today, you will become familiar with the Node-RED 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.\nNode-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.\nI will demonstrate the installation for Windows 10 as an example. Most of these commands can be used with other systems.\nFirst Node.js must be installed. This software is available along with a detailed installation manual from the website https://nodejs.org/. 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 cmd), and type node \u0026ndash;version \u0026amp;\u0026amp; npm –version\nYou will see something like v8.10.0 and 5.6.0, or maybe you already have a newer version. In the command line enter the command that will install NodeRED:\nnpm install -g \u0026ndash;unsafe-perm node-red\nThis may take a while. Then use the command line to start Node-RED: node-red\nFirewall request. In der console Node-RED starts in the background Firewall immediately acts and wants to know how to proceed with this new connection. Now it is essential to select Private networks and Allow access. 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.\nNow you have installed and launched Node-RED. But except a few lines in the terminal you haven’t seen anything useful yet. The user interface of the software is opened via the browser. Thus, open t by using the address http://127.0.0.1:1880/. 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’s 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.\nSettings and a message received The Input section on the left has a node called udp. Drag it into the free area in the middle. A bit further down under the output is debug. 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 Done. Start by clicking the Deploy button in the top right corner. The message Successfully deployed appears briefly. The new flow is now active. As a final step, select the debug tab on the very right and then press the button on the breadboard. The debug window will show a message in the familiar JSON format: {\u0026ldquo;cmd\u0026rdquo;: \u0026ldquo;btn1_pressed\u0026rdquo;}. The connection to Node-RED has been established.\nNote**:** Counting the board pins can be tiresome. Therefore, we have provided a stencil on our Board page under Pinout, which you can print out, cut and place on the board.\n","permalink":"https://neu-iot.fkainka.de/en/day5-2018/","summary":"\u003cp\u003eBehind 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.\u003c/p\u003e","title":"Day 5: Node-RED"},{"content":"Behind the fourth door of the Advent calendar is a set of cables that is very useful for the upcoming hardware setup. But today in our project we are going to look at the JSON format; what is it and how does it help us communicating with the board.\nAs usual, first you need to activate today’s program. You will also need the Packet Sender program with the same settings that we were using yesterday. Today, a message appears only after you briefly press on the board’s boot button. This message looks like this:\n{\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;boot_pressed\u0026rdquo;}\nThe message in Packet Sender This is a JSON (JavaScript Object Notation) message. JSON is a slim data exchange format for machines that is also very readable for humans. Basically, everything in the JSON format consists of names and values. First, we have the name of the value (which is also called key), in our case this is cmd (short for command), and then the value itself, here boot_pressed. Both texts are separated by a colon and, because this is text, it is also enclosed in quotation marks. A complete JSON object is also surrounded by curly brackets.\nThe board not only sends messages, it can also receive messages. To make this happen, you need to fix a few settings in the Packet Sender program. In the upper part there is a text field labelled Address. Here again you need to enter the broadcast address which is also used by the board. Alternatively, enter the board IP or just the mDNS name (simply nodeesp). In the Port field on the right, enter again the port 55056. Last but not least, select UDP from the drop-down menu further on the right. Now you can enter a message into the field ASCII located a little higher up and Send it. Start with sending a trial text such as Hello. Since the Packet Sender listens on the same port and you are also using the broadcast IP address, you will also receive some of the messages sent. In addition, you will receive the message {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;ack\u0026rdquo;} from the board.ack is the short of acknowledged. The board thus has confirmed the receipt of a message, although most likely it couldn’t do anything with the message itself.\nsending a text If you send a predefined command in JSON, things will look a bit different. If you send the text {\u0026ldquo;cmd\u0026rdquo;:\u0026ldquo;ping\u0026rdquo;}, for example, you will get {\u0026ldquo;cmd\u0026rdquo;: \u0026ldquo;pong\u0026rdquo;} as a reply from the board after a short while. You could also try other commands. For example, {\u0026ldquo;cmd\u0026rdquo;: \u0026ldquo;get_wifi_status\u0026rdquo;} will return the connection status of the board. {\u0026ldquo;cmd\u0026rdquo;: \u0026ldquo;get_wifi_scan\u0026rdquo;} will detect and list all Wi-Fi networks in range.\nYou can find a couple of universal commands on the board page or on the project page. But be careful: there are a few commands in the category Settings that will make changes to the settings of the board and then nothing will work anymore. If this happens, go to the default settings by holding down the boot button for more than 10 seconds. You can use this method for all programs that have WPS in brackets after the program name. You have the same function on the configuration page under Advanced Settings and then (Restore Default Configuration).\nAs a third option move pin 13 to LOW during the startup of the board. Don’t forget to disconnect pin 13 after the reset.\n.\n","permalink":"https://neu-iot.fkainka.de/en/day4-2018/","summary":"\u003cp\u003eBehind the fourth door of the Advent calendar is a set of cables that is very useful for the upcoming hardware setup. But today in our project we are going to look at the JSON format; what is it and how does it help us communicating with the board.\u003c/p\u003e\n\u003cp\u003eAs usual, first you need to activate today’s program. You will also need the Packet Sender program with the same settings that we were using yesterday. Today, a message appears only after you briefly press on the board’s boot button. This message looks like this:\u003c/p\u003e","title":"Day 4: UDP and JSON"},{"content":"Today’s door reveals another breadboard. It can be plugged into the board of yesterday. The NodeESP board can now be placed on both boards together. However, this constellation will not work for everyone. Breaking off the side parts of the boards is the easiest solution. I have done this by fitting the boards into each other and then bending one until a side part broke off. I did the same thing with the other board. But you could use pliers, too. Without the side parts, you can place the boards closer to each other, and then there won’t be a problem with the grid. Simply plug the NodeESP board onto both boards as shown in the picture. This leaves enough room for other components. In today’s project, we will learn how to connect to the board from your PC without using the web browser.\nThe NodeESP on two breadboards Select today’s program on the configuration page. The board will restart. But you are not yet finished with the settings. On the configuration page there is another area called UPD Settings. There you will see the item IP (send). Perhaps the IP is already correct; most likely, however, you will need to enter your broadcast address manually here. In most cases, you simply copy your local IP, which you will find under Board Wifi Status located at the top, into the field and change the last 3 numbers after the dot with 255. Some home networks may use different approaches. If it gets complicated, use an online tool such as:\nhttps://remotemonitoringsystems.ca/broadcast.php\nor search through the comment section of today’s program for help. After you have confirmed with Submit, the board will restart as usual and will already send messages. Now we need a program on our PC, that allows us to receive these messages. We recommend the tool Packet Sender, which works with all common operating systems and can be downloaded from https://packetsender.com/download\nHere you can do as you like, and either select the installer version or the portable version that you can start directly. When launching the program, Windows may ask for your firewall settings. Choose Home network and Allow access.\nBelow under the Packet Sender program UDP followed by the number 55056 should appear. If the number is not 55056, go to File/Settings in the Network tab and under Server Port enter UDP. This is the same port as set on the configuration page of our board.\nThe Packet Sender program showing the settings And indeed, after a short while, a message appears in the lower window and refreshed every five seconds. So now, you have successfully received a message from your board.\n","permalink":"https://neu-iot.fkainka.de/en/day3-2018/","summary":"\u003cp\u003eToday’s door reveals another breadboard. It can be plugged into the board of yesterday. The NodeESP board can now be placed on both boards together. However, this constellation will not work for everyone. Breaking off the side parts of the boards is the easiest solution. I have done this by fitting the boards into each other and then bending one until a side part broke off. I did the same thing with the other board. But you could use pliers, too. Without the side parts, you can place the boards closer to each other, and then there won’t be a problem with the grid. Simply plug the NodeESP board onto both boards as shown in the picture. This leaves enough room for other components. In today’s project, we will learn how to connect to the board from your PC without using the web browser.\u003c/p\u003e","title":"Day 3: UDP and Packet Sender"},{"content":"On the second day you will find a breadboard for the upcoming experiments hidden behind the door. I would recommend however, that you do not yet plug your NodeESP into the board. Let’s first look today at how we launch the programs preinstalled on the board and bring the board up to date.\nReconnect your board first to a power source. Wi-Fi data that you entered yesterday is still stored and the board should automatically connect to your Wi-Fi network. Then access the board page using the IP or mDNS name (http: //nodeesp.local/). Now, the first thing you do is searching for possible software updates. To do this, open the configuration page, click Advanced Settings at the bottom and click on Check for Firmware Updates.\nThe Board is up to date You will see a message on the configuration web page, if a new update is found. Confirm and then have a cup of coffee. The update process can take a while (up to 20 minutes). Continue, once the light on the board turns green. Check again for any updates. Normally, the board will now report that everything is up to date. If things go wrong, look at the instructions on the project website and what you can do to fix it.\nNow we will deal with the preinstalled programs: On the configuration page you will see the item Application Settings where all programs are listed and an info box shows you which of those are currently active. First select IoT Adventscalendar 2018 in the top box and then today’s program (starting with IoT Calendar 2018 – Day 2). Confirm with Submit. The board will now restart with the selected program.\nColour picker element After reboot and once reconnected, go to the board’s main page. There is another link called Application Page. Follow this link to go to a webpage with a so-called colour picker element, which you can use to select colours. The selected colour is sent to the board and displayed by the onboard LED. Now you have a small, useful, coloured lamp – without having anything to assemble.\n","permalink":"https://neu-iot.fkainka.de/en/day2-2018/","summary":"\u003cp\u003eOn the second day you will find a breadboard for the upcoming experiments hidden behind the door. I would recommend however, that you do not yet plug your NodeESP into the board. Let’s first look today at how we launch the programs preinstalled on the board and bring the board up to date.\u003c/p\u003e\n\u003cp\u003eReconnect your board first to a power source. Wi-Fi data that you entered yesterday is still stored and the board should automatically connect to your Wi-Fi network. Then access the board page using the IP or mDNS name (\u003cstrong\u003ehttp: //nodeesp.local\u003c/strong\u003e/). Now, the first thing you do is searching for possible software updates. To do this, open the configuration page, click \u003cstrong\u003eAdvanced Settings\u003c/strong\u003e at the bottom and click on \u003cstrong\u003eCheck for Firmware Updates\u003c/strong\u003e.\u003c/p\u003e","title":"Day 2: OnBoard LED and Update"},{"content":"This is the first day of the 2018 Advent calendar project. The time has come to open the first window. Behind this calendar door you will find a microcontroller board. The main task today is to connect to the home network and to become acquainted with the board.\nThe NodeESP board with WPS button selected In a first step we will supply power to the board by simply connecting the board using a MicroUSB cable to the PC or to a standard smartphone charger. You will need at least 300mA to power the board. Older laptops and USB hubs may pose a problem, if they do not have an external power supply however. After a short while the RGB LED on the board turns on and glows yellow. Initialisation is complete. Now all you have to do is enter your Wi-Fi data. There are two ways to do that:\nOption 1: WPS You may already know the WPS feature from other devices. By pressing a button on your router and on the device that you want to connect, you are enabling both devices to exchange Wi-Fi data independently. The NodeESP board, too, has this feature. Press and hold the boot button for a few seconds (the button near the battery terminal highlighted in the picture) and the LED will flash yellow. Now press the WPS button on your router. The NodeESP restarts after a short while. If the connection was established successfully, the LED will flash briefly and then the green light is on. If this is not the case, repeat the process or try the second option.\nOption 2: Configuring via die Website Visiting the pre-programmed configuration web page offers a second way to connect to your home network. To use this option, you need to connect to the board’s hotspot. This creates an open Wi-Fi network in your environment called NodeESP. Connect to this hotspot using a PC or Smartphone. Open a browser and type the address of the board http://192.168.4.1 in access point mode. The website integrated in the board is called up.\nA complete web server is running on the small board, and you can thus visit quite a few sites. Among other things, you will find the Board Configuration page there. You have also the possibility of entering your Wi-Fi data here. Click on WIFI Station Settings. The board will scan for Wi-Fi networks within reach. After a short while you can select your network from the list and enter the password in the text field below.\nThe Board’s configuration page You have now configured the connection to the home network and can access the board website via your home network. You can also find the board IP on the board’s configuration page. You may need to reconnect to the NodeESP network for that. The IP address assigned to your board by your router is listed in the Board WiFi Status section. Connect to your home network again and view this IP in the browser. In our example this is: http://192.168.178.114/.\nThe Board’s configuration page Apple’s Bonjour service offers a handier approach. To use this, you need to install a little tool that you can download from the website https://support.apple.com/de-de/bonjour\nNote: Only Windows users need to follow these steps. The service is already pre-installed for Apple and Linux users. It won’t work on Android smartphones.\nOnce the service is installed, simply type http://nodeesp.local****/ into your browser to access the board’s web page. No need to remember the IP address anymore. The service behind all this is called mDNS (multicast domain name system). It works because the board constantly sends its IP and domain name to the network. By the way, you can also adjust the mDNS name on the configuration page. This would create a connection to the home network. If you should encounter any problem write a comment below.\n","permalink":"https://neu-iot.fkainka.de/en/day1-2018/","summary":"\u003cp\u003eThis is the first day of the 2018 Advent calendar project. The time has come to open the first window. Behind this calendar door you will find a microcontroller board. The main task today is to connect to the home network and to become acquainted with the board.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2018/11/T1_NodeES_WPS.jpg\"\u003e\u003cimg class=\"size-large wp-image-2432\" src=\"/images/2018/11/T1_NodeES_WPS.jpg\" alt=\"Das NodeESP-Board mit markierter WPS-Taste.\" width=\"616\" height=\"251\" data-id=\"2432\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe NodeESP board with WPS button selected\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eIn a first step we will supply power to the board by simply connecting the board using a MicroUSB cable to the PC or to a standard smartphone charger. You will need at least 300mA to power the board. Older laptops and USB hubs may pose a problem, if they do not have an external power supply however. After a short while the RGB LED on the board turns on and glows yellow. Initialisation is complete. Now all you have to do is enter your Wi-Fi data. There are two ways to do that:\u003c/p\u003e","title":"Day 1: The NodeESP Board"},{"content":"","permalink":"https://neu-iot.fkainka.de/en/nodeesp-technical-specs/","summary":"","title":"NodeESP Technical Specs"},{"content":"Der IoT Adventskalender 2018 Day 24: Christmas Tree Lighting Day 23: Alarm System Day 22: Climate Guard Day 21: Piano Player Day 20: Plant Guard Das NodeESP Board Firmware Neuigkeiten und Bug Report NodeESP Kommandoreferenz das-nodeesp-board NodeESP Technical Specs NodeESP Firmware Reinstallieren Maker Kit für Smart Home Maker Kit für Smart Home ","permalink":"https://neu-iot.fkainka.de/en/nodeesp/","summary":"\u003ch3 id=\"der-iot-adventskalender-2018\"\u003eDer IoT Adventskalender 2018\u003c/h3\u003e\n\n\u003cdiv class=\"post-grid\"\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day24-2018/\"\u003e\n      \u003cimg src=\"/images/2018/11/T24UI_hu_b0665a49660ff01c.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 24: Christmas Tree Lighting\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day23-2018/\"\u003e\n      \u003cimg src=\"/images/2018/11/Day23_Speaker_Tilt_Steckplatine_hu_440e45f823aba3a6.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 23: Alarm System\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day22-2018/\"\u003e\n      \u003cimg src=\"/images/2018/11/T22Flow_hu_19f7cd5e5d5129c0.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 22: Climate Guard\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/tag-21-piano-player/\"\u003e\n      \u003cimg src=\"/images/2018/11/Day21_Speaker_Steckplatine_hu_b74cd3076a3788bd.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 21: Piano Player\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day20-2018/\"\u003e\n      \u003cimg src=\"/images/2018/11/T20UI_hu_8c470cb26183339f.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 20: Plant Guard\u003c/span\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003ch3 id=\"das-nodeesp-board\"\u003eDas NodeESP Board\u003c/h3\u003e\n\n\u003cdiv class=\"post-grid\"\u003e\n  \u003ca class=\"post-grid-item\" href=\"/firmware-neuigkeiten-und-bug-report/\"\u003e\n      \u003cimg src=\"/images/2018/11/technischeDaten-1_hu_41f849b3971c2d7c.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eFirmware Neuigkeiten und Bug Report\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/nodeesp-command-reference/\"\u003e\n      \u003cimg src=\"/images/2018/11/T12_JSON_hu_bf32aba68f61c4a0.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eNodeESP Kommandoreferenz\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/das-nodeesp-board/\"\u003e\n      \u003cimg src=\"/images/2018/10/board1_hu_f365872d2e80573f.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003edas-nodeesp-board\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/nodeesp-technical-specs/\"\u003e\n      \u003cimg src=\"/images/2018/11/technischeDaten-1_hu_41f849b3971c2d7c.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eNodeESP Technical Specs\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/nodeesp-firmware-reinstallieren/\"\u003e\n      \u003cimg src=\"/images/2018/11/Tool2-1_hu_abfed3b9844e78fb.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eNodeESP Firmware Reinstallieren\u003c/span\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003ch3 id=\"maker-kit-für-smart-home\"\u003eMaker Kit für Smart Home\u003c/h3\u003e\n\n\u003cdiv class=\"post-grid\"\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/maker-kit-fuer-smart-home/\"\u003e\n      \u003cimg src=\"/images/2019/10/smarthome_hu_b58afba295a7d5bd.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eMaker Kit für Smart Home\u003c/span\u003e\n  \u003c/a\u003e\n\u003c/div\u003e","title":"nodeesp"},{"content":"Alles rund ums Board Everything about the NanoESP WiFi-Board NanoESP Updaten Library for NanoESP \u0026amp; Pretzel Board Pinout NanoESP \u0026amp; Pretzel Board Fritzing Bauteil - NanoESP \u0026amp; Pretzel Board Die IoT Lernpakete mit dem NanoESP Download Beispielprogramme das-lernpaket-iot Diskusionen und Hilfe Driver -NanoESP \u0026amp; Pretzelboard Der IoT Adventskalender 2016 der-conrad-adventskalender-iot-2016 Day 24: Gift box Day 23: MQTT Climate Day 22: MQTT Cheerlights Day 21: House automation Der IoT Adventskalender 2015 The Conrad advent calendar Internet of Things Day 24: Fire alarm for the Christmas tree Day 23: Cheerlights Day 22: TalkBack Day 21: Alarm system ","permalink":"https://neu-iot.fkainka.de/en/nanoesp/","summary":"\u003ch3 id=\"alles-rund-ums-board\"\u003eAlles rund ums Board\u003c/h3\u003e\n\n\u003cdiv class=\"post-grid\"\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/board/\"\u003e\n      \u003cimg src=\"/images/2015/08/Boards2_hu_e9ef7fd5b427e39.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eEverything about the NanoESP WiFi-Board\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/nanoesp-updaten/\"\u003e\n      \u003cimg src=\"/images/2019/08/P0_fw1_hu_358b07446e5ec689.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eNanoESP Updaten\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/library/\"\u003e\n      \u003cimg src=\"/images/2015/09/download-151556_640_hu_c9d59490062b7b8d.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eLibrary for NanoESP \u0026amp; Pretzel Board\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/pinout-pretzel-board-nanoesp/\"\u003e\n      \u003cimg src=\"/images/2016/01/Pinout-Pretzel-Board_hu_c2a45be39575e29f.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003ePinout NanoESP \u0026amp; Pretzel Board\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/das-nanoesp-pretzelboard-fritzing-bauteil/\"\u003e\n      \u003cimg src=\"/images/2015/12/ScreenShot1_hu_33071afd30fe5c94.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eFritzing Bauteil - NanoESP \u0026amp; Pretzel Board\u003c/span\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003ch3 id=\"die-iot-lernpakete-mit-dem-nanoesp\"\u003eDie IoT Lernpakete mit dem NanoESP\u003c/h3\u003e\n\n\u003cdiv class=\"post-grid\"\u003e\n  \u003ca class=\"post-grid-item\" href=\"/download-beispielprogramme/\"\u003e\n      \u003cimg src=\"/images/2015/09/download-151556_640_hu_c9d59490062b7b8d.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDownload Beispielprogramme\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/das-lernpaket-iot/\"\u003e\n      \u003cimg src=\"/images/2015/09/LPete_hu_585b245c6064d11.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003edas-lernpaket-iot\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/test/\"\u003e\n      \u003cimg src=\"/images/2015/09/forum-27450_640_hu_6775eaaba46cc47e.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDiskusionen und Hilfe\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/driver/\"\u003e\n      \u003cimg src=\"/images/2015/09/Driver1_hu_22b7d9866f4a575f.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDriver -NanoESP \u0026amp; Pretzelboard\u003c/span\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003ch3 id=\"der-iot-adventskalender-2016\"\u003eDer IoT Adventskalender 2016\u003c/h3\u003e\n\n\u003cdiv class=\"post-grid\"\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/der-conrad-adventskalender-iot-2016/\"\u003e\n      \u003cimg src=\"/images/2016/10/bg-2016_hu_e0b06ff9897e68d8.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eder-conrad-adventskalender-iot-2016\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day-24-gift-box/\"\u003e\n      \u003cimg src=\"/images/2016/09/Day24_Present2_Steckplatine_hu_196973a30f64d911.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 24: Gift box\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day23-2016/\"\u003e\n      \u003cimg src=\"/images/2016/09/Day23_Climate_Steckplatine_hu_d3635ab90bad1a94.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 23: MQTT Climate\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day22-2016/\"\u003e\n      \u003cimg src=\"/images/2016/09/Day22_Steckplatine_hu_259b78390065678d.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 22: MQTT Cheerlights\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day21-2016/\"\u003e\n      \u003cimg src=\"/images/2016/09/Day21_Roomst_Steckplatine_hu_701a5bece548f00f.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 21: House automation\u003c/span\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003ch3 id=\"der-iot-adventskalender-2015\"\u003eDer IoT Adventskalender 2015\u003c/h3\u003e\n\n\u003cdiv class=\"post-grid\"\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/der-conrad-iot-adventskalender/\"\u003e\n      \u003cimg src=\"/images/2015/09/prev-e1443182559386_hu_1d6e25b060b4c271.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eThe Conrad advent calendar Internet of Things\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day-24/\"\u003e\n      \u003cimg src=\"/images/2015/09/Day24-1_hu_1e23b74e899576de.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 24: Fire alarm for the Christmas tree\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day-23/\"\u003e\n      \u003cimg src=\"/images/2015/09/Day23-2_hu_d0fd70b45c3007f8.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 23: Cheerlights\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day-22/\"\u003e\n      \u003cimg src=\"/images/2015/09/Day22-1_hu_65cc386f053a314c.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 22: TalkBack\u003c/span\u003e\n  \u003c/a\u003e\n  \u003ca class=\"post-grid-item\" href=\"/en/day-21/\"\u003e\n      \u003cimg src=\"/images/2015/09/Day21-1_hu_7e8bb5f6530b0342.webp\" width=\"480\" height=\"300\" alt=\"\" loading=\"lazy\"\u003e\n    \u003cspan class=\"post-grid-title\"\u003eDay 21: Alarm system\u003c/span\u003e\n  \u003c/a\u003e\n\u003c/div\u003e","title":"The NanoESP Page"},{"content":"Download: Ernteroboter_Programme We have designed a computer network consisting of one Server (NanoESP S), two Arduino Clients (NanoESP C1 and C2) and a Laptop as third Client (running there either Packet Sender https://packetsender.com/download or TWedge of TEC-IT https://www.tec-it.com/de/download/Default.aspx ), to construct a small UDP WiFi network. We denote it as Y-configuration, which symbolizes the connections. The center is the Server S, at the ends of the inclined arms of the Y are the Arduino Clients C1 and C2 and the vertical line is the connection to the Laptop as third Client.\nThe Setup The NanoESP or Pretzel Board is a combination of an Arduino Nano and the WiFi module ESP8266, which are connected via Softserial pin 11 (Arduinos RX) and pin 12 (Arduinos TX). A similar configuration can be realized also self-made. The Clients can principally not communicate with each other directly. This can only be done via the Server. A special message structure enables this. The following IP addresses are assigned:\n192.168.4.1 Server S 192.168.4.2 Client Packet Sender or TWedge: 192.168.4.3 Client C1 192.168.4.4 Client C2 Packet Sender is a program, which enables to send and to receive messsages. TWedge sends and receives messages as well, but enables to visualize the results in Microsoft Excel.\nThe following Ids are assigned:\nId = 0 Client Packet Sender orTWedge Id = 1 Client C1 Id = 2 Client C2 Id = 5 Server S The following ports are used:\n90, 91 Client Packet Sender oder TWedge: 92, 93 Client C1 94, 95 Client C2 The sketches have the following names: S_ with the following designations:\nUDPBidirectional-Server NanoESP S UDPBidirectional-Client1 NanoESP C1 UDPBidirectional-Client2 NanoESP C2 Download: Ernteroboter_Programme The use of library functions is omitted to have a clear idea, which AT commands are sent, to which one can refer by https://room-15.github.io/blog/2015/03/26/esp8266-at-command-reference/..A drawback of the ESP8266 is, that receivings from it can be either messages from outside or answers of the module itself (self generated answers). Sending messages via the ESP8266 is also realized with AT commands. There is no clear separation between an AT mode and working mode (sending and receiving).\nAll configuring AT commands are given in the Setup part of the sketch, although it would not be necessary to configure the ESP8266 after each restart. The AT commands are sent in the subroutine sendCom, which also analyzes the answers of the module on the command without fully printing out it.\nRemark.: In the subroutine SendCom() the expression is used: esp8266.findUntil(\u0026ldquo;OK\u0026rdquo;, \u0026ldquo;ERROR\u0026rdquo;), which is true, when before \u0026ldquo;ERROR\u0026rdquo; \u0026ldquo;OK“ has been found, and false, when at first \u0026ldquo;ERROR\u0026rdquo; has been found or both strings have not been found..\nThe Packet Sender menu looks like:\nThe Packet Sender Program Under „File“ one finds „Settings“, where one has to configure the following:\nPacket Sender Settings (1) Packet Sender Settings (2) In TWedge the following devices have to be configured:\nTwedge Devices Substantially TWedge is a single Client, but in the program sending and receiving is separated. The program receives as Gerät 2 (UDP Client) and sends as Gerät 3 (UDP Server). Received data can be transferred to an Excel sheet and cell contents from the Excel sheet can be sent by TWedge to another Client or the Server.\nOriginal sending and receiving: Sending and receiving are supposed to be realized via the Serial Monitor of the Arduino, which we choose to have a baudrate of 19200. All messages, sent and received are terminated by CR and NL, so that the length is messagelength + 2. To send a message is announced by the following AT command:\nAT+CIPSEND=,\u0026lt;messagelength+2\u0026gt;\nwhere Id is the receivers Id as mentioned above. The ESP8266 answers with a prompt: „\u0026gt;“ and one can input the message. On the receivers side appears the following:\n+IPD, ,:\nwhere Id is here the senders Id and length is the length of message.\nSeparation of At commands and sending and receiving The separation of At commands sending and receiving to/from outside can be realized by the principle, that AT commands are sent solely by the Arduino sketch, and what appears on the Serial Monitor or is sent by it are pure messages. For the message a certain structure is chosen, to be aware about the final receivers Id (frId) or the original senders Id (osId), just what is of interest in the network. To this end the message consists of a net message Msg and a single Id. Both informations are separated by a colon (:).\nmessage = : example: 170pv:1\nWhen a Client sends, Id is the frId, and when it receives, it is the osId. For the Server holds the opposite.\nThe Server can get all information from the original receiving, which can only come from another Client:\n+IPD, ,::\nIf he is not the receiver by himself, he passes the message to the Client with the frId removed and replaced by the osId, in the form:\nmessage = :\nsince for the final receiver is solely the original senders identity (osId) of interest.\nlocation sending receiving Server osId frId Client frId osId Message Structure When via the respective Serial Monitor a message is entered without adding an Id, it is executed on place. Messages, which stem from other places of the network, have the form: +IPD, ,:, thats why the string “+IPD,“ is used to distinguish messages from outside from answers of the ESP.\nIt may seem complicated, this adding of the respective Id, either osId or frId, but enables to handle only one Id for each event. Each participant of the network can send to every other participant and even to himself. Receiving a message, the recipient is aware that it was his address, where the message had to be passed. The only question, from where it is, he can see from the osId. Only the Server needs both informations, and can get it from the receivings.\nIf for example Client 1 wants to send to Client 2 the net message Msg = 123pv, he sends to the Server:\n: = 123pv:2\nafter handling by the Server at Client 2 arrives:\n: = 123pv:1.\nThe programs structure The AT commands for configuring the ESP moduls are given in the Setup and are partially executed in subroutines (ConfigESP, ConfigWifi, StartCon and others), whereas the above mentioned IP addresses are defined and the participants of the network define themselfes as Server or Client (station).\nIn the Loop a hierarchy is defined with if else statements, priorizing receivings, that arrive via ESP, secondly it is looked after news from the Serial Monitor, and only in cases, where both are quiet, it deals with its own tasks.\nReceivings via ESP A receiving from the ESP can be a self generated answer (ESPsga). This is supposed in the beginning of each receiving from the ESP (Flag: ESPsga = true). Only if the sequence “+IPD,” is found, the ESPsga is set false. Since it is an alternative, the receiving is a message from outside. Now follows the parsing of the receiving. In the case of the Server the message might be to send further to the final receiver, by sending it to him while replacing the final receivers Id (frId) by the original senders Id (osId).\nTo this end the subroutine WiFiSend is used.\nSending via the Serial Monitor Messages as well can be sent from each respective Serial Monitor and received messages are printed out there. The Baudrate is 19200 and CR and LF are to be set active.\nStart using The three NanoESP (Pretzelboards) have to be connected to three USB Ports and the Arduino IDE has to be started threefold. In “tools” select the “Arduino Nano” and as processor “ATMega328P” and select the respective COM Port. When the sketches for Server and Clients are uploaded, after some seconds at the Clients both blue LEDs should lid. Test sending and receiving data with the Serial Monitors.\nOn the Laptop the network NanoESP appears:\nDas NanoESP Netzwerk One should connect with this network, but note, that one has no Internet anymore, as long as one is connected with the Y network. The Firewall has to be deactivated:\nFirewall deaktivieren Afterwards one can send from each Serial Monitor to another network participant messages and receive from others messages.\nFor example:\n: as example: a letter from me:0\n(this message goes to the Laptop and either Packet Sender or TWedge).\nWe wish you fun with your WiFi UDP Y network and hope, that our work will help you further.\nDr. Christian Rempel \u0026amp; Laurin Kettner\nZeuthen im August 2018\nRefer to AT commands: https://room-15.github.io/blog/2015/03/26/esp8266-at-command-reference/\nDownload: Ernteroboter_Programme ","permalink":"https://neu-iot.fkainka.de/en/wifi-udp-y-netzwerk-aus-drei-pretzelboards-und-einem-laptop/","summary":"\u003ch2 id=\"download-ernteroboter_programme\"\u003e\u003ca href=\"/images/2018/10/Ernteroboter_Programme.zip\"\u003eDownload: Ernteroboter_Programme\u003c/a\u003e\u003c/h2\u003e\n\u003cp\u003eWe have designed a computer network consisting of one Server (NanoESP S), two Arduino Clients (NanoESP C1 and C2) and a Laptop as third Client (running there either Packet Sender \u003ca href=\"https://packetsender.com/download\"\u003ehttps://packetsender.com/download\u003c/a\u003e or TWedge of TEC-IT \u003ca href=\"https://www.tec-it.com/de/download/Default.aspx\"\u003ehttps://www.tec-it.com/de/download/Default.aspx\u003c/a\u003e ), to construct a small UDP WiFi network. We denote it as Y-configuration, which symbolizes the connections. The center is the Server S, at the ends of the inclined arms of the Y are the Arduino Clients C1 and C2 and the vertical line is the connection to the Laptop as third Client.\u003c/p\u003e","title":"WiFi UDP Y-Network consisting of three NanoESP (Pretzel Boards) and Laptop"},{"content":"With the last test in this Advent, we get really Christmasy. We\u0026rsquo;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.\nBehind today\u0026rsquo;s door is a retro-reflective sensor. This is actually two components, an IR transmitter diode and a phototransistor. It\u0026rsquo;s not very easy to see which way the elements have to be connected in terms of polarity. For this reason, it\u0026rsquo;s best if you connect the photoelectric sensor with the connection cables according to the example shown. Then you won\u0026rsquo;t be able to switch the polarity as easily.\nThis is how to connect the retro-reflective sensor Today\u0026rsquo;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.\nThe last layout of the Advent calendar The sketch: A16_P24_MQTT_Present.ino /* MQTT Present Change SSID and PASSWORD. */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_MQTT.h\u0026gt; #include \u0026lt;SoftwareSerial.h\u0026gt; #include \u0026lt;RGBLED.h\u0026gt; #include \u0026lt;RGBColor.h\u0026gt; #include \u0026#34;pitches.h\u0026#34; #include \u0026#34;songs.h\u0026#34; #define SSID \u0026#34;YourSSID\u0026#34; #define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 #define DEBUG true #define RED 3 #define GREEN 5 #define BLUE 6 #define GND 4 #define BUTTON 7 #define PIEZO 8 #define IR A1 #define PHOTO A0 NanoESP nanoesp = NanoESP(); NanoESP_MQTT mqtt = NanoESP_MQTT(nanoesp); RGBLED rgbLED = RGBLED(RED, GREEN, BLUE, 0, 3, 0); String ip, mqttId; RGBColor newColor = RGBColor(0, 0, 0); RGBColor offColor = RGBColor(0, 0, 0); int curSong; bool isOpen = true; mqtt_msg opened = {\u0026#34;\u0026#34;, \u0026#34;Opened\u0026#34;, 0, true}; void setup() { pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); pinMode(GND, OUTPUT); digitalWrite(GND, LOW); pinMode(IR, OUTPUT); Serial.begin(19200); nanoesp.init(); //Station Mode nanoesp.configWifiMode(STATION); // nanoesp.configWifiStation(SSID, PASSWORD); if (nanoesp.wifiConnected()) { Serial.println(F(\u0026#34;Wifi Connected\u0026#34;)); digitalWrite(LED_WLAN, HIGH); } else { Serial.println(F(\u0026#34;Wifi not Connected\u0026#34;)); } //Print IP in Terminal nanoesp.getIpMac( ip, mqttId); Serial.println(\u0026#34;My IP: \u0026#34; + ip); //Print MQTTid in Terminal mqttId.replace(\u0026#34;:\u0026#34;, \u0026#34;\u0026#34;); Serial.println(\u0026#34;My MQTT ID: \u0026#34; + mqttId+\u0026#34;\\n\u0026#34;); if (mqtt.connect(0, \u0026#34;broker.fkainka.de\u0026#34;, 1883, mqttId)) { Serial.println(F(\u0026#34;Connected to Broker\u0026#34;)); Serial.println(F(\u0026#34;My personal Topic is:\u0026#34;)); Serial.println(\u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/\\n\u0026#34;); if (mqtt.subscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/present\u0026#34;, 2, newPresent)) Serial.println(F(\u0026#34;Subscribed to present\u0026#34;)); else Serial.println(F(\u0026#34;Error Subscribe to present\u0026#34;)); } else { Serial.println(F(\u0026#34;error connecting\u0026#34;)); } setSongs(); } void loop() { int id, len; if (nanoesp.recvData(id, len)) { mqtt.recvMQTT(id, len); //auto hanlder mit Funktionen } mqtt.stayConnected(0); //Present opened? if (!isOpen) { if (checkIsOpen()) { isOpen = true; Serial.println(\u0026#34;Open\u0026#34;); mqtt.publish(0, \u0026amp;opened); rgbLED.crossfade(newColor); play(curSong); } } else { //Present closed? if (!checkIsOpen()) { isOpen = false; Serial.println(\u0026#34;Closed\u0026#34;); rgbLED.crossfade(offColor); } } } bool checkIsOpen() { int high; int low; digitalWrite(IR, HIGH); delay(1); high = analogRead(PHOTO); digitalWrite(IR, LOW); delay(1); low = analogRead(PHOTO); digitalWrite(IR, HIGH); delay(1); high += analogRead(PHOTO); digitalWrite(IR, LOW); delay(1); low += analogRead(PHOTO); if (high \u0026gt; (2 * low)) { return false; } else { return true; } } String oldTopic; void newPresent(String value) { Serial.println(\u0026#34;New Present for \u0026#34; + value); if (opened.topic != \u0026#34;\u0026#34;) { mqtt.unsubscribe(0, opened.topic + \u0026#34;/color\u0026#34;); Serial.println(F(\u0026#34;Unsubscribed old color\u0026#34;)); mqtt.unsubscribe(0, opened.topic + \u0026#34;/song\u0026#34;); Serial.println(F(\u0026#34;Unsubscribed old song\u0026#34;)); } opened.topic = \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/present/\u0026#34; + value; mqtt.subscribe(0, opened.topic + \u0026#34;/color\u0026#34;, 2, gotnewColor); Serial.println(F(\u0026#34;Subscribed new Color\u0026#34;)); // Recieve retained msg before subscribing next int id, len; for (int i = 0; i \u0026lt;= 250; i++) { if (nanoesp.recvData(id, len)) { if (mqtt.recvMQTT(id, len)) { break; //auto hanlder mit Funktionen } } delay(10); } mqtt.subscribe(0, opened.topic + \u0026#34;/song\u0026#34;, 2, gotnewSong); Serial.println(F(\u0026#34;Subscribed new Song\u0026#34;)); } void gotnewColor(String value) { Serial.println(\u0026#34;New color: \u0026#34; + value); value = value.substring(value.indexOf(\u0026#39;(\u0026#39;) + 1); //255,23,226) int red = value.substring(0, value.indexOf(\u0026#39;,\u0026#39;)).toInt(); value = value.substring(value.indexOf(\u0026#39;,\u0026#39; ) + 1); //23,226) int green = value.substring(0, value.indexOf(\u0026#39;,\u0026#39;)).toInt(); value = value.substring(value.indexOf(\u0026#39;,\u0026#39;) + 1); //226) int blue = value.substring(0, value.indexOf(\u0026#39;)\u0026#39;)).toInt(); newColor = RGBColor(red, green, blue); //for direct change //analogWrite(RED, red); analogWrite(GREEN, green); analogWrite(BLUE, blue); } void gotnewSong(String value) { Serial.println(\u0026#34;New Song: \u0026#34; + value); curSong = value.toInt(); } void setSongs() { //Configuration for songs, you may change some songs int numTunes = 5; tunes[0] = {weWish, weWishDurations, sizeof(weWish) / sizeof(int), 80, N_C6, N_C5}; tunes[1] = {alleJahre, alleJahreDurations, sizeof(alleJahre) / sizeof(int), 80, N_C6, N_C5}; tunes[2] = {jingleBells, jingleBellsDurations, sizeof(jingleBells) / sizeof(int), 60, 784, 523}; tunes[3] = {firstNoel, firstNoelDurations, sizeof(firstNoel) / sizeof(int), 60, 523, 262}; //tunes[3] = {oHolyNight, oHolyNightDurations, sizeof(oHolyNight) / sizeof(int), 100, 659, 262}; tunes[4] = {whatChild, whatChildDurations, sizeof(whatChild) / sizeof(int), 100, 587, 247}; tunes[5] = {weThreeKings, weThreeKingsDurations, sizeof(weThreeKings) / sizeof(int), 100, 587, 294}; } void play(int tuneNum) { int randomOffset = random(32); int numNotes = tunes[tuneNum].numCount; int tempo = tunes[tuneNum].tempo; for (int thisNote = 0; thisNote \u0026lt; numNotes; thisNote++) { int freq = pgm_read_word_near(tunes[tuneNum].melody + thisNote) * 2; int noteDuration = tempo * pgm_read_byte_near(tunes[tuneNum].durations + thisNote); if (freq \u0026gt; 0) { int n = (map(freq, tunes[tuneNum].low, tunes[tuneNum].high, 1, 31) + randomOffset) % 31 + 1; tone(PIEZO, freq, noteDuration); } else { // REST delay(noteDuration); } delay(noteDuration); // to distinguish the notes, set a minimum time between them. // the note\u0026#39;s duration + 30% seems to work well: int pauseBetweenNotes = noteDuration * 0.30; delay(pauseBetweenNotes); noTone(PIEZO); } } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nAfter you have loaded today\u0026rsquo;s programme on the controller, go once more to the http://www.hivemq.com/try-out/ site and connect to the broker broker.fkainka.de. Once you\u0026rsquo;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:\nNanoESP/MyMQTTiD/present/person/color\nNanoESP/MyMQTTiD/present/person/song\nwhere you replace \u0026ldquo;MyMQTTiD\u0026rdquo; with your personal ID and \u0026ldquo;person\u0026rdquo; with the person to whom you want to give the present. In the topic \u0026ldquo;color,\u0026rdquo; publish a colour according to the pattern you already know, rgb(X,X,X), and in the topic \u0026ldquo;song\u0026rdquo; 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:\nTopic Value Retain NanoESP/mqttId/present/mother/color rgb(255,255,0) | X || NanoESP/mqttId/present/mother/song |\n2 | X || NanoESP/mqttId/present/father/color |\nrgb(0,0,255) | X || NanoESP/mqttId/present/father/song |\n1 | X || NanoESP/mqttId/present/sister/color |\nrgb(255,0,255) | X || NanoESP/mqttId/present/sister/song |\n4 | X |\nNow you can switch between these persons by publishing the person in the topic\nNanoESP/MyMQTTiD/present\nIf you enter \u0026ldquo;sister\u0026rdquo; 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.\n","permalink":"https://neu-iot.fkainka.de/en/day-24-gift-box/","summary":"\u003cp\u003eWith the last test in this Advent, we get really Christmasy. We\u0026rsquo;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.\u003c/p\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door is a retro-reflective sensor. This is actually two components, an IR transmitter diode and a phototransistor. It\u0026rsquo;s not very easy to see which way the elements have to be connected in terms of polarity. For this reason, it\u0026rsquo;s best if you connect the photoelectric sensor with the connection cables according to the example shown. Then you won\u0026rsquo;t be able to switch the polarity as easily.\u003c/p\u003e","title":"Day 24: Gift box"},{"content":"Behind the door for today is a battery clip for a 9 V block, with which you can make the entire system moveable. An alternative to a battery is a power bank (a rechargeable battery pack, normally for mobile phones). You can see in today\u0026rsquo;s layout picture how to connect a 9 V battery correctly.\nThis is how you can connect a 9 V battery to today\u0026#x27;s layout Climate data should be captured again today. But this time they are published through the MQTT broker and are thus accessible worldwide. The data could thus be called up via a plug-in and stored in a database.\nThe sketch: A16_P23_MQTT_Climate.ino /* MQTT Basic functions Change SSID and PASSWORD. */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_MQTT.h\u0026gt; #include \u0026lt;SoftwareSerial.h\u0026gt; #define SSID \u0026#34;YourSSID\u0026#34; #define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 #define TEMP A0 #define LIGHT A1 #define HUMIDITY A4 #define GND A5 NanoESP nanoesp = NanoESP(); NanoESP_MQTT mqtt = NanoESP_MQTT(nanoesp); mqtt_msg newTemp; mqtt_msg newLight; mqtt_msg newHum; String ip, mqttId; void setup() { Serial.begin(19200); nanoesp.init(); nanoesp.configWifiStation(SSID, PASSWORD); if (nanoesp.wifiConnected()) { Serial.println(F(\u0026#34;Wifi Connected\u0026#34;)); digitalWrite(LED_WLAN, HIGH); } else { Serial.println(F(\u0026#34;Wifi not Connected\u0026#34;)); } //Print IP in Terminal nanoesp.getIpMac( ip, mqttId); Serial.println(\u0026#34;My IP: \u0026#34; + ip); //Print MQTTid in Terminal mqttId.replace(\u0026#34;:\u0026#34;, \u0026#34;\u0026#34;); Serial.println(\u0026#34;My MQTT ID: \u0026#34; + mqttId+\u0026#34;\\n\u0026#34;); newTemp = {\u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/climate/temp\u0026#34;, \u0026#34;0\u0026#34;, 0, true}; newLight = {\u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/climate/light\u0026#34;, \u0026#34;0\u0026#34;, 0, true}; newHum = {\u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/climate/hum\u0026#34;, \u0026#34;0\u0026#34;, 0, true}; //topic, value, QOS, retain mqtt_msg lastWill = {\u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/climate/status\u0026#34;, \u0026#34;offline\u0026#34;, 0, true}; //ConnectionID, Brooker, Port, Clean Session, Keep alive Time (def. 120s), Pointer to lastWill MSG, Username, Password if (mqtt.connect(0, \u0026#34;broker.fkainka.de\u0026#34;, 1883, mqttId, true, 10, \u0026amp;lastWill, \u0026#34;\u0026#34;, \u0026#34;\u0026#34;)) { Serial.println(F(\u0026#34;Connected to Broker\u0026#34;)); //Change msg lastWill.value = \u0026#34;online\u0026#34;; mqtt.publish(0, \u0026amp;lastWill); } else { Serial.println(F(\u0026#34;error connecting\u0026#34;)); } } void loop() { int id, len; if (nanoesp.recvData(id, len)) { mqtt.recvMQTT(id, len); //auto hanlder mit Funktionen } mqtt.stayConnected(0); sendValues(); } void sendValues() { newTemp.value = String(getTemp()); newLight.value = String(getLight()); newHum.value = String(getRF()); mqtt.publish(0, \u0026amp;newTemp); mqtt.publish(0, \u0026amp;newLight); mqtt.publish(0, \u0026amp;newHum); //delay(250); } //--------------------------------Sensors---------------------------------------------------- int getRF() { long U, R; double F; pinMode(HUMIDITY, INPUT); // Ddrb.3 = 0 \u0026#39;Eingang digitalWrite(HUMIDITY, HIGH); // Portb.3 = 1 \u0026#39;Pullup ein U = analogRead(HUMIDITY); // U = Getadc(3) digitalWrite(HUMIDITY, LOW); // Portb.3 = 0 \u0026#39;Pullup Aus pinMode(HUMIDITY, OUTPUT); // Ddrb.3 = 1 \u0026#39;Nierohmig pinMode(GND, INPUT); // Ddrb.4 = 0 \u0026#39;Eingang digitalWrite(GND, HIGH); // Portb.4 = 1 \u0026#39;Pullup ein U += analogRead(GND); // U = U + Getadc(2) digitalWrite(GND, LOW); // Portb.4 = 0 \u0026#39;Pullup Aus pinMode(GND, OUTPUT); // Ddrb.4 = 1 \u0026#39;Nierohmig. entladen U = U / 2; R = 3500 * U; //\u0026#39;R=35k*(U/1023-U) U = 1023 - U; R = (U \u0026gt; 0) ? R / U : 999999; //alternativ writing to: if(U\u0026gt;0) R = R/U; else R=999999; R = R - 450; //- interner Bahnwiderstand 0,45 k //Calculate Humidity F = R / 280; F = log(F); //ln f !!! F = F * 8.9; F = 100 - F; F = round(F); // Serial.println(String(R) + \u0026#34;Ohm \u0026#34; + String(F) + \u0026#34;%\u0026#34;); //delay(500); return F; } double getTemp() { //Source: http://playground.arduino.cc/ComponentLib/Thermistor2 double Temp; int RawADC = analogRead(TEMP); Temp = log(10000.0 * ((1024.0 / RawADC - 1))); // =log(10000.0/(1024.0/RawADC-1)) // for pull-up configuration Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp )) * Temp ); Temp = Temp - 273.15; // Convert Kelvin to Celcius // Temp = (Temp * 9.0)/ 4.7 + 32.0; // Convert Celcius to Fahrenheit Temp = round(Temp * 10); Temp = Temp / 10; return Temp; } int getLight() { int vLight = analogRead(LIGHT); return vLight; } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nDownload today\u0026rsquo;s programme and program your NanoESP with it. After a short time, the board is connected to the WLAN and the broker and begins to send the measurement data. Now go to thehttp://www.hivemq.com/try-out/ page and connect to the broker. Subscribe to these topics:\nNanoESP/MyMQTTiD/climate/temp\nNanoESP/MyMQTTiD/climate/light\nNanoESP/MyMQTTiD/climate/hum\nAs always, replace MyMQTTiD with your personal ID. You now see in the browser how the data arrive in quick succession. Next subscribe to the following topic:\nNanoESP/MyMQTTiD/climate/status\nYou ought to receive the message \u0026ldquo;online.\u0026rdquo; Now disconnect the board from the power. Logically, you should now no longer receive any new temperature data. However, after approx. 10 seconds, the status changes from \u0026ldquo;online\u0026rdquo; to \u0026ldquo;offline.\u0026rdquo; How is that possible if the board can\u0026rsquo;t send any messages at all anymore?\nThe trick lies in the last will message that was defined upon connection to the broker. This message is sent when the connection is suddenly broken. But it takes a while for the broker to notice the interruption of the connection. How long it takes is likewise defined when the connection is established, with the keep-alive time. If no message is sent from the board to the broker within the time given there, the broker assumes that the connection was broken. This time is defined in the library as standard at 120 seconds. For today\u0026rsquo;s test, however, it is 10 seconds. So that the connection is not cut off only because the NanoESP currently has nothing to report, there is the stayConnected command. Here, if not stated otherwise, a ping is sent to the broker after half of the keep-alive time as a sign that the connection is still active.\n","permalink":"https://neu-iot.fkainka.de/en/day23-2016/","summary":"\u003cp\u003eBehind the door for today is a battery clip for a 9 V block, with which you can make the entire system moveable. An alternative to a battery is a power bank (a rechargeable battery pack, normally for mobile phones). You can see in today\u0026rsquo;s layout picture how to connect a 9 V battery correctly.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/09/Day23_Climate_Steckplatine.jpg\"\u003e\u003cimg class=\"wp-image-1410 size-large\" src=\"/images/2016/09/Day23_Climate_Steckplatine.jpg\" alt=\"So können Sie eine 9V-Batterie am heutigen Aufbau anschließen\" width=\"616\" height=\"337\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThis is how you can connect a 9 V battery to today\u0026#x27;s layout\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eClimate data should be captured again today. But this time they are published through the MQTT broker and are thus accessible worldwide. The data could thus be called up via a plug-in and stored in a database.\u003c/p\u003e","title":"Day 23: MQTT Climate"},{"content":"Today\u0026rsquo;s trial is about MQTT and a global project that was presented last year: the Cheerlights Project by Hans Schaaler. For everyone who doesn\u0026rsquo;t know the project: It\u0026rsquo;s about globally networked coloured lights that can be simultaneously controlled through Twitter commands. Another version of this project was part of last year\u0026rsquo;s Advent calendar. This year we have the version with MQTT and expanded functions.\nBehind today\u0026rsquo;s door is a 1-kohm resistor. The layout consists of the RGB LED with series resistors and a button.\nTodays layout Download today\u0026rsquo;s programme. Before you can transfer the programme to the NanoESP, you have to install a library. This is the Crossfade library by Radek Wierzbicki (source: https://github.com/radekw/Arduino/tree/5f24ce7c8db9dfbb5252b59824c3217d851b3a3c). For practical reasons, a copy of the library version used is contained as a ZIP file in the Sketch folder. You can easily add integrate this through the Library Manager in the Arduino IDE by selecting the ZIP directory in the Sketch folder Sketch \u0026gt; Integrate library \u0026gt; Integrate .ZIP library. Now the programme compiles, and you can upload it to the NanoESP\nThe sketch: A16_P22_MQTT_Cheerlights.ino /* MQTT Cheerlights Change SSID and PASSWORD. */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_MQTT.h\u0026gt; #include \u0026lt;SoftwareSerial.h\u0026gt; #include \u0026lt;RGBLED.h\u0026gt; #include \u0026lt;RGBColor.h\u0026gt; //#define SSID \u0026#34;YourSSID\u0026#34; //#define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 #define RED 3 #define GREEN 5 #define BLUE 6 #define GND 4 #define BUTTON 7 NanoESP nanoesp = NanoESP(); NanoESP_MQTT mqtt = NanoESP_MQTT(nanoesp); RGBLED rgbLED = RGBLED(RED, GREEN, BLUE, 0, 3, 0); RGBColor red = RGBColor(100, 0, 0); RGBColor green = RGBColor(0, 100, 0); RGBColor blue = RGBColor(0, 0, 100); RGBColor cyan = RGBColor(0, 100, 100); RGBColor white = RGBColor(100, 100, 100); RGBColor warmwhite = RGBColor(100, 87, 87); RGBColor purple = RGBColor(50, 0, 50); RGBColor magenta = RGBColor(100, 0, 100); RGBColor yellow = RGBColor(100, 100 , 0); RGBColor orange = RGBColor(100, 65 , 0); RGBColor pink = RGBColor(100, 75 , 100); String ip, mqttId; void setup() { pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); pinMode(GND, OUTPUT); digitalWrite(GND, LOW); pinMode(BUTTON, INPUT_PULLUP); Serial.begin(19200); nanoesp.init(); //! Only if you use a new Network // nanoesp.configWifi(STATION, SSID, PASSWORD); //Station Mode nanoesp.configWifiMode(STATION); //delay(1000); // Wait till Connected to WiFi if (nanoesp.wifiConnected())digitalWrite(LED_WLAN, HIGH); else Serial.println(F(\u0026#34;Error WLAN Connect\u0026#34;)); //Print IP in Terminal nanoesp.getIpMac( ip, mqttId); Serial.println(\u0026#34;My IP: \u0026#34; + ip); //Print MQTTid in Terminal mqttId.replace(\u0026#34;:\u0026#34;, \u0026#34;\u0026#34;); Serial.println(\u0026#34;My MQTT ID: \u0026#34; + mqttId + \u0026#34;\\n\u0026#34;); //if (mqtt.connect(0, \u0026#34;broker.hivemq.com\u0026#34;, 1883, mqttId)) { //connect to alternative broker if (mqtt.connect(0, \u0026#34;broker.fkainka.de\u0026#34;, 1883, mqttId)) { //connect to broker Serial.println(F(\u0026#34;Connected to Broker\u0026#34;)); Serial.println(F(\u0026#34;My personal Topic is:\u0026#34;)); Serial.println(\u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/\\n\u0026#34;); if (mqtt.subscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/rgb/mode\u0026#34;, 2, changeMode)) Serial.println(\u0026#34;Subscribed to:\\nNanoESP/\u0026#34; + mqttId + \u0026#34;/rgb/mode\u0026#34;); else Serial.println(F(\u0026#34;Error Subscribe to rgb Mode\u0026#34;)); } else { Serial.println(F(\u0026#34;error connecting\u0026#34;)); } } bool cheerlightsMode; void loop() { int id, len; if (nanoesp.recvData(id, len)) { mqtt.recvMQTT(id, len); //auto handle recieved data by defined functions } mqtt.stayConnected(0); if (!digitalRead(BUTTON)) { //change cheerlights mode mqtt_msg msgMode = {\u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/rgb/mode\u0026#34;, String(!cheerlightsMode), 0, true}; //type: mqtt_msg (topic, msg, qos, retain) if (mqtt.publish(0, \u0026amp;msgMode)) Serial.println(F(\u0026#34;Changed mode\\n\u0026#34;)); msgMode.value = \u0026#34;1\u0026#34;; while (!digitalRead(BUTTON)) {}; } } void changeMode(String value) { if (value == \u0026#34;1\u0026#34;) { Serial.println(\u0026#34;Cheerlights mode\\n\u0026#34;); if (mqtt.unsubscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/rgb/color\u0026#34;)) Serial.println(\u0026#34;Unsubscribed from: NanoESP/\u0026#34; + mqttId + \u0026#34;/rgb/color\u0026#34;); if (mqtt.subscribe(0, \u0026#34;Info/Cheerlights\u0026#34;, 2, changeCheerlights)) Serial.println(F(\u0026#34;Subscribed to Cheerlights\u0026#34;)); cheerlightsMode = true; } else { Serial.println(\u0026#34;Personal light mode\\n\u0026#34;); if (mqtt.unsubscribe(0, \u0026#34;Info/Cheerlights\u0026#34;)) Serial.println(F(\u0026#34;Unsubscribed from Cheerlights\u0026#34;)); else Serial.println(F(\u0026#34;Error\u0026#34;)); if (mqtt.subscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/rgb/color\u0026#34;, 2, changeColor)) Serial.println(\u0026#34;Subscribed to: NanoESP/\u0026#34; + mqttId + \u0026#34;/rgb/color\u0026#34;); cheerlightsMode = false; } } void changeCheerlights(String color) { Serial.println(\u0026#34;New Cheerlights color : \u0026#34; + color); if (color == \u0026#34;red\u0026#34;) rgbLED.crossfade(red); else if (color == \u0026#34;green\u0026#34;) rgbLED.crossfade(green); else if (color == \u0026#34;blue\u0026#34;) rgbLED.crossfade(blue); else if (color == \u0026#34;cyan\u0026#34;) rgbLED.crossfade(cyan); else if (color == \u0026#34;white\u0026#34;) rgbLED.crossfade(white); else if (color == \u0026#34;warmwhite\u0026#34;) rgbLED.crossfade(warmwhite); else if (color == \u0026#34;purple\u0026#34;) rgbLED.crossfade(purple); else if (color == \u0026#34;magenta\u0026#34;) rgbLED.crossfade(magenta); else if (color == \u0026#34;yellow\u0026#34;) rgbLED.crossfade(yellow); else if (color == \u0026#34;orange\u0026#34;) rgbLED.crossfade(orange); } void changeColor(String value) { Serial.println(\u0026#34;New color: \u0026#34; + value); //rgb(255,23,226) value = value.substring(value.indexOf(\u0026#39;(\u0026#39;) + 1); //255,23,226) int red = value.substring(0, value.indexOf(\u0026#39;,\u0026#39;)).toInt(); value = value.substring(value.indexOf(\u0026#39;,\u0026#39; ) + 1); //23,226) int green = value.substring(0, value.indexOf(\u0026#39;,\u0026#39;)).toInt(); value = value.substring(value.indexOf(\u0026#39;,\u0026#39;) + 1); //226) int blue = value.substring(0, value.indexOf(\u0026#39;)\u0026#39;)).toInt(); RGBColor vColor = RGBColor(red, green, blue); rgbLED.crossfade(vColor); //for direct change //analogWrite(RED, red); analogWrite(GREEN, green); analogWrite(BLUE, blue); } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nAfter uploading the programme, now go back to the site www.hivemq.com/try-out/ and establish a connection to the broker.fkainka.de broker. There, with the topic\nNanoESP/MyMQTTiD/rgb/mode\nyou can switch the mode between Cheerlights and personal colours by publishing a 1 or a 0. It\u0026rsquo;s important that for all messages you activate the Retain check box before you send the message with the Publish button next to it on the right. Retain means something like Save because the broker stores the message. Now, as soon as a device subscribes to the topic, the saved message is sent in its entirety to the device. You can thus save states. Incidentally, the button on the breadboard likewise switches the mode using a message with Retain flag. So later on, you don\u0026rsquo;t always have to go to the Try Out site to switch the mode.\nIn personal mode (mode 0), you can give the RGB LED a colour by publishing a message in the topic\nNanoESP/MyMQTTiD/rgb/color\nin the form\nrgb(X,X,X)\nThe X stands here respectively for a PWM value between 0 and 255. The sequence of colours is red, green, blue. So for a green colour with maximum brightness, you have to publish\nrgb(0,255,0)\nDon\u0026rsquo;t forget to check the Retain box.\nIn Cheerlights mode (mode 1), the board subscribes to a topic to which the current Cheerlights colour is published. You can change this colour by composing a Twitter message and thereby changing your colour and also the colour of all other Cheerlights users. First, the message must contain #Cheerlights, @Cheerlights or simply the keyword Cheerlights; second, one of the predefined colours must come after the keyword. The predefined colours include:\nred, green, blue, cyan, white, warmwhite, purple, magenta, yellow, orange, pink\nA potential tweet thus looks like this:\nTesting my #cheerlights #MQTT project on my #NanoESP with the color blue\nYou thereby give yourself and the whole world a new colour. But if you prefer your personal colours without someone else butting in, simply switch back to the personal mode, and now the LED changes back to your predefined colour.\n","permalink":"https://neu-iot.fkainka.de/en/day22-2016/","summary":"\u003cp\u003eToday\u0026rsquo;s trial is about MQTT and a global project that was presented last year: the Cheerlights Project by Hans Schaaler. For everyone who doesn\u0026rsquo;t know the project: It\u0026rsquo;s about globally networked coloured lights that can be simultaneously controlled through Twitter commands. Another version of this project was part of last year\u0026rsquo;s Advent calendar. This year we have the version with MQTT and expanded functions.\u003c/p\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door is a 1-kohm resistor. The layout consists of the RGB LED with series resistors and a button.\u003c/p\u003e","title":"Day 22: MQTT Cheerlights"},{"content":"In today\u0026rsquo;s test, we\u0026rsquo;ll illuminate the characteristics and possibilities of MQTT in more detail by creating a practical scenario. In the example, there is a building with two rooms, each of which has a light switch, a light and an alarm sensor. The light switch switches the light of the respective room on or off. The alarm sensors activate a building-wide alarm.\nNormally, seven different devices would be used here, which are all connected to each other through an MQTT broker. But since we probably have only one NanoESP, this will simulate all devices. For this reason, today\u0026rsquo;s layout looks somewhat complicated. The LED D3 is used today as the second light. Therefore, today it won\u0026rsquo;t show you whether you\u0026rsquo;re connected to the WLAN. The tilt sensors are used on the extension cables as alarm sensors. A person could, for example, attach them to doors or windows so that they trigger an alarm if the entry opens. Behind today\u0026rsquo;s door is the second sensor.\nThe layout for Day 21 with a 1-kohm resistor The sketch: A16_P21_MQTT_Rooms.ino /* MQTT Roons Change SSID and PASSWORD. */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_MQTT.h\u0026gt; #include \u0026lt;SoftwareSerial.h\u0026gt; #define SSID \u0026#34;YourSSID\u0026#34; #define PASSWORD \u0026#34;YourPassword\u0026#34; NanoESP nanoesp = NanoESP(); NanoESP_MQTT mqtt = NanoESP_MQTT(nanoesp); String ip, mqttId; #define SWITCH_ROOM_1 5 #define SWITCH_ROOM_2 7 #define ALARMSENSOR_ROOM_1 A3 #define ALARMSENSOR_ROOM_2 A2 #define LIGHT_ROOM_1 9 #define LIGHT_ROOM_2 13 #define PIEZO 8 unsigned long previousMillisAlarm = 0; unsigned long intervalAlarm = 1000; int durationAlarm; bool alarmActive = false; bool alarmToggle; bool alarm_status_v; bool room1_light_stauts_v; bool room2_light_stauts_v; void setup() { pinMode(SWITCH_ROOM_1, INPUT_PULLUP); pinMode(SWITCH_ROOM_2, INPUT_PULLUP); pinMode(ALARMSENSOR_ROOM_1, INPUT); pinMode(ALARMSENSOR_ROOM_2, INPUT); pinMode(LIGHT_ROOM_1, OUTPUT); pinMode(LIGHT_ROOM_2, OUTPUT); pinMode(A1, OUTPUT); pinMode(A1, OUTPUT); digitalWrite(A1, HIGH); digitalWrite(A1, HIGH); Serial.begin(19200); nanoesp.init(); //! Only if you want to change the ACCESPOINT configuration //nanoesp.configWifi(ACCESSPOINT, \u0026#34;NanoESP\u0026#34;, \u0026#34;\u0026#34;); //! Only if you use a new Network // nanoesp.configWifi(DUAL, SSID, PASSWORD); //Station Mode nanoesp.configWifiMode(STATION); //delay(1000); // Wait till Connected to WiFi if (nanoesp.wifiConnected())Serial.println(F(\u0026#34;WLAN Connected\u0026#34;)); else Serial.println(F(\u0026#34;Error WLAN Connect\u0026#34;)); //Print IP in Terminal nanoesp.getIpMac( ip, mqttId); Serial.println(\u0026#34;My IP: \u0026#34; + ip); //Print MQTTid in Terminal mqttId.replace(\u0026#34;:\u0026#34;, \u0026#34;\u0026#34;); Serial.println(\u0026#34;My MQTT ID: \u0026#34; + mqttId + \u0026#34;\\n\u0026#34;); //if (mqtt.connect(0, \u0026#34;broker.hivemq.com\u0026#34;, 1883, mqttId)) { //connect to alternative broker if (mqtt.connect(0, \u0026#34;broker.fkainka.de\u0026#34;, 1883, mqttId)) { //connect to broker Serial.println(F(\u0026#34;Connected to Broker\u0026#34;)); Serial.println(F(\u0026#34;My personal Topic is:\u0026#34;)); Serial.println(\u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/\\n\u0026#34;); //subcribe: Connection ID, Topic, Max Qualitiy of Service, Function to call when msg recieved if (mqtt.subscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/room1/light\u0026#34;, 2, room1_light_status)) Serial.println(F(\u0026#34;Subscribed to /room1/light\u0026#34;)); if (mqtt.subscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/room1/light\u0026#34;, 2, room1_light)) Serial.println(F(\u0026#34;Subscribed to /room1/light\u0026#34;)); if (mqtt.subscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/room2/light\u0026#34;, 2, room2_light_status)) Serial.println(F(\u0026#34;Subscribed to /room2/light\u0026#34;)); if (mqtt.subscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/room2/light\u0026#34;, 2, room2_light)) Serial.println(F(\u0026#34;Subscribed to /room2/light\u0026#34;)); if (mqtt.subscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/+/alarm\u0026#34;, 2, alarm_status)) Serial.println(F(\u0026#34;Subscribed to alarm\u0026#34;)); } else { Serial.println(F(\u0026#34;error connecting\u0026#34;)); } } void loop() { int id, len; if (nanoesp.recvData(id, len)) { mqtt.recvMQTT(id, len); //auto handle recieved data by defined functions } checkConditions(); mqtt.stayConnected(0); if (alarm_status_v) alarm(); } void checkConditions() { room1_alarmsensor_check(); room2_alarmsensor_check(); room1_button_check(); room2_button_check(); } //----------------------------Room1--------------------------------------------- //____________________________Switch__________________________________________ //Switch knows about the light status so it can toggle the light void room1_light_status (String value) { Serial.println(\u0026#34;Light status Room 1 :\u0026#34; + value); if (value == \u0026#34;1\u0026#34;) { room1_light_stauts_v = true; } else if (value == \u0026#34;0\u0026#34;) { room1_light_stauts_v = false; } } void room1_button_check () { if (!digitalRead(SWITCH_ROOM_1)) { if (mqtt.publish(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/room1/light\u0026#34;, String(!room1_light_stauts_v))) Serial.println(F(\u0026#34;Button 1 pressed\\n\u0026#34;)); while (!digitalRead(SWITCH_ROOM_1)) {}; } } //____________________________Light___________________________________________ void room1_light (String value) { if (value == \u0026#34;1\u0026#34;) { Serial.println(F(\u0026#34;Light on\u0026#34;)); digitalWrite(LIGHT_ROOM_1, HIGH); } else if (value == \u0026#34;0\u0026#34;) { Serial.println(F(\u0026#34;Light off\u0026#34;)); digitalWrite(LIGHT_ROOM_1, LOW); } } //____________________________Alarmsensor___________________________________________ void room1_alarmsensor_check () { if (!digitalRead(ALARMSENSOR_ROOM_1)) { if (mqtt.publish(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/room1/alarm\u0026#34;, \u0026#34;1\u0026#34;)) Serial.println(F(\u0026#34;Alarm Room 1\\n\u0026#34;)); while (!digitalRead(ALARMSENSOR_ROOM_1)) {}; } } //----------------------------Room2--------------------------------------------- //____________________________Switch__________________________________________ //Switch knows about the light status so it can toggle the light void room2_light_status (String value) { Serial.println(\u0026#34;Light status Room 2 :\u0026#34; + value); if (value == \u0026#34;1\u0026#34;) { room2_light_stauts_v = true; } else if (value == \u0026#34;0\u0026#34;) { room2_light_stauts_v = false; } } void room2_button_check () { if (!digitalRead(SWITCH_ROOM_2)) { if (mqtt.publish(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/room2/light\u0026#34;, String(!room2_light_stauts_v))) Serial.println(F(\u0026#34;Button 2 pressed\\n\u0026#34;)); while (!digitalRead(SWITCH_ROOM_2)) {}; } } //____________________________Light___________________________________________ void room2_light (String value) { if (value == \u0026#34;1\u0026#34;) { Serial.println(F(\u0026#34;Light on\u0026#34;)); digitalWrite(LIGHT_ROOM_2, HIGH); } else if (value == \u0026#34;0\u0026#34;) { Serial.println(F(\u0026#34;Light off\u0026#34;)); digitalWrite(LIGHT_ROOM_2, LOW); } } //____________________________Alarmsensor___________________________________________ void room2_alarmsensor_check () { if (!digitalRead(ALARMSENSOR_ROOM_2)) { if (mqtt.publish(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/room2/alarm\u0026#34;, \u0026#34;1\u0026#34;)) Serial.println(F(\u0026#34;Alarm Room 2\\n\u0026#34;)); while (!digitalRead(ALARMSENSOR_ROOM_2)) {}; } } //----------------------------ALARM--------------------------------------------- void alarm_status (String value) { if (value == \u0026#34;1\u0026#34;) { Serial.println(F(\u0026#34;ALARM\u0026#34;)); durationAlarm = 20; alarm_status_v = true; } if (value == \u0026#34;0\u0026#34;) { Serial.println(F(\u0026#34;ALARM DEACTIVATED\u0026#34;)); durationAlarm = 20; alarm_status_v = false; } } void alarm() { if (millis() - previousMillisAlarm \u0026gt;= intervalAlarm) { alarmToggle != alarmToggle; if (alarmToggle) tone(PIEZO, 400, 500); else tone(PIEZO, 800, 500); previousMillisAlarm = millis(); //Reset time till AlarmToggle; durationAlarm--; if (durationAlarm \u0026lt;= 0) alarmActive = false; } } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nThe programme now subscribes to the following topics, where MyMQTTiD is replaced with your ID:\nNanoESP/MyMQTTiD/room1/light\nNanoESP/MyMQTTiD/room2/light\nNanoESP/MyMQTTiD/+/alarm\nYou can now use the buttons to activate the light in the respective room. If you tip a tilt sensor, the alarm is triggered. It is deactivated either after 20 seconds or if you send a 0 to the alarm topic, e.g. through the http://www.hivemq.com/try-out/ webpage. You are also informed of all changes through the serial monitor.\n","permalink":"https://neu-iot.fkainka.de/en/day21-2016/","summary":"\u003cp\u003eIn today\u0026rsquo;s test, we\u0026rsquo;ll illuminate the characteristics and possibilities of MQTT in more detail by creating a practical scenario. In the example, there is a building with two rooms, each of which has a light switch, a light and an alarm sensor. The light switch switches the light of the respective room on or off. The alarm sensors activate a building-wide alarm.\u003c/p\u003e\n\u003cp\u003eNormally, seven different devices would be used here, which are all connected to each other through an MQTT broker. But since we probably have only one NanoESP, this will simulate all devices. For this reason, today\u0026rsquo;s layout looks somewhat complicated. The LED D3 is used today as the second light. Therefore, today it won\u0026rsquo;t show you whether you\u0026rsquo;re connected to the WLAN. The tilt sensors are used on the extension cables as alarm sensors. A person could, for example, attach them to doors or windows so that they trigger an alarm if the entry opens. Behind today\u0026rsquo;s door is the second sensor.\u003c/p\u003e","title":"Day 21: House automation"},{"content":"For the last days of this Advent, you\u0026rsquo;ll now become familiar with a subject that plays a large role in the realm of the IoT. We\u0026rsquo;re dealing with the messaging protocol MQTT, which was specially developed for the communication from machine to machine (M2M). The protocol is thus so brilliant because e.g. control data, measurement data or texts can be exchanged very easily and compactly. The overhead (data that\u0026rsquo;s transferred alongside the actual user data) is much lower than with HTTP and can be processed readily even by embedded devices, meaning microcontrollers like our NanoESP. At the same time, the controller doesn\u0026rsquo;t constantly have to establish a connection and query whether there\u0026rsquo;s been a change; instead, the connection is continually maintained and the client automatically gives information about changes.\nA so-called broker forms the basis for the communication. A broker is a server application that processes all data. A device can now connect to the broker and \u0026ldquo;publish\u0026rdquo; messages, i.e. send them to the broker. Another device can \u0026ldquo;subscribe\u0026rdquo; to specific topics and then immediately receives a new message published to this topic delivered by the broker. So that you don\u0026rsquo;t have to set up your own broker, a public broker has been set up for you at the address broker.fkainka.de.\nThe MQTT broker delivers the messages The topics are structured hierarchically, where subtopics are each separated with a slash. There are also so-called wild cards. With a \u0026ldquo;+\u0026rdquo; or \u0026ldquo;#\u0026rdquo; you can subscribe to multiple topics at the same time. Publishing with the wild cards \u0026ldquo;#\u0026rdquo; or \u0026ldquo;+\u0026rdquo; isn\u0026rsquo;t possible, however. For example, the topics\nMyHome/Kitchen/Temperature\nMyHome/Bathroom/Temperature\ncan thus be received at the same time by subscribing to the topic\nMyHome/+/Temperature\nThe plus thereby always replaces only one topic level. The # replaces all at once. With the topic MyHome/#\nyou thus receive all messages that are published in all subtopics of MyHome. The data that are published to a topic can be virtually anything, from pure texts to measurement values or simple 1/0 commands for switching a light.\nThe sketch: A16_P20_MQTT_Basics.ino /* MQTT Basic functions Change SSID and PASSWORD. */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_MQTT.h\u0026gt; //special library for MQTT #include \u0026lt;SoftwareSerial.h\u0026gt; #define SSID \u0026#34;YourSSID\u0026#34; #define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 #define DEBUG true NanoESP nanoesp = NanoESP(); NanoESP_MQTT mqtt = NanoESP_MQTT(nanoesp); String ip, mqttId; void setup() { Serial.begin(19200); nanoesp.init(); //! Only if you use a new Network // nanoesp.configWifi(STATION, SSID, PASSWORD); //Station Mode nanoesp.configWifiMode(STATION); //delay(1000); // Wait till Connected to WiFi if (nanoesp.wifiConnected())digitalWrite(LED_WLAN, HIGH); else Serial.println(F(\u0026#34;Error WLAN Connect\u0026#34;)); //Print IP in Terminal nanoesp.getIpMac(ip, mqttId); Serial.println(\u0026#34;My IP: \u0026#34; + ip); //Print MQTTid in Terminal mqttId.replace(\u0026#34;:\u0026#34;, \u0026#34;\u0026#34;); Serial.println(\u0026#34;My MQTT ID: \u0026#34; + mqttId+\u0026#34;\\n\u0026#34;); //if (mqtt.connect(0, \u0026#34;broker.hivemq.com\u0026#34;, 1883, mqttId)) { //connect to alternative broker if (mqtt.connect(0, \u0026#34;broker.fkainka.de\u0026#34;, 1883, mqttId)) { //connect to broker Serial.println(F(\u0026#34;Connected to Broker\\n\u0026#34;)); Serial.println(F(\u0026#34;My personal Topic is:\u0026#34;)); Serial.println(\u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/\\n\u0026#34;); if (mqtt.subscribe(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/test\u0026#34;)) Serial.println(\u0026#34;Subscribed to:\\nNanoESP/\u0026#34; + mqttId + \u0026#34;/test\\n\u0026#34;); if (mqtt.publish(0, \u0026#34;NanoESP/\u0026#34; + mqttId + \u0026#34;/test\u0026#34;, \u0026#34;Hello from my NanoESP\u0026#34;)) Serial.println(\u0026#34;Published to:\\nNanoESP/\u0026#34; + mqttId + \u0026#34;/test\\n\u0026#34;); } else { Serial.println(F(\u0026#34;error connecting\u0026#34;)); } } void loop() { int id, len; if (nanoesp.recvData(id, len)) { //recv data String topic, value; if (mqtt.recvMQTT(id, len, topic, value)) { //handle recvd data as mqtt data, parameters topic and value as reference Serial.println(\u0026#34;New Message:\\nTopic=\u0026#34; + topic + \u0026#34; Value=\u0026#34; + value+\u0026#34;\\n\u0026#34;); //print message } } mqtt.stayConnected(0); //keep the connection to broker alive } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nBehind today\u0026rsquo;s door is a button. In the test, we primarily want to make a couple of dry runs on the subject of MQTT. So load today\u0026rsquo;s programme to the board and open the serial monitor. After a short time, you\u0026rsquo;ll see more or less the following messages:\nThe messages on the serial monitor The board has thus connected first to the WLAN and then to the online broker. So that the many different users don\u0026rsquo;t fall into the queue, a special structure must be maintained. You can therefore write only in subtopics of the form NanoESP/MyMQTTiD/\u0026hellip; , where you have to replace MyMQTTiD with the ID that you receive from the board, displayed on the serial monitor. For today, that means that everything is written to the individually adapted topic NanoESP/MyMQTTiD/test.\nSo that you can also see what you\u0026rsquo;re writing in a topic, we use an online tool from the company HiveMQ on the computer. With this tool, you can likewise connect to the broker and subscribe to your personal topics or write to them. Now go to the page www.hivemq.com/try-out/ and click there on “Try the websocket client”. Now you first have to establish a connection to the broker by entering the address broker.fkainka.de in the menu option \u0026ldquo;Connection\u0026rdquo; under \u0026ldquo;Host.\u0026rdquo; The port and the ClientID can remain the same, and the other parameters are also correct. Click \u0026ldquo;Connect.\u0026rdquo; If everything worked, the text \u0026ldquo;connected\u0026rdquo; appears next to a green dot at the top right and you have the option in other areas to publish in a topic or to subscribe to a topic.\nFirst click on “Add New Topic Subscription” and enter NanoESP/MyMQTTiD/test in the topic field, where you replace MyMQTTiD with the ID from the serial monitor. Now reset the NanoESP by pressing the Reset button on the board. After a short time, you should receive the message “Hello from my NanoESP” in the browser under the \u0026ldquo;Messages\u0026rdquo; item. You can also send a message to the board by going into the topic field NanoESP/MyMQTTiD/test under \u0026ldquo;Publish\u0026rdquo; and entering any message you choose, like “Hello from my Browser,” under \u0026ldquo;Message\u0026rdquo;. Now you receive the message displayed on the serial monitor. So the communication is up.\nThe Websocket Client ","permalink":"https://neu-iot.fkainka.de/en/day-20-mqtt-message-queue-telemetry-transport/","summary":"\u003cp\u003eFor the last days of this Advent, you\u0026rsquo;ll now become familiar with a subject that plays a large role in the realm of the IoT. We\u0026rsquo;re dealing with the messaging protocol MQTT, which was specially developed for the communication from machine to machine (M2M). The protocol is thus so brilliant because e.g. control data, measurement data or texts can be exchanged very easily and compactly. The overhead (data that\u0026rsquo;s transferred alongside the actual user data) is much lower than with HTTP and can be processed readily even by embedded devices, meaning microcontrollers like our NanoESP. At the same time, the controller doesn\u0026rsquo;t constantly have to establish a connection and query whether there\u0026rsquo;s been a change; instead, the connection is continually maintained and the client automatically gives information about changes.\u003c/p\u003e","title":"Day 20: MQTT (Message Queue Telemetry Transport)"},{"content":"Behind today\u0026rsquo;s door is another cable. With the two cables it\u0026rsquo;s possible, for example, to place the RGB LED apart from the board. We\u0026rsquo;ll need the RGB LED today because the test is about a website with which you can adjust its colours. But that\u0026rsquo;s not the main aspect: To make the configuration of the NanoESP board especially easy not just for programmers, there is a configuration page through which the WLAN data of the module can be adjusted. But first to the set-up. You see it in the following picture.\nThe RGB LED with all three series resistors The sketch: A16_P19_ConfigRGB.ino /* TCP-Server for RGB-Control Change SSID and PASSWORD. RGB-Led (common cathode) on Pins 3,5,6 */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_HTTP.h\u0026gt; #include \u0026lt;SoftwareSerial.h\u0026gt; #include \u0026#34;Websites.h\u0026#34; //#define SSID \u0026#34;YourSSID\u0026#34; //#define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 #define RED 3 #define GREEN 5 #define BLUE 6 #define GND 4 #define DEBUG true NanoESP nanoesp = NanoESP(); NanoESP_HTTP http = NanoESP_HTTP(nanoesp); void setup() { Serial.begin(19200); nanoesp.init(); pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); pinMode(GND, OUTPUT); digitalWrite(GND, LOW); //! Only if you want to change the ACCESPOINT configuration //nanoesp.configWifi(ACCESSPOINT, \u0026#34;NanoESP\u0026#34;, \u0026#34;\u0026#34;); //! Only if you use a new Network // nanoesp.configWifi(DUAL, SSID, PASSWORD); //Dual Mode nanoesp.configWifiMode(DUAL); //delay(1000); // Wait till Connected to WiFi if (nanoesp.wifiConnected())digitalWrite(LED_WLAN, HIGH); else Serial.println(F(\u0026#34;Error WLAN Connect\u0026#34;)); //Start TCP Server if (nanoesp.startTcpServer(80)) Serial.println(F(\u0026#34;TCP Server Activ\u0026#34;)); else Serial.println(F(\u0026#34;TCP Server Error\u0026#34;)); //Print IP in Terminal Serial.println(nanoesp.getIp()); } void loop() { String method, ressource, parameter; int id; if (http.recvRequest(id, method, ressource, parameter)) { Serial.println(\u0026#34;New Request from id :\u0026#34; + String(id) + \u0026#34;, method: \u0026#34; + method + \u0026#34;, ressource: \u0026#34; + ressource + \u0026#34; parameter: \u0026#34; + parameter); if (ressource == \u0026#34;/\u0026#34;) { http.sendFromFlash(id, index, sizeof(index)); nanoesp.closeConnection(id); } else if (ressource == \u0026#34;/config\u0026#34;) { http.sendFromFlash(id, config, sizeof(config)); nanoesp.closeConnection(id); } else if (ressource == \u0026#34;/setcolor\u0026#34;) { //COLOR nanoesp.closeConnection(id); if (parameter != \u0026#34; \u0026#34;) { long number = (long) strtol( \u0026amp;parameter[7], NULL, 16); //Convert String to Hex http://stackoverflow.com/questions/23576827/arduino-convert-a-sting-hex-ffffff-into-3-int // Split them up into r, g, b values int r = number \u0026gt;\u0026gt; 16; int g = number \u0026gt;\u0026gt; 8 \u0026amp; 0xFF; int b = number \u0026amp; 0xFF; analogWrite(RED, r); analogWrite(GREEN, g); analogWrite(BLUE, b); } } else if (ressource == \u0026#34;/setconfig\u0026#34;) { //new Wifi-Configuration nanoesp.closeConnection(id); if (parameter != \u0026#34; \u0026#34;) { if (wifiConfig(id, GetRidOfurlCharacters(parameter))) { Serial.println(nanoesp.getIp()); } } } else if (ressource == \u0026#34;/eventssid\u0026#34;) { //Wifi scanner http.sendStreamHeader(id); sendStreamData(id, \u0026#34;msg\u0026#34;, \u0026#34;Scanning...\u0026#34;); ssidTransmit(id); //Scan for WiFi Networks in range and transmit sendStreamData(id, \u0026#34;msg\u0026#34;, \u0026#34;Done\u0026#34;); } else { http.sendFromFlash(id, error404, sizeof(error404)); nanoesp.closeConnection(id); } } } bool wifiConfig(int id, String parameter) { //get new WiFi Configuration String ssid, pass, apssid, apass = \u0026#34;\u0026#34;; while (parameter.length() \u0026gt; 0) { String varName = parameter.substring(0, parameter.indexOf(\u0026#39;=\u0026#39;)); parameter = parameter.substring(parameter.indexOf(\u0026#39;=\u0026#39;) + 1); if (varName == \u0026#34;ssid\u0026#34;) ssid = parameter.substring(0, parameter.indexOf(\u0026#39;\u0026amp;\u0026#39;)); if (varName == \u0026#34;apssid\u0026#34;) apssid = parameter.substring(0, parameter.indexOf(\u0026#39;\u0026amp;\u0026#39;)); if (varName == \u0026#34;pass\u0026#34;) pass = parameter.substring(0, parameter.indexOf(\u0026#39;\u0026amp;\u0026#39;)); if (varName == \u0026#34;apass\u0026#34;) apass = parameter.substring(0, parameter.indexOf(\u0026#39;\u0026amp;\u0026#39;)); parameter = parameter.substring(parameter.indexOf(\u0026#39;\u0026amp;\u0026#39;) + 1); } bool success = true; digitalWrite(LED_WLAN, LOW); if (ssid != \u0026#34;\u0026#34; ) success \u0026amp;= nanoesp.configWifiStation(ssid, pass); //set new Station config if (apssid != \u0026#34;\u0026#34; ) success \u0026amp;= nanoesp.configWifiAP(apssid, apass); //set new AccessPoint config digitalWrite(LED_WLAN, success); return success; } void ssidTransmit(int id) { //find and transmit wifis nanoesp.println(\u0026#34;AT+CWLAP\u0026#34;); nanoesp.setTimeout(5000); int i = 0; String ssids[10]; //max 10 ssids //get 10 scanned SSIDs while ((nanoesp.find(\u0026#34;+CWLAP:\u0026#34;)) \u0026amp;\u0026amp; (i \u0026lt; 10)) { nanoesp.find(\u0026#34;\\\u0026#34;\u0026#34;); ssids[i] = nanoesp.readStringUntil(\u0026#39;\\\u0026#34;\u0026#39;); i++; } nanoesp.find(\u0026#34;OK\\r\\n\u0026#34;); //transmit ssids to browser (and terminal) for (int x = 0; x \u0026lt; i; x++) { Serial.println (ssids[x]); if (!nanoesp.sendData(id, \u0026#34;event: ssid\\ndata: \u0026#34; + ssids[x] + \u0026#34;\\n\\n\u0026#34;)) Serial.println(\u0026#34;error wifi event\u0026#34;); } nanoesp.setTimeout(1000); } boolean sendStreamData(int connectionId, String event, String data) { return nanoesp.sendData(connectionId, \u0026#34;event: \u0026#34; + event + \u0026#34;\\n\u0026#34; + \u0026#34;data: \u0026#34; + data + \u0026#34;\\n\\n\u0026#34;); } String GetRidOfurlCharacters(String urlChars) // Convert URL-charakters no normal for ssid { urlChars.replace(\u0026#34;%0D%0A\u0026#34;, String(\u0026#39;\\n\u0026#39;)); urlChars.replace(\u0026#34;+\u0026#34;, \u0026#34; \u0026#34;); urlChars.replace(\u0026#34;%20\u0026#34;, \u0026#34; \u0026#34;); urlChars.replace(\u0026#34;%21\u0026#34;, \u0026#34;!\u0026#34;); urlChars.replace(\u0026#34;%22\u0026#34;, String(char(\u0026#39;\\\u0026#34;\u0026#39;))); urlChars.replace(\u0026#34;%23\u0026#34;, \u0026#34;#\u0026#34;); urlChars.replace(\u0026#34;%24\u0026#34;, \u0026#34;$\u0026#34;); urlChars.replace(\u0026#34;%25\u0026#34;, \u0026#34;%\u0026#34;); urlChars.replace(\u0026#34;%26\u0026#34;, \u0026#34;\u0026amp;\u0026#34;); urlChars.replace(\u0026#34;%27\u0026#34;, String(char(39))); urlChars.replace(\u0026#34;%28\u0026#34;, \u0026#34;(\u0026#34;); urlChars.replace(\u0026#34;%29\u0026#34;, \u0026#34;)\u0026#34;); urlChars.replace(\u0026#34;%2A\u0026#34;, \u0026#34;*\u0026#34;); urlChars.replace(\u0026#34;%2B\u0026#34;, \u0026#34;+\u0026#34;); urlChars.replace(\u0026#34;%2C\u0026#34;, \u0026#34;,\u0026#34;); urlChars.replace(\u0026#34;%2D\u0026#34;, \u0026#34;-\u0026#34;); urlChars.replace(\u0026#34;%2E\u0026#34;, \u0026#34;.\u0026#34;); urlChars.replace(\u0026#34;%2F\u0026#34;, \u0026#34;/\u0026#34;); urlChars.replace(\u0026#34;%30\u0026#34;, \u0026#34;0\u0026#34;); urlChars.replace(\u0026#34;%31\u0026#34;, \u0026#34;1\u0026#34;); urlChars.replace(\u0026#34;%32\u0026#34;, \u0026#34;2\u0026#34;); urlChars.replace(\u0026#34;%33\u0026#34;, \u0026#34;3\u0026#34;); urlChars.replace(\u0026#34;%34\u0026#34;, \u0026#34;4\u0026#34;); urlChars.replace(\u0026#34;%35\u0026#34;, \u0026#34;5\u0026#34;); urlChars.replace(\u0026#34;%36\u0026#34;, \u0026#34;6\u0026#34;); urlChars.replace(\u0026#34;%37\u0026#34;, \u0026#34;7\u0026#34;); urlChars.replace(\u0026#34;%38\u0026#34;, \u0026#34;8\u0026#34;); urlChars.replace(\u0026#34;%39\u0026#34;, \u0026#34;9\u0026#34;); urlChars.replace(\u0026#34;%3A\u0026#34;, \u0026#34;:\u0026#34;); urlChars.replace(\u0026#34;%3B\u0026#34;, \u0026#34;;\u0026#34;); urlChars.replace(\u0026#34;%3C\u0026#34;, \u0026#34;\u0026lt;\u0026#34;); urlChars.replace(\u0026#34;%3D\u0026#34;, \u0026#34;=\u0026#34;); urlChars.replace(\u0026#34;%3E\u0026#34;, \u0026#34;\u0026gt;\u0026#34;); urlChars.replace(\u0026#34;%3F\u0026#34;, \u0026#34;?\u0026#34;); urlChars.replace(\u0026#34;%40\u0026#34;, \u0026#34;@\u0026#34;); return urlChars; } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nWhen you\u0026rsquo;ve loaded the programme in the board, you can call up the module\u0026rsquo;s webpage. Because you\u0026rsquo;re acting today as if the board didn\u0026rsquo;t already know your WLAN data, the path through the access point is useful. So connect to the NanoESP network. After connecting, call up the IP address 192.168.4.1 in the browser. You reach the main page of the board, through which you can adjust the colours of the RGB LED. But follow the link to the configuration page.\nNow at the bottom of the configuration page, you\u0026rsquo;ll see a text box, in which the text \u0026ldquo;Scanning \u0026hellip;\u0026rdquo; appears after a short time. The board now searches for networks in range and conveys the networks with the strongest signals through the connection to the website. You now see the message \u0026ldquo;Done\u0026rdquo; in the text box. In the field \u0026ldquo;SSID\u0026rdquo; you can now select your network. If it wasn\u0026rsquo;t found, e.g. because your network is hidden, you can also enter the name manually. In the text field underneath comes the network password.\nIn the lower boxes you can also enter another name for the access point network and set a password (minimum eight characters). But be careful: If you enter the wrong home network data and give the access point network a password that you then forget, you\u0026rsquo;ve got a problem. Then you first have to upload another programme with the right network data or an open access point before you can access the web server of the board again.\nConfigure your WiFi ","permalink":"https://neu-iot.fkainka.de/en/day19-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door is another cable. With the two cables it\u0026rsquo;s possible, for example, to place the RGB LED apart from the board. We\u0026rsquo;ll need the RGB LED today because the test is about a website with which you can adjust its colours. But that\u0026rsquo;s not the main aspect: To make the configuration of the NanoESP board especially easy not just for programmers, there is a configuration page through which the WLAN data of the module can be adjusted. But first to the set-up. You see it in the following picture.\u003c/p\u003e","title":"Day 19: Configuration page for the NanoESP"},{"content":"Behind today\u0026rsquo;s door is a very special component, namely a humidity sensor. Together with the phototransistor and the NTC, it creates a weather station for at-home use. The following layout is necessary for this purpose:\nThe layout with all sensors (resistors 1 kohm) Today\u0026rsquo;s layout is a bit fiddly. Especially at the point where the potentiometer on the right of the image sits, it touches the NanoESP. But that\u0026rsquo;s not really a problem as long as the contact on the left of the image is plugged firmly into the board.\nThe current climate data in the browser The sketch: A16_P18_Climate.ino /* TCP-Server Climate with server send events Change SSID and PASSWORD. */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_HTTP.h\u0026gt; #include \u0026lt;SoftwareSerial.h\u0026gt; #include \u0026#34;Websites.h\u0026#34; #include \u0026lt;math.h\u0026gt; //#define SSID \u0026#34;YourSSID\u0026#34; //#define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 #define TEMP A0 #define LIGHT A1 #define HUMIDITY A4 #define GND A5 #define DEBUG true NanoESP nanoesp = NanoESP(); NanoESP_HTTP http = NanoESP_HTTP(nanoesp); void setup() { Serial.begin(19200); nanoesp.init(); //! Only if you want to change the ACCESPOINT configuration //nanoesp.configWifi(ACCESSPOINT, \u0026#34;NanoESP\u0026#34;, \u0026#34;\u0026#34;); //! Only if you use a new Network // nanoesp.configWifi(DUAL, SSID, PASSWORD); //Dual Mode nanoesp.configWifiMode(DUAL); //delay(1000); // Wait till Connected to WiFi if (nanoesp.wifiConnected())digitalWrite(LED_WLAN, HIGH); else Serial.println(F(\u0026#34;Error WLAN Connect\u0026#34;)); //Start TCP Server if (nanoesp.startTcpServer(80)) Serial.println(F(\u0026#34;TCP Server Activ\u0026#34;)); else Serial.println(F(\u0026#34;TCP Server Error\u0026#34;)); //Print IP in Terminal Serial.println(nanoesp.getIp()); } int streamId = -1; byte errorCount; void loop() { String method, ressource, parameter; int id ; if (http.recvRequest(id, method, ressource, parameter)) { Serial.println(\u0026#34;New Request from id :\u0026#34; + String(id) + \u0026#34;, method: \u0026#34; + method + \u0026#34;, ressource: \u0026#34; + ressource + \u0026#34; parameter: \u0026#34; + parameter); if (ressource == \u0026#34;/\u0026#34;) { http.sendFromFlash(id, index, sizeof(index)); nanoesp.closeConnection(id); } else if (ressource == \u0026#34;/eventclimate\u0026#34;) { //new server send events connection if (http.sendStreamHeader(id)) { //send stream header as response streamId = id; //this id belongs to the sse-client sendStreamData(streamId,\u0026#34;msg\u0026#34;, \u0026#34;Connection established\u0026#34;); //send first message } } else { http.sendFromFlash(id, error404, sizeof(error404)); nanoesp.closeConnection(id); } } if (streamId \u0026gt; -1) { //there is a stream client if (!sendStreamData(streamId, \u0026#34;hum\u0026#34;, String(getRF()))) errorCount++; else errorCount = 0; //send server send event data if (!sendStreamData(streamId, \u0026#34;light\u0026#34;, String(getLight()))) errorCount++;else errorCount = 0; //send server send event data if (!sendStreamData(streamId, \u0026#34;temp\u0026#34;, String(getTemp()))) errorCount++;else errorCount = 0; //send server send event data if (errorCount \u0026gt; 6){ //client is disconnected if more than 6 transmissions were faulty nanoesp.closeConnection(streamId); streamId = -1; errorCount = 0; } } } boolean sendStreamData(int connectionId, String event, String data) { //Serial.println(String (connectionId) + \u0026#34; - \u0026#34; + event + \u0026#34; - \u0026#34; + data); return nanoesp.sendData(connectionId, \u0026#34;event: \u0026#34; + event + \u0026#34;\\n\u0026#34; + \u0026#34;data: \u0026#34; + data + \u0026#34;\\n\\n\u0026#34;); } int getRF() { //get Humidity, source: http://www.elektronik-labor.de/AVR/Rmessung.html#rx2 long U, R; double F; pinMode(HUMIDITY, INPUT); // Ddrb.3 = 0 \u0026#39;Eingang digitalWrite(HUMIDITY, HIGH); // Portb.3 = 1 \u0026#39;Pullup ein U = analogRead(HUMIDITY); // U = Getadc(3) digitalWrite(HUMIDITY, LOW); // Portb.3 = 0 \u0026#39;Pullup Aus pinMode(HUMIDITY, OUTPUT); // Ddrb.3 = 1 \u0026#39;Nierohmig pinMode(GND, INPUT); // Ddrb.4 = 0 \u0026#39;Eingang digitalWrite(GND, HIGH); // Portb.4 = 1 \u0026#39;Pullup ein U += analogRead(GND); // U = U + Getadc(2) digitalWrite(GND, LOW); // Portb.4 = 0 \u0026#39;Pullup Aus pinMode(GND, OUTPUT); // Ddrb.4 = 1 \u0026#39;Nierohmig. entladen U = U / 2; R = 3500 * U; //\u0026#39;R=35k*(U/1023-U) U = 1023 - U; R = (U \u0026gt; 0) ? R / U : 999999; //alternativ writing to: if(U\u0026gt;0) R = R/U; else R=999999; R = R - 450; //- interner Bahnwiderstand 0,45 k //Calculate Humidity F = R / 280; F = log(F); //ln f !!! F = F * 8.9; F = 100 - F; F = round(F); // Serial.println(String(R) + \u0026#34;Ohm \u0026#34; + String(F) + \u0026#34;%\u0026#34;); //delay(500); return F; } double getTemp() { //Source: http://playground.arduino.cc/ComponentLib/Thermistor2 double Temp; int RawADC = analogRead(TEMP); Temp = log(10000.0 * ((1024.0 / RawADC - 1))); // =log(10000.0/(1024.0/RawADC-1)) // for pull-up configuration Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp )) * Temp ); Temp = Temp - 273.15; // Convert Kelvin to Celcius // Temp = (Temp * 9.0)/ 4.7 + 32.0; // Convert Celcius to Fahrenheit Temp = round(Temp*10); Temp = Temp/ 10; return Temp; } int getLight() { int vLight = analogRead(LIGHT); return vLight; } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nAfter you upload the programme, you can now open the website. You see three values that are represented as text and as bars. You can now calibrate the values somewhat with the potentiometers. The temperature value, especially, should be compared to a thermometer and adjusted. That\u0026rsquo;s the only way to ensure that the information on the website is more or less accurate.\n","permalink":"https://neu-iot.fkainka.de/en/day18-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door is a very special component, namely a humidity sensor. Together with the phototransistor and the NTC, it creates a weather station for at-home use. The following layout is necessary for this purpose:\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/09/Day18_Climate_Steckplatine.jpg\"\u003e\u003cimg class=\"wp-image-1391 size-large\" src=\"/images/2016/09/Day18_Climate_Steckplatine.jpg\" alt=\"Der Aufbau mit allen Sensoren\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe layout with all sensors (resistors 1 kohm)\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eToday\u0026rsquo;s layout is a bit fiddly. Especially at the point where the potentiometer on the right of the image sits, it touches the NanoESP. But that\u0026rsquo;s not really a problem as long as the contact on the left of the image is plugged firmly into the board.\u003c/p\u003e","title":"Day 18: Weather monitoring"},{"content":"Today\u0026rsquo;s project deals with a well-known lamp from Phillips, the Wake Up Light. This is an alarm clock that, instead of making a loud noise, slowly increases the brightness. This creates a type of sunrise, and one wakes up in a natural manner.\nBehind today\u0026rsquo;s door is another potentiometer, which is important for tomorrow\u0026rsquo;s test. The following layout is required today:\nThe RGB LED with series resistors The sketch: A16_P17_WakeUpLight.ino /* TCP-Server: Wakeup light Change SSID and PASSWORD. RGB-Led (common cathode) on Pins 3,5,6 */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_HTTP.h\u0026gt; #include \u0026lt;SoftwareSerial.h\u0026gt; #include \u0026#34;Websites.h\u0026#34; #include \u0026lt;math.h\u0026gt; #include \u0026lt;Time.h\u0026gt; #define SSID \u0026#34;YourSSID\u0026#34; #define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 #define RED 3 #define GREEN 5 #define BLUE 6 #define GND 4 #define BUTTON 7 NanoESP nanoesp = NanoESP(); NanoESP_HTTP http = NanoESP_HTTP(nanoesp); //String timeServerIP = ; // time.nist.gov NTP server address String ntpServerName = \u0026#34;195.145.119.188\u0026#34;;//\u0026#34;time.nist.gov\u0026#34;; const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message byte packetBuffer[NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets int alarmHour = 0, alarmMinute = 2; bool alarm; byte cRed = 0, cBlue = 0, cGreen = 0; unsigned long previousMillis = 0; // will store last time a msg was send unsigned long interval = 78; // void setup() { Serial.begin(19200); nanoesp.init(); pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); pinMode(GND, OUTPUT); digitalWrite(GND, LOW); pinMode(BUTTON, INPUT); //Only Station Mode for TimeSync nanoesp.configWifiMode(STATION); //delay(1000); // Wait till Connected to WiFi if (nanoesp.wifiConnected())digitalWrite(LED_WLAN, HIGH); else Serial.println(F(\u0026#34;Error WLAN Connect\u0026#34;)); //Start TCP Server if (nanoesp.startTcpServer(80)) Serial.println(F(\u0026#34;TCP Server Activ\u0026#34;)); else Serial.println(F(\u0026#34;TCP Server Error\u0026#34;)); //Print IP in Terminal Serial.println(nanoesp.getIp()); setSyncProvider(getNtpTime); Show_Time(); } time_t getNtpTime() { //convert to time_t , Paramter: connectionId, ServerAdress, Timezone return (time_t)getNTPpacket(4, ntpServerName, 2); } void loop() { String method, ressource, parameter; int id ; if (http.recvRequest(id, method, ressource, parameter)) { Serial.println(\u0026#34;New Request from id :\u0026#34; + String(id) + \u0026#34;, method: \u0026#34; + method + \u0026#34;, ressource: \u0026#34; + ressource + \u0026#34; parameter: \u0026#34; + parameter); if (ressource == \u0026#34;/\u0026#34;) { http.sendFromFlash(id, index, sizeof(index)); nanoesp.closeConnection(id); } if (ressource == \u0026#34;/settimer\u0026#34;) { if (parameter != \u0026#34;\u0026#34;) { //timer=02%3A03\u0026amp; String sHour = parameter.substring(parameter.indexOf(\u0026#39;=\u0026#39;) + 1, parameter.indexOf(\u0026#39;%\u0026#39;)); String sMin = parameter.substring(parameter.indexOf(\u0026#39;A\u0026#39;) + 1, parameter.indexOf(\u0026#39;\u0026amp;\u0026#39;)); String sDuration = parameter.substring(parameter.indexOf(\u0026#39;\u0026amp;\u0026#39;) + 1); sDuration = sDuration.substring(sDuration.indexOf(\u0026#39;=\u0026#39;) + 1, sDuration.indexOf(\u0026#39;\u0026amp;\u0026#39;)); alarmHour = sHour.toInt(); alarmMinute = sMin.toInt(); int iDuration = sDuration.toInt(); interval *= iDuration; Serial.println(\u0026#34;Timer: \u0026#34; + String(alarmHour) + \u0026#34;:\u0026#34; + String(alarmMinute) + \u0026#34; Duartion: \u0026#34; + String (iDuration) ); Show_Time(); } nanoesp.closeConnection(id); } if (ressource == \u0026#34;/turnoff\u0026#34;) { alarm = false; cRed = 0; cBlue = 0; cGreen =0; analogWrite(RED,cRed); analogWrite(BLUE,cBlue);analogWrite(GREEN,cGreen); } else { http.sendFromFlash(id, error404, sizeof(error404)); nanoesp.closeConnection(id); } } else { if (hour() == alarmHour) { if (minute() == alarmMinute) { if (!alarm) alarm = true; } } if (alarm) wakeUp(); } } void MorningAlarm() { Serial.println(\u0026#34;Alarm: - turn lights off\u0026#34;); } void wakeUp() { if (millis() - previousMillis \u0026gt;= interval) { previousMillis = millis(); if (cRed == 0) Show_Time(); if (cRed \u0026lt; 255) { cRed++; analogWrite(RED, cRed ); } else { if (cGreen \u0026lt; 255) { cGreen++; analogWrite(GREEN, cGreen); } else { if (cBlue \u0026lt; 255) { cBlue++; analogWrite(BLUE, cBlue ); if (cBlue == 255) Show_Time(); } } } } } // prepare an NTP request to the time server and send to the given bool sendNTPpacket(int id, String address) { // set all bytes in the buffer to 0 memset(packetBuffer, 0, NTP_PACKET_SIZE); // Initialize values needed to form NTP request // (see URL above for details on the packets) packetBuffer[0] = 0b11100011; // LI, Version, Mode packetBuffer[1] = 0; // Stratum, or type of clock packetBuffer[2] = 6; // Polling Interval packetBuffer[3] = 0xEC; // Peer Clock Precision // 8 bytes of zero for Root Delay \u0026amp; Root Dispersion packetBuffer[12] = 49; packetBuffer[13] = 0x4E; packetBuffer[14] = 49; packetBuffer[15] = 52; // // if we need a cr/lf // packetBuffer[NTP_PACKET_SIZE ] = 0x0D; packetBuffer[NTP_PACKET_SIZE + 1] = 0x0A; // all NTP fields have been given values, now // you can send a packet requesting a timestamp: if ( nanoesp.sendRaw(id, packetBuffer, NTP_PACKET_SIZE)) return true; return false; } long getNTPpacket(int id, String address, int timeZone) { unsigned long secsSince1900; byte offset = 40; if (!nanoesp.newConnection(id, UDP, address, 123)) Serial.println (\u0026#34;no connection ntp server\u0026#34;); //NTP requests are to port 123 delay(100); if (!sendNTPpacket(id, address)) { Serial.println(\u0026#34;No time request send\u0026#34;); return 0; } nanoesp.setTimeout(2000); if (nanoesp.find(\u0026#34;+IPD,\u0026#34;)) { int vid = nanoesp.parseInt(); nanoesp.find(\u0026#34;,\u0026#34;); int len = nanoesp.parseInt(); //Serial.println(String(len)); byte buffer[len]; nanoesp.find(\u0026#34;:\u0026#34;); nanoesp.readBytes(buffer, 48); // for (int i = 0; i \u0026lt;= NTP_PACKET_SIZE; i++) { // Serial.print(buffer[i], HEX); // } // convert four bytes starting at location 40 to a long integer secsSince1900 = (unsigned long)buffer[offset + 0] \u0026lt;\u0026lt; 24; secsSince1900 |= (unsigned long)buffer[offset + 1] \u0026lt;\u0026lt; 16; secsSince1900 |= (unsigned long)buffer[offset + 2] \u0026lt;\u0026lt; 8; secsSince1900 |= (unsigned long)buffer[offset + 3]; nanoesp.find(\u0026#34;OK\\r\\n\u0026#34;); nanoesp.closeConnection(id); // return secsSince1900 + timeZone * SECS_PER_HOUR; // NTP Date return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR; // UNIX Date } else { Serial.println(\u0026#34;no time recieved\u0026#34;); nanoesp.closeConnection(id); return 0; } } void Show_Time() { String shour, sminute, ssecond; Serial.print(\u0026#34;Date: \u0026#34;); Serial.print(day()); Serial.print(\u0026#34;.\u0026#34;); Serial.print(month()); Serial.print(\u0026#34;.\u0026#34;); Serial.println(year()); if (hour() \u0026lt;= 9) shour = \u0026#34;0\u0026#34; + String(hour()); else shour = String(hour()); // adjust for 0-9 if (minute() \u0026lt;= 9) sminute = \u0026#34;0\u0026#34; + String(minute()); else sminute = String(minute()); if (second() \u0026lt;= 9) ssecond = \u0026#34;0\u0026#34; + String(second()); else ssecond = String(second()); Serial.println( \u0026#34;Time: \u0026#34; + shour + \u0026#34;:\u0026#34; + sminute + \u0026#34;:\u0026#34; + ssecond ); } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nAfter the set-up, you can download the programme and upload it to the board. After the installation, open the browser and enter the IP address of the board. On the page that now appears, you can select a time at which the wake-up process should start. You can also set the duration. In the standard setting, it\u0026rsquo;s 30 minutes. When the time is reached, the LED begins to light up red weakly at first. It slowly becomes brighter, and then the green LED mixes in, which creates a yellow tone. Finally, the blue LED also lights up, which results in a white with which the entire bedroom is brightened.\nSet the timer on this website ","permalink":"https://neu-iot.fkainka.de/en/day17-2016/","summary":"\u003cp\u003eToday\u0026rsquo;s project deals with a well-known lamp from Phillips, the Wake Up Light. This is an alarm clock that, instead of making a loud noise, slowly increases the brightness. This creates a type of sunrise, and one wakes up in a natural manner.\u003c/p\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door is another potentiometer, which is important for tomorrow\u0026rsquo;s test. The following layout is required today:\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/09/Day10_1_RGB-2.jpg\"\u003e\u003cimg class=\"wp-image-1386 size-large\" src=\"/images/2016/09/Day10_1_RGB-2.jpg\" alt=\"Die RGB LED mit Vorwiderständen\" width=\"616\" height=\"362\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe RGB LED with series resistors\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cdetails class=\"spoiler\"\u003e\n  \u003csummary\u003eThe sketch: A16_P17_WakeUpLight.ino\u003c/summary\u003e\n  \u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-cpp\" data-lang=\"cpp\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e/*\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e  TCP-Server: Wakeup light\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e  Change SSID and PASSWORD.\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e  RGB-Led (common cathode) on Pins 3,5,6\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e*/\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;NanoESP.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;NanoESP_HTTP.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;SoftwareSerial.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026#34;Websites.h\u0026#34;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;math.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;Time.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define SSID \u0026#34;YourSSID\u0026#34;\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define PASSWORD \u0026#34;YourPassword\u0026#34;\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define LED_WLAN 13\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define RED 3\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define GREEN 5\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define BLUE 6\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define GND 4\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define BUTTON 7\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eNanoESP\u003c/span\u003e \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eNanoESP\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eNanoESP_HTTP\u003c/span\u003e \u003cspan class=\"n\"\u003ehttp\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eNanoESP_HTTP\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e//String timeServerIP = ; // time.nist.gov NTP server address\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003entpServerName\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;195.145.119.188\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\u003cspan class=\"c1\"\u003e//\u0026#34;time.nist.gov\u0026#34;;\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003econst\u003c/span\u003e \u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003eNTP_PACKET_SIZE\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e48\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e \u003cspan class=\"c1\"\u003e// NTP time stamp is in the first 48 bytes of the message\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003ebyte\u003c/span\u003e \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"n\"\u003eNTP_PACKET_SIZE\u003c/span\u003e\u003cspan class=\"p\"\u003e];\u003c/span\u003e \u003cspan class=\"c1\"\u003e//buffer to hold incoming and outgoing packets\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003ealarmHour\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003ealarmMinute\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003ebool\u003c/span\u003e \u003cspan class=\"n\"\u003ealarm\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003ebyte\u003c/span\u003e \u003cspan class=\"n\"\u003ecRed\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003ecBlue\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003ecGreen\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003eunsigned\u003c/span\u003e \u003cspan class=\"kt\"\u003elong\u003c/span\u003e \u003cspan class=\"n\"\u003epreviousMillis\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e        \u003cspan class=\"c1\"\u003e// will store last time a msg was send\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003eunsigned\u003c/span\u003e \u003cspan class=\"kt\"\u003elong\u003c/span\u003e \u003cspan class=\"n\"\u003einterval\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e78\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e \u003cspan class=\"c1\"\u003e//\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003esetup\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ebegin\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e19200\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003einit\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epinMode\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eRED\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eOUTPUT\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epinMode\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eGREEN\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eOUTPUT\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epinMode\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eBLUE\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eOUTPUT\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epinMode\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eGND\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eOUTPUT\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003edigitalWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eGND\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eLOW\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epinMode\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eBUTTON\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eINPUT\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//Only Station Mode for TimeSync\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003econfigWifiMode\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eSTATION\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//delay(1000);\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// Wait till Connected to WiFi\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ewifiConnected\u003c/span\u003e\u003cspan class=\"p\"\u003e())\u003c/span\u003e\u003cspan class=\"n\"\u003edigitalWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eLED_WLAN\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eHIGH\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Error WLAN Connect\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//Start TCP Server\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003estartTcpServer\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e80\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e    \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;TCP Server Activ\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e \u003cspan class=\"k\"\u003eelse\u003c/span\u003e   \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;TCP Server Error\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//Print IP in Terminal\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003egetIp\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003esetSyncProvider\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003egetNtpTime\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eShow_Time\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003etime_t\u003c/span\u003e \u003cspan class=\"nf\"\u003egetNtpTime\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//convert to time_t , Paramter: connectionId, ServerAdress, Timezone\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003etime_t\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\u003cspan class=\"n\"\u003egetNTPpacket\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e4\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003entpServerName\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"mi\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003eloop\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003emethod\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eressource\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003eid\u003c/span\u003e \u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ehttp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003erecvRequest\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003emethod\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eressource\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;New Request from id :\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;, method: \u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003emethod\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e  \u003cspan class=\"s\"\u003e\u0026#34;, ressource: \u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eressource\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e  \u003cspan class=\"s\"\u003e\u0026#34; parameter: \u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eressource\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;/\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003ehttp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esendFromFlash\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eindex\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"k\"\u003esizeof\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eindex\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ecloseConnection\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eressource\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;/settimer\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eparameter\u003c/span\u003e \u003cspan class=\"o\"\u003e!=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"c1\"\u003e//timer=02%3A03\u0026amp;\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003esHour\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esubstring\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eindexOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"sc\"\u003e\u0026#39;=\u0026#39;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eindexOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"sc\"\u003e\u0026#39;%\u0026#39;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003esMin\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esubstring\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eindexOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"sc\"\u003e\u0026#39;A\u0026#39;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eindexOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"sc\"\u003e\u0026#39;\u0026amp;\u0026#39;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003esDuration\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esubstring\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eindexOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"sc\"\u003e\u0026#39;\u0026amp;\u0026#39;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003esDuration\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003esDuration\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esubstring\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003esDuration\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eindexOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"sc\"\u003e\u0026#39;=\u0026#39;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003esDuration\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eindexOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"sc\"\u003e\u0026#39;\u0026amp;\u0026#39;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003ealarmHour\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003esHour\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003etoInt\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003ealarmMinute\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003esMin\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003etoInt\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003eiDuration\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003esDuration\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003etoInt\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003einterval\u003c/span\u003e \u003cspan class=\"o\"\u003e*=\u003c/span\u003e \u003cspan class=\"n\"\u003eiDuration\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Timer: \u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ealarmHour\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;:\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ealarmMinute\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;   Duartion: \u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eiDuration\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003eShow_Time\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ecloseConnection\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eressource\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;/turnoff\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003ealarm\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"nb\"\u003efalse\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003ecRed\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e \u003cspan class=\"n\"\u003ecBlue\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e \u003cspan class=\"n\"\u003ecGreen\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e\u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eRED\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"n\"\u003ecRed\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eBLUE\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"n\"\u003ecBlue\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eGREEN\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"n\"\u003ecGreen\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e  \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003ehttp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esendFromFlash\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eerror404\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"k\"\u003esizeof\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eerror404\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ecloseConnection\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ehour\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"n\"\u003ealarmHour\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eminute\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"n\"\u003ealarmMinute\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"o\"\u003e!\u003c/span\u003e\u003cspan class=\"n\"\u003ealarm\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"n\"\u003ealarm\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"nb\"\u003etrue\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ealarm\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"n\"\u003ewakeUp\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003eMorningAlarm\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Alarm: - turn lights off\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003ewakeUp\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003emillis\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"o\"\u003e-\u003c/span\u003e \u003cspan class=\"n\"\u003epreviousMillis\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026gt;=\u003c/span\u003e \u003cspan class=\"n\"\u003einterval\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003epreviousMillis\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003emillis\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ecRed\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"n\"\u003eShow_Time\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ecRed\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"mi\"\u003e255\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003ecRed\u003c/span\u003e\u003cspan class=\"o\"\u003e++\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eRED\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003ecRed\u003c/span\u003e \u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ecGreen\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"mi\"\u003e255\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003ecGreen\u003c/span\u003e\u003cspan class=\"o\"\u003e++\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eGREEN\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003ecGreen\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ecBlue\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026lt;\u003c/span\u003e \u003cspan class=\"mi\"\u003e255\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e          \u003cspan class=\"n\"\u003ecBlue\u003c/span\u003e\u003cspan class=\"o\"\u003e++\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e          \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eBLUE\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003ecBlue\u003c/span\u003e \u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e          \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ecBlue\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"mi\"\u003e255\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"n\"\u003eShow_Time\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e        \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e// prepare an NTP request to the time server and send to the given\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003ebool\u003c/span\u003e \u003cspan class=\"nf\"\u003esendNTPpacket\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003eaddress\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// set all bytes in the buffer to 0\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003ememset\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eNTP_PACKET_SIZE\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// Initialize values needed to form NTP request\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// (see URL above for details on the packets)\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mb\"\u003e0b11100011\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e   \u003cspan class=\"c1\"\u003e// LI, Version, Mode\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e     \u003cspan class=\"c1\"\u003e// Stratum, or type of clock\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e6\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e     \u003cspan class=\"c1\"\u003e// Polling Interval\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mh\"\u003e0xEC\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e  \u003cspan class=\"c1\"\u003e// Peer Clock Precision\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// 8 bytes of zero for Root Delay \u0026amp; Root Dispersion\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e12\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e  \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e49\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e13\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e  \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mh\"\u003e0x4E\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e14\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e  \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e49\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e15\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e  \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e52\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// if we need a cr/lf\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"n\"\u003eNTP_PACKET_SIZE\u003c/span\u003e    \u003cspan class=\"p\"\u003e]\u003c/span\u003e  \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mh\"\u003e0x0D\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"n\"\u003eNTP_PACKET_SIZE\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e  \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mh\"\u003e0x0A\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// all NTP fields have been given values, now\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// you can send a packet requesting a timestamp:\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esendRaw\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003epacketBuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eNTP_PACKET_SIZE\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e \u003cspan class=\"k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"nb\"\u003etrue\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"nb\"\u003efalse\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003elong\u003c/span\u003e \u003cspan class=\"nf\"\u003egetNTPpacket\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003eaddress\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003etimeZone\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"kt\"\u003eunsigned\u003c/span\u003e \u003cspan class=\"kt\"\u003elong\u003c/span\u003e \u003cspan class=\"n\"\u003esecsSince1900\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003ebyte\u003c/span\u003e          \u003cspan class=\"n\"\u003eoffset\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"mi\"\u003e40\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"o\"\u003e!\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003enewConnection\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eUDP\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eaddress\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"mi\"\u003e123\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;no connection ntp server\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"c1\"\u003e//NTP requests are to port 123\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003edelay\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e100\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"o\"\u003e!\u003c/span\u003e\u003cspan class=\"n\"\u003esendNTPpacket\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eaddress\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;No time request send\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esetTimeout\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e2000\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003efind\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;+IPD,\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003evid\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eparseInt\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003efind\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;,\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003elen\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eparseInt\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"c1\"\u003e//Serial.println(String(len));\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003ebyte\u003c/span\u003e \u003cspan class=\"n\"\u003ebuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"n\"\u003elen\u003c/span\u003e\u003cspan class=\"p\"\u003e];\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003efind\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;:\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ereadBytes\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ebuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"mi\"\u003e48\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e//    for (int i = 0; i \u0026lt;= NTP_PACKET_SIZE; i++) {\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e//      Serial.print(buffer[i], HEX);\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e//    }\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"c1\"\u003e// convert four bytes starting at location 40 to a long integer\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003esecsSince1900\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e  \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"kt\"\u003eunsigned\u003c/span\u003e \u003cspan class=\"kt\"\u003elong\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\u003cspan class=\"n\"\u003ebuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"n\"\u003eoffset\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026lt;\u0026lt;\u003c/span\u003e \u003cspan class=\"mi\"\u003e24\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003esecsSince1900\u003c/span\u003e \u003cspan class=\"o\"\u003e|=\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"kt\"\u003eunsigned\u003c/span\u003e \u003cspan class=\"kt\"\u003elong\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\u003cspan class=\"n\"\u003ebuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"n\"\u003eoffset\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026lt;\u0026lt;\u003c/span\u003e \u003cspan class=\"mi\"\u003e16\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003esecsSince1900\u003c/span\u003e \u003cspan class=\"o\"\u003e|=\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"kt\"\u003eunsigned\u003c/span\u003e \u003cspan class=\"kt\"\u003elong\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\u003cspan class=\"n\"\u003ebuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"n\"\u003eoffset\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"mi\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026lt;\u0026lt;\u003c/span\u003e \u003cspan class=\"mi\"\u003e8\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003esecsSince1900\u003c/span\u003e \u003cspan class=\"o\"\u003e|=\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"kt\"\u003eunsigned\u003c/span\u003e \u003cspan class=\"kt\"\u003elong\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\u003cspan class=\"n\"\u003ebuffer\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"n\"\u003eoffset\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"mi\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e];\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003efind\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;OK\u003c/span\u003e\u003cspan class=\"se\"\u003e\\r\\n\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ecloseConnection\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"c1\"\u003e//   return secsSince1900 + timeZone * SECS_PER_HOUR;                    // NTP  Date\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"n\"\u003esecsSince1900\u003c/span\u003e \u003cspan class=\"o\"\u003e-\u003c/span\u003e \u003cspan class=\"mi\"\u003e2208988800UL\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003etimeZone\u003c/span\u003e \u003cspan class=\"o\"\u003e*\u003c/span\u003e \u003cspan class=\"n\"\u003eSECS_PER_HOUR\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e         \u003cspan class=\"c1\"\u003e// UNIX Date      \n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;no time recieved\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ecloseConnection\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003eShow_Time\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003eshour\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003esminute\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003essecond\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprint\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Date: \u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprint\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eday\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprint\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;.\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprint\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003emonth\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprint\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;.\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eyear\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ehour\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026lt;=\u003c/span\u003e \u003cspan class=\"mi\"\u003e9\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"n\"\u003eshour\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;0\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ehour\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"n\"\u003eshour\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ehour\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e \u003cspan class=\"c1\"\u003e// adjust for 0-9\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eminute\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026lt;=\u003c/span\u003e \u003cspan class=\"mi\"\u003e9\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"n\"\u003esminute\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;0\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eminute\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e  \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"n\"\u003esminute\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eminute\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003esecond\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"o\"\u003e\u0026lt;=\u003c/span\u003e \u003cspan class=\"mi\"\u003e9\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"n\"\u003essecond\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;0\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003esecond\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e  \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"n\"\u003essecond\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003esecond\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;Time: \u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eshour\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;:\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003esminute\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;:\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003essecond\u003c/span\u003e \u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003c/details\u003e\n\n\u003cp\u003e\u003cem\u003e(The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\u003c/em\u003e\u003c/p\u003e","title":"Day 17: Wake Up Light"},{"content":"Behind today\u0026rsquo;s door is a piezo sound transducer. It\u0026rsquo;s possible to generate sounds with it, which will become clear in today\u0026rsquo;s test. Today you\u0026rsquo;re building a type of piano that can be used via a website. See the following picture for the layout:\nThe correct connection of the piezo sound transducer The sketch: A16_P16_WebserverPiano.ino /* TCP-Server Piano Change SSID and PASSWORD. */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_HTTP.h\u0026gt; //special library for http-connection #include \u0026lt;SoftwareSerial.h\u0026gt; #include \u0026#34;Websites.h\u0026#34; //websites in a special file as progmem #define SSID \u0026#34;YourSSID\u0026#34; #define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 NanoESP nanoesp = NanoESP(); NanoESP_HTTP http = NanoESP_HTTP(nanoesp); void setup() { Serial.begin(19200); nanoesp.init(); //! Only if you want to change the ACCESPOINT configuration //nanoesp.configWifi(ACCESSPOINT, \u0026#34;NanoESP\u0026#34;, \u0026#34;\u0026#34;); //! Only if you use a new Network // nanoesp.configWifi(DUAL, SSID, PASSWORD); //Dual Mode nanoesp.configWifiMode(DUAL); //delay(1000); // Wait till Connected to WiFi if (nanoesp.wifiConnected())digitalWrite(LED_WLAN, HIGH); else Serial.println(F(\u0026#34;Error WLAN Connect\u0026#34;)); //Start TCP Server if (nanoesp.startTcpServer(80)) Serial.println(F(\u0026#34;TCP Server Activ\u0026#34;)); else Serial.println(F(\u0026#34;TCP Server Error\u0026#34;)); //Print IP in Terminal Serial.println(nanoesp.getIp()); } void loop() { String method, ressource, parameter; int id; if (http.recvRequest(id, method, ressource, parameter)) { //Incoming request, parameters by reference Serial.println(\u0026#34;New Request from id :\u0026#34; + String(id) + \u0026#34;, method: \u0026#34; + method + \u0026#34;, ressource: \u0026#34; + ressource + \u0026#34; parameter: \u0026#34; + parameter); if (ressource == \u0026#34;/\u0026#34;) { http.sendFromFlash(id, index, sizeof(index)); nanoesp.closeConnection(id); } else if (ressource == \u0026#34;/dataonly\u0026#34;) { //only data is recieved on this url, no need to send a website nanoesp.closeConnection(id); } else { http.sendFromFlash(id, error404, sizeof(error404)); nanoesp.closeConnection(id); } if (parameter != \u0026#34;\u0026#34;) //the request included parameters { String strTone; if (method == GET) strTone = parameter.substring(6); else strTone = parameter.substring(5); //get note values noTone(8); tone(8, strTone.toInt(), 200); //play note for 200ms } } } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nWhen you\u0026rsquo;ve uploaded the programme, you can open the board\u0026rsquo;s website using the IP address in the browser. Today it doesn\u0026rsquo;t matter whether you connect to the board through your home network or the access point, since no external data is loaded. On the website you find a few buttons with which you can trigger a tone when you press them. The transfer is really fast. However, you should give the board a quarter of a second to play the tone before you send another tone. Otherwise, the note sounds very strange. But try to play one of the classics of the beginner songs: All My Ducklings. The notes are:\nC D E F G G A A A A G A A A A G F F F F E E G G G G C\nThe piano website ","permalink":"https://neu-iot.fkainka.de/en/day16-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door is a piezo sound transducer. It\u0026rsquo;s possible to generate sounds with it, which will become clear in today\u0026rsquo;s test. Today you\u0026rsquo;re building a type of piano that can be used via a website. See the following picture for the layout:\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/09/Day16_Piezzo_Steckplatine.jpg\"\u003e\u003cimg class=\"wp-image-1382 size-large\" src=\"/images/2016/09/Day16_Piezzo_Steckplatine.jpg\" alt=\"Der Piezzo richtig angeschlossen\" width=\"616\" height=\"401\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe correct connection of the piezo sound transducer\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cdetails class=\"spoiler\"\u003e\n  \u003csummary\u003eThe sketch: A16_P16_WebserverPiano.ino\u003c/summary\u003e\n  \u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-cpp\" data-lang=\"cpp\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e/*\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e  TCP-Server Piano\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e  Change SSID and PASSWORD.\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e*/\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;NanoESP.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;NanoESP_HTTP.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e \u003c/span\u003e\u003cspan class=\"c1\"\u003e//special library for http-connection\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;SoftwareSerial.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026#34;Websites.h\u0026#34;\u003c/span\u003e\u003cspan class=\"cp\"\u003e \u003c/span\u003e\u003cspan class=\"c1\"\u003e//websites in a special file as progmem\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define SSID \u0026#34;YourSSID\u0026#34;\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define PASSWORD \u0026#34;YourPassword\u0026#34;\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define LED_WLAN 13\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eNanoESP\u003c/span\u003e \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eNanoESP\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eNanoESP_HTTP\u003c/span\u003e \u003cspan class=\"n\"\u003ehttp\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eNanoESP_HTTP\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003esetup\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ebegin\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e19200\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003einit\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//! Only if you want to change the ACCESPOINT configuration\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//nanoesp.configWifi(ACCESSPOINT, \u0026#34;NanoESP\u0026#34;, \u0026#34;\u0026#34;);\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//! Only if you use a new Network\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// nanoesp.configWifi(DUAL, SSID, PASSWORD);\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//Dual Mode\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003econfigWifiMode\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eDUAL\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//delay(1000);\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// Wait till Connected to WiFi\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ewifiConnected\u003c/span\u003e\u003cspan class=\"p\"\u003e())\u003c/span\u003e\u003cspan class=\"n\"\u003edigitalWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eLED_WLAN\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eHIGH\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Error WLAN Connect\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//Start TCP Server\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003estartTcpServer\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e80\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e    \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;TCP Server Activ\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e \u003cspan class=\"k\"\u003eelse\u003c/span\u003e   \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;TCP Server Error\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//Print IP in Terminal\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003egetIp\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003eloop\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003emethod\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eressource\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"kt\"\u003eint\u003c/span\u003e \u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ehttp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003erecvRequest\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003emethod\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eressource\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e \u003cspan class=\"c1\"\u003e//Incoming request, parameters by reference\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;New Request from id :\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;, method: \u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003emethod\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e  \u003cspan class=\"s\"\u003e\u0026#34;, ressource: \u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eressource\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e  \u003cspan class=\"s\"\u003e\u0026#34; parameter: \u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e+\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eressource\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;/\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003ehttp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esendFromFlash\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eindex\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"k\"\u003esizeof\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eindex\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ecloseConnection\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eressource\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;/dataonly\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e  \u003cspan class=\"c1\"\u003e//only data is recieved on this url, no need to send a website\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ecloseConnection\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003ehttp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esendFromFlash\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eerror404\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"k\"\u003esizeof\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eerror404\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003enanoesp\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ecloseConnection\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eid\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eparameter\u003c/span\u003e \u003cspan class=\"o\"\u003e!=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e      \u003cspan class=\"c1\"\u003e//the request included parameters\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003estrTone\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003emethod\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"n\"\u003eGET\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e  \u003cspan class=\"n\"\u003estrTone\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esubstring\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e6\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"k\"\u003eelse\u003c/span\u003e   \u003cspan class=\"n\"\u003estrTone\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eparameter\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esubstring\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e5\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"c1\"\u003e//get note values\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003enoTone\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e8\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003etone\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e8\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003estrTone\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003etoInt\u003c/span\u003e\u003cspan class=\"p\"\u003e(),\u003c/span\u003e \u003cspan class=\"mi\"\u003e200\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e    \u003cspan class=\"c1\"\u003e//play note for 200ms\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003c/details\u003e\n\n\u003cp\u003e\u003cem\u003e(The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\u003c/em\u003e\u003c/p\u003e","title":"Day 16: A web server piano"},{"content":"Since the Blynk platform was the central point of our projects over the last few days, now we\u0026rsquo;re coming to a totally new subject: the NanoESP as web server. You\u0026rsquo;ve already gotten a first impression of it in the test for the first day. In the coming days, we\u0026rsquo;ll see what all else is possible.\nBehind today\u0026rsquo;s door is a special two-core cable with which you can connect e.g. even LEDs or sensors outside the board. For today\u0026rsquo;s test, however, no hardware layout is necessary at all. You only need the programme and a browser.\nThe sketch: A16_P15_Webserver.ino /* TCP-Server example Change SSID and PASSWORD. */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;NanoESP_HTTP.h\u0026gt; //special library for http-connection #include \u0026lt;SoftwareSerial.h\u0026gt; #include \u0026#34;Websites.h\u0026#34; //websites in a special file as progmem #define SSID \u0026#34;YourSSID\u0026#34; #define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 NanoESP nanoesp = NanoESP(); NanoESP_HTTP http = NanoESP_HTTP(nanoesp); //init http library with an instance of nanoesp void setup() { Serial.begin(19200); nanoesp.init(); //! Only if you want to change the ACCESPOINT configuration //nanoesp.configWifi(ACCESSPOINT, \u0026#34;NanoESP\u0026#34;, \u0026#34;\u0026#34;); //! Only if you use a new Network // nanoesp.configWifi(DUAL, SSID, PASSWORD); //Dual Mode nanoesp.configWifiMode(DUAL); //delay(1000); // Wait till Connected to WiFi if (nanoesp.wifiConnected())digitalWrite(LED_WLAN, HIGH); else Serial.println(F(\u0026#34;Error WLAN Connect\u0026#34;)); //Start TCP Server if (nanoesp.startTcpServer(80)) Serial.println(F(\u0026#34;TCP Server Activ\u0026#34;)); else Serial.println(F(\u0026#34;TCP Server Error\u0026#34;)); //Print IP to Terminal Serial.println(nanoesp.getIp()); } void loop() { String method, ressource, parameter; int id; if (http.recvRequest(id, method, ressource, parameter)) { //Incoming request, parameters by reference Serial.println(\u0026#34;New Request from id :\u0026#34; + String(id) + \u0026#34;, method: \u0026#34; + method + \u0026#34;, ressource: \u0026#34; + ressource + \u0026#34; parameter: \u0026#34; + parameter); if (ressource == \u0026#34;/\u0026#34;) { //index page http.sendFromFlash(id, index, sizeof(index)); //send website from website.h nanoesp.closeConnection(id); //close connection so browser knows website transmission is complete } else if (ressource == \u0026#34;/lib\u0026#34;) { http.sendFromFlash(id, lib, sizeof(lib)); //send website from website.h nanoesp.closeConnection(id); //close connection so browser knows website transmission is complete } else if (ressource == \u0026#34;/pinout\u0026#34;) { http.sendFromFlash(id, pinout, sizeof(pinout)); //send website from website.h nanoesp.closeConnection(id); //close connection so browser knows website transmission is complete } else { http.sendFromFlash(id, error404, sizeof(error404)); //send website from website.h nanoesp.closeConnection(id);//close connection so browser knows website transmission is complete } } } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nDownload the programme and program it on the board. You might be wondering why you don\u0026rsquo;t have to enter any WLAN data today. The reason is that the board, or more precisely the WLAN chip, still has your WLAN data stored from the previous test. A new function of the library now waits for a restart until a connection to the known WLAN has been made. If you\u0026rsquo;re using a new WLAN, you need to delete the comment characters before the line\nnanoesp.configWifi(DUAL, SSID, PASSWORD);\nso that the new data can be adjusted. The same is true for all subsequent days. There\u0026rsquo;s something else new today: The board is used in dual mode. This means that the board both connects to your home WLAN network and generates its own access point. You can thus access the board in two ways.\nAfter the upload, two IP addresses also appear simultaneously on the serial monitor this time. The address that\u0026rsquo;s after +CIFST:APIP is that of the board in the access point WLAN. The one after +CIFST:STAIP is the one that the board has been assigned by the router. Because your computer is probably already connected to the home network, you should enter the second IP address in your browser. A main page appears through which you can reach other pages via links, all of which are also stored on the board. You can follow the calling up of a page on the serial monitor.\nThe board can be accessed through two networks, but only one has an Internet connection The website in the browser If you now want to connect your PC to the NanoESP\u0026rsquo;s own WLAN, you have to call up the access point IP address in the browser. The pages are the same, with the exception that no pictures are displayed. The reason is that the PC has no connection to the Internet through this network and thus the images, as external resources, can\u0026rsquo;t be loaded. The advantage of this network mode, however, is that you don\u0026rsquo;t need a router as a way station but can access the board directly. Both methods thus have their advantages and disadvantages.\nThe IP addresses and browser requests on the serial monitor ","permalink":"https://neu-iot.fkainka.de/en/day15-2016/","summary":"\u003cp\u003eSince the Blynk platform was the central point of our projects over the last few days, now we\u0026rsquo;re coming to a totally new subject: the NanoESP as web server. You\u0026rsquo;ve already gotten a first impression of it in the test for the first day. In the coming days, we\u0026rsquo;ll see what all else is possible.\u003c/p\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door is a special two-core cable with which you can connect e.g. even LEDs or sensors outside the board. For today\u0026rsquo;s test, however, no hardware layout is necessary at all. You only need the programme and a browser.\u003c/p\u003e","title":"Day 15: A web server"},{"content":"Behind today\u0026rsquo;s door is an NTC sensor (negative temperature coefficient thermistor). Its conductivity changes depending on the temperature. You\u0026rsquo;ll use the sensor today to undertake a long-term measurement of the temperature. As a small bonus, you can select a time at which you get a summary by email.\nFor today\u0026rsquo;s layout, in addition to the NTC, you\u0026rsquo;ll also need the potentiometer and a 1-kohm resistor. You can make a fine adjustment of the temperature with the potentiometer.\nThe NTC with potentiometer for adjustment The sketch: A16_P14_Blynk10_NTCSensor.ino /* Blnky10: NTC-Sensor Change ssid, password, token and email */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;YourToken\u0026#34;; char email[] = \u0026#34;YourEmail\u0026#34;; char subject[] = \u0026#34;Temperatur Summary\u0026#34;; #define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; #include \u0026lt;SimpleTimer.h\u0026gt; #include \u0026lt;TimeLib.h\u0026gt; // Set ESP8266 Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX ESP8266 wifi(EspSerial); SimpleTimer timer; //init max min value (0 makes no sense) double tempMax = - 273; double tempMin = +200; bool autoSend; void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); //timer for temp measure timer.setInterval(500L, getTemp); } void loop() { Blynk.run(); timer.run(); //Call timer (other than normal timers) } BLYNK_CONNECTED() { Blynk.syncVirtual(V5); //sync email auto send state } void getTemp() { //get temp, convert to C and send double currValue = Thermistor(analogRead(A0)) ; //Convert to C !!! Pot: round((x*10)/10) if (currValue \u0026lt; tempMin) { tempMin = currValue; } if (currValue \u0026gt; tempMax) { tempMax = currValue; } Blynk.virtualWrite(V0, currValue); Blynk.virtualWrite(V1, currValue); Blynk.virtualWrite(V3, tempMin); Blynk.virtualWrite(V2, tempMax); } double Thermistor(int RawADC) { //Source: http://playground.arduino.cc/ComponentLib/Thermistor2 double Temp; Temp = log(10000.0 * ((1024.0 / RawADC - 1))); // =log(10000.0/(1024.0/RawADC-1)) // for pull-up configuration Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp )) * Temp ); Temp = Temp - 273.15; // Convert Kelvin to Celcius // Temp = (Temp * 9.0)/ 4.7 + 32.0; // Convert Celcius to Fahrenheit return Temp; } void sendSummary() { //send email summary String msg = \u0026#34;Tempertur Summary:\\nCurrent Temperatur: \u0026#34; + String(Thermistor(analogRead(A0))) + \u0026#34; C\\n\\nMax. Temp: \u0026#34; + String(tempMax) + \u0026#34;C \\n\\nMin. Temp: \u0026#34; + String(tempMin) + \u0026#34;C \\n\u0026#34;; Blynk.email(email, subject, msg); } BLYNK_WRITE(V6) { //Timer Send if (autoSend) { sendSummary(); } } BLYNK_WRITE(V4) { //Button Send sendSummary(); } BLYNK_WRITE(V5) { //config email send autoSend = param.asInt(); } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nYou can load the interface in your Blynk app with the QR code. In the programme you download from the website, besides the current token and your WLAN data, today you have to enter an email address again to which the summary should be sent.\nThe Blynk interface contains the history graph as the central element. It shows the current temperature as well as maximum and minimum values. In the line below, you can select the time frame of the data to be visualised. You can delete the stored data by swiping on the widget toward the left while the interface is active. You\u0026rsquo;ll also find the current temperature in the display under the graph. With the elements at the bottom left, you can make adjustments for the automatic sending of a summary. However, with the button on the right side, you can also have a summary sent at any time.\nLong term measurement ","permalink":"https://neu-iot.fkainka.de/en/day14-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door is an NTC sensor (negative temperature coefficient thermistor). Its conductivity changes depending on the temperature. You\u0026rsquo;ll use the sensor today to undertake a long-term measurement of the temperature. As a small bonus, you can select a time at which you get a summary by email.\u003c/p\u003e\n\u003cp\u003eFor today\u0026rsquo;s layout, in addition to the NTC, you\u0026rsquo;ll also need the potentiometer and a 1-kohm resistor. You can make a fine adjustment of the temperature with the potentiometer.\u003c/p\u003e","title":"Day 14: Long-term temperature measurement"},{"content":"Today\u0026rsquo;s project deals with a simple silent alarm system with password input for resetting the alarm. So that you get anything at all from the alarm, the board sends a push message to your smartphone. We\u0026rsquo;ll set the tilt sensor that\u0026rsquo;s behind today\u0026rsquo;s door as a motion detector. It can give information about vibrations and thus inform you if someone tips the NanoESP board.\nLayout with tilt sensor The sketch: A16_P13_Blynk9_PushAlarm.ino /* Blnky9: PushAlarm Change ssid, password and token */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;YourToken\u0026#34;; String passwordAlarm = \u0026#34;password\u0026#34;; String alarmMsg = \u0026#34;Alarm! Someone touched the NanoESP!\u0026#34;; #define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; #include \u0026lt;SimpleTimer.h\u0026gt; // Set ESP8266 Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX ESP8266 wifi(EspSerial); SimpleTimer timer; WidgetTerminal terminal(V1); boolean alarm = false; void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); //push msg Blynk.notify(\u0026#34;Alarm active\u0026#34;); pinMode(2, INPUT_PULLUP); //timer for blinking led on alarm timer.setInterval(1000L, blinkAlarm); } void loop() { Blynk.run(); if (alarm) timer.run(); else digitalWrite(13, LOW); //blink if alarm active if (digitalRead(2)) { //read tilt sensor if (!alarm) { alarm = true; Blynk.notify(alarmMsg); //push msg on alarm terminal.println(F(\u0026#34;Alarm! Type in Password:\u0026#34;)); terminal.flush(); } } } BLYNK_CONNECTED() { Blynk.syncAll(); terminal.println(F(\u0026#34;Blynk v\u0026#34; BLYNK_VERSION \u0026#34;: Device started\u0026#34;)); terminal.println(\u0026#34;-------------\u0026#34;); terminal.flush(); } BLYNK_WRITE(V1) //Terminal { //type in password on alarm if (alarm) { String passInput = param.asStr(); if (passwordAlarm == passInput) { alarm = false; terminal.println(F(\u0026#34;Alarm deaktivated\u0026#34;)); terminal.flush(); } else { terminal.println(F(\u0026#34;Wrong password!\u0026#34;)); terminal.flush(); } } } //timer function for blinking led on alarm void blinkAlarm() { digitalWrite(13, !digitalRead(13)); } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nThe Blynk interface for today\u0026rsquo;s project is kept quite simple. There is a terminal through which the important information is delivered. At the same time, the terminal is used to input the password. Set the password in the programme. If you haven\u0026rsquo;t entered anything, the password is \u0026ldquo;password\u0026rdquo;. There\u0026rsquo;s also another element, namely the push widget. Push messages are sent through it to your mobile. Push means that the message appears directly as a message on your smartphone. In the widget, you can choose between \u0026ldquo;Normal\u0026rdquo; and \u0026ldquo;High Priority.\u0026rdquo; With High Priority, the message is displayed immediately, but it needs significantly more battery. Now if someone tries to steal your NanoESP, you\u0026rsquo;ll get a message directly on your mobile.\nSomeone moved the NanoESP ","permalink":"https://neu-iot.fkainka.de/en/day13-2016/","summary":"\u003cp\u003eToday\u0026rsquo;s project deals with a simple silent alarm system with password input for resetting the alarm. So that you get anything at all from the alarm, the board sends a push message to your smartphone. We\u0026rsquo;ll set the tilt sensor that\u0026rsquo;s behind today\u0026rsquo;s door as a motion detector. It can give information about vibrations and thus inform you if someone tips the NanoESP board.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/09/Day13_Tilt_Steckplatine.jpg\"\u003e\u003cimg class=\"size-large wp-image-1366\" src=\"/images/2016/09/Day13_Tilt_Steckplatine.jpg\" alt=\"Aufbau mit Tiltsensor\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eLayout with tilt sensor\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cdetails class=\"spoiler\"\u003e\n  \u003csummary\u003eThe sketch: A16_P13_Blynk9_PushAlarm.ino\u003c/summary\u003e\n  \u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-cpp\" data-lang=\"cpp\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e/*\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e  Blnky9: PushAlarm\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e  Change ssid, password and token\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e*/\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003echar\u003c/span\u003e \u003cspan class=\"n\"\u003essid\u003c/span\u003e\u003cspan class=\"p\"\u003e[]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;YourSSID\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003echar\u003c/span\u003e \u003cspan class=\"n\"\u003epassword\u003c/span\u003e\u003cspan class=\"p\"\u003e[]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;YourPassword\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003echar\u003c/span\u003e \u003cspan class=\"n\"\u003etoken\u003c/span\u003e\u003cspan class=\"p\"\u003e[]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;YourToken\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003epasswordAlarm\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;password\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eString\u003c/span\u003e  \u003cspan class=\"n\"\u003ealarmMsg\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;Alarm! Someone touched the NanoESP!\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define BLYNK_DEBUG\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define BLYNK_PRINT Serial    \u003c/span\u003e\u003cspan class=\"c1\"\u003e// Comment this out to disable prints and save space\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;ESP8266_SoftSer.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;SimpleTimer.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e// Set ESP8266 Serial object\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;SoftwareSerial.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eSoftwareSerial\u003c/span\u003e \u003cspan class=\"nf\"\u003eEspSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e11\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"mi\"\u003e12\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"c1\"\u003e// RX, TX\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eESP8266\u003c/span\u003e \u003cspan class=\"nf\"\u003ewifi\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eEspSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eSimpleTimer\u003c/span\u003e \u003cspan class=\"n\"\u003etimer\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eWidgetTerminal\u003c/span\u003e \u003cspan class=\"nf\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV1\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eboolean\u003c/span\u003e \u003cspan class=\"n\"\u003ealarm\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"nb\"\u003efalse\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003esetup\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// Set console baud rate\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ebegin\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e19200\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eEspSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ebegin\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e19200\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ebegin\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003etoken\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003ewifi\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003essid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003epassword\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//push msg\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003enotify\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Alarm active\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003epinMode\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eINPUT_PULLUP\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//timer for blinking led on alarm\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003etimer\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esetInterval\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e1000L\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eblinkAlarm\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003eloop\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003erun\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ealarm\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"n\"\u003etimer\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003erun\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"n\"\u003edigitalWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e13\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eLOW\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"c1\"\u003e//blink if alarm active\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003edigitalRead\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e \u003cspan class=\"c1\"\u003e//read tilt sensor\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"o\"\u003e!\u003c/span\u003e\u003cspan class=\"n\"\u003ealarm\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003ealarm\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"nb\"\u003etrue\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003enotify\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ealarmMsg\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"c1\"\u003e//push msg on alarm\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Alarm! Type in Password:\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eflush\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eBLYNK_CONNECTED\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esyncAll\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Blynk v\u0026#34;\u003c/span\u003e \u003cspan class=\"n\"\u003eBLYNK_VERSION\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;: Device started\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;-------------\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eflush\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eBLYNK_WRITE\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV1\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"c1\"\u003e//Terminal\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//type in password on alarm\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ealarm\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"n\"\u003epassInput\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003easStr\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003epasswordAlarm\u003c/span\u003e \u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"n\"\u003epassInput\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003ealarm\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"nb\"\u003efalse\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Alarm deaktivated\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eflush\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eF\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s\"\u003e\u0026#34;Wrong password!\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e      \u003cspan class=\"n\"\u003eterminal\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eflush\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e//timer function for blinking led on alarm\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003eblinkAlarm\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003edigitalWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e13\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"o\"\u003e!\u003c/span\u003e\u003cspan class=\"n\"\u003edigitalRead\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e13\u003c/span\u003e\u003cspan class=\"p\"\u003e));\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003c/details\u003e\n\n\u003cp\u003e\u003cem\u003e(The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\u003c/em\u003e\u003c/p\u003e","title":"Day 13: Alarm system with push messages"},{"content":"Behind today\u0026rsquo;s door, you\u0026rsquo;ll find a phototransistor. This is a sensor with which the brightness can be measured. You\u0026rsquo;ll do that today, but in addition to simple measurement, the project also sounds an alarm as soon as limit values that you\u0026rsquo;ve pre-set in the app are exceeded. So that everything will function, you have to connect the sensor with a voltage divider circuit at Pin A0, as shown in the picture below. Pay attention to the correct polarity of the phototransistor (short leg to VCC). It does also work the other way round, but not nearly as sensitively.\nThe phototransistor in voltage divider circuit with a 10-kohm resistor The Blynk interface looks pretty full today. Many different functions are realised with widgets. Through one of them, represented by the Twitter bird, you can connect your Twitter account to the project. This is one of the channels through which you can receive an alarm message.\nThe sketch: A16_P12_Blynk8_LightSensor.ino /* Blynk 8: LightSensor Change ssid, password, token and email */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;YourToken\u0026#34;; char email[] = \u0026#34;Your@Email.com\u0026#34;; char subject[] = \u0026#34;Alarm NanoESP\u0026#34;; String alarmMsg = \u0026#34;Alarm! #NanoESP\u0026#34;; #define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; // Set ESP8266 Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX ESP8266 wifi(EspSerial); int alarmValueMin; int alarmValueMax; boolean alTwitter; boolean alEmail; boolean alarm = false; WidgetTerminal terminal(V1); void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); } void loop() { Blynk.run(); compValue(); } BLYNK_CONNECTED() { //Sync all values and write MSG to terminal widget Blynk.syncAll(); terminal.println(F(\u0026#34;Blynk v\u0026#34; BLYNK_VERSION \u0026#34;: Device started\u0026#34;)); terminal.println(\u0026#34;-------------\u0026#34;); terminal.println(\u0026#34;Type in Alarmmessage.\u0026#34;); terminal.println(\u0026#34;Current message:\u0026#34;); terminal.println(alarmMsg); terminal.flush(); } BLYNK_WRITE(V1) //Terminal: get new alarm msg { alarmMsg = param.asStr(); terminal.println(\u0026#34;Message saved: \u0026#34;) ; terminal.println(alarmMsg) ; terminal.flush(); } BLYNK_WRITE(V2) //AlarmValueMin { alarmValueMin = param.asInt(); } BLYNK_WRITE(V3) //AlarmValueMax { alarmValueMax = param.asInt(); } void compValue() { //compare values to max/min int currValue = analogRead(A0); if (alarm == false) { if ((currValue \u0026lt; alarmValueMin) || (currValue \u0026gt; alarmValueMax)) { //Alarm terminal.println(\u0026#34;Alarm!!!\u0026#34;) ; //Twitter if twitter alarm active if (alTwitter) { Blynk.tweet(alarmMsg + \u0026#34; \u0026#34; + currValue); terminal.println(\u0026#34;Tweet send\u0026#34;); } //E-mail if E-mail alarm active if (alEmail) { Blynk.email(email, subject, alarmMsg + \u0026#34; Value: \u0026#34; + currValue); terminal.println(\u0026#34;Email send\u0026#34;); } terminal.flush(); alarm = true; } } else { if ((currValue \u0026gt; alarmValueMin) \u0026amp;\u0026amp; (currValue \u0026lt; alarmValueMax)) { //deactivate alarm terminal.println(\u0026#34;No alarm\u0026#34;) ; terminal.flush(); alarm = false; } } } BLYNK_WRITE(V4) { //Email alarm activation alEmail = param.asInt(); Blynk.virtualWrite(V7, param.asInt() * 255); // LED on/off } BLYNK_WRITE(V5) // Twitter alarm activation { alTwitter = param.asInt(); Blynk.virtualWrite(V6, param.asInt() * 255); // LED on/off } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nThere\u0026rsquo;s something more to do in the Arduino programme today, too. In addition to WLAN data and token, you can enter an email address today. That\u0026rsquo;s the other channel through which an alarm message is sent.\nIf you start the interface now, you\u0026rsquo;ll already see a row of measured values scrolling above the topmost element. You can follow the progression of values with the line. If you pass your hand over the sensor, the measured values become significantly lower. Using the sliding switch directly below the measured values, you can set limit values that must not be exceeded or fallen below. At the bottom, there\u0026rsquo;s also a blue and a white button. With these, you can activate or deactivate the reporting via Twitter or via email. The LED next to the respective symbol shows the current status. If a measured value leaves the allowed range, the system goes into an alarm state and sends a message. A terminal in the centre also gives information about current events. You can also set a new message text using the terminal. Thus you\u0026rsquo;re always up to date on whether e.g. your plants are getting enough light.\nAn alarm was triggert ","permalink":"https://neu-iot.fkainka.de/en/day12-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door, you\u0026rsquo;ll find a phototransistor. This is a sensor with which the brightness can be measured. You\u0026rsquo;ll do that today, but in addition to simple measurement, the project also sounds an alarm as soon as limit values that you\u0026rsquo;ve pre-set in the app are exceeded. So that everything will function, you have to connect the sensor with a voltage divider circuit at Pin A0, as shown in the picture below. Pay attention to the correct polarity of the phototransistor (short leg to VCC). It does also work the other way round, but not nearly as sensitively.\u003c/p\u003e","title":"Day 12: Light monitor"},{"content":"Behind today\u0026rsquo;s door is a 10-kohm resistor, but we don\u0026rsquo;t need it yet today. Instead, the set-up from yesterday\u0026rsquo;s test works today as well. In this project, you\u0026rsquo;ll build a day-night lamp that changes colours at specific times. Thus you can have a bright light shining during the day, while at night only a dim red serves as emergency lighting for a bit of orientation.\nThe layout from Day 10 The sketch: A16_P11_Blynk7_DayNight.ino /* Blynk 7: DayNight Change ssid, password and token */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;YourToken\u0026#34;; #define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; // Set ESP8266 Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX ESP8266 wifi(EspSerial); boolean isDay; void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); } void loop() { //all events are handled by functions below Blynk.run(); } BLYNK_CONNECTED() { //Sync all states when reconnected Blynk.syncAll(); } BLYNK_WRITE(V1) //DayTimer { if (param.asInt()== 1){ Blynk.virtualWrite(V0,1); Blynk.virtualWrite(V7,0); isDay = true; Blynk.syncVirtual(V3); } } BLYNK_WRITE(V4) //NightTimer { if (param.asInt()== 1){ Blynk.virtualWrite(V0,0); Blynk.virtualWrite(V7,1); isDay = false; Blynk.syncVirtual(V8); } } BLYNK_WRITE(V0) //Day { if(param.asInt()==1) { Blynk.virtualWrite(V7,0); isDay = true; Blynk.syncVirtual(V3); } } BLYNK_WRITE(V7){ //Night if(param.asInt()==1) { Blynk.virtualWrite(V0,0); isDay = false; Blynk.syncVirtual(V8); } } BLYNK_WRITE(V3) // change color Day { if (isDay){ analogWrite(3, param[0].asInt()); // getting first value analogWrite(5, param[1].asInt()); // getting second value analogWrite(6, param[2].asInt()); // getting N value } } BLYNK_WRITE(V8) // change color Night { if (!isDay){ analogWrite(3, param[0].asInt()); // getting first value analogWrite(5, param[1].asInt()); // getting second value analogWrite(6, param[2].asInt()); // getting N value } } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nWhen you\u0026rsquo;ve transferred the Blynk interface via QR code and downloaded today\u0026rsquo;s programme, changed it and uploaded it to the controller, you can already get started. On the Blynk interface, you see two ZeRGBa elements, which are labelled \u0026ldquo;DayLight\u0026rdquo; and \u0026ldquo;NightLight.\u0026rdquo; When you switch to day or night mode with the outside buttons below the ZeRGBa elements, the corresponding colour of the element is shown. But you can also automate the switch between day and night mode. To do this, tap one of the two timer elements directly below the colour selection elements. Here, while the interface is not started, you can select a time at which the mode should be switched. All you have to adjust is the start time. The same applies for the other timer element. At the selected time, the mode switches over, and the LED changes from the day colour to the night colour or vice versa. You don\u0026rsquo;t even have to have the app open at those times. The Blynk server regulates the switch-over automatically.\nThe user interface ","permalink":"https://neu-iot.fkainka.de/en/day11-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door is a 10-kohm resistor, but we don\u0026rsquo;t need it yet today. Instead, the set-up from yesterday\u0026rsquo;s test works today as well. In this project, you\u0026rsquo;ll build a day-night lamp that changes colours at specific times. Thus you can have a bright light shining during the day, while at night only a dim red serves as emergency lighting for a bit of orientation.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/09/Day10_1_RGB-1.jpg\"\u003e\u003cimg class=\"wp-image-1352 size-large\" src=\"/images/2016/09/Day10_1_RGB-1.jpg\" alt=\"Der Aufbau von Tag 10\" width=\"616\" height=\"362\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe layout from Day 10\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cdetails class=\"spoiler\"\u003e\n  \u003csummary\u003eThe sketch: A16_P11_Blynk7_DayNight.ino\u003c/summary\u003e\n  \u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-cpp\" data-lang=\"cpp\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e/*\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003eBlynk 7: DayNight\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003eChange ssid, password and token\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e*/\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003echar\u003c/span\u003e \u003cspan class=\"n\"\u003essid\u003c/span\u003e\u003cspan class=\"p\"\u003e[]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;YourSSID\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003echar\u003c/span\u003e \u003cspan class=\"n\"\u003epassword\u003c/span\u003e\u003cspan class=\"p\"\u003e[]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;YourPassword\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003echar\u003c/span\u003e \u003cspan class=\"n\"\u003etoken\u003c/span\u003e\u003cspan class=\"p\"\u003e[]\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"s\"\u003e\u0026#34;YourToken\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define BLYNK_DEBUG\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#define BLYNK_PRINT Serial    \u003c/span\u003e\u003cspan class=\"c1\"\u003e// Comment this out to disable prints and save space\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;ESP8266_SoftSer.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e// Set ESP8266 Serial object\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cp\"\u003e#include\u003c/span\u003e \u003cspan class=\"cpf\"\u003e\u0026lt;SoftwareSerial.h\u0026gt;\u003c/span\u003e\u003cspan class=\"cp\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eSoftwareSerial\u003c/span\u003e \u003cspan class=\"nf\"\u003eEspSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e11\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"mi\"\u003e12\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \u003cspan class=\"c1\"\u003e// RX, TX\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eESP8266\u003c/span\u003e \u003cspan class=\"nf\"\u003ewifi\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eEspSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eboolean\u003c/span\u003e \u003cspan class=\"n\"\u003eisDay\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003esetup\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e// Set console baud rate\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ebegin\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e19200\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eEspSerial\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ebegin\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e19200\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003ebegin\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003etoken\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003ewifi\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003essid\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003epassword\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"kt\"\u003evoid\u003c/span\u003e \u003cspan class=\"nf\"\u003eloop\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"c1\"\u003e//all events are handled by functions below\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003erun\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eBLYNK_CONNECTED\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e   \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"c1\"\u003e//Sync all states when reconnected\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e     \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esyncAll\u003c/span\u003e\u003cspan class=\"p\"\u003e();\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eBLYNK_WRITE\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV1\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"c1\"\u003e//DayTimer\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e){\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003evirtualWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV0\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003evirtualWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV7\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e    \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eisDay\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"nb\"\u003etrue\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esyncVirtual\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV3\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eBLYNK_WRITE\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV4\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"c1\"\u003e//NightTimer\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\u003cspan class=\"o\"\u003e==\u003c/span\u003e \u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e){\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003evirtualWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV0\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003evirtualWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV7\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e    \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eisDay\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"nb\"\u003efalse\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esyncVirtual\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV8\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eBLYNK_WRITE\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV0\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"c1\"\u003e//Day\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\u003cspan class=\"o\"\u003e==\u003c/span\u003e\u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e{\u003c/span\u003e  \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003evirtualWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV7\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e    \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eisDay\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"nb\"\u003etrue\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e   \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esyncVirtual\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV3\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eBLYNK_WRITE\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV7\u003c/span\u003e\u003cspan class=\"p\"\u003e){\u003c/span\u003e \u003cspan class=\"c1\"\u003e//Night\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eif\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e\u003cspan class=\"o\"\u003e==\u003c/span\u003e\u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e{\u003c/span\u003e   \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003evirtualWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV0\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eisDay\u003c/span\u003e \u003cspan class=\"o\"\u003e=\u003c/span\u003e \u003cspan class=\"nb\"\u003efalse\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eBlynk\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003esyncVirtual\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV8\u003c/span\u003e\u003cspan class=\"p\"\u003e);\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eBLYNK_WRITE\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV3\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"c1\"\u003e// change color Day\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e   \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eisDay\u003c/span\u003e\u003cspan class=\"p\"\u003e){\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e     \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e].\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e \u003cspan class=\"c1\"\u003e// getting first value\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e     \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e5\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e].\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e \u003cspan class=\"c1\"\u003e// getting second value\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e     \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e6\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e].\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e \u003cspan class=\"c1\"\u003e// getting N value  \n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eBLYNK_WRITE\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003eV8\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"c1\"\u003e//  change color Night\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e{\u003c/span\u003e   \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"k\"\u003eif\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"o\"\u003e!\u003c/span\u003e\u003cspan class=\"n\"\u003eisDay\u003c/span\u003e\u003cspan class=\"p\"\u003e){\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e     \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e0\u003c/span\u003e\u003cspan class=\"p\"\u003e].\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e \u003cspan class=\"c1\"\u003e// getting first value\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e     \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e5\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e].\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e \u003cspan class=\"c1\"\u003e// getting second value\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e     \u003cspan class=\"n\"\u003eanalogWrite\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"mi\"\u003e6\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"n\"\u003eparam\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"mi\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e].\u003c/span\u003e\u003cspan class=\"n\"\u003easInt\u003c/span\u003e\u003cspan class=\"p\"\u003e());\u003c/span\u003e \u003cspan class=\"c1\"\u003e// getting N value  \n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e  \u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003c/details\u003e\n\n\u003cp\u003e\u003cem\u003e(The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\u003c/em\u003e\u003c/p\u003e","title":"Day 11: Day- and nightlight"},{"content":"Behind today\u0026rsquo;s door is the reason for the many 1-kohm resistors. Namely, what you find there is a so-called RGB LED RGB stands for red-greenblue, since this LED is actually three LEDs that can be connected through a common cathode. By varying the brightness of the individual LEDs using PWM, you can generate almost every colour conceivable.\nYou can see the layout of today\u0026rsquo;s circuit in the following figure. Note that the somewhat longer leg (the cathode) must be plugged into the GND contact strip.\nThe RGB LED with all three series resistors In the Blynk app, a totally new element comes into play today, namely the ZeRGBa element (combination of Zebra and RGB). You can already see roughly how it works from the colourful design. You can either insert the element in your own new project and adjust the pins manually (red at D3, green at D5 and blue at D6) or load the interface of the test as usual via QR code. Whichever way you choose, don\u0026rsquo;t forget to enter the new token in the programme, which you can download as usual from below:\nThe sketch: A16_P10_Blynk6_RGB.ino /* Blynk 6: RGB Change ssid, password and token */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;7c5cc35bf1b54058b232f6392b847519\u0026#34;; #define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; // Set ESP8266 Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX ESP8266 wifi(EspSerial); void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); } void loop() { //the controll of the RGB-LED is done by Blynk automatically Blynk.run(); } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nWhen you have uploaded the programme with your data and the interface has started in the app, you can move the circle in the ZeRGBa widget. You see that the colour of the circle changes. At the same time, the colour of the RGB LED on the board changes. So you can have fun playing around and trying out various colours. You can even get white if you move the circle to the top left corner. The three numbers above also give the current PWM value of the pins D3, D5 and D6. This time, too, you can conceivable use the programme for a living room lamp with mood lighting that can be controlled via app.\nDas ZeRGBa-Element ","permalink":"https://neu-iot.fkainka.de/en/day10-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door is the reason for the many 1-kohm resistors. Namely, what you find there is a so-called RGB LED RGB stands for red-greenblue, since this LED is actually three LEDs that can be connected through a common cathode. By varying the brightness of the individual LEDs using PWM, you can generate almost every colour conceivable.\u003c/p\u003e\n\u003cp\u003eYou can see the layout of today\u0026rsquo;s circuit in the following figure. Note that the somewhat longer leg (the cathode) must be plugged into the GND contact strip.\u003c/p\u003e","title":"Day 10: Colour mixing"},{"content":"Behind today\u0026rsquo;s door is another 1-kohm resistor. But today you don\u0026rsquo;t have to change anything in the hardware layout from yesterday. Only a small detail changes on the interface.\nThe layout from yesterday You don\u0026rsquo;t have to re-upload the programme because you\u0026rsquo;re simply manually adjusting the interface from yesterday. If you\u0026rsquo;d like to load the interface in the app anyway for safety\u0026rsquo;s sake, you\u0026rsquo;ll find the QR code here as usual. But then you also have to re-enter the token in your programme.\nIn order to make the changes manually, you first have to delete the button that was previously responsible for the LED at D9. To do this, tap briefly on the button while the interface is not started and tap the \u0026ldquo;delete\u0026rdquo; option below. There you\u0026rsquo;ll also be shown the energy that you \u0026ldquo;recycle.\u0026rdquo; Now, instead of the button, you have to insert a slider. To do this, tap on the plus sign at the top right and select \u0026ldquo;Slider_L.\u0026rdquo; The slider appears on the screen. By briefly tapping on the element, you reach its settings. Once you\u0026rsquo;re there, set \u0026ldquo;Output\u0026rdquo; to \u0026ldquo;Digital D9.\u0026rdquo; Note that after \u0026ldquo;D9\u0026rdquo; there\u0026rsquo;s a small red \u0026ldquo;PWM,\u0026rdquo; a little indication of how today\u0026rsquo;s test works. After these changes, you can start the interface by tapping the Play button at the top right.\nWhat was previously possible only with the virtual LED is now also possible with real objects. You change the brightness of the LED at D9 by changing the slider position. Thus, for example, you can build a dimmable living room lamp that can be controlled via app. The keyword for this subject is PWM (pulse width modulation). Unlike with an incandescent light bulb, for example, you can\u0026rsquo;t simply dim an LED with less voltage. The procedure here is more complicated and functions by quickly switching the port on and off. The on and off times vary such that it looks like the LED becomes brighter or darker. The longer the on time is compared to the off time, the brighter the LED appears. The fact that the flickering of the LED can\u0026rsquo;t be seen or can barely be seen is due to the high speed with which the port is switched. With this procedure, you can also control engines or generate audio signals.\nThe sketch: A16_P09_Blynk5_PWM.ino /* Blynk 5: PWM No Change to previous programm Change ssid, password and token */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;YourToken\u0026#34;; #define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; // Set ESP8266 Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX #define BUTTON 7 ESP8266 wifi(EspSerial); WidgetLED led1(V0); WidgetLED led2(V1); void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); pinMode(BUTTON, INPUT_PULLUP); } void loop() { Blynk.run(); checkPin(); checkPoti(); } boolean currState = false ; void checkPin() { if (!digitalRead(BUTTON)) { currState = !currState; //write current state to virtual LED if (currState){ led1.on(); } else{ led1.off(); } //wait till button is released while (!digitalRead(BUTTON)){ } } } int lastValue = 0; void checkPoti() { //read A0 and convert it to values 0-255 int currValue = map(analogRead(A0), 0, 1023, 0, 255); //if values have changed write to virtual led2 if (!(currValue == lastValue)){ lastValue = currValue; Blynk.virtualWrite(V1, currValue); } } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\n","permalink":"https://neu-iot.fkainka.de/en/day9-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door is another 1-kohm resistor. But today you don\u0026rsquo;t have to change anything in the hardware layout from yesterday. Only a small detail changes on the interface.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/09/Day8_AnalogButtonLED_Steckplatine-1.jpg\"\u003e\u003cimg class=\"wp-image-1340 size-large\" src=\"/images/2016/09/Day8_AnalogButtonLED_Steckplatine-1.jpg\" alt=\"Der Aufbau von gestern\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe layout from yesterday\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eYou don\u0026rsquo;t have to re-upload the programme because you\u0026rsquo;re simply manually adjusting the interface from yesterday. If you\u0026rsquo;d like to load the interface in the app anyway for safety\u0026rsquo;s sake, you\u0026rsquo;ll find the QR code here as usual. But then you also have to re-enter the token in your programme.\u003c/p\u003e","title":"Day 9: Brightness of the real LED"},{"content":"In the test for the sixth day, you saw how a push button on the hardware side can be mapped on a button in the app. However, another widget, namely the LED widget, is much simpler for this instance. In today\u0026rsquo;s test, you\u0026rsquo;ll see how to use it properly and what options it offers.\nBehind today\u0026rsquo;s door is another 1-kohm resistor that is important for later tests. Today the circuit from yesterday is expanded by a button.\nThe layout of today\u0026#x27;s project You can insert the interface again via QR code. However, the Blynk app may then give you a notice that you don\u0026rsquo;t have enough energy. As mentioned on Day 6, you can get around this problem by deleting the old projects. Now you have enough energy again.\nYou\u0026rsquo;ll find today\u0026rsquo;s programme bellow. Enter your WLAN data and the token code, and already you can upload the programme.\nThe sketch: A16_P08_Blynk4_VirtualLEDs.ino /* Blynk 4: Virtual LEDs Change ssid, password and token */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;YourToken\u0026#34;; #define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; // Set ESP8266 Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX ESP8266 wifi(EspSerial); #define BUTTON 7 //Virtual LED Widgets WidgetLED led1(V0); WidgetLED led2(V1); void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); pinMode(BUTTON, INPUT_PULLUP); } void loop() { Blynk.run(); checkPin(); checkPoti(); } boolean currState = false ; void checkPin() { if (!digitalRead(BUTTON)) { currState = !currState; //write current state to virtual LED if (currState){ led1.on(); } else{ led1.off(); } //wait till button is released while (!digitalRead(BUTTON)){ } } } int lastValue = 0; void checkPoti() { //read A0 and convert it to values 0-255 int currValue = map(analogRead(A0), 0, 1023, 0, 255); //if values have changed write to virtual led2 if (!(currValue == lastValue)){ lastValue = currValue; Blynk.virtualWrite(V1, currValue); } } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nThe programme now unites multiple hardware and software actors and buttons. For example, if you push the first button in the app, the LED at D9 starts to light up. The second button switches on the LED D3, which is permanently mounted on the board. With the button on the breadboard, you change the status of the first app LED. You can affect the brightness of the second LED with the potentiometer. Thus you have many different control options for many different elements.\nToday\u0026#x27;s user interface ","permalink":"https://neu-iot.fkainka.de/en/day8-2016/","summary":"\u003cp\u003eIn the test for the sixth day, you saw how a push button on the hardware side can be mapped on a button in the app. However, another widget, namely the LED widget, is much simpler for this instance. In today\u0026rsquo;s test, you\u0026rsquo;ll see how to use it properly and what options it offers.\u003c/p\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door is another 1-kohm resistor that is important for later tests. Today the circuit from yesterday is expanded by a button.\u003c/p\u003e","title":"Day 8: Virtual LEDs"},{"content":"Behind today\u0026rsquo;s door is a potentiometer. You can use it to transfer analogue messages to the Blynk app. To do this, you need to build the circuit according to the picture.\nThe potentiometer uses the lower wire for the connection to A0 Things can get a bit tight when constructing with the MicroUSB cable. So that everything connects, you first have to disconnect the board from the cable and place the jumpers to be as flat as possible. You also need to be aware that this time the VCC is not applied to the track at the bottom of the image; instead, the track is intended for the connection at Pin A0.\nThe sketch: A16_P07_Blynk3_AnalogIn.ino /* Blynk3: AnalogIn Change ssid, password and token */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;YourToken\u0026#34;; //#define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; // Set ESP8266 Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX ESP8266 wifi(EspSerial); void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); } void loop() { //Analog read and LED toogle are done here automatically by Blynk //No need for special programming Blynk.run(); } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nYou can import the Blynk interface as usual with the QR code. You\u0026rsquo;ll find the programme above. Don\u0026rsquo;t forget to enter the new token and your WLAN data before you upload the programme to the NanoESP board.\nThe measured data are now received approx. once a second and shown in the graph widget. You can affect the measured values by turning the potentiometer. Note that the maximum value is 1023. The reason is that the NanoESP reads the voltage with a resolution of 10 bits. These are formed from a voltage range between 0 and +5 V. The potentiometer acts as a voltage divider in this process, so that voltages between 0 and 5 V can be adjusted at the centre pin.\nToday\u0026#x27;s interface ","permalink":"https://neu-iot.fkainka.de/en/day7-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door is a potentiometer. You can use it to transfer analogue messages to the Blynk app. To do this, you need to build the circuit according to the picture.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/09/Day7_1_AnalogIn_Steckplatine.jpg\"\u003e\u003cimg class=\"wp-image-1325 size-large\" src=\"/images/2016/09/Day7_1_AnalogIn_Steckplatine.jpg\" alt=\"Das Poti benutzt heute die untere Leitung für die Verbindung mit A0\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe potentiometer uses the lower wire for the connection to A0\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eThings can get a bit tight when constructing with the MicroUSB cable. So that everything connects, you first have to disconnect the board from the cable and place the jumpers to be as flat as possible. You also need to be aware that this time the VCC is not applied to the track at the bottom of the image; instead, the track is intended for the connection at Pin A0.\u003c/p\u003e","title":"Day 7: Analogue write"},{"content":"In yesterday\u0026rsquo;s test, you realised a simple control of an LED using the Blynk app. Today you\u0026rsquo;ll see that the control works in both directions. The push-button switch behind today\u0026rsquo;s door really comes in handy for this purpose. With it, you can expand yesterday\u0026rsquo;s circuit as follows:\nThe new layout with push-button switch at D7 You can scan the interface for today here:\nThe QR code for Day 6 http://tinyurl.com/z99macn In the Blynk app, there is a virtual currency labelled Energy. It prevents you from using very extensive projects or many smaller projects in the app at the same time. For you, that means that you may have to delete old projects starting on Day 8. But you can save your adapted project by creating a QR code and saving it somewhere.\nAs always, you\u0026rsquo;ll find today\u0026rsquo;s programme here:\nThe sketch: A16_P06_Blynk2_Button.ino /* Blynk 2: Button Change ssid, password and token */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;YourToken\u0026#34;; //#define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; #define BUTTON 7 // Set NanoESP Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX ESP8266 wifi(EspSerial); void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); pinMode(BUTTON, INPUT_PULLUP); } void loop() { Blynk.run(); checkPin(); } boolean currState = false ; void checkPin() { if (!digitalRead(BUTTON)) { //toggle state currState = !currState; Blynk.virtualWrite(V0, currState); //Wait till button is released while (!digitalRead(BUTTON)){ } } } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nToday, too, the WLAN data and the AUTH TOKEN of the project must be transferred into the programme. Each project has its own token, so you have to have the code re-sent or transfer it into the programme manually. After you start the interface with the Play button, you can again cause the LED on the breadboard to light up by tapping on the button. But you also see a change in the app if you push the button on the breadboard. Thus, the connection is possible in both directions.\n","permalink":"https://neu-iot.fkainka.de/en/day6-2016/","summary":"\u003cp\u003eIn yesterday\u0026rsquo;s test, you realised a simple control of an LED using the Blynk app. Today you\u0026rsquo;ll see that the control works in both directions. The push-button switch behind today\u0026rsquo;s door really comes in handy for this purpose. With it, you can expand yesterday\u0026rsquo;s circuit as follows:\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/09/Day6_1.jpg\"\u003e\u003cimg class=\"wp-image-1321 size-large\" src=\"/images/2016/09/Day6_1.jpg\" alt=\"Der neue Aufbau mit Tastschalter an D7\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe new layout with push-button switch at D7\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eYou can scan the interface for today here:\u003c/p\u003e","title":"Day 6: The hardware button"},{"content":"You already established a first connection from the board to the Internet yesterday. In the coming days, this connection should be used effectively. So we\u0026rsquo;re looking at the online platform Blynk, through which short commands, measurement data or messages can be exchanged between the NanoESP board and your smartphone.\nCommunication with the Blynk Server Blynk enables the simple control of various IoT boards, e.g. the Raspberry Pi or our NanoESP, using an app. You can put the graphic interface together completely on your own, and programming is also extremely simple. As if that weren\u0026rsquo;t enough, you can even control the board from anywhere in the world. So it\u0026rsquo;s totally within the sense of the Internet of Things.\nFor your first test, you need the LED that\u0026rsquo;s behind today\u0026rsquo;s door and the resistor from yesterday. We want to switch the LED using the smartphone or tablet. Set up the circuit shown here on the breadboard. Pay attention to the correct polarity of the LED (small leg at GND).\nDie LED wird an Pin D9 angeschlossen In the next step, you need to install the Blynk library. You\u0026rsquo;ll find a functioning version linked on GitHub. Version 0.3.4 is required:\nhttps://github.com/blynkkk/blynk-library/releases/tag/v0.3.4\nIntegrating this library is somewhat more complicated, since there are multiple library files in the ZIP folder. That means: You have to install it manually. But that\u0026rsquo;s not particularly hard. Simply open your Sketch file folder. If you don\u0026rsquo;t know exactly where it is, look under File \u0026gt; Presets.\nIn the Sketch folder is a folder named libraries. You need to copy the folder contained in the ZIP file into this folder. These are basically the steps the Arduino IDE took automatically on Day 2 when installing the NanoESP library. That\u0026rsquo;s why you\u0026rsquo;ll also find a subfolder named NanoESP in the libraries folder. You should now likewise be able to find the folder from the downloaded archive here.\nNow Blynk is integrated into your Arduino IDE, but you don\u0026rsquo;t yet have the app that goes with it on your smartphone. To change that, download the app from your app store, depending on your operating system, or go to www.blynk.cc and follow the link there.\nOpen the app. You are greeted with the two options Login and Create New Account. Create a new account. For this, you don\u0026rsquo;t have to do anything more than enter an email address and a password. Then you can log in.\nIn order to get the interface for today on your smartphone, there\u0026rsquo;s an exceptionally practical function in the app. Tap the icon at the top right that\u0026rsquo;s between the plus and the i. A QR code scanner opens, which you simply have to hold on the following picture. The interface already appears on your device.\nThe QR code for today\u0026#x27;s project Next, you have to tap the hexagonal icon at the top right and write down the code that\u0026rsquo;s under AUTH TOKEN or, an option that\u0026rsquo;s especially practical, have it sent to your email address. You see, this code belongs in the Arduino programme.\nYou have to download today\u0026rsquo;s Arduino programme from below and open it in the Arduino IDE. Then, just like yesterday, you have to enter the WLAN data at the top in the programme after \u0026ldquo;SSID\u0026rdquo; and \u0026ldquo;PASSWORD.\u0026rdquo; You also have to enter the code referred to above after the keyword \u0026ldquo;token.\u0026rdquo; Only then can you load the programme on the NanoESP. After the upload, you can follow a couple of messages on the serial monitor and thus make sure that the connection set-up has worked.\nThe sketch: A16_P05_Blynk1_LED.ino /* Blynk 1: LED Change ssid, password and token */ char ssid[] = \u0026#34;YourSSID\u0026#34;; char password[] = \u0026#34;YourPassword\u0026#34;; char token[] = \u0026#34;YourToken\u0026#34;; //#define BLYNK_DEBUG #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include \u0026lt;ESP8266_SoftSer.h\u0026gt; #include \u0026lt;BlynkSimpleShieldEsp8266_SoftSer.h\u0026gt; // Set NanoESP Serial object #include \u0026lt;SoftwareSerial.h\u0026gt; SoftwareSerial EspSerial(11, 12); // RX, TX ESP8266 wifi(EspSerial); void setup() { // Set console baud rate Serial.begin(19200); EspSerial.begin(19200); Blynk.begin(token, wifi, ssid, password); } void loop() { Blynk.run(); } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nNow back to the smartphone or tablet. Start your interface by tapping on the Play button at the top right. You can now press the button in the middle of your interface, and whenever you touch the button, the LED lights up on the breadboard. As a test, you can change the button type; stop the programme by pressing the Stop button and tap briefly on the button. There change the button type from Push to Switch; then press Play again in the interface view. Now a simple tap is enough to cause the LED to stay lit.\nThe Blynk APP ","permalink":"https://neu-iot.fkainka.de/en/day5-2016/","summary":"\u003cp\u003eYou already established a first connection from the board to the Internet yesterday. In the coming days, this connection should be used effectively. So we\u0026rsquo;re looking at the online platform Blynk, through which short commands, measurement data or messages can be exchanged between the NanoESP board and your smartphone.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/08/Day5_1.jpg\"\u003e\u003cimg class=\"size-large wp-image-1299\" src=\"/images/2016/08/Day5_1.jpg\" alt=\"Kommunikationswege mit Blynk\" width=\"616\" height=\"375\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eCommunication with the Blynk Server\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eBlynk enables the simple control of various IoT boards, e.g. the Raspberry Pi or our NanoESP, using an app. You can put the graphic interface together completely on your own, and programming is also extremely simple. As if that weren\u0026rsquo;t enough, you can even control the board from anywhere in the world. So it\u0026rsquo;s totally within the sense of the Internet of Things.\u003c/p\u003e","title":"Day 5: Blynk"},{"content":"Behind today\u0026rsquo;s door is a 1-kohm resistor. We\u0026rsquo;re not going to do much with it today, but tomorrow it becomes important. In today\u0026rsquo;s test, we want to set up an initial connection to your home WLAN network. For this purpose, you need, as you will on many days to come, to enter your WLAN data in the programme.\nThe Board pings the Goolge server But first you need to download today\u0026rsquo;s programme. You can download it via the right button on the from the Arduino Create Iframe.\n.\nThe sketch: A16_P04_WiFiConnect.ino /* Test for Wifi connection and ping-time Change SSID and PASSWORD. */ #include \u0026lt;NanoESP.h\u0026gt; #include \u0026lt;SoftwareSerial.h\u0026gt; //Change SSID and PASSWORD here: #define SSID \u0026#34;YourSSID\u0026#34; #define PASSWORD \u0026#34;YourPassword\u0026#34; #define LED_WLAN 13 NanoESP nanoesp = NanoESP(); void setup() { Serial.begin(19200); nanoesp.init(); //Station Mode, Connect to WiFi if (!nanoesp.configWifi(STATION, SSID, PASSWORD)) { Serial.println(F(\u0026#34;Error: WLAN not Connected\\n\u0026#34;)); } else { Serial.println(F(\u0026#34;WLAN Connected\\n\u0026#34;)); digitalWrite(LED_WLAN, HIGH); } //Print IP in Terminal Serial.println(nanoesp.getIp()); //Time for Ping int vTime = nanoesp.ping(\u0026#34;www.google.de\u0026#34;); if (vTime \u0026gt; 0 ){ Serial.println(\u0026#34;Internet Connection OK\\nPing: \u0026#34; + String(vTime) + \u0026#34;ms\u0026#34;); } else { Serial.println(F(\u0026#34;Error: Internet Connection\u0026#34;)); } } void loop() { } (The former Arduino Create embed is no longer available; the code is taken from the download of all sketches.)\nWhen you\u0026rsquo;ve opened the programme in the Arduino IDE, you will see at the very first two DEFINES. This is where you have to enter your WLAN name and the password. Only then can you upload the programme. You can now check the status of the WLAN connection on the serial monitor. In the ideal case, you\u0026rsquo;ll see \u0026ldquo;WLAN Connected\u0026rdquo; there. The LED D3 also lights up. If you run into problems, you\u0026rsquo;ll find help in the commentary section.\nAfter the connection, yet more messages appear on the serial monitor. First, the IP address of the board is given once. It was assigned to the NanoESP by the router and is the board\u0026rsquo;s address in the local network. After that, the board pings a server on the Internet to test whether it is connected to the Internet. If everything functions, a suitable message appears on the serial monitor and the answer time in milliseconds that passed from the sending of the ping to reception of the answer. You may recognise this ping value from online games. The connection to the Internet now exists, and you are ready to take larger steps with the board.\nConnection successfully created ","permalink":"https://neu-iot.fkainka.de/en/day4-2016/","summary":"\u003cp\u003eBehind today\u0026rsquo;s door is a 1-kohm resistor. We\u0026rsquo;re not going to do much with it today, but tomorrow it becomes important. In today\u0026rsquo;s test, we want to set up an initial connection to your home WLAN network. For this purpose, you need, as you will on many days to come, to enter your WLAN data in the programme.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/08/Day4_1.jpg\"\u003e\u003cimg class=\"size-large wp-image-1295\" src=\"/images/2016/08/Day4_1.jpg\" alt=\"Das Board pingt den Google Server an\" width=\"616\" height=\"359\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe Board pings the Goolge server\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eBut first you need to download today\u0026rsquo;s programme. You can download it via the right button on the from the \u003ca href=\"https://create.arduino.cc/\"\u003eArduino Create\u003c/a\u003e Iframe.\u003c/p\u003e","title":"Day 4: Setting up Internet connection"},{"content":"Behind the third door is the jumper wire, which is important for many tests. To prepare for later tests, you can place the supply lines GND and VCC on the outermost lanes. You\u0026rsquo;ll thereby have better access to these important lines later.\nThe jumpers to GND and VCC In the project for today, you now get around to changing something in a programme even on your own. The following sample programme serves as a basis:\nFile \u0026gt; Samples \u0026gt; NanoESP \u0026gt; Basics \u0026gt; AccessPoint\nWhen you upload this programme, you won\u0026rsquo;t see any change at first. There is still an open WLAN with the name NanoESP in range. However, if you now change line 16 in the programme with the configWifi command, the access point settings also change. You can replace the \u0026ldquo;NanoESP\u0026rdquo; in quotation marks with another WLAN name, or you can even define a password for the network by adjusting the last parameter of the function. The password must have at least eight characters. A possible example is:\nnanoesp.configWifi(ACCESSPOINT, “MyNanoESP”, “MyPassword”);\nThen you need to upload the programme again. If the configuration was successful, the LED D3 lights up for confirmation. If there is an error, the LED does not light up and you need to check the settings. It\u0026rsquo;s never been easier to create your own WLAN.\n","permalink":"https://neu-iot.fkainka.de/en/day3-2016/","summary":"\u003cp\u003eBehind the third door is the jumper wire, which is important for many tests. To prepare for later tests, you can place the supply lines GND and VCC on the outermost lanes. You\u0026rsquo;ll thereby have better access to these important lines later.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/08/Day3_0.jpg\"\u003e\u003cimg class=\"wp-image-1290 size-large\" src=\"/images/2016/08/Day3_0.jpg\" alt=\"Die Drahtbrücken an GND und VCC\" width=\"616\" height=\"306\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe jumpers to GND and VCC\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eIn the project for today, you now get around to changing something in a programme even on your own. The following sample programme serves as a basis:\u003c/p\u003e","title":"Day 3: The NanoESP in access point mode"},{"content":"This time there\u0026rsquo;s a breadboard behind the door. On it, you can quickly and easily assemble the hardware layouts of the Advent calendar. Since only the NanoESP is available so far, we\u0026rsquo;ll start with it.\nNanoESP on a breadboard It\u0026rsquo;s best if you plug the controller into the breadboard as shown in the picture. That way, the greatest space remains free for experiments; the WLAN module sticks out behind past the breadboard. The micro-USB cable then hangs between the contact sides and is only a minimal disruption. The board needs to be pressed in gently until it touches the contacts.\nToday we also want to deal with the software with which the board can be programmed. This is the Arduino development environment (Arduino IDE for short). You can download the latest version for your individual system at http://www.arduino.cc/en/Main/software and then install it. Please note that you should work with at least Arduino Version 1.6.5.\nPProgramming occurs here in a somewhat simplified C/C++. You can now open an initial sample programme in the IDE by clicking File \u0026gt; Samples \u0026gt; 01.Basics \u0026gt; Blink. The programme causes the LED D3 on the board to flash in a one-second cycle. In order to execute it on the NanoESP, you first have to transfer it via the USB interface to the board. Before you do that, select the right board and the right communications port (COM for short) in the software:\nUnder Tools \u0026gt; Board select \u0026ldquo;Arduino Nano\u0026rdquo; Under Tools \u0026gt; Processor select \u0026ldquo;ATmega328\u0026rdquo; Under Tools \u0026gt; Serial Port select the corresponding COM port Then click the Upload button. The programme is now compiled and transferred to the NanoESP. You can follow the progress in the status bar below. During the upload, you can also see the two centre LEDs (TX1 and RX1) flashing rapidly. If everything was successful, the LED D3 on the board begins to flash in a one-second cycle. You\u0026rsquo;ve just successfully uploaded your first Arduino programme.\nThis was only a test of whether the board functions correctly in principle. Now comes the IoT part of today\u0026rsquo;s test. First, though, you still have to download something, namely the library, which will enormously simplify handling the board for you. You\u0026rsquo;ll find the latest version at\nhttp:// iot.fkainka.de/library\nNow you have to integrate this ZIP file into Arduino by selecting it under\nSketch \u0026gt; Integrate library \u0026gt; Add .ZIP library\nYou may have to restart the Arduino IDE so that you can find the sample programme under\nFile \u0026gt; Samples \u0026gt; NanoESP \u0026gt; Basics \u0026gt; Wifi_Scanner\nand open it. Now you have to upload this programme. Then open the serial monitor and set the baud rate 19200. After a short time, you will first see information about the firmware and finally a list of all WLAN networks in range of your NanoESP board.\nSSIDs in the serial monitor ","permalink":"https://neu-iot.fkainka.de/en/day2-2016/","summary":"\u003cp\u003eThis time there\u0026rsquo;s a breadboard behind the door. On it, you can quickly and easily assemble the hardware layouts of the Advent calendar. Since only the NanoESP is available so far, we\u0026rsquo;ll start with it.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/08/Day2_1.jpg\"\u003e\u003cimg class=\"size-large wp-image-1286\" src=\"/images/2016/08/Day2_1.jpg\" alt=\"NanoESP auf dem Steckboard\" width=\"616\" height=\"309\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eNanoESP on a breadboard\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eIt\u0026rsquo;s best if you plug the controller into the breadboard as shown in the picture. That way, the greatest space remains free for experiments; the WLAN module sticks out behind past the breadboard. The micro-USB cable then hangs between the contact sides and is only a minimal disruption. The board needs to be pressed in gently until it touches the contacts.\u003c/p\u003e","title":"Day 2: The Arduino IDE"},{"content":"It\u0026rsquo;s the first of December and thus time to open the first door. Behind it is arguably the most important element of the calendar: the NanoESP board. This Arduino-compatible controller with WLAN function is at the centre of the 24 tests.\nThe NanoESP Board To s briefly, it can be said that the board is most likely a cross between a board similar to an Arduino Nano and a WLAN module with the name ESP8266. The communication between the two elements runs through a serial port generated via software, which is connected to Pins D11 and D12. You should thus avoid these pins with your own projects.\nSo that you can successfully program your board, you first need to install the driver. You\u0026rsquo;ll find it on the page:\nhttp://iot.fkainka.de/driver\nThere are versions for different operating systems there. In the Windows version, there is a setup.exe file in the ZIP folder that you have to execute. In the window that then appears, simply click on \u0026ldquo;Install\u0026rdquo;.\nAfter the installation, you can now connect the board to the PC for the first time. The PC should automatically find the driver, while the two Power LEDS (D6 and D2) light up on the board. The third LED (D3) flashes first. If the LEDs light up but the PC does not recognise any new hardware, check whether you\u0026rsquo;re actually using a USB data cable. You see, there are also cables that are intended only for charging devices like smartphones but don\u0026rsquo;t enable data communication. You can also look in Device Manager to see whether the device has been correctly recognised and installed.\nThe driver is now installed, and in the meantime the third LED should also have stopped flashing and remain constantly lit. That\u0026rsquo;s the sign that the initialisation of the board was successful. Now you should also be able to spot something else, namely that a new open WLAN exists within your reach. The WLAN bears the name NanoESP. In today\u0026rsquo;s practical test, you should connect to this WLAN. If the PC asks about the type of connection, you should select the option \u0026ldquo;Home network.\u0026rdquo; In this way, the communication with other devices isn\u0026rsquo;t blocked. When you are connected to the WLAN, you can open a browser of your choice and enter the following in the address bar:\n192.168.4.1\nThis is the IP address of your board. The page that now loads for you to see is a small website that is sent from the board to your PC. This is an Easter egg, which is a hidden function. The first test is a function test and at the same time offers a glance at a potential use of the board as a web server. But more on that later.\n","permalink":"https://neu-iot.fkainka.de/en/day1-2016/","summary":"\u003cp\u003eIt\u0026rsquo;s the first of December and thus time to open the first door. Behind it is arguably the most important element of the calendar: the NanoESP board. This Arduino-compatible controller with WLAN function is at the centre of the 24 tests.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2016/08/Day1_1.jpg\"\u003e\u003cimg class=\"size-large wp-image-1280\" src=\"/images/2016/08/Day1_1.jpg\" alt=\"Das NanoESP Board\" width=\"616\" height=\"186\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe NanoESP Board\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eTo s briefly, it can be said that the board is most likely a cross between a board similar to an Arduino Nano and a WLAN module with the name ESP8266. The communication between the two elements runs through a serial port generated via software, which is connected to Pins D11 and D12. You should thus avoid these pins with your own projects.\u003c/p\u003e","title":"Tag 1: Das NanoESP-Board"},{"content":"","permalink":"https://neu-iot.fkainka.de/en/library/","summary":"","title":"Library for NanoESP \u0026 Pretzel Board"},{"content":"Gerade im Kontext des Adventskalenders oder den anderen Lernpaketen habe ich einige HTML-Seiten für den NanoESP entworfen. Allerdings hat mich dabei immer gestört, dass zum einen der Speicherplatz ziemlich gering ist zum anderen die Übertragung etwas langsam sein kann, vor allem, wenn die Seite oft neu geladen werden muss. Deswegen habe ich mir eine neue Methode überlegt, bei der die dazustellenden Webseite auf einem anderen Webserver liegt und beim Verbinden mit dem TCP-Server des Boards einfach nachgeladen wird. Der Nachteil ist hier vor allem, dass der Client mit dem Internet verbunden sein muss. Das bedeutet auch, das ein privates Netzwerk mit dem NanoESP als AccesPoint nicht möglich ist. Die Vorteile sind aber komplexere Seiten und schnellere Ladezeiten sowie eine insgesamt Entlastung des Boards. Im Folgenden Stelle ich das System anhand des RGB-LED-Beispiels vor.\nZunächst das Arduino-Programm Hinweis: Arduino-Programm downloaden und mit Arduino ab Version 1.6.5 auf den Controller uploaden.\nHier ändert sich gar nicht soviel. Auf dem Board läuft immer noch ein TCP-Server der beim Aufruf der IP einen HTML-Text verschickt. Dieser ist diesmal aber sehr viel kleiner und besteht im Grund nur aus folgenden Zeilen:\n\u0026lt;html\u0026gt;\u0026lt;script src=\u0026#34;http://temp.fkainka.de/RGB2.js\u0026#34;\u0026gt;\u0026lt;/script\u0026gt;\u0026lt;script type=\u0026#34;text/javascript\u0026#34;\u0026gt;draw());\u0026lt;/script\u0026gt;\u0026lt;/html\u0026gt; Mit anderen Worten wird nichts anderes gemacht, als die JavaScript-Datei :\nhttp://temp.fkainka.de/RGB2.js\nnachzuladen und anschließend die Funktion draw() aufzurufen. Diese Funktion macht nun die ganze Arbeit.\nfunction draw(rgb){ document.write(\u0026#39;\\ \u0026lt;HEAD\u0026gt;\\ \u0026lt;link rel=\u0026#34;icon\u0026#34; href=\u0026#34;data:;base64,iVBORw0KGgo=\u0026#34;\u0026gt;\\ \u0026lt;meta name=\u0026#34;viewport\u0026#34; content=\u0026#34;width=device-width, initial-scale=2.0, user-scalable=yes\u0026#34;\u0026gt;\\ \u0026lt;title\u0026gt;\\ RGB LED\\ \u0026lt;/title\u0026gt;\\ \u0026lt;/HEAD\u0026gt;\\ \\ \u0026lt;BODY bgcolor=\u0026#34;#FFFF99\u0026#34; text=\u0026#34;#000000\u0026#34;\u0026gt;\\ \u0026lt;FONT size=\u0026#34;6\u0026#34; FACE=\u0026#34;Verdana\u0026#34;\u0026gt;\\ Select Color\\ \u0026lt;/FONT\u0026gt;\\ \\ \u0026lt;HR\u0026gt;\\ \u0026lt;BR\u0026gt;\\ \u0026lt;FONT size=\u0026#34;3\u0026#34; FACE=\u0026#34;Verdana\u0026#34;\u0026gt;\\ Change the Color\u0026lt;BR\u0026gt;\\ of the RGB-LED\\ \u0026lt;BR\u0026gt;\\ \u0026lt;BR\u0026gt;\\ \u0026lt;form method=\u0026#34;GET\u0026#34;\u0026gt;\\ \u0026lt;input type=\u0026#34;color\u0026#34; name=\u0026#34;rgb\u0026#34; value=\u0026#34;#\u0026#39;+rgb+\u0026#39;\u0026#34; onchange=\u0026#34;this.form.submit()\u0026#34;\u0026gt;\u0026lt;BR\u0026gt;\\ \u0026lt;/form\u0026gt;\\ \u0026lt;BR\u0026gt;\\ \u0026lt;HR\u0026gt;\\ \\ \u0026lt;/font\u0026gt;\\ \u0026#39;); } In draw() wird nun mit der JavaScript Funktion document.write() der sonst aus der ColorPicker.html-Seite bekannte Inhalt in den Browser geschrieben. Dadurch baut sich die bekannte Seite im Browser auf und das auch mit der gleichen Funktionalität die beim Übertragen vom Board direkt zustande gekommen wäre. Das ermöglicht es uns nun im Grunde, noch viel größere und komplexere Seite mit eigenen JavaScripts und großer Funktionalität nachzuladen, ohne den NanoESP groß zu belasten.\nEinen weiten Vorteil gibt es bei dieser Seite auch noch, denn die Seite stellt nun auch dar, welche Farbe gerade gewählt wurde. Dazu wird in späteren Aufrufen der draw()-Funktion der Parameter rgb übergeben, der in der document.write()-Funktion als Value von ColorPicker eingefügt wird. Der richtige Hex-Code wird einfach aus den immer noch in der URL-Verschlüsselten Daten übernommen. Ein weitere Vorteil dieser Version also.\nDer Beitrag Ausgelagerte Webseiten für den NanoESP erschien zuerst auf Elektronik Dachbude.\nSource: http://fkainka.de/tag/Pretzelboard/\n","permalink":"https://neu-iot.fkainka.de/en/ausgelagerte-webseiten-fuer-den-nanoesp/","summary":"\u003cp\u003eGerade im Kontext des Adventskalenders oder den anderen Lernpaketen habe ich einige HTML-Seiten für den NanoESP entworfen. Allerdings hat mich dabei immer gestört, dass zum einen der Speicherplatz ziemlich gering ist zum anderen die Übertragung etwas langsam sein kann, vor allem, wenn die Seite oft neu geladen werden muss. Deswegen habe ich mir eine neue Methode überlegt, bei der die dazustellenden Webseite auf einem anderen Webserver liegt und beim Verbinden mit dem TCP-Server des Boards einfach nachgeladen wird. Der Nachteil ist hier vor allem, dass der Client mit dem Internet verbunden sein muss. Das bedeutet auch, das ein privates Netzwerk mit dem NanoESP als AccesPoint nicht möglich ist. Die Vorteile sind aber komplexere Seiten und schnellere Ladezeiten sowie eine insgesamt Entlastung des Boards. Im Folgenden Stelle ich das System anhand des \u003ca href=\"/day-14\"\u003eRGB-LED-Beispiels\u003c/a\u003e vor.\u003c/p\u003e","title":"Ausgelagerte Webseiten für den NanoESP"},{"content":"Sie kennen das? Sie sitzen in Ihrem Arbeits- oder Bastelzimmer, ganz vertieft in Ihr neues Pretzelboard, plötzlich schießt es siedendheiss durch den Kopf: \u0026ldquo;Der Tee!\u0026rdquo; - doch der ist längst eiskalt, steht in der Küche und hat sich in eine tiefschwarze Jauche verwandelt, die höchstens noch als Pflanzenschutzmittel taugt.\nDas ist der Auftritt für den IoTeaTimer. Eine Eieruhr mit WLAN-Anschluss? Nein, Ihr persönlicher Erinnerungsagent … lesen Sie weiter in der umfassenden Projektdokumentation, hier als PDF, zum Download.\n","permalink":"https://neu-iot.fkainka.de/en/wettbewerbsbeitrag-ioteatimer/","summary":"\u003cp\u003eSie kennen das? Sie sitzen in Ihrem Arbeits- oder Bastelzimmer, ganz vertieft in Ihr neues Pretzelboard, plötzlich schießt es siedendheiss durch den Kopf: \u0026ldquo;Der Tee!\u0026rdquo; - doch der ist längst eiskalt, steht in der Küche und hat sich in eine tiefschwarze Jauche verwandelt, die höchstens noch als Pflanzenschutzmittel taugt.\u003c/p\u003e\n\u003cp\u003eDas ist der Auftritt für den IoTeaTimer. Eine Eieruhr mit WLAN-Anschluss? Nein, Ihr persönlicher Erinnerungsagent … lesen Sie weiter in der umfassenden Projektdokumentation, hier als PDF, zum Download.\u003c/p\u003e","title":"Wettbewerbsbeitrag: IoTeaTimer"},{"content":"Beitrag zum Kalenderwettbewerb 2015 von Bernhard Kaiser \u0026amp; Michael Gaus Bei diesem Projekt handelt es sich um einen Wassermelder, der optisch, akustisch und per Twitter-Meldung Alarm gibt, sobald an den Sensorkontakten Wasser detektiert wird. Er kann z.B. zur Überwachung auf austretendes Wasser aus Waschmaschine oder Spülmaschine dienen und helfen, rechtzeitig vor größeren Überschwemmungen eingreifen zu können. Als Sensorkontakt können einfach 2 Drähte mit abisolierten Enden genommen werden, so wie es auch auf dem Foto zu sehen ist. Verwendet wurden ausschließlich die Bauteile der beiden Adventskalender.\nSchaltplan\nIm Ruhezustand der Schaltung sperrt die Darlingtonstufe bestehend aus den beiden Transistoren T1 und T2. Bei Benetzung mit Wasser am Sensorkontakt J1 entsteht eine leitfähige Verbindung, sodass die Darlingtonstufe durchschaltet und die rote LED1 eingeschaltet wird. Zusätzlich wird durch den LOW-Pegel am Kollektor das IoT-Modul (NanoESP) über den Digitaleingang D2 getriggert, sodass dann per Software eine Twitter-Meldung als weltweiter Alarm abgesetzt wird. Damit jedoch nicht die ganze Welt im Klartext das Wasserleck mitbekommt, erfolgt die Twitter-Textmeldung in bester Geheimdienst-Manier:\n„Achtung, alle Mann an Bord! Das Boot ist bereit zum Ablegen!“ :-)\nZusätzlich wird per Software ein optisches (gelbe LED2 blinkt) und akustisches Alarmsignal per Piezo solange erzeugt, bis der Sensorkontakt keine leitfähige Verbindung mehr hat. Somit ist der Alarm auch direkt lokal vor Ort seh- und hörbar.\nAls Basis für die Software wurde das Projekt „Alarmanlage“ (Tag 21 des IoT-Adventskalenders) verwendet und entsprechend abgeändert.\nGanz oben im Quellcode müssen für die 3 Defines SSID, PASSWORD und TwitterKEY anstatt der Platzhalter die entsprechenden Werte eingetragen werden. Benötigt werden ein Thingspeak und ein Twitter Account, so wie im IoT-Adventskalender beschrieben.\nDownload: Arduino Programm Noch ein Hinweis zur Software:\nDie Arduino-Stringverarbeitung verwendet dynamisch allokierten Heap-Speicher, wobei es zu einer starken Fragmentierung kommen kann. Dies kann zu RAM-Problemen führen. Da in den Adventskalender-Beispielen sehr viele Strings angelegt und hintereinander gehängt werden, kann dies teilweise zu scheinbar unerklärlichem Softwareverhalten führen und sogar Softwareabstürze zur Folge haben, da es zum Überschreiben von RAM-Inhalten kommen kann. Als beispielsweise in dieser Softwareanpassung für den Wassermelder der zu sendende Twitter-Text länger gemacht wurde als im Adventskalender-Beispiel, hat das Versenden der Twitter-Meldung zunächst nicht mehr funktioniert. Um statisch verwendetes RAM zu sparen, sodass mehr RAM für den dynamischen Heap zur Verfügung steht, wurden deshalb hier Strings, die als Debugausgabe auf der seriellen Schnittstelle ausgegeben werden, ins Flash gelegt mit folgendem Mechanismus: statt „Textausgabe“ wird verwendet: F(„Textausgabe“).\nBeispiel:\ndebug(F(„WLAN Connected“));\nDer Quelltext\n/* Wassermelder Alarm SSID, PASSWORD und TwitterKEY muessen angepasst werden */ #define SSID \u0026#34;[Your SSID]\u0026#34; #define PASSWORD \u0026#34;[Your Password]\u0026#34; #define TwitterKEY \u0026#34;[Your Key]\u0026#34; #define SENSOR_INPUT 7 // Wasser-Sensor ist am digital input D2 abgeschlossen #define LED_ALARM 9 // Alarm-LED ist am digital input D3 angeschlossen #define PIEZO 8 #define LED_WLAN 13 #define DEBUG true #include SoftwareSerial.h\u0026gt; SoftwareSerial esp8266(11, 12); // RX, TX const byte thingPost[] PROGMEM = { 80, 79, 83, 84, 32, 42, 85, 82, 76, 42, 32, 72, 84, 84, 80, 47, 49, 46, 49, 10, 72, 111, 115, 116, 58, 32, 97, 112, 105, 46, 116, 104, 105, 110, 103, 115, 112, 101, 97, 107, 46, 99, 111, 109, 10, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 58, 32, 99, 108, 111, 115, 101, 10, 67, 111, 110, 116, 101, 110, 116, 45, 84, 121, 112, 101, 58, 32, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 120, 45, 119, 119, 119, 45, 102, 111, 114, 109, 45, 117, 114, 108, 101, 110, 99, 111, 100, 101, 100, 10, 67, 111, 110, 116, 101, 110, 116, 45, 76, 101, 110, 103, 116, 104, 58, 32, 42, 76, 69, 78, 42, 10, 10, 42, 65, 80, 80, 69, 78, 68, 42, 10 }; void setup() { Serial.begin(19200); Serial.println(\u0026#34;Wassermelder\u0026#34;); esp8266.begin(19200); if (!espConfig()) serialDebug(); else digitalWrite(LED_WLAN, HIGH); pinMode(SENSOR_INPUT, INPUT); pinMode(LED_ALARM, OUTPUT); } void loop() { if(digitalRead(SENSOR_INPUT) == LOW) { alarm(); } else { debug(F(\u0026#34;Alles im trockenen Bereich.\u0026#34;)); } delay(500); } void alarm(void) { debug(F(\u0026#34;Achtung, alle Mann an Bord! Das Boot ist bereit zum Ablegen!\u0026#34;)); sendTwitterPost(TwitterKEY, \u0026#34;Achtung, alle Mann an Bord! Das Boot ist bereit zum Ablegen!\u0026#34;); do { digitalWrite(LED_ALARM, HIGH); tone(PIEZO, 400, 500); delay(500); digitalWrite(LED_ALARM, LOW); tone(PIEZO, 800, 500); delay(500); } while (digitalRead(SENSOR_INPUT) == LOW); } boolean sendTwitterPost(String key, String twitterMsg) { boolean succes = true; String Host = \u0026#34;api.thingspeak.com\u0026#34;; String Url = \u0026#34;/apps/thingtweet/1/statuses/update\u0026#34;; String msg = \u0026#34;\u0026amp;status=\u0026#34; + twitterMsg; succes \u0026amp;= sendCom(\u0026#34;AT+CIPSTART=\u0026#34;TCP\u0026#34;,\u0026#34;\u0026#34; + Host + \u0026#34;\u0026#34;,80\u0026#34;, \u0026#34;OK\u0026#34;); String postRequest = createThingPost(Url, key, msg); if (sendCom(\u0026#34;AT+CIPSEND=\u0026#34; + String(postRequest.length()), \u0026#34;\u0026gt;\u0026#34;)) { esp8266.print(postRequest); debug (postRequest); esp8266.find(\u0026#34;SEND OK\u0026#34;); succes \u0026amp;= sendCom(\u0026#34;AT+CIPCLOSE\u0026#34;, \u0026#34;OK\u0026#34;); } else { succes = false; } return succes; } //-----------------------------------------ThingsSpeak Functions------------------------------------ boolean sendThingPost(String key, int value) { boolean succes = true; String Host = \u0026#34;api.thingspeak.com\u0026#34;; String msg = \u0026#34;field1=\u0026#34; + String(value); succes \u0026amp;= sendCom(\u0026#34;AT+CIPSTART=\u0026#34;TCP\u0026#34;,\u0026#34;\u0026#34; + Host + \u0026#34;\u0026#34;,80\u0026#34;, \u0026#34;OK\u0026#34;); String postRequest = createThingPost(\u0026#34;/update\u0026#34;, key, msg); if (sendCom(\u0026#34;AT+CIPSEND=\u0026#34; + String(postRequest.length()), \u0026#34;\u0026gt;\u0026#34;)) { esp8266.print(postRequest); esp8266.find(\u0026#34;SEND OK\u0026#34;); if (!esp8266.find(\u0026#34;CLOSED\u0026#34;)) succes \u0026amp;= sendCom(\u0026#34;AT+CIPCLOSE\u0026#34;, \u0026#34;OK\u0026#34;); } else { succes = false; } return succes; } String createThingPost(String url, String key, String msg) { String xBuffer; for (int i = 0; i sizeof(thingPost); i++) { char myChar = pgm_read_byte_near(thingPost + i); xBuffer += myChar; } String append = \u0026#34;api_key=\u0026#34; + key + \u0026#34;\u0026amp;\u0026#34; + msg; xBuffer.replace(\u0026#34;*URL*\u0026#34;, url); xBuffer.replace(\u0026#34;*LEN*\u0026#34;, String( append.length())); xBuffer.replace(\u0026#34;*APPEND*\u0026#34;, append); return xBuffer; } String createThingGet(String url, String key) { String xBuffer; for (int i = 0; i sizeof(thingPost); i++) { char myChar = pgm_read_byte_near(thingPost + i); xBuffer += myChar; } String append = \u0026#34;api_key=\u0026#34; + key; xBuffer.replace(\u0026#34;POST\u0026#34;, \u0026#34;GET\u0026#34;); xBuffer.replace(\u0026#34;*URL*\u0026#34;, url); xBuffer.replace(\u0026#34;*LEN*\u0026#34;, String( append.length())); xBuffer.replace(\u0026#34;*APPEND*\u0026#34;, append); return xBuffer; } String createThingGet(String url, String key, String msg) { String xBuffer; for (int i = 0; i sizeof(thingPost); i++) { char myChar = pgm_read_byte_near(thingPost + i); xBuffer += myChar; } String append = \u0026#34;api_key=\u0026#34; + key + \u0026#34;\u0026amp;\u0026#34; + msg; xBuffer.replace(\u0026#34;POST\u0026#34;, \u0026#34;GET\u0026#34;); xBuffer.replace(\u0026#34;*URL*\u0026#34;, url); xBuffer.replace(\u0026#34;*LEN*\u0026#34;, String( append.length())); xBuffer.replace(\u0026#34;*APPEND*\u0026#34;, append); return xBuffer; } //-----------------------------------------Config ESP8266------------------------------------ boolean espConfig() { boolean succes = true; esp8266.setTimeout(5000); succes \u0026amp;= sendCom(\u0026#34;AT+RST\u0026#34;, \u0026#34;ready\u0026#34;); esp8266.setTimeout(1000); if (configStation(SSID, PASSWORD)) { succes \u0026amp;= true; debug(F(\u0026#34;WLAN Connected\u0026#34;)); debug(F(\u0026#34;My IP is:\u0026#34;)); debug(sendCom(F(\u0026#34;AT+CIFSR\u0026#34;))); } else { succes \u0026amp;= false; } //shorter Timeout for faster wrong UPD-Comands handling succes \u0026amp;= sendCom(F(\u0026#34;AT+CIPMUX=0\u0026#34;), \u0026#34;OK\u0026#34;); succes \u0026amp;= sendCom(F(\u0026#34;AT+CIPMODE=0\u0026#34;), \u0026#34;OK\u0026#34;); return succes; } boolean configTCPServer() { boolean succes = true; succes \u0026amp;= (sendCom(F(\u0026#34;AT+CIPMUX=1\u0026#34;), \u0026#34;OK\u0026#34;)); succes \u0026amp;= (sendCom(F(\u0026#34;AT+CIPSERVER=1,80\u0026#34;), \u0026#34;OK\u0026#34;)); return succes; } boolean configTCPClient() { boolean succes = true; succes \u0026amp;= (sendCom(\u0026#34;AT+CIPMUX=0\u0026#34;, \u0026#34;OK\u0026#34;)); //succes \u0026amp;= (sendCom(\u0026#34;AT+CIPSERVER=1,80\u0026#34;, \u0026#34;OK\u0026#34;)); return succes; } boolean configStation(String vSSID, String vPASSWORT) { boolean succes = true; succes \u0026amp;= (sendCom(\u0026#34;AT+CWMODE=1\u0026#34;, \u0026#34;OK\u0026#34;)); esp8266.setTimeout(20000); succes \u0026amp;= (sendCom(\u0026#34;AT+CWJAP=\u0026#34;\u0026#34; + String(vSSID) + \u0026#34;\u0026#34;,\u0026#34;\u0026#34; + String(vPASSWORT) + \u0026#34;\u0026#34;\u0026#34;, \u0026#34;OK\u0026#34;)); esp8266.setTimeout(1000); return succes; } boolean configAP() { boolean succes = true; succes \u0026amp;= (sendCom(F(\u0026#34;AT+CWMODE=2\u0026#34;), \u0026#34;OK\u0026#34;)); succes \u0026amp;= (sendCom(\u0026#34;AT+CWSAP=\u0026#34;NanoESP\u0026#34;,\u0026#34;\u0026#34;,5,0\u0026#34;, \u0026#34;OK\u0026#34;)); return succes; } boolean configUDP() { boolean succes = true; succes \u0026amp;= (sendCom(F(\u0026#34;AT+CIPMODE=0\u0026#34;), \u0026#34;OK\u0026#34;)); succes \u0026amp;= (sendCom(F(\u0026#34;AT+CIPMUX=0\u0026#34;), \u0026#34;OK\u0026#34;)); succes \u0026amp;= sendCom(\u0026#34;AT+CIPSTART=\u0026#34;UDP\u0026#34;,\u0026#34;192.168.255.255\u0026#34;,90,91,2\u0026#34;, \u0026#34;OK\u0026#34;); //Importand Boradcast...Reconnect IP return succes; } //-----------------------------------------------Controll ESP----------------------------------------------------- boolean sendUDP(String Msg) { boolean succes = true; succes \u0026amp;= sendCom(\u0026#34;AT+CIPSEND=\u0026#34; + String(Msg.length() + 2), \u0026#34;\u0026gt;\u0026#34;); //+\u0026#34;,\u0026#34;192.168.4.2\u0026#34;,90\u0026#34;, \u0026#34;\u0026gt;\u0026#34;); if (succes) { succes \u0026amp;= sendCom(Msg, \u0026#34;OK\u0026#34;); } return succes; } boolean sendCom(String command, char respond[]) { esp8266.println(command); if (esp8266.findUntil(respond, \u0026#34;ERROR\u0026#34;)) { return true; } else { debug(\u0026#34;ESP SEND ERROR: \u0026#34; + command); return false; } } String sendCom(String command) { esp8266.println(command); return esp8266.readString(); } //-------------------------------------------------Debug Functions------------------------------------------------------ void serialDebug() { while (true) { if (esp8266.available()) Serial.write(esp8266.read()); if (Serial.available()) esp8266.write(Serial.read()); } } void debug(String Msg) { if (DEBUG) { Serial.println(Msg); } } [collapse]\nDer Beitrag Wettbewerbsbeitrag: Wassermelder mit Twitter-Alarmmeldung erschien zuerst auf Elektronik Dachbude.\nSource: fkainka.de/pretzelboard\n","permalink":"https://neu-iot.fkainka.de/en/wettbewerbsbeitrag-wassermelder-mit-twitter-alarmmeldung/","summary":"\u003ch2 id=\"beitrag-zum-kalenderwettbewerb-2015-vonbernhard-kaiser-michael-gaus\"\u003eBeitrag zum \u003ca href=\"http://fkainka.de/der-kalender-wettbewerb-2015-sensoren-im-internet-of-things/\"\u003eKalenderwettbewerb\u003c/a\u003e 2015 von Bernhard Kaiser \u0026amp; Michael Gaus\u003c/h2\u003e\n\u003cp\u003eBei diesem Projekt handelt es sich um einen Wassermelder, der optisch, akustisch und per Twitter-Meldung Alarm gibt, sobald an den Sensorkontakten Wasser detektiert wird. Er kann z.B. zur Überwachung auf austretendes Wasser aus Waschmaschine oder Spülmaschine dienen und helfen, rechtzeitig vor größeren Überschwemmungen eingreifen zu können. Als Sensorkontakt können einfach 2 Drähte mit abisolierten Enden genommen werden, so wie es auch auf dem Foto zu sehen ist. Verwendet wurden ausschließlich die Bauteile der beiden Adventskalender.\u003c/p\u003e","title":"Wettbewerbsbeitrag: Wassermelder mit Twitter-Alarmmeldung"},{"content":"Pinout Pretzel Board (NanoESP) Download PDF: Pinout Pretzel Board ","permalink":"https://neu-iot.fkainka.de/en/pinout-pretzel-board-nanoesp/","summary":"\u003cfigure\u003e\u003ca href=\"/images/2016/01/Pinout-Pretzel-Board.jpg\" rel=\"attachment wp-att-1066\"\u003e\u003cimg class=\"size-full wp-image-1066\" src=\"/images/2016/01/Pinout-Pretzel-Board.jpg\" alt=\"Pinout Pretzel Board (NanoESP)\" width=\"978\" height=\"900\" /\u003e\u003c/a\u003e\u003cfigcaption\u003ePinout Pretzel Board (NanoESP)\u003c/figcaption\u003e\u003c/figure\u003e\n\u003ch3 id=\"download-pdfpinout-pretzel-board\"\u003eDownload PDF: \u003ca href=\"/images/2016/01/Pinout-Pretzel-Board.pdf\"\u003ePinout Pretzel Board\u003c/a\u003e\u003c/h3\u003e","title":"Pinout NanoESP \u0026 Pretzel Board"},{"content":"The final project consists of several elements you have been introduced to in the course of the advent time. One function is the Cheerlights function presented the day before. You can also receive the current colour of the Cheerlights project and display it with the RGB-LED. The board is also used for long-term monitoring of the temperature. At the same time, the board is used to emit an alarm sound when the temperature exceeds a specific value, e.g. because there is a fire. As a last function, the board can be used as a Christmas bell, by making it play the song Jingle Bells with a time-controlled TalkBack command. All in all, today\u0026rsquo;s project is an all-rounder for the Christmas tree.\nBehind today\u0026rsquo;s door, there is another rather exciting sensor: an NTC (negative temperature coefficient). It changes its resistance depending on the temperature. It is a good idea to revisit some of the older experiments while using the temperature sensor. Today\u0026rsquo;s setup consists of quite a few elements. The potentiometer is also used again, to permit fine reconciliation of the NTC. Alternatively, you can also use the 10-kΩ-resistor, but will then be unable to perform fine tuning.\nThe circuit of the last project The program: Day24_Christmas\nThe final program must combine the many different elements. The ThingSpeak page is very important again. Among others, the threshold monitoring of the NTC is assumed by a ThingSpeak app. From there, the alarm action is performed, i.e. sending a Twitter message and inserting a TalkBack command that trips the alarm on the controller. The Time-Control app of the ThingSpeak page can also be used to specify a time at which the Jingle-Bells song will call the family to the tree, or at which the music is to wake you up the next morning.\nIn the first step, you need to set a new channel on the ThingSpeak page. You can name it FireAlarm, for example. Field1 is then given the name Temp. Under API keys, you will find the first key that you need to enter for the ThingSpeakKEY. This ensures transmission of the current temperature.\nAs a second step, you should generate a new TalkBack element. You can name it, e.g. Alarms. You can also have the commands logged in the channel FireAlarm. You need to enter the API key after TalkBackKEY and the ID after TalkBackID. Now you can also send commands to the board. You can also enter commands manually by clicking the Add a new Command in the TalkBack overview of the Alarm channel and then enter either Alarm or Jingle under Command String. You do not need to enter the position, since the command is automatically saved in the first location. You can now upload the program and test whether the transfer of the current temperature value works and whether the board executes the commands. In this place, it will also help to calibrate the NTC via the potentiometer with a room thermometer.\nGenerally, this would be a full project already. However, the bonus functions are still missing. They no longer need to be performed in the programme, however, but only on the ThingSpeak page. For this, go to Apps and then select React. React can be used to react to specific events. Click New React to create a new React function and enter the following values:\nName: FireDetect1\nCondition Type: Numeric\nTest Frequency: On Data Insertion\nCondition: If Channel\nFireAlarm\nfield 1 (Temp)\nis great than\n40\nAction: ThingTweet\nthen tweet:\nFire Alarm on the #NanoESP! Temp: %%trigger%%C #ThingSpeak #IoT\nUsing Twitter Account\n[Twitter Account]\nOptions: Run action only the first time the condition is met\nThingSpeak React with Twitter integration ThingSpeak React with ThingHTTP integration Save React saves the settings. Thus, the first step of monitoring is already made. If the value is exceeded, ThingSpeak will send a Twitter message via your account. For the second step, insertion of the alarm command, you need to reach a bit more deeply into your sleeve. The function is not supported automatically. ThingHTTP is, however, supported. Therefore, click Apps and then ThingHTTP. Create a new element there and set the following:\nName: Alarm\nURL: [https://api.thingspeak.com/talkbacks/YOUR TALKBACK ID]/commands\nMethod: POST\nHTTP Version: 1.1\nHost: api.thingspeak.com\nHeaders:\nBody: api_key=[YOUR TALKBACK ID]\u0026amp;command_string=Alarm\u0026amp;position=1\nThe TalkBack settings Ensure that you replace [YOUR TALKBACK ID] and [YOUR TALKBACK KEY] in the URL and the body part by your TalkBack-ID and your TalkBackKEY. Now you can create another React element which contains the same parameters as the first one, but with the change that you will now select ThingHTTP under Action and there the item Alarm. Thus, you have ensured that an alarm sounds when the critical value is exceeded.\nAs a last function, you can set up a time-controlled Jingle Bells. For this, click TimeControl under Apps and create a new element, e.g. with the name Bell. Make the following settings there:\nName: Presents\nFrequency: One Time\nTime Zone: Berlin\nRun At: 2015-24-12 7:00 pm\nFuzzy Time: ± 0 minutes\nTalkBack: Alarms, add command: Jingle\nThe TimeControll settings For a first test, it is recommended to select a time in a few minutes. If this has worked, you can set the proper time.\nYou can also turn the project mobile with the 9-V battery clip or a rechargeable battery bank. When hiding the board in the tree, so that only the RGB-LED points out of the branches in a fitting location, the ambience is not unnecessarily impaired either. Right on time at 7 PM, all family members will be called to the tree by the sounds of Jingle Bells.\nI wish you a Merry Christmas!\n","permalink":"https://neu-iot.fkainka.de/en/day-24/","summary":"\u003cp\u003eThe final project consists of several elements you have been introduced to in the course of the advent time. One function is the Cheerlights function presented the day before. You can also receive the current colour of the Cheerlights project and display it with the RGB-LED. The board is also used for long-term monitoring of the temperature. At the same time, the board is used to emit an alarm sound when the temperature exceeds a specific value, e.g. because there is a fire. As a last function, the board can be used as a Christmas bell, by making it play the song Jingle Bells with a time-controlled TalkBack command. All in all, today\u0026rsquo;s project is an all-rounder for the Christmas tree.\u003c/p\u003e","title":"Day 24: Fire alarm for the Christmas tree"},{"content":"Today\u0026rsquo;s experiment is based on a project by Hans Scharler that is called Cheerlights. The idea is globally linked lights that can be simultaneously controlled via Twitter commands. It is a good example of the world growing closer and closer together with the Internet.\nThe circuit is similar to previous projects Behind today\u0026rsquo;s door, you will find a fourth extension cable with which the RGB-LED can also be placed aside. This can be particularly practical if, for example, you want to hide the board in the Christmas tree while the RGB-LED decorates the top of the tree.\nThe program: Day23_CheerLights\nFor today\u0026rsquo;s program, you do not need to make any dedicated ThingSpeak changes. This project has a public channel that you can find under the link\nhttps://thingspeak.com/channels/1417\nPreview of the Cheerlights project page On that page, you will also always find the current colour and further information on the project.\nThe programme also needs the Crossfade-Library by Radek Wierzbicki (source: https://github.com/radekw/Arduino/tree/5f24ce7c8db9dfbb5252b59824c3217d851b3a3c). For practical reasons, a copy of the Library version used is enclosed in the sketch folder. It must be copied into the libraries folder of your sketchbook folder. The library permits quick and easy definition of colours and also ensures that the LEDs will slowly change to another colour (this is called fade).\nIf you upload the program now, the current colour of the LED is displayed after a few seconds. You can now write a Twitter message and thus change your and also the colour of all other Cheerlights users. The message must contain a #Cheerlights, @Cheerlights or just the keyword Cheerlights and also have one of the pre-defined colours behind the keyword. The pre-defined colours include:\nred, green, blue, cyan, white, warm white, purple, magenta, yellow, orange, pink\nA possible tweet is:\nTesting my #cheerlights project on my #NanoESP with the colour blue #ThingSpeak #IoT\nor a similar message. This way, you can recolour the world.\n","permalink":"https://neu-iot.fkainka.de/en/day-23/","summary":"\u003cp\u003eToday\u0026rsquo;s experiment is based on a project by Hans Scharler that is called Cheerlights. The idea is globally linked lights that can be simultaneously controlled via Twitter commands. It is a good example of the world growing closer and closer together with the Internet.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day23-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-255\" src=\"/images/2015/09/Day23-1.jpg\" alt=\"Die RGB-Led auf dem Steckboard an den Pins D3, D5 und D6\" width=\"616\" height=\"363\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe circuit is similar to previous projects\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door, you will find a fourth extension cable with which the RGB-LED can also be placed aside. This can be particularly practical if, for example, you want to hide the board in the Christmas tree while the RGB-LED decorates the top of the tree.\u003c/p\u003e","title":"Day 23: Cheerlights"},{"content":"Today\u0026rsquo;s project is about another app of the ThingSpeak page, i.e. the TalkBack-App. This function permits creating a command that is read and executed by the controller. What appears nonsensical with a single controller does make sense when using two or an entire network of controllers. Some boards can act as sensors then, e.g. with motion detectors, and send a TalkBack command. Another module reads the command from the ThingSpeak page and then opens the door or reports an alarm.\nTwo Buttons on D5 and D10 and a LED on D9 You will find another button behind today\u0026rsquo;s door. The setup of today\u0026rsquo;s experiment consists of an LED with a dropping resistor and two buttons as the figure shows.\nThe program: Day22_ThinkSpeakTalkback\nFirst, you need to create a new TalkBack channel under APPS – TalkBack. If you like, you can also have the commands entered in a channel. This can be the already-created light channel of the 19th day, or a dedicated channel. All commands are then logged. Particularly the API key, which you will enter in #define TalkBackKEY, is important. In addition to the API-KEY, you now also need an ID, which you will find in the overview under TalkBackID, after you have clicked Save-TalkBack. Enter #define TalkBackID into the program here.\nThe TalkBack-APP If you upload the program now and call the serial monitor, you will first see the message No Command. Push one of the two buttons now. After a brief time, the message OpenDoor or CloseDoor will appear, depending on which button you pushed. For the OpenDoor command, the LED will also light up.\n","permalink":"https://neu-iot.fkainka.de/en/day-22/","summary":"\u003cp\u003eToday\u0026rsquo;s project is about another app of the ThingSpeak page, i.e. the TalkBack-App. This function permits creating a command that is read and executed by the controller. What appears nonsensical with a single controller does make sense when using two or an entire network of controllers. Some boards can act as sensors then, e.g. with motion detectors, and send a TalkBack command. Another module reads the command from the ThingSpeak page and then opens the door or reports an alarm.\u003c/p\u003e","title":"Day 22: TalkBack"},{"content":"Today\u0026rsquo;s project is an alarm system with which you can, for example, check whether someone opens a drawer without permission. There is a continuous check for whether the connected light sensor is exposed to too much light. If this is the case, an alarm signal will sound and a message will be sent via Twitter.\nLightsensor on A0 and Piezo on D8 Behind today\u0026rsquo;s door, there is a Piezo speaker that is used as alarm signal encoder. The structure of today\u0026rsquo;s experiment is shown in the figure.\nThe program: Day21_ThinkSpeakAlarm\nToday\u0026rsquo;s subject is, among others, the Twitter App of the ThingSpeak page. Click Apps and then ThingTweet. By clicking the link TwitterAccount and entering your access data, you will connect the two services. If you have no Twitter account yet, it will pay off to create a test account for processing the advent calendar. After Twitter has been successfully linked to ThingSpeak, you can enter the API key under Apps-ThingTweet\nafter the item #define TwitterKEY in today\u0026rsquo;s program. The program now continually reviews whether the measured brightness increases over 500. If this is the case, a Twitter message is sent and the alarm is sounded until the brightness drops below 500 again. The currently measured brightness values can be tracked via the serial monitor. For the first attempts, I recommend covering the light sensor to keep the alarm from being triggered early.\n","permalink":"https://neu-iot.fkainka.de/en/day-21/","summary":"\u003cp\u003eToday\u0026rsquo;s project is an alarm system with which you can, for example, check whether someone opens a drawer without permission. There is a continuous check for whether the connected light sensor is exposed to too much light. If this is the case, an alarm signal will sound and a message will be sent via Twitter.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day21-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-244\" src=\"/images/2015/09/Day21-1.jpg\" alt=\"Lichtsensor an A0 und Piezo an D8\" width=\"616\" height=\"401\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eLightsensor on A0 and Piezo on D8\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door, there is a Piezo speaker that is used as alarm signal encoder. The structure of today\u0026rsquo;s experiment is shown in the figure.\u003c/p\u003e","title":"Day 21: Alarm system"},{"content":"The website ThingSpeak offers a lot more than just long-time monitoring of sensors. Today\u0026rsquo;s project is similar to the projects from days 9 and 10 in its basic idea. Information is collected from a website on the internet. In this case, it is whether a specific stream is currently online or not.\nThere are two decisive advantages of the ThingSpeak version over the first attempts. First, the ThingSpeak page can also call websites via HTTPS (HyperText Transfer Protocol Secure), while the module only supports the unsafe HTTP-protocol. Second, the website can pre-filter important information and thus clearly reduce the data volume to be processed by the controller.\nIn today\u0026rsquo;s project, you will implement a twitch streaming display as an example of different options. Twitch is a website on which live games or information around the subject of computer games are streamed. One of the best-known streaming channels is RocketBeansTV from the former GameOne producers, which sends around the clock and therefore is well suitable for the first test. Later, you can, of course, use a channel of your choice.\nTodays circuit: LED on Pin D9 The program: Day20_ThinkSpeakTwitch\nIn addition to the hardware setup, some steps on the ThingSpeak page are necessary. When you click APPs in the top-most menu of the website, you will be shown a number of different application options. Today, we will deal with the ThingHTTP-App. If you click the corresponding button, you will first be shown a rather empty interface. Click New ThingHTTP. Enter the following into the form that comes up:\nName: Twitch\nURL: https://api.twitch.tv/kraken/streams?channel=rocketbeanstv\nMethod: GET\nHTTP Version: 1.1\nParse String: _total\nSettings of the ThingHTTP-APP If you prefer another streamer, you can enter another channel in the URL behind \u0026ldquo;channel\u0026rdquo;. Click Save ThingHTTP and then copy the API key that appears in the overview into your clipboard. You now need to copy the key into the program, after #define ThingHTTP. Do not forget the WLAN data. You can now upload the program. Once per minute, it will be checked if a stream can be found. If this is the case, the LED will light up.\n","permalink":"https://neu-iot.fkainka.de/en/day-20/","summary":"\u003cp\u003eThe website ThingSpeak offers a lot more than just long-time monitoring of sensors. Today\u0026rsquo;s project is similar to the projects from days 9 and 10 in its basic idea. Information is collected from a website on the internet. In this case, it is whether a specific stream is currently online or not.\u003c/p\u003e\n\u003cp\u003eThere are two decisive advantages of the ThingSpeak version over the first attempts. First, the ThingSpeak page can also call websites via HTTPS (HyperText Transfer Protocol Secure), while the module only supports the unsafe HTTP-protocol. Second, the website can pre-filter important information and thus clearly reduce the data volume to be processed by the controller.\u003c/p\u003e","title":"Day 20: Twitch"},{"content":"In the last days of the advent time, we will deal with an entirely new subject: the website ThingSpeak. This website has been specifically developed for the subject of Internet of Things and contains various practical functions for you.\nBefore you tackle the setup and programme as usual, you need to set up an account on the website\nwww.ThingSpeak.com\nLog in with your user data under the item Sign In. You can see a website that shows your channels. Since you have no channels yet, this site will look rather empty. Click New Channel and assign a name, e.g. Light. In this project, you will measure brightness. In the item Field1, you can now assign a name to the field, e.g. Brightness. All other fields can be left empty for now.\nCreate a channel on ThingSpeak Click Save Channel to save your settings. You will be forwarded to the page of your channel, on which you will only see an empty chart. Click API Keys in the tab above. The sequence of numbers and letters that you will find in the item Write API Key will be needed in a moment.\nHere you can find you API-Key You will find another cable behind today\u0026rsquo;s door. You can now also place three-legged parts such as the IR reception module, outside of the plug board. Today\u0026rsquo;s experiment is structured identically as the one from the 15th day. A voltage divider with 10-kΩ-resistor and photo transistor permits measuring the current brightness.\nThe setup with photo transistor at A0 The program: Day19_ThinkSpeak1\nToday\u0026rsquo;s program measures the brightness, similar to the programme from day 15 . In contrast to the past experiment, however, the data will be sent directly to the ThingSpeak page. This page will not only save the data, but also present them well-structuredly in a chart. It is a very practical function for a measuring station with long-term monitoring.\nFor the program to be able to send to the website, you need to enter the above API key in the program first under the item ThingSpeakKEY in addition to your WLAN data. It is recommended to open the Serial Monitor after uploading. Usually, an update-send message should accompany successful transmission. On the ThingSpeak page, you can now click the tab Private View of your channel again. There, you can see the chart of your channel, which receives new data every 15 seconds.\nThe results in a chart ","permalink":"https://neu-iot.fkainka.de/en/day-19/","summary":"\u003cp\u003eIn the last days of the advent time, we will deal with an entirely new subject: the website ThingSpeak. This website has been specifically developed for the subject of Internet of Things and contains various practical functions for you.\u003c/p\u003e\n\u003cp\u003eBefore you tackle the setup and programme as usual, you need to set up an account on the website\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"http://www.ThingSpeak.com\"\u003ewww.ThingSpeak.com\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eLog in with your user data under the item Sign In. You can see a website that shows your channels. Since you have no channels yet, this site will look rather empty. Click New Channel and assign a name, e.g. Light. In this project, you will measure brightness. In the item Field1, you can now assign a name to the field, e.g. Brightness. All other fields can be left empty for now.\u003c/p\u003e","title":"Day 19: ThingSpeak"},{"content":"Yesterday, you built a receiver for infra-red remote controls. Today, you are building the remote control itself. More precisely, you will build a universal remote control that you can operate by computer or Smartphone and with which you can operate your TV or other devices whenever you misplace the original remote control.\nThe IR-diode at Pin D3 For this project, you need the component behind today\u0026rsquo;s door: the IR diode. It looks like a simple LED, but it sends light in the invisible infra-red range. The IR-signals are visible to a digital camera, however. The structure of today\u0026rsquo;s experiment is shown in the figure. Don\u0026rsquo;t be surprised that the IR-LED is not given a dropping resistor. The effective dropping resistor is the On-resistor of the port, at approx. 30 Ohm. Because of this, the current through the diode is quite high, but the impulses sent are so short that the diode will not take damage.\nThe program: Day18_IrRemote\nBefore the program can work, you need to make some adjustments again. If you read out and used the codes for Power, Volume up, Volume down, Channel up, Channel down and Mute yesterday, you can simply enter these codes into the irCommand array in sequence. Otherwise, install yesterday\u0026rsquo;s programme again and read out the matching codes. Of course, you may use entirely different codes as well. The labels on the website will not match then. In addition to the codes, you also need to enter the protocol used in the variable irProtokoll if your remote control is supported. Last, you need to enter the length of the signal to be sent. Determine it by multiplying the digits of the hex code by four. Example: My code for Power was 0x20DF10EF. 0x is simply the sign for a hex code, which leaves 20DF10EF and thus an eight-digit hex code. 8•4 = 32, i.e. in the example program, the variable irLen means 32. A similar calculation is needed for a code with another length.\nOnce you have entered all codes and parameters, and of course also your WLAN data, you can upload the program. The website of the board now contains six buttons that are labelled accordingly. When you push one of the buttons, a message should appear on the Serial Monitor and your TV or other device should react to the signal correctly. If not, you may need to get closer or check if the IR diode sends anything at all. An LED connected with the wrong polarity would be one possible reason why a project is not working as desired.\nThe TV-remote Website ","permalink":"https://neu-iot.fkainka.de/en/day-18/","summary":"\u003cp\u003eYesterday, you built a receiver for infra-red remote controls. Today, you are building the remote control itself. More precisely, you will build a universal remote control that you can operate by computer or Smartphone and with which you can operate your TV or other devices whenever you misplace the original remote control.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day18-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-220\" src=\"/images/2015/09/Day18-1.jpg\" alt=\"Anschluss der IR-Diode an Pin D3\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe IR-diode at Pin D3\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eFor this project, you need the component behind today\u0026rsquo;s door: the IR diode. It looks like a simple LED, but it sends light in the invisible infra-red range. The IR-signals are visible to a digital camera, however. The structure of today\u0026rsquo;s experiment is shown in the figure. Don\u0026rsquo;t be surprised that the IR-LED is not given a dropping resistor. The effective dropping resistor is the On-resistor of the port, at approx. 30 Ohm. Because of this, the current through the diode is quite high, but the impulses sent are so short that the diode will not take damage.\u003c/p\u003e","title":"Day 18: Universal remote control"},{"content":"Today\u0026rsquo;s project permits controlling the controller by remote control. You can change the colour of the RGB-LED with buttons you can choose on an infra-red remote control, and change the background colour of the website right along with it.\nTheIR-Modul on Pins D7-D5 Behind today\u0026rsquo;s door, you will find the important part of today\u0026rsquo;s project, i.e. the infra-red receiver module. You can connect the module without a cable as shown in the figure below. The program sets the corresponding pins so that the module is supplied with power.\nThe program: Day17_IRmodul\nToday\u0026rsquo;s program once again uses an external library: the IRremote-Library by Ken Shiriff. A copy of the version used by me is again enclosed in the Sketch folder and only needs to be copied into the library folder of your Sketchbook.\nAfter uploading the program, you should start the Serial Monitor. Find a remote control and point it at the module. When you push a button, you should have the value of the signal output as a HEX code and the type of the protocol as a number in the monitor. When the type is displayed as -1, the protocol has not been recognised. There may be several failed attempts before a command is properly decoded. Just try out a bit or try another remote control. Once you have found a working one, select six buttons (best take Power, Volume up, Volume down, Channel up, Channel down and Mute). Now copy the codes for the six commands in the program behind the six #define irComX (do not forget the 0x before the hex code). The commands of an LG-TV remote control are pre-defined there. If you have entered the codes correctly, you can upload the program again. You can use the buttons defined by you to change the colour of the RGB-LED now. When updating the board page, you will also see that the colour has changed.\n","permalink":"https://neu-iot.fkainka.de/en/day-17/","summary":"\u003cp\u003eToday\u0026rsquo;s project permits controlling the controller by remote control. You can change the colour of the RGB-LED with buttons you can choose on an infra-red remote control, and change the background colour of the website right along with it.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day17-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-213\" src=\"/images/2015/09/Day17-1.jpg\" alt=\"Das IR-Modul an Pins D7-D5\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eTheIR-Modul on Pins D7-D5\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door, you will find the important part of today\u0026rsquo;s project, i.e. the infra-red receiver module. You can connect the module without a cable as shown in the figure below. The program sets the corresponding pins so that the module is supplied with power.\u003c/p\u003e","title":"Day 17: IR module"},{"content":"Today\u0026rsquo;s project permits simple control of the digital pins D2-D7 per website. The status of the respective pin is also presented on the website, so that you will never lose the overview.\nTo review the condition of the pin well, a setup as in the following figure is recommended. Both the RGB-LED and the regular LED are used. The cathodes of the LEDs are now not connected to the long ground line on the outside of the board, but are also at a digital output. Only when these pins are switched low can the LEDs light up.\nToday\u0026rsquo;s calendar component is another cable. This permits keeping the LED off the board. You can now install the board in a housing, for example, and put the LED outside.\nSettings for LEDs on D2-D7 Attention! LEDs must not be connected without dropping resistors. In this case it is permitted due to the On resistors of the internal port FETs of approx. 30 Ohm. Because the LEDs are placed between two ports, they actually work with a dropping resistor of 60 Ohm. Depending on LED type and colour, an LED current between 15 mA and 30 mA at most occurs. This is still permitted.\nThe program: Day16_TCPServerGPIO\nThe website of today\u0026rsquo;s program uses check boxes as an HTML element. When you upload the program and call the page of the board, you can see a number of boxes that can be clicked. A check mark in a box means that the pin is high. No check mark means low. You can now try out which pins need to be high and which ones need to be low for all LEDs to be lit.\nThe website of todays project ","permalink":"https://neu-iot.fkainka.de/en/tag-16-gpio-control/","summary":"\u003cp\u003eToday\u0026rsquo;s project permits simple control of the digital pins D2-D7 per website. The status of the respective pin is also presented on the website, so that you will never lose the overview.\u003c/p\u003e\n\u003cp\u003eTo review the condition of the pin well, a setup as in the following figure is recommended. Both the RGB-LED and the regular LED are used. The cathodes of the LEDs are now not connected to the long ground line on the outside of the board, but are also at a digital output. Only when these pins are switched low can the LEDs light up.\u003c/p\u003e","title":"Day 16: GPIO Control"},{"content":"Today\u0026rsquo;s project does not use the web server\u0026rsquo;s website as a control interface, but as an output element. The brightness measured via a brightness sensor is displayed well-structuredly as a relative value.\nThe fototranistor at Pin A0 Behind today\u0026rsquo;s door, there is another photo transistor that serves as a light sensor. The photo transistor looks like an LED, but should not be mistaken for one. The structure of today\u0026rsquo;s experiment is shown in the figure. The collector of the photo transistor is the shorter connection. It is applied to +5 V.\nThe program: Day15_TCPServerBright\nUntil now, the websites of the webserver were always made up of an unchangeable page that sent data to the controller. Today, the website is to be changed before being transmitted to the browser, to display the appropriate brightness of the photo transistor. This works because the source code of the website holds a kind of placeholder. The program now replaces the placeholder *bright* when loading the data from the Progmem variable by the current brightness value. Thus, the output text and the deflection of the slider are changed. Another line in the HTML file ensures that the page will reload automatically every few seconds. The current brightness is already displayed well-structuredly in the browser.\nThe website of the brightness sensor\n","permalink":"https://neu-iot.fkainka.de/en/day-15/","summary":"\u003cp\u003eToday\u0026rsquo;s project does not use the web server\u0026rsquo;s website as a control interface, but as an output element. The brightness measured via a brightness sensor is displayed well-structuredly as a relative value.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day15-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-203\" src=\"/images/2015/09/Day15-1.jpg\" alt=\"Anschluss des Fototransistors an Pin A0\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe fototranistor at Pin A0\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door, there is another photo transistor that serves as a light sensor. The photo transistor looks like an LED, but should not be mistaken for one. The structure of today\u0026rsquo;s experiment is shown in the figure. The collector of the photo transistor is the shorter connection. It is applied to +5 V.\u003c/p\u003e","title":"Day 15: Light sensor"},{"content":"Today\u0026rsquo;s project is about controlling the RGB-LED by web server. A well-structured interface can be used to change the colour of the LED. The website has also been adjusted and should be easy to display even on Smartphones.\nThe website on a PC browser Behind today\u0026rsquo;s advent calendar door, there is another resistor, but this one is of 10 kΩ (brown, black, orange). You will need it for tomorrow\u0026rsquo;s experiment.\nThe circuit of todays project The structure of today\u0026rsquo;s experiment is like the one from day ten. The RGB-LED is connected to the PWM-capable pins D3, D5 and D6 with dropping resistors.\nThe program: Day14_TCPServerRGB\nThe transmitted website is again concealed in the Progmem variables site in binary form. Again, you can view the HTML page in the Sketch folder. After setting the WLAN data and uploading the programme, the website of the web server can be reached via the IP of the module. The page is designed similarly to the previous one in background colour and headline. However, there is a new element on the page, i.e. the HTML5element Colour Picker. It can be used to select a colour for the LED. Once you have confirmed the colour, the LED will display it. The display of the Colour-Picker element may differ strongly depending on the chosen browser.\nThe ColorPicker element in an Android 5.0 browser ","permalink":"https://neu-iot.fkainka.de/en/day-14/","summary":"\u003cp\u003eToday\u0026rsquo;s project is about controlling the RGB-LED by web server. A well-structured interface can be used to change the colour of the LED. The website has also been adjusted and should be easy to display even on Smartphones.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day14-2.jpeg\"\u003e\u003cimg class=\"size-full wp-image-195\" src=\"/images/2015/09/Day14-2.jpeg\" alt=\"Die Webseite mit ColorPicker\" width=\"303\" height=\"310\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe website on a PC browser\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eBehind today\u0026rsquo;s advent calendar door, there is another resistor, but this one is of 10 kΩ (brown, black, orange). You will need it for tomorrow\u0026rsquo;s experiment.\u003c/p\u003e","title":"Day 14: Webserver for the RGB-LED"},{"content":"In today\u0026rsquo;s experiment, the illustration of the website is even more sophisticated. There are now also control elements that permit much more comfortable control of the LED.\nThe 9V-batterie powers the board The structure of today\u0026rsquo;s experiment is no different from yesterday\u0026rsquo;s: An LED at pin D9, which can be controlled via the module. As an additional component, today\u0026rsquo;s door once again holds a resistor with 1 kΩ. If necessary, you can now reduce the brightness of an LED by switching two resistors in series.\nThe program: Day13_TCPServerProgmen\nToday\u0026rsquo;s program saves the website a little differently from the preceding one. While the simple website was contained in the source text yesterday, the page is saved in a Progmem variable this time. This relieves the board\u0026rsquo;s SRAM and permits more complex display of websites. However, you are losing some overview of the page.\nThe website You can, however, view the HTML file in the Sketch folder and change it as required. By having the website converted to bytes on the website\ntools.thebuzzmedia.com/bytechar\nand entering these into the program variable, you can generate a new website for your web server.\nThe convertion on the Buzz Media Page ","permalink":"https://neu-iot.fkainka.de/en/day-13/","summary":"\u003cp\u003eIn today\u0026rsquo;s experiment, the illustration of the website is even more sophisticated. There are now also control elements that permit much more comfortable control of the LED.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day12-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-163\" src=\"/images/2015/09/Day12-1.jpg\" alt=\"So schließen Sie eine Batterie an den heutigen Versuchsaufbau an\" width=\"616\" height=\"337\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe 9V-batterie powers the board\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eThe structure of today\u0026rsquo;s experiment is no different from yesterday\u0026rsquo;s: An LED at pin D9, which can be controlled via the module. As an additional component, today\u0026rsquo;s door once again holds a resistor with 1 kΩ. If necessary, you can now reduce the brightness of an LED by switching two resistors in series.\u003c/p\u003e","title":"Day 13: Website with buttons"},{"content":"The results of yesterday\u0026rsquo;s experiment are now to be used in an autonomous program. Today\u0026rsquo;s program not only sends a simple website to the browser, but also permits control of an LED.\nThe 9V-batterie powers the board Behind today\u0026rsquo;s door, you will find a 9-V battery clip that can make your board mobile. As an alternative, you may also use a Power Bank (a battery pack usually used for mobile phones). If you want to use the 9-V-battery, observe that the red wire must be connected to Vin, and the black one to GND. The figure shows the setup of today\u0026rsquo;s experiment with external power supply.\nThe program: Day12_TCPServerLed\nToday\u0026rsquo;s program sends a slightly more complex page than the previous experiment. You can also switch the LED at pin D9 by entering /LED behind the IP? of the module. The current condition of the LED is then inverted, i.e. toggled each time.\nEnter the WLAN data and upload the program. The board\u0026rsquo;s IP is displayed in serial mode. Then you can open the browser and call the board\u0026rsquo;s IP. The website now has a headline and a little more text. The text indicates how to control the LED. It is a first, fully autonomous web server.\n","permalink":"https://neu-iot.fkainka.de/en/day-12/","summary":"\u003cp\u003eThe results of yesterday\u0026rsquo;s experiment are now to be used in an autonomous program. Today\u0026rsquo;s program not only sends a simple website to the browser, but also permits control of an LED.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day12-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-163\" src=\"/images/2015/09/Day12-1.jpg\" alt=\"So schließen Sie eine Batterie an den heutigen Versuchsaufbau an\" width=\"616\" height=\"337\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe 9V-batterie powers the board\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door, you will find a 9-V battery clip that can make your board mobile. As an alternative, you may also use a Power Bank (a battery pack usually used for mobile phones). If you want to use the 9-V-battery, observe that the red wire must be connected to Vin, and the black one to GND. The figure shows the setup of today\u0026rsquo;s experiment with external power supply.\u003c/p\u003e","title":"Day 12: Autonomous webserver"},{"content":"In the previous experiments, we dealt with the subject of TCP and access to web servers a lot. Today, the module is to act as a web server of its own for the first time.\nBehind the door of the 11th day, there is a special cable that will be very useful soon. A special setup is not necessary today, since the program works similarly to the serial monitor programme of day one.\nThe program: Day11_TCPServer\nChange the WLAN data as before and load the program onto your board. Then start the monitor. It may take a few seconds before the message that the board is connected appears. When the success message has appeared and the IP of the module is displayed, you can start with the first command in the Serial Monitor:\nAT+CIPMUX=1\nThis command permits multiple connections to the module. You can then access the web server from several computers. Use the next command to start the web server:\nAT+CIPSERVER=1,80\nThe parameter 1 means that the server is being started. 0 terminates a server again. The number 80 represents the port under which the server can be reached. HTTP requests sent by the browser are generally sent through port 80.\nYou can now open a browser of your choice and enter the IP of your module into the address bar and call it. The browser initially shows a loading message, but the Serial Monitor will show a change. You can see a request query similar to the one you have sent out manually before.\nThe browser query The browser now waits for a response, and will show a loading sign until then, or until the connection is interrupted due to time-out. You can send a message to the browser with a version of a familiar command:\nAT+CIPSEND=0,7\nThe parameter 0 indicates the client to which the message is to be sent here. This is necessary because multiple connections are permitted and several clients may therefore also be connected. The second parameter, here 7, again indicates the characters to be sent. \u0026gt; appears, and you can enter a simple\nHello\nand send it out with Enter. Nothing will change in your browser at first. You need to close the connection before this can happen. For this, use the command:\nAT+CIPCLOSE=0\nNow you can see a Hello in the browser. You have implemented the first webserver application.\n","permalink":"https://neu-iot.fkainka.de/en/day-11/","summary":"\u003cp\u003eIn the previous experiments, we dealt with the subject of TCP and access to web servers a lot. Today, the module is to act as a web server of its own for the first time.\u003c/p\u003e\n\u003cp\u003eBehind the door of the 11th day, there is a special cable that will be very useful soon. A special setup is not necessary today, since the program works similarly to the serial monitor programme of day one.\u003c/p\u003e","title":"Day 11: TCP-Webserver"},{"content":"Today\u0026rsquo;s project is an intuitive display of the current temperature. With a single look, you can guess at whether it is sensible to take along a warm jacket.\nThe RGB-LED on Pins D3, D5 and D6 Behind today\u0026rsquo;s door, there is another LED. This is a special one. It is an RGB-LED. RGB means Red, Green, Blue, the LED actually is made up of several LEDs with a shared cathode connection. A combination of the different colours with different brightnesses permits presenting almost any colour. The LED can be connected to the PWM outputs D3, D5, D6 of the controller with dropping resistors.\nThe program: Day10_TCPWeatherUpdate\nToday\u0026rsquo;s sketch is about querying a website again, but this time a weather site. Formerly the website was the well known site www.openweathermap.org, but due to changes in their API i had to create an other webservice, from which you can get the current temperatur. But this webservices source is still openweathermap.com. So the new weblink is:\nwww.temp.fkainka.de\nOn this page, you can get information on the weather in your town by varying the URL. In the program just enter the city you want to query in the source text behind CITY. As an example, I am using my home town Essen.\nThe link to the webservice would be:\nhttp://temp.fkainka.de/?city=essen\nThe programme now reads the temperature from this page and shows the result in colour via the RGB-LED. At the same time, the value is output via the serial monitor. The temperature range used in the example program for display on the LED is -20°C to +40°C.\nThe temperature in the Serial Monitor ","permalink":"https://neu-iot.fkainka.de/en/day-10/","summary":"\u003cp\u003eToday\u0026rsquo;s project is an intuitive display of the current temperature. With a single look, you can guess at whether it is sensible to take along a warm jacket.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day10-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-152\" src=\"/images/2015/09/Day10-1.jpg\" alt=\"Anschluss der RGB LED an die Pins D3, D5 und D6\" width=\"616\" height=\"362\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe RGB-LED on Pins D3, D5 and D6\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door, there is another LED. This is a special one. It is an RGB-LED. RGB means Red, Green, Blue, the LED actually is made up of several LEDs with a shared cathode connection. A combination of the different colours with different brightnesses permits presenting almost any colour. The LED can be connected to the PWM outputs D3, D5, D6 of the controller with dropping resistors.\u003c/p\u003e","title":"Day 10: Temperature display"},{"content":"Today\u0026rsquo;s project uses the functions of the prior test to independently collect information from a website. The program specifically loads the current time from a dedicated website and thus sets the internal clock of the controller that is implemented by library.\nBehind today\u0026rsquo;s door, there is another resistor with 1 kΩ. All three resistors will be needed for tomorrow\u0026rsquo;s experiment.\nThe program: Day9_TCPAutoTime\nWhile yesterday\u0026rsquo;s program still required mostly manual operation, today\u0026rsquo;s program works mostly autonomously. The controller connects to the website entirely independently:\nhttp://chronic.herokuapp.com/\nThe URL can be used to call various time systems and conversions. The current time valid in Germany in winter is queried by the URL\nhttp://chronic.herokuapp.com/utc/in-one-hour\nTherefore, the call of the function getTime has the second parameter »utc/in-one-hour«. Based on the UTC (coordinated world time), you need to change the call to »utc/in-two-hours« in summer. You can treat all other time zones according to the same system.\nThe current time in the Serial Monitor The determined time is now handed over to the Time-Library of Michael Margolis (source: http://www.pjrc.com/teensy/td_libs_Time.html). For practical reasons, a copy of the Time-Library version that I use is enclosed in the sketch folder. It must be copied into the libraries folder of your sketchbook folder. In the background, the new time is continually calculated and output in the terminal every second. You can now simply program an alarm clock or another time-controlled application.\n","permalink":"https://neu-iot.fkainka.de/en/day-9/","summary":"\u003cp\u003eToday\u0026rsquo;s project uses the functions of the prior test to independently collect information from a website. The program specifically loads the current time from a dedicated website and thus sets the internal clock of the controller that is implemented by library.\u003c/p\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door, there is another resistor with 1 kΩ. All three resistors will be needed for tomorrow\u0026rsquo;s experiment.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eThe program: \u003ca href=\"/images/2015/09/Day9_TCPAutoTime.zip\"\u003eDay9_TCPAutoTime\u003c/a\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eWhile yesterday\u0026rsquo;s program still required mostly manual operation, today\u0026rsquo;s program works mostly autonomously. The controller connects to the website entirely independently:\u003c/p\u003e","title":"Day 9: TCP time"},{"content":"In the last days, we mostly dealt with the UDP protocol with which data can be sent out simply and directly. In the next few days, we will deal with the TCP (Transmission Control Protocol). TCP only permits one connection at a time between precisely two computers. It is mostly used online for browsing on websites.\nBehind today\u0026rsquo;s door, there is another resistor with 1 kΩ (brown, black, red). As with all other parts: keep it safe, even though you are not using this part today yet.\nThe program: Day8_TCPBrowser\nThe program\u0026rsquo;s function is similar to the SoftwareSerial program of the first day, but among others, it connects to the WLAN independently at start-up. This saves you a lot of typing and you can start more quickly. Do not forgot that you need to enter your home network’s data into the program. Then enter the following command line in the serial monitor:\nAT+CIPSTART=“TCP“,“www.example.com“,80\nThis command establishes a TCP connection to the website www.example.com. Port 80 is the standard port for HTTP-queries. After confirmation of the connection with OK, you can enter the next command, which you already know:\nAT+CIPSEND=40\nYou want to send a message through the connection you have just established, after all. When you are asked to enter a text with \u0026gt;, first enter\nGET / HTTP/1.1\nand then push Enter. Enter does not appear in the Serial Monitor, but the module has received it. Then the message continues with\nHost:www.example.com\nfollowed by two times Enter. A long text is returned. The first part is the response of the server, containing some information for the browser. The text after \u0026lt;!document html\u0026gt; is the website that you can also see when you call the page www.example.com directly - but purely textbased. A browser would now interpret this text and present it in a form that we understand.\nExcerpt from the answer of the web server ","permalink":"https://neu-iot.fkainka.de/en/day-8/","summary":"\u003cp\u003eIn the last days, we mostly dealt with the UDP protocol with which data can be sent out simply and directly. In the next few days, we will deal with the TCP (Transmission Control Protocol). TCP only permits one connection at a time between precisely two computers. It is mostly used online for browsing on websites.\u003c/p\u003e\n\u003cp\u003eBehind today\u0026rsquo;s door, there is another resistor with 1 kΩ (brown, black, red). As with all other parts: keep it safe, even though you are not using this part today yet.\u003c/p\u003e","title":"Day 8: A browser"},{"content":"In the last project, a button was used to deal with the simplest form of a sensor. This time, a potentiometer should be used as an analogue sensor to permanently send measured values into the network.\nBehind the 7th door of the advent calendar, there is a potentiometer with 10 kΩ. The setup is shown in the lower figure.\nThe setup on pin A0 The program: Day7_UDPAnalog\n! Attention: Some MAC-Users reportet a bug in the PacketSender-Software. This bug doesn\u0026rsquo;t allow you to change the ports. If you have problems with this bug you can change the ports in the Arduino program. All you have to do for todays project is to change the line 100 from\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.255.255\u0026quot;,90,91,2\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\nto\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.255.255\u0026quot;,5505,5506,2\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\nIn addition to the analogue sensor, there is another change to the programme. This time, the controller is not to be operated in access point mode as before, but to connect to your home network. You can enter your station data simply at the top of the program this time.\nAfter the upload, it may be a while before the connection to the network is established. If this has been successful, the LED D3, which is firmly equipped on the board, lights up. This is the sign that the controller is now ready. While the serial monitor is active, you will see the corresponding message, but you may want to use the board autonomously for later experiments. In this case, the feedback can be very helpful. The serial monitor will also give you the information of which IP has had the board assigned by the router. This IP is important if you want to connect to the board later.\nThe software recieves the messured data The connection to the board works similarly as before. Only the IP of the module and your computer will have changed. The program initially does not receive any measured results. You need to send a message, e.g. the command led=1, first. New measured data will then come in approx. once per second.\n","permalink":"https://neu-iot.fkainka.de/en/day-7/","summary":"\u003cp\u003eIn the last project, a button was used to deal with the simplest form of a sensor. This time, a potentiometer should be used as an analogue sensor to permanently send measured values into the network.\u003c/p\u003e\n\u003cp\u003eBehind the 7th door of the advent calendar, there is a potentiometer with 10 kΩ. The setup is shown in the lower figure.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day7-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-132\" src=\"/images/2015/09/Day7-1.jpg\" alt=\"Der Aufbau mit Potentiometer an A0\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe setup on pin A0\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003e\u003cstrong\u003eThe program: \u003ca href=\"/images/2015/09/Day7_UDPAnalog.zip\"\u003eDay7_UDPAnalog\u003c/a\u003e\u003c/strong\u003e\u003c/p\u003e","title":"Day 7: Analogous sensor"},{"content":"In yesterday\u0026rsquo;s program, the first commands were evaluated by the controller. Today\u0026rsquo;s program maintains this function but can also additionally send a command into the network independently.\nThe button on pin D8 You will find a button behind today\u0026rsquo;s door. It is used as a simple sensor here. Connect it to the controller as shown in the setup image.\nThe program: Day6_UDPSwitch\n! Attention: Some MAC-Users reportet a bug in the PacketSender-Software. This bug doesn\u0026rsquo;t allow you to change the ports. If you have problems with this bug you can change the ports in the Arduino program. All you have to do for todays project is to change the line 83 from\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,90,91\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\nto\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,5505,5506\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\nThe program continues to evaluate the incoming signals. Additionally, the button is continually queried. When the user actuates it, the controller sends the text\nButton=1\nto the network. All devices connected to the module with a UDP server on port 90 can receive the command. For a building automation project, a server would receive the status message, e.g. of a motion sensor, and then reset the command led=1 to activate the light.\nThe commands ","permalink":"https://neu-iot.fkainka.de/en/day-6/","summary":"\u003cp\u003eIn yesterday\u0026rsquo;s program, the first commands were evaluated by the controller. Today\u0026rsquo;s program maintains this function but can also additionally send a command into the network independently.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day6-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-127\" src=\"/images/2015/09/Day6-1.jpg\" alt=\"Der Schalter platzsparend an D8 angeschlossen\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe button on pin D8\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eYou will find a button behind today\u0026rsquo;s door. It is used as a simple sensor here. Connect it to the controller as shown in the setup image.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eThe program: \u003ca href=\"/images/2015/09/Day6_UDPSwitch.zip\"\u003eDay6_UDPSwitch\u003c/a\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003e! Attention: Some MAC-Users reportet a bug in the PacketSender-Software. This bug doesn\u0026rsquo;t allow you to change the ports. If you have problems with this bug you can change the ports in the Arduino program. All you have to do for todays project is to change the line 83 from\u003c/em\u003e\u003cbr\u003e\n\u003cem\u003e\u003cstrong\u003esucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,90,91\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\u003c/strong\u003e\u003c/em\u003e\u003cbr\u003e\n\u003cem\u003eto\u003c/em\u003e\u003cbr\u003e\n\u003cem\u003e\u003cstrong\u003esucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,5505,5506\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\u003c/strong\u003e\u003c/em\u003e\u003c/p\u003e","title":"Day 6: UDP-Button"},{"content":"Today\u0026rsquo;s program is finally about controlling hardware via the UDP protocol. In this case, an LED is switched on and off with simple commands.\nThe LED in Pin D9 You will find an LED board behind the fifth door. The right dropping resistor already was in yesterday\u0026rsquo;s door. Build the circuit as the picture shows.\nThe program: Day5_UDPLED\n! Attention: Some MAC-Users reportet a bug in the PacketSender-Software. This bug doesn\u0026rsquo;t allow you to change the ports. If you have problems with this bug you can change the ports in the Arduino program. All you have to do for todays project is to change the line 83 from\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,90,91\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\nto\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,5505,5506\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\nWhile the previous example programs needed many user inputs, today\u0026rsquo;s program is to work autonomously. Nevertheless, the serial monitor will continue to output information for debugging purposes.\nThe debug messages in the Serial Monitor The controller will now wait for data received from the module that are announced by the +IPD message. Legitimate commands that you can send through the Packet Sender are led1 and led0. The controller interprets them and switches the LED on and off accordingly. Feedback to the transmitter is transmitted as well. If another command is sent, the serial monitor reports \u0026ldquo;Wrong UDP Command\u0026rdquo;. The same message is also submitted to the transmitter via the network.\nThe transmitted commands ","permalink":"https://neu-iot.fkainka.de/en/day-5/","summary":"\u003cp\u003eToday\u0026rsquo;s program is finally about controlling hardware via the UDP protocol. In this case, an LED is switched on and off with simple commands.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day5-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-117\" src=\"/images/2015/09/Day5-1.jpg\" alt=\"So schließen Sie die LED mit Vorwiderstand am Pin D9 an\" width=\"616\" height=\"301\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe LED in Pin D9\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eYou will find an LED board behind the fifth door. The right dropping resistor already was in yesterday\u0026rsquo;s door. Build the circuit as the picture shows.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eThe program: \u003ca href=\"/images/2015/09/Day5_UDPLED.zip\"\u003eDay5_UDPLED\u003c/a\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003e! Attention: Some MAC-Users reportet a bug in the PacketSender-Software. This bug doesn\u0026rsquo;t allow you to change the ports. If you have problems with this bug you can change the ports in the Arduino program. All you have to do for todays project is to change the line 83 from\u003c/em\u003e\u003cbr\u003e\n\u003cem\u003e\u003cstrong\u003esucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,90,91\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\u003c/strong\u003e\u003c/em\u003e\u003cbr\u003e\n\u003cem\u003eto\u003c/em\u003e\u003cbr\u003e\n\u003cem\u003e\u003cstrong\u003esucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,5505,5506\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\u003c/strong\u003e\u003c/em\u003e\u003c/p\u003e","title":"Day 5: Switching an LED"},{"content":"In yesterday\u0026rsquo;s project, the UDP communication was tested in one direction, i.e. from the board to the PC. In this program, the module is set so that communication in the other direction is possible as well, almost like in a chat. Behind the fourth door of the Advent calendar, there is a resistor with 1 kΩ (brown, black, red). The component is not used in today\u0026rsquo;s test yet, but should be kept for later.\nThe program: Day4_UDPBidirectional\nToday\u0026rsquo;s program generally only contains a very small change that has a great effect on the communication with the UDP protocol. When you upload the program, another access point with which you can connect to a PC is generated. Again, you will need Packet Sender or a comparable program. Start the program and make the same settings as yesterday (File-\u0026gt; Settings-\u0026gt;Network: Enable UDP Server, Port 90). Then you need to enter the address of the module (192.168.4.1) in the main window in the IP address field, set the port to 91 and select the item UDP in the dropdown menu farther to the right. When these settings have been made and the serial monitor has been opened, you can send the first message to the module by entering, e.g., Hi in the field labelled with ASCII.\nThe programm send Hi ! Attention: Some MAC-Users reportet a bug in the PacketSender-Software. This bug doesn\u0026rsquo;t allow you to change the ports. If you have problems with this bug you can change the ports in the Arduino program. All you have to do for todays project is to change the line 54 from\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,90,91\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\nto\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.255\u0026quot;,5505,5506\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;);\nIf you click Send now, the Serial Monitor will show\n+IPD,2:Hi OK\nThe message has been received. You can now also answer, by using the CIPSEND command again, e.g.\nAT+CIPSEND=7\n\u0026gt;Hello\nChatting with two devices is possible, though very impractical.\nThe Serial Monitor recieved the message ","permalink":"https://neu-iot.fkainka.de/en/day-4/","summary":"\u003cp\u003eIn yesterday\u0026rsquo;s project, the UDP communication was tested in one direction, i.e. from the board to the PC. In this program, the module is set so that communication in the other direction is possible as well, almost like in a chat. Behind the fourth door of the Advent calendar, there is a resistor with 1 kΩ (brown, black, red). The component is not used in today\u0026rsquo;s test yet, but should be kept for later.\u003c/p\u003e","title":"Day 4: UDP bidirectional"},{"content":"In today\u0026rsquo;s project, data are exchanged between the board and the PC through the WLAN for the first time. The prerequisite for this is that your computer has a WLAN adapter. The UDP (User Datagram Protocol) is used. Another program on the PC-side ensures successful receipt of the messages.\nBehind the third door of the calendar, you can find an insulated cable that you will need to build circuits. To prepare for later experiments, you can place the supply lines ground and VCC on the outer tracks.\nVCC and GND for easy acces The program: Day3_UPDBasics\nWhen you load the program onto the controller, the controller is configured as an access point and you should see an open network called NanoESP. Before connecting to the network, first download another program from the Internet. In my experiments, I used the programme Packet Sender by Dan Nagle which you can download from the following link:\nhttps://packetsender.com/\nAfter loading and installing the program, you can connect your PC to the open network of the NanoESP. Ensure that the firewall recognises the network as a home network, to avoid blocking data. Your computer should now have the IP 192.168.4.2. You can check this by sending the command\nAT+CWLIF\nto the module via the serial monitor. This command shows all computers connected to the access point with IP and MAC addresses.\nStart the program Packet Sender; set the UDP server port to 90 in Settings-\u0026gt;Network and click the check box \u0026ldquo;Enable UDP Server\u0026rdquo;. Usually, the lower left should say UDP:90. If it does not, you need to restart the software once.\nThe right settings ! Attention: Some MAC-Users reportet a bug in the PacketSender-Software. This bug doesn\u0026rsquo;t allow you to change the ports. If you have problems with this bug you can change the ports in the Arduino program. All you have to do for todays project is to change the line 55 from\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.2\u0026quot;,90\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;); //UDP-Server\nto\nsucces \u0026amp;= sendCom(\u0026ldquo;AT+CIPSTART=\u0026quot;UDP\u0026quot;,\u0026quot;192.168.4.2\u0026quot;,5505\u0026rdquo;, \u0026ldquo;OK\u0026rdquo;); //UDP-Server\nThe program on the computer is now used as UDP server, while the controller is set as UDP client. The differentiation between client and server is not clear in the UDP protocol, but in this case it means that you will send data from your controller to the computer.\nTo send data, use the command:\nAT+CIPSEND=7\nUse the CIPSEND command The 7 means the number of characters to be sent. The character \u0026gt; is returned. This means that you can now send your message. Enter Hello and confirm with Enter again. The module returns SEND OK, although you have only entered five characters. This is because after your input Carriage Return and New Line are sent as well, i.e. two characters more that you need to include in your message length calculation.\nThe programm recieved the message When you switch back to the Packet Sender and look at Log Traffic there, you can see the receipt of the message. In the ASCII view, you will even see the two enclosed characters, represented by \\r and \\n. Therefore the first communication between board and PC via the WLAN has been successful.\n","permalink":"https://neu-iot.fkainka.de/en/day-3/","summary":"\u003cp\u003eIn today\u0026rsquo;s project, data are exchanged between the board and the PC through the WLAN for the first time. The prerequisite for this is that your computer has a WLAN adapter. The UDP (User Datagram Protocol) is used. Another program on the PC-side ensures successful receipt of the messages.\u003c/p\u003e\n\u003cp\u003eBehind the third door of the calendar, you can find an insulated cable that you will need to build circuits. To prepare for later experiments, you can place the supply lines ground and VCC on the outer tracks.\u003c/p\u003e","title":"Day 3: UDP-Send"},{"content":"With today\u0026rsquo;s project, you test whether you can reach the Google server. This is used as a test of whether there generally is a connection to the Internet or, e.g., a firewall is blocking the NanoESP-board.\nYou will find a plug board behind today\u0026rsquo;s door. The plug board is used as an experimenting platform later, to connect sensors and other elements. It is best if you plug the controller onto the plug board as shown in the following figure. This leaves you the most space for experiments, while the WLAN module protrudes over the plug board at the rear. The micro USB cable is then suspended between the contact sides and will only interfere minimally.\nThe NanoESP on the breadboard The program: Day2_GooglePing\nThe example program from the website has mostly automated the processes that you entered manually in the first example. The controller sends commands to the ESP module in sequence, thus connecting to the WLAN, among others. The differently long time-out times give the module enough time to answer.\nBefore the programme can work properly, you need to enter your WLAN data behind the two #defines SSID and PASSWORT right at the\nbeginning of the programme source code. The module needs access to the Internet to execute its last command. The command\nAT+PING\npings other devices in the network. Pinging means a request of whether an address can generally be reached. Here, the Google server is pinged with AT+PING=“www.google.de“. When a response returns, a success message appears in the serial monitor and the LED labelled D3 that is connected to Pin D13 at the board is activated. The first communication with the Internet is successful.\n","permalink":"https://neu-iot.fkainka.de/en/day-2/","summary":"\u003cp\u003eWith today\u0026rsquo;s project, you test whether you can reach the Google server. This is used as a test of whether there generally is a connection to the Internet or, e.g., a firewall is blocking the NanoESP-board.\u003c/p\u003e\n\u003cp\u003eYou will find a plug board behind today\u0026rsquo;s door. The plug board is used as an experimenting platform later, to connect sensors and other elements. It is best if you plug the controller onto the plug board as shown in the following figure. This leaves you the most space for experiments, while the WLAN module protrudes over the plug board at the rear. The micro USB cable is then suspended between the contact sides and will only interfere minimally.\u003c/p\u003e","title":"Day 2: Google Ping"},{"content":"It is the first day of December and thus time to open the first door. Behind the door, you will find the most important part of this calendar: the Arduino™-compatible NanoESP-board with integrated WLAN module that this calendar is about.\nThe NanoESP Board As you can see quite well on the PCB, the board is made up of two components. The left half is an Arduino™-compatible micro controller system that can be compared to the Arduino™ Nano. The right part is the WLAN module with the designation ESP8266. These two components communicate via a serial interface generated by software. The Arduino™-side rather acts as the boss, forwarding the commands to the WLAN module. Some of these commands will already be tried out today on the first day.\nThe program: Day1_SoftwareSerial The Arduino™-software is used as the developing environment. The current version can be found on the website:\narduino.cc\nI have worked with Arduino™-versions 1.6.4 – 1.6.5. Older versions may cause problems. For some Linux versions, there is currently only a very old version. Advice on how to solve this and other problems can be found on the website. In the Arduino™ software, you need to select Arduino™ Nano as a board and the serial port. Then you can upload the program.\nToday\u0026rsquo;s download is a very simple program that does nothing but pass on all data received through the serial hardware interface of the\nmicrocontroller to the ESP controller via a self-defined software interface. The entire thing works in the opposite direction as well. As you can see in the source text, the two connections of the software interface are pins 11 and 12. They should not be used as GPIO-pins in your own projects. You also need the SoftwareSerial library. The library is pre-installed in most Arduino™ versions, but if not, you should download it via the Manager.\nAfter the program has been uploaded, you can start the serial monitor of the Arduino™ interface. Before you can start, two important settings must be made to the Serial Monitor, i.e. the baud rate must be set to \u0026ldquo;19200\u0026rdquo; in the lower right corner and the setting \u0026ldquo;CR and NL\u0026rdquo; must be made in the box to its left.\nAfter setting, you can see a message, i.e. an AT and a few lines, followed by OK. The command AT was sent to the ESP module by the microcontroller and the module answered OK. You can see by this that the module works and is ready for use.\nYou can test this again by sending the command\nAT\nby serial monitor. The uploaded program again passes on the command to the ESP module, which in turn answers OK. The next command that you can test is:\nAT+GMR\nThis command outputs the current firmware and version number. The command\nAT+RST\nresets the module. You will see a few illegible characters on the terminal first, followed by ready, which says that the module is now ready. Use\nAT+CWMODE\nto specify the WLAN mode. There are three options: Mode 1 is the station mode. This means that you can log into a present WLAN in the module. Mode 2 is the AccessPoint mode. This means that you can log on to a WLAN provided by the module with a WLAN-capable device. Mode 3 is dual mode. You can both log on to a present WLAN with the module and make a direct connection to another device. Test the AccessPoint mode by specifying mode 2 with the command\nAT+CWMODE = 2\nand then using the command\nAT+CWSAP=”MyNanoESP”,”MyPassword”,5,3\nto set the parameters for the access point. You can then find the network MyNanoESP e.g. with a WLAN-capable computer, and connect with the password MyPasswort. When the connection has been successfully established, you can use\nAT+CWLIF\nto display the connected device with IP and MAC address.\nThe AT commands in the serial monitor You can now also test station mode by first switching modes with\nAT+CWMODE=1\nYou can have all available WLAN networks in range with the command\nAT+CWLAP\nYou can use\nAT+CWJAP=“MySSID“,“MyPassword“\nto connect to your network, with MySSID and MyPassword being replaced by your network name and your password. It may take quite a while until the connection is established, but the end will be confirmed with OK. The first connection has now been established.\n","permalink":"https://neu-iot.fkainka.de/en/day-1/","summary":"\u003cp\u003eIt is the first day of December and thus time to open the first door. Behind the door, you will find the most important part of this calendar: the Arduino™-compatible NanoESP-board with integrated WLAN module that this calendar is about.\u003c/p\u003e\n\u003cfigure\u003e\u003ca href=\"/images/2015/09/Day1-1.jpg\"\u003e\u003cimg class=\"size-large wp-image-84\" src=\"/images/2015/09/Day1-1.jpg\" alt=\"Das NanoESP Board\" width=\"616\" height=\"240\" /\u003e\u003c/a\u003e\u003cfigcaption\u003eThe NanoESP Board\u003c/figcaption\u003e\u003c/figure\u003e\n\u003cp\u003eAs you can see quite well on the PCB, the board is made up of two components. The left half is an Arduino™-compatible micro controller system that can be compared to the Arduino™ Nano. The right part is the WLAN module with the designation ESP8266. These two components communicate via a serial interface generated by software. The Arduino™-side rather acts as the boss, forwarding the commands to the WLAN module. Some of these commands will already be tried out today on the first day.\u003c/p\u003e","title":"Day 1 - First Steps"},{"content":"Many people asked me when the projects will be ready for download. Every project description including schematics and software will come on its owm December day. But if you can\u0026rsquo;t wait, you can download only all software files in advance here.\nCalenderIoT ","permalink":"https://neu-iot.fkainka.de/en/tag-0-alle-projekte-fuer-ungeduldige-spoiler-alert/","summary":"\u003cp\u003eMany people asked me when the projects will be ready for download. Every project description including schematics and software will come on its owm December day. But if you can\u0026rsquo;t wait, you can download only all software files in advance here.\u003c/p\u003e\n\u003ch3 id=\"calenderiot\"\u003e\u003ca href=\"/images/2015/11/CalenderIoT.zip\"\u003eCalenderIoT\u003c/a\u003e\u003c/h3\u003e","title":"Day 0: Download all Projects (Spoiler Alert)"},{"content":"On this page you can find the specifications of the Board\nSpecifications: Microcontroller: ATmega328 Flash memory: 32 KB (including 0,5 KB for the Bootloader) SRAM: 2 KB EEPROM: 1 KB Taktrate: 16 MHz I/O-Pins: 20 (including 2 for communication with the WiFi module) Included PWM: 6 Included analog inputs: 6 USB-to-Serial Chip: CH340G Operating voltage: 5 V Recommended input voltage:: 7-12 V Maximum current per I/O pin: 40 mA Load capacityof the 3.3 V output: 50 mA WLAN-Modul: ESP8266\nSPI-Flash 4Mbit Operating voltage: 3,3V WLAN standards:: 802.11 b/g/n WLAN modes:: Wi-Fi Direct (P2P), soft-AP Firmware: AT-Firmware version 0.22 Miscellaneous:: Integrated TCP/IP stack Output power +19.5 dBm in 802.11b mode Integrated low-power 32 bit CPU Communication via UART ","permalink":"https://neu-iot.fkainka.de/en/technische-daten/","summary":"\u003cp\u003eOn this page you can find the specifications of the Board\u003c/p\u003e\n\u003ch2 id=\"specifications\"\u003eSpecifications:\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eMicrocontroller:                                  ATmega328\u003c/li\u003e\n\u003cli\u003eFlash memory:                                  32 KB (including 0,5 KB for the Bootloader)\u003c/li\u003e\n\u003cli\u003eSRAM:                                              2 KB\u003c/li\u003e\n\u003cli\u003eEEPROM:                                         1 KB\u003c/li\u003e\n\u003cli\u003eTaktrate:                                           16 MHz\u003c/li\u003e\n\u003cli\u003eI/O-Pins:                                           20 (including 2 for communication with the WiFi module)\n\u003cul\u003e\n\u003cli\u003eIncluded PWM:                              6\u003c/li\u003e\n\u003cli\u003eIncluded analog inputs:                   6\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eUSB-to-Serial Chip:                            CH340G\u003c/li\u003e\n\u003cli\u003eOperating voltage:                              5 V\u003c/li\u003e\n\u003cli\u003eRecommended input voltage::             7-12 V\u003c/li\u003e\n\u003cli\u003eMaximum current per I/O pin:              40 mA\u003c/li\u003e\n\u003cli\u003eLoad capacityof the 3.3 V output:        50 mA\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e\u003cstrong\u003eWLAN-Modul:                                      ESP8266\u003c/strong\u003e\u003c/p\u003e","title":"Board specifications NanoESP \u0026 Pretzel Board"},{"content":"When you attach the board for the first time via the MicroUSB connector, your PC will try to install a driver. If this does not work automatically download and install the driver here.\nThe ArduinoTM IDE provides the simplest way of programming the development board. Download the IDE from www.Arduino.cc. When you start the software, you first have to choose the correct port and board. For the latter, you select the Arduino NanoTM (ATmega328 processor).\nThe settings of the IDE (right below) and the Serial Monitor In order to test the WiFi module, you open the serial monitor and select a transfer rate of 19,200 baud. As long as no other program is loaded into the controller, the monitor should display a few messages. Furthermore, you will now find an open WLAN called NanoESP. To control the module yourself, use the Software Serial library via pins 11 and 12 with a transfer rate of 19,200 baudor just donwload the programm to your computer and upload it via the Arduino Software to your board:\nDownlaod: Example Programm\nThe serial monitor has to be set to CR and NL. The following AT commands are useful for the first test:\nTest command: AT\nReset: AT+RST\nFirmware info: AT+GMR\n","permalink":"https://neu-iot.fkainka.de/en/schnellstart-anleitung/","summary":"\u003cp\u003eWhen you attach the board for the first time via the MicroUSB connector, your PC will try to install a driver. If this does not work automatically download and install \u003ca href=\"/treiber\"\u003ethe driver here.\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eThe ArduinoTM IDE provides the simplest way of programming the development board. Download the IDE from \u003ca href=\"https://www.arduino.cc/en/Main/Software\"\u003ewww.Arduino.cc\u003c/a\u003e. When you start the software, you first have to choose the correct port and board. For the latter, you select the \u003cstrong\u003eArduino NanoTM (ATmega328 processor).\u003c/strong\u003e\u003c/p\u003e","title":"Quick Start - NanoESP \u0026 Pretzelboard"},{"content":"In this section you habe the possibility to ask questions or give suggestions to a subject related to the Pretzelboard (NanoESP) via the commentary function.\n","permalink":"https://neu-iot.fkainka.de/en/diskusion-und-hilfe/","summary":"\u003cp\u003eIn this section you habe the possibility to ask questions or give suggestions to a subject related to the Pretzelboard (NanoESP) via the commentary function.\u003c/p\u003e","title":"Questions and Answers - NanoESP \u0026 Pretzelboard"},{"content":" Description Command Basics Test Command AT Reset AT+RST Firmware Infos AT+GMR Echo On/Off ATE\u0026lt;1/0\u0026gt; WiFi Commands WiFi-Modus (1 = Client, 2 = AP, 3 = Dual) AT+CWMODE= Search WiFi network AT+CWLAP Connect to Wifi AT+CWJAP=““,““ Disconnect WiFi AT+CWQAP Settings WiFi -AccesPoint AT+CWSAP=““,““[,,] Show IP AT+CIFSR activate/deactivate DHCP AT+CWDHCP=\u0026lt;1/0\u0026gt; Auto connect to WiFi AT+CWAUTOCONN=\u0026lt;1/0\u0026gt; Change MAC address of AP AT+CIPSTAMAC= Set IP address of station AT+CIPSTA= Set IP address of AccesPoint AT+CIPAP= Start SmartConfig AT+CWSTARTSMART= Stop SmartConfig AT+CWSTOPSMART Communication Ping AT+PING= Accept multiple connections AT+CIPMUX= Set transfer mode (0=normal, 1= unvarnished transmission mode, only for TCP single connection) AT+CIPMODE= Structure of received data +IPD,,: Start connection AT+CIPSTART=““,““, Send data AT+CIPSEND=, Close connection AT+CIPCLOSE= Server Commands Start TCP server AT+CIPSERVER=1, Stop TCP server AT+CIPSERVER=0 Server status \u0026amp; connected clients AT+CIPSTATUS Set server timeout AT+CIPSTO= Show connected clients AT+CWLIF ","permalink":"https://neu-iot.fkainka.de/en/at-befehlsliste/","summary":"\u003ctable\u003e\n\t\u003cthead\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003cth\u003e\u003c/th\u003e\n\t\t\t\t\t\u003cth\u003e\u003c/th\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/thead\u003e\n\t\u003ctbody\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eDescription\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eCommand\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eBasics\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eTest Command\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eReset\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+RST\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eFirmware Infos\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+GMR\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eEcho On/Off\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eATE\u0026lt;1/0\u0026gt;\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eWiFi Commands\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eWiFi-Modus (1 = Client, 2 = AP, 3 = Dual)\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWMODE=\u003cmode\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSearch WiFi network\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWLAP\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eConnect to Wifi\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWJAP=“\u003cssid\u003e“,“\u003cpass\u003e“\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eDisconnect WiFi\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWQAP\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSettings WiFi -AccesPoint\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWSAP=“\u003cssid\u003e“,“\u003cpass\u003e“[,\u003cchan\u003e,\u003cenc\u003e]\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eShow IP\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIFSR\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eactivate/deactivate DHCP\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWDHCP=\u0026lt;1/0\u0026gt;\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eAuto connect to WiFi\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWAUTOCONN=\u0026lt;1/0\u0026gt;\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eChange MAC address of AP\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPSTAMAC=\u003cMAC\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSet IP address of station\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPSTA=\u003cIP\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSet IP address of AccesPoint\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPAP=\u003cIP\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eStart SmartConfig\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWSTARTSMART=\u003ctyp\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eStop SmartConfig\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWSTOPSMART\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eCommunication\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003ePing\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+PING=\u003cHOST\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eAccept multiple connections\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPMUX=\u003cmode\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSet transfer mode (0=normal, 1= unvarnished transmission mode, only for TCP single connection)\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPMODE=\u003cmode\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eStructure of received data\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e+IPD,\u003cid\u003e,\u003clen\u003e:\u003cdata\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eStart connection\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPSTART=“\u003ctype\u003e“,“\u003caddress\u003e“,\u003cport\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSend data\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPSEND=\u003cid\u003e,\u003clen\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eClose connection\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPCLOSE=\u003cid\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003e\u003cstrong\u003eServer Commands\u003c/strong\u003e\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eStart TCP server\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPSERVER=1,\u003cport\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eStop TCP server\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPSERVER=0\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eServer status \u0026amp; connected clients\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPSTATUS\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eSet server timeout\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CIPSTO=\u003ctimeout\u003e\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\t\t\u003ctr\u003e\n\t\t\t\t\t\u003ctd\u003eShow connected clients\u003c/td\u003e\n\t\t\t\t\t\u003ctd\u003eAT+CWLIF\u003c/td\u003e\n\t\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e","title":"AT Commands -NanoESP \u0026 Pretzelboard"}]