Introduction: The WOPR (WWW Operated Relay)
The WOPR (in honor of the original WarGames movie from the eighties) is a box that's connected to the internet via Wifi. Inside is a relay that can be switched by means of a Windows Phone app.
In my case WOPR stands for Www Operated Relay: a relay that can be controlled via the internet. I use the WOPR for switching my computer on or off while I'm not at home. I need my home desktop PC to be on when I want to access it using remote desktop.
On my smartphone (I have a Windows Phone) a simple app reads the status of the WOPR and sends commands to it to switch it on or off.
Step 1: Electronics
Inside the WOPR is an Espduino with a prototyping shield on top of it. You also need a buzzer and a relay, a transistor (universal NPN type), a 1k5 resistor and a 1N4148 diode. You can get all those parts at your favorite Arduino webshop.
The buzzer is used to signal when a hacker tries to operate your switch. Don't worry: the switch has some security build in.
Note on the wiring of the relay: I wired it so that the NO contact (normally open) of the relay switches the device. That way the device will be on after a power failure (even during a power failure).
If you own a 3D printer you can print the case yourself. I designed a case for it. You will find the OpenScad files and STL files attached to this step.
Step 2: Software
Upload the sketch on the EspDuino (see attached file WOPR.ino) and install the Windows Phone app (see attached file WOPR-App.zip) on your phone. Test the system by tapping on the On button on the phone's app to switch the relay on or off.
The Windows Phone app is compatible for Windows Phones 8.1 and higher (also Windows 10 phones) and for phone resolutions starting at 720x1280 pixels. I use a Nokia Lumia 1350.
Notes for the Windows Phone app:
- In the C# code change the WWW address to the IP address or the Dynamic DNS name of your home.
- Also change the port if you want to use another port than 8080.
Both the sketch and the Windows phone app use a simple formula as a hash function. Please feel free to create a more enhanced hash function. Also use another port than 8080 for security reasons. You might even want to use SSL if you are a real coward.
- Forward the port 8080 on your router to the WOPR.