Project in progress

Tripwire Automatically Minimizes Tabs When Someone Walks By © GPL3+

Do you always slack off on your computer and worry about getting busted? Not anymore!

  • 4,023 views
  • 4 comments
  • 32 respects

Components and supplies

About this project

Originally posted on diyusthad.com

Introduction

Do you always slack off on your computer and worry about getting busted? Not anymore because today we are going to make a tripwire which automatically minimizes your tabs when someone walks by.

Video

Before we going to the project let me thanks allpcb.com for sponsoring this project.

ALLPCB is an ultrafast PCB super factory as well as an Internet-based manufacturing company. We are committed to building an electronic collaborative manufacturing service platform. We serve enterprises related to consumer electronics, communication equipment, industrial control, instruments and apparatus, intelligent hardware, “Internet of Things” and “Industry 4.0” solutions, etc. We offer professional one-stop service, including PCB manufacturing, PCB assembly and components sourcing.

GET 20% OFF FOR YOUR PCB

Theory

This project mainly contains two modules RECEIVER (Rx) and a TRANSMITTER (Tx). The Rx module is the one which we connect to the computer’s USB port which will receive a signal to execute the pre-written script whenever there is a trigger happens in the Tx module.

Features

  • Hide all your windows
  • Lock your computer
  • Execute a custom script to do whatever you want!

Supported Platforms

  • Windows
  • Linux
  • Mac OSX
  • Android

Schematic & PCB

Transmitter (TX)

Receiver (RX)

PCB

Support my works by subscribing http://bit.ly/2L7VLn3

Code

TxC/C++
/*
   www.diyusthad.com
   www.youtube.com/c/diyusthad
*/

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define ir 3

RF24 radio(5, 8); // CE, CSN

const byte address[6] = "00001";
boolean irState = HIGH;
boolean preIrState = HIGH;

void setup() {
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();

  pinMode(ir,INPUT_PULLUP);

  Serial.begin(9600);
}

void loop() {
  const int trigger = 1;

  irState = digitalRead(ir);

 if(preIrState != irState)
 {
    Serial.println("detected");
    radio.write(&trigger, sizeof(trigger));
    preIrState = irState;
   
 }
  
}
RxC/C++
/*
  by Mohamed Najad, www.diyusthad.com
  www.youtube.com/c/diyusthad

*/

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Keyboard.h>

RF24 radio(5, 3); // CE, CSN

const byte address[6] = "00001";

int os = 1; //osx = 1, windows = 2, linux = 3
int function = 3; //lock the computer = 1, minimize active window = 2 , show desktop = 3, custom script = 4

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
  Keyboard.begin();
}

void loop() {
  if (radio.available()) {
    int trigger;
    radio.read(&trigger, sizeof(trigger));

    if (trigger == 1)
    {
      switch (os)
      {
        case 1: //osx
          switch (function)
          {
            case 1://lock computer
              Keyboard.press(KEY_LEFT_GUI);
              Keyboard.press(KEY_RIGHT_CTRL);
              Keyboard.press('q');
              delay(100);
              Keyboard.releaseAll();
              Serial.println(trigger);
              while (1);


            case 2: //minimize active window
              Keyboard.press(KEY_LEFT_GUI);
              Keyboard.press('m');
              delay(100);
              Keyboard.releaseAll();
              Serial.println(trigger);
              while (1);


            case 3: //show desktop
              Keyboard.press(KEY_F11);
              Keyboard.press('m');
              delay(100);
              Keyboard.releaseAll();
              Serial.println(trigger);
              while (1);


            case 4: //custome script
              while (1);


          }

        case 2: //windows
          switch (function)
          {
            case 1: //lock
              Keyboard.press(KEY_LEFT_GUI);
              Keyboard.press('l');
              delay(100);
              Keyboard.releaseAll();
              Serial.println(trigger);
              while (1);


            case 2: //minimize active window
              Keyboard.press(KEY_LEFT_GUI);
              Keyboard.press('m');
              delay(100);
              Keyboard.releaseAll();
              Serial.println(trigger);
              while (1);


            case 3: // show desktop
              Keyboard.press(KEY_LEFT_GUI);
              Keyboard.press('d');
              delay(100);
              Keyboard.releaseAll();
              Serial.println(trigger);
              while (1);


            case 4: //custome script
              while (1);


          }

        case 3: //linux
          switch (function)
          {
            case 1:
              while (1);


            case 2:
              while (1);


            case 3:
              while (1);


            case 4:
              while (1);


          }

        case 4: //custom
        
          while (1);

      }

    }
  }
}

Custom parts and enclosures

Gerber File
gerber_pcb_tripwire_pSDrUsY8bo.zip

Schematics

Comments

Similar projects you might like

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 49,272 views
  • 22 comments
  • 141 respects

Arduino Laser Tripwire

Project tutorial by Ian Cumming

  • 23,969 views
  • 13 comments
  • 56 respects

Amazing 6WD Off-Road Robot | Arduino RC Robot

Project tutorial by Jithin Sanal

  • 9,980 views
  • 0 comments
  • 54 respects

Ouija Board Access Control

Project tutorial by TheRiverPeople

  • 5,457 views
  • 1 comment
  • 21 respects

LASER Tripwire Alarm - Arduino

Project tutorial by SurtrTech

  • 4,844 views
  • 2 comments
  • 13 respects

Automatic Sliding Door for the Garage

Project tutorial by DVDMDN

  • 26,255 views
  • 49 comments
  • 101 respects
Add projectSign up / Login