Introduction: Faux Power Plug As a Switch
I have been upcycling old televisions into displays for stores and restaurants and such. A while ago I was approached by people building an escape room. The room they were building has a 1940s scary dentist practice theme. Fake blood splattered around and everything. In one of the rooms they wanted a vintage television to play a video that provides a clue.
To have players start the video they were thinking of a big red button, but I suggested that didn't fit their theme, and I proposed something that did.
In this Instructable I show you the simple thing I made: a fake power plug that seems to come from the TV. The introductory video starts playing when visitors plug it into a fake wall socket.
Also in this Instructable, I tell you my pro tips. Basically I enthuse about insert nuts, crimp connectors and Wago clamps :-)
Step 1: Materials Needed
- Old power socket
- power cord
- crimp pins with female housing
- Wago lever clamp connectors
Stuff to connect the power plug to:
- Raspberry Pi
- Second hand monitor
- Wire and connectors
- wire stripper
I bought two old bakelite wall sockets from someone who had just replaced them in their home. They are very dark brown, which makes for a great combination with the television from the fifties (and the rest of the escape room).
I liked the unearthed socket better because it looks more old-fashioned, but the plug wobbles a bit in there, which causes jitter in the signal to the Raspberry Pi. With the earthed socket, the plug stays in, so I went with that one.
The pretty iron power cord in an old-fashoned color I bought from Wattnou, a terrific lamp store in Rotterdam. No I don't have stocks, I just like their stuff.
Step 2: Wiring the Plug
WARNING: if you build this, you have to make sure there is no way anyone can put this plug in a real wall socket. That would put mains voltage on the Pi's pins, cause sparks to fly and would without a doubt fry the whole board.
My initial attempt to make this work with minimal risk was to connect both wires in the power cord to the plug's earth only. I connected them together to a single pin from the Pi (using just one would be fine too, as long as you properly isolate the one you don't use). Then I connected a wire coming from the faux wall socket's earth to another pin on Pi. So the circuit would be closed whenever somebody would put the plug in the socket.
I was quite content with this very smarty-pants way to avoid spectacular shorts. If the plug would be put in a live wall socket it wouldn't lead to sparks and fire (I am no electrician so I am not entirely sure, and I didn't want to try it out).
But then the escape room people said they preferred to not have a cable coming from the wall socket. So contrary to what you see on the photos, both poles of the plug are now each connected to a pin. Inside the fake wall socket I cross-connected both sides with a simple wire so it makes the circuit complete with no other wire coming from the wall socket.
I must have given the escape room owners the above warning about ten times, also in writing, and I have insurance.
Step 3: Faking a Wall Outlet
I made a small board to present to the clients, but if this is your own project you may just bolt the socket directly to a wall.
Mark where the center of the wood is and where holes for socket need to be drilled. Drill the holes. You could then screw the socket on using small wood screws, but the most elegant solution is to use insert nuts (also called screw-in nuts or Rampa nuts).
I love insert nuts. With a screwdriver you screw the nut into the hole you drilled in the wood. The insert nut has a thread for metal bolts, so you can use the metal bolts that fit the socket to attach it to the wood. Amazing, right?!
When I was connecting a wire to the socket, I decided I wanted it to go through the wood to have it come out the back, so I drilled a hole at an angle to pull it through.
Applied a bit of bees wax to make the board look nice, and that's all.
Step 4: Connecting the Plug to the TV
If you work with Raspberry Pi's often and don't know this next trick, you're going to love this.
To connect the wires from the faux power plug to the pins on the Pi, I made my own connectors.
The female pins can be crimped on wires and then snapped into the crimp connector housings. This way, you can make your own custom connectors that you can easily push on the Pi headers.
There are several vendors that carry sets with pins and housings. You can get crimp housings for up to 20 pins (or 40 pins if you want double row housings). I often use the housings with 2 or 3 pins; they make it very easy to quickly and neatly connect a single component, like a single button for instance. If you have to do more of these than a couple, it gets labour intensive, but frankly I find it a fun job :-)
With the connector, I attached the wires from the plug to pin 5 and Ground on the Pi. In the photo you'll see I used two different terminals to connect the wires from the power cord to smaller wires that go to the Pi. There is another and better alternative: Wago clamps (I show them in more detail in my TV Instructable and you see them in the last photo in this step). They are just as awesome as insert nuts and crimp connectors! The small wires we often use in electronics prototyping will break in larger screw terminals, or they come loose. Wago lever clamps are so perfect for this kind of job, because the small wires will really stay in there without screwing them in very tight.
Step 5: Starting a Video
There are several ways to start a video playing on your Raspberry Pi. I chose to use mediaplayer OSMC, mainly because of its support for many different video formats (so it will play any new videos the clients will put on there).
Here's the general idea on starting a video in OSMC through the GPIO pins. I use two Python scripts, one is started by OSMC and the other by rc.local (in the most recent version of OSMC you have to use systemd to have scripts start automatically at startup).
You can find more details in the attached Python scripts, but here's the general idea. Switch.py continuously checks the GPIO pin to see if the plug is put in the socket. If it is, then it saves this new state to the text file. Autoexec.py first finds out what media files are in the USB drive that's inserted to the Pi, makes a playlist, turns off the monitor and then watches the text file for changes. If it does change, the script will turn on the monitor and start playing the videos. I also have some code in there for the button I connected on the back of the television to have the Pi shutdown cleanly.
After putting in the plug, for realism and a bit of dramatic effect, the tv first shows a 9 second clip of static, then plays the main video. When that is done, a 15 minute video of just black screen is shown. Since the client may change the video, I didn't know when exactly to shutdown the monitor. The black screen prevents the main video from going on repeat, and also makes sure the monitor is not turned off again before the introductory video has finished.
You can see the result in the above video.
If you liked this Instructable, please vote for it in the Trash to Treasure-contest!
If you liked all the connectors I mentioned, please vote for this Instructable in the Pro Tips-contest!