Blynk controlled home Cinema motorized screen

Had to build a special actuator and software solution to hide my home cinema screen on top of a shallow but tall book shelf when not in use.
The project make use of Blynk and a ESP8266 for the remote part and a Arduino Nano for most of the PLC logics not because I couldn’t have done it all with a ESP and blynk but just because its fun to mix and learn :wink:
Don’t be afraid to teach me, ask questions and/or suggest changes I’m still learning and will do so 4ever!

Full project: https://www.stockholmviews.com/wp/stealth-home-cinema-screen/
Movie of actuator and alpha version in action: https://youtu.be/xdWi0xIxDwM

Blynk part of the code below

        #include <ESP8266WiFi.h>
        #include <BlynkSimpleEsp8266.h>
        #include <SimpleTimer.h> 
        SimpleTimer timer;
        char auth[] = "ad8fe2aafd7245f0b76291a1546949d3";
        int value;
        //int relaypin1 = D5;  // example digital pin for relay 1
        void setup() {
          Serial.begin(9600);
          Blynk.begin(auth, "Timber", "greggan12", "192.168.1.40", 8080);
          pinMode (D8, OUTPUT);
          pinMode (D7, OUTPUT);
          pinMode (D6, OUTPUT);
          pinMode (D5, OUTPUT);
          pinMode (D2, OUTPUT);

        }

        BLYNK_WRITE(V1) {
          if (param.asInt() == 1) { // "SCREEN POS 1" act only on the HIGH and not the LOW of the momentary
              digitalWrite(D8, !digitalRead(D8));  // invert pin state just once
            timer.setTimeout(500L, []() {
              digitalWrite(D8, !digitalRead(D8));  // then invert it back after 100ms
              Blynk.virtualWrite(V1, LOW);
              //    });

            });
          }
        }


        BLYNK_WRITE(V2) {
          if (param.asInt() == 1) { // "SCREEN POS 2" act only on the HIGH and not the LOW of the momentary
            digitalWrite(D7, !digitalRead(D7));  // invert pin state just once
            timer.setTimeout(500L, []() {
              digitalWrite(D7, !digitalRead(D7));  // then invert it back after 100ms
              Blynk.virtualWrite(V2, LOW);
              //    });

            });
          }
        }

        BLYNK_WRITE(V3) {
          if (param.asInt() == 1) { // "SCREEN ROLL UP AND FOLD" act only on the HIGH and not the LOW of the momentary
            digitalWrite(D6, !digitalRead(D6));  // invert pin state just once
            timer.setTimeout(500L, []() {
              digitalWrite(D6, !digitalRead(D6));  // then invert it back after 100ms
              Blynk.virtualWrite(V3, LOW);
              //    });

            });
          }
        }

        BLYNK_WRITE(V4)  {  // SCREEN EMERGENCY STOP Set to your Buttons vPin
          digitalWrite(D5, !digitalRead(D5));  // Panic STOP on/off
            //    });
          }

        BLYNK_WRITE(V5) {
            if (param.asInt() == 1) { // FUTURE FUNCTION act only on the HIGH and not the LOW of the momentary
              digitalWrite(D2, !digitalRead(D2));  // invert pin state just once
              timer.setTimeout(500L, []() {
                digitalWrite(D2, !digitalRead(D2));  // then invert it back after 100ms
                Blynk.virtualWrite(V5, LOW);
                //    });

              });
            }
          }


          void loop()
          {
            Blynk.run();
            timer.run();
          }
2 Likes