Day 24: Gift box

With the last test in this Advent, we get really Christmasy. We’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. Behind today’s door is a retro-reflective sensor. This is actually two components, an IR transmitter diode and a phototransistor. It’s not very easy to see which way the elements have to be connected in terms of polarity. For this reason, it’s best if you connect the photoelectric sensor with the connection cables according to the example shown. Then you won’t be able to switch the polarity as easily. ...

24.12.2016 · 6 min · Fabian Kainka

Day 16: A web server piano

Behind today’s door is a piezo sound transducer. It’s possible to generate sounds with it, which will become clear in today’s test. Today you’re building a type of piano that can be used via a website. See the following picture for the layout: The correct connection of the piezo sound transducer The sketch: A16_P16_WebserverPiano.ino /* TCP-Server Piano Change SSID and PASSWORD. */ #include <NanoESP.h> #include <NanoESP_HTTP.h> //special library for http-connection #include <SoftwareSerial.h> #include "Websites.h" //websites in a special file as progmem #define SSID "YourSSID" #define PASSWORD "YourPassword" #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, "NanoESP", ""); //! 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("Error WLAN Connect")); //Start TCP Server if (nanoesp.startTcpServer(80)) Serial.println(F("TCP Server Activ")); else Serial.println(F("TCP Server Error")); //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("New Request from id :" + String(id) + ", method: " + method + ", ressource: " + ressource + " parameter: " + parameter); if (ressource == "/") { http.sendFromFlash(id, index, sizeof(index)); nanoesp.closeConnection(id); } else if (ressource == "/dataonly") { //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 != "") //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.) ...

16.12.2016 · 3 min · Fabian Kainka

Day 24: Fire alarm for the Christmas tree

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’s project is an all-rounder for the Christmas tree. ...

24.12.2015 · 5 min · Fabian Kainka

Day 21: Alarm system

Today’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. Lightsensor on A0 and Piezo on D8 Behind today’s door, there is a Piezo speaker that is used as alarm signal encoder. The structure of today’s experiment is shown in the figure. ...

21.12.2015 · 2 min · Fabian Kainka