Introduction

What's the most common piece of electronic equipment you have to turn on and off every once in a while? Your Internet modem and WiFi router, of course.

When your WiFi is down, all of your home IoT products are left in the dark. Maybe you're not physically at home, or your router is very inconvenient to get to. Or maybe you just don't want to leave the couch. With this hack, you can power down and power up your WiFi, with a single text message from your phone!

But wait, there's more! Since it's a controllable power outlet, you can pretty much plug in anything you want - a light, a TV, a toaster, anything you'd normally plug into the wall - and turn it on or off, all through a simple text message.

A big thanks to Nate from SparkFun, for giving me the confidence to do this hack with his very helpful tutorial for a Controllable Power Outlet, which utilizes the SparkFun Beefcake Relay Control Kit.

WARNING: Never tinker with this project while it's plugged in. Always unplug it from the wall first. Live power is dangerous!

We're working with live power here, which can be very dangerous if not handled properly. So it's essential that a proper enclosure is utilized to prevent electric shock.

The main components of this project are:

The Enclosure

GFCI Power Outlet

SparkFun's Beefcake Magnetic Relay Kit

Hologram Dash and Global SIM

Power Routing

Control Signal Routing

The Enclosure

For the enclosure, I was able to find a nice plastic one at Lowes, which had space for two outlets and a big hole in the bottom for the power cable. The idea was to use one side for the actual power outlet, and the other side for the cellular/control components - it ended up fitting very snug, so make sure your enclosure is at least this big.

The Outlet

For the power outlet, I chose a GFCI outlet from Lowes that will trip when more than 10A go through it. These are the same outlets that you find in your kitchen or bathroom, that are designed to cut out if water gets into them. They are more expensive than standard outlets, but I don't like to take any chances when it comes to live power, so I spent the extra $10. The maximum amperage support of all the components was 10A (the plastic headers on the Beefcake Relay Kit was the limiting factor), so that is why I chose a 10A outlet. 10A is pretty low, but it should be enough to support most electronics, like your modem and router - just don't expect to be able to daisy chain multiple power strips full of hair dryers and space heaters.

The Power Cord

For the power cord, I took a basic 3ft power strip from Lowes and cut off the power strip. You'll notice three wires within the encasing (green, black, and white). I trimmed off another 8in of this wire to be used within the enclosure, and then stripped off about 3in of the encasing, to expose the black, white, and green wires. Then stripped off about 0.5in of the inner incasing to expose the raw copper wire.

The Magnetic Relay

Magnetic relays are awesome. Basically, they allow you to control really high voltage, with low voltage control signals. Most microcontrollers like the Arduino or Hologram Dash, will only output 5V or 3.3V from their control pins. This doesn't help when you need to control a 120V wall outlet! So the idea behind the magnetic relay, is that you actually control a magnet with the low voltage control signals, which is then able to make a physical connection or disconnection to the high voltage line.

I chose SparkFun's Beefcake Magnetic Relay Kit, mainly because their Connected Power Outlet tutorial gave me confidence that it can be used in this manner. Make sure you pick a magnetic relay that can handle the voltage and current that you need - many cheaper relays are not meant for this kind of power and may malfunction during operation (risk of fire).

The Hologram Dash + Global SIM

The Hologram Dash is the brains behind the whole operation. It is basically a compact Arduino-like microcontroller, with a built in cellular modem. The Hologram Dash comes with an extremely cheap SIM card that works world-wide, meant specifically for IoT applications such as this. It also comes with an antenna to extend the range of your device, and a USB cable for programming.

When you first get your Dash, you'll want to activate your SIM card at hologram.io/start. You will also be able to configure a phone number for your device so that you can control the Dash via SMS from your phone. SMS messages sent inbound to your device are free on Hologram's network, so this has a very low cost of operation!

You'll have to upload some code to the Hologram Dash, which I've included in this tutorial. In order to do this, check out the documentation on Getting Started with the Hologram Dash, copy/paste the code into the Arduino IDE, and upload it to the Dash.

Power Routing

There are two things that need to be powered in this project:

The Hologram Dash (which is powered off of 5V)

The power outlet (with one line routed through the magnetic relay)

The power outlet and magnetic relay can be connected directly to the power cord - that part is easy. But the Hologram Dash is powered off of 5V, so we actually need a transformer that brings the 120V down to 5V for it. The Dash requires about 1.5A of power to operate properly, which is conveniently the same as many common USB cell phone adapters, so that is what I used. Make sure the transformer that you use, brings it down to 5V and supports 1.5A-2A of current output - anything less and the Dash might not operator properly during the spikes of cellular transmission.

Powering the Dash

A few things need to happen to power the Dash:

We need to split the power from the power cord (one side goes to the power outlet, the other side goes to the Dash).

We need to connect the Dash's power adapter to these wires (to drop the voltage from 120V to 5V).

We need to connect the pins of the Dash to its power adapter (to physically power the Dash).

In order to safely split the power from the power cord, I consulted the help of a couple 3-port push-in wire connectors from Home Depot:

And in order to safely connect those lines to the power adapter, I bought some AMP Female Disconnects (also from Home Depot):

With the 8in of excess power cable we trimmed off in the beginning, I stripped off about a 4in piece and a 2in piece, of both the white and black wires, exposing about 0.5in of raw copper on all ends of the wires. Connecting one end of each into a 3-port connector (make sure to push the wire all the way into the connector), and one end of the 4in wires to the Disconnects (you may need a crimper or pliers to squish the middle part of the disconnect down onto the wire), we get something that looks like this:

The black and white power cord wires will eventually plug into the 3-port connectors as well.

And when we connect this to the power adapter, it should look like this:

Connect to Dash

Now we need to connect this power adapter to the pins of the Dash. Since the output of the power adapter is USB, I cut up a really cheap USB cable, and stripped it down to expose only the red and black wires (about 5in long in total). This will give us 5V on the red wire, and GND on the black wire. With a little shrink wrap and soldering to the female end of jumper wires, I was able to come up with something that looks like this:

Plug In

Now this can plug directly into the power adapter, and then power the Hologram Dash by plugging the red (5V) wire into pin L01 (USB_5V) and the black (GND) wire into pin L02 (GND):

Powering the Power Outlet

Normally, like when an electrician wires your house - you would connect the power wires directly to the terminals of the power outlet, and you would be good to go. But we want to be able to cut the power to the outlet on command, so we're going to route one of those power lines through the magnetic relay to give us that control. In order to do that, all we need is about 2in of the excess black wire from the power strip, with about 0.5in of copper exposed on each end.

Laying it out next to the dash power, the schematic kind of looks like this:

You'll notice the three control wires lined up on the top. Those will be used to connect the Hologram Dash to the magnetic relay, so that the Dash can flip the power on and off.

Putting it all together

This is roughly what everything looks like when it's laid out before anything is connected. It's vaguely in the schematic/shape of how it will be connected once it's inserted into the enclosure.

Connecting the Power

Step 1

The very first step, is to thread the power cord through the hole in the bottom. If you don't do this step, you'll be a very unhappy camper when you can't get your power cord back through the hole!

Step 2

Connect the green wire from the power cord, to the ground terminal on the power outlet:

Step 3

Thread the white and black wires from the power cord, to the remaining holes on the 3-port connectors. Now the power from the power cord is split into two sides - one for the Hologram Dash, and one for the power outlet/magnetic relay.

Step 4

Connect the loose white wire to the far end of the power outlet (farthest from the magnetic relay). The black end will be routed through the magnetic relay, so for efficiency of routing the wires, you'll want to connect black to the side closest to the magnetic relay.

Step 5

To prep for attaching the magnetic relay, you'll want to affix the tiny 2in piece of excess black wire to to the power outlet first - I found this was easier than trying to connect to the screw terminal after it was already connected to the relay.

Step 6

Now is also a good time to attach the 3 control wires to the control terminals on the magnetic relay. I used a white wire for the 5V reference (although we'll actually be using 3.3V as the reference instead), a blue wire for the center control signal, and a black wire for the GND reference.

Step 7

Once it's setup like the picture above, insert the black wire from the 3-port connector into the COM (i.e. "common") port on the magnetic relay. Then insert the black wire from the power outlet into the NC (i.e. "normally closed") port on the magnetic relay.

The third port on the relay is labeled NO (i.e. "normally open"). The difference between "normally open" and "normally closed" is whether the circuit between "common" and the output port is connected (i.e. "closed") or disconnected (i.e. "open") when the control signal is high on the blue control wire. I chose to connect the power outlet to "normally closed" so that the default behavior is to have power enabled to the outlet (i.e. the power is on by default), and the Hologram Dash basically controls when to turn it off. Depending on your specific application, you may want to reverse this behavior - in that case, you would also want to modify the behavior of the "ON" and "OFF" text messages in the program uploaded to the Dash.

Step 8

Now that the magnetic relay is fully connected, it's time to add the remainder of the power components for the Dash, to the white and black female disconnects. The 3-port connectors will be tucked underneath the power outlet, so if the wires are starting to get a bit unruly at this point, try tucking them under to see if that helps.

Dropping into the Enclosure

The power is now all hooked up, and we're ready to insert it into the enclosure! You'll want to pull the power cord all the way through the hole so that it's taking up as little space as possible. Make sure that the power outlet can be firmly seated on the mounting holes, while the magnetic relay and 5V USB adapter components sit next to it on the bottom of the enclosure. Once that's set, you can screw in the power outlet. Everything should be pretty snug and not move around much.

Wiring up the Hologram Dash

You should have 5 exposed wires for connecting to the Hologram Dash. Before connecting them up, make sure your Hologram Global SIM has been activated and inserted into the Dash - then, wire them up as follows:

Red wire from USB adapter (5V) to pin L01 (USB_5V)

Black wire from USB adapter (GND) to pin L02 (GND)

White wire from relay (5V) to pin R12 (+3.3V)

Blue wire from relay (CTL) to pin R04 (Digital Pin 2)

Black wire from relay (GND) to pin R02 (GND)

When all is said and done, it should look like this:

After tucking in a few of the control wires, and flipping over the Hologram Dash, it should fit snuggly on top of the magnetic relay, like so:

Last but not least, don't forget to attach the cellular antenna to make sure the Dash can get a signal! It snaps onto the tiny round connector on the left edge of the Dash.

Wrapping it up

With that done, we're ready to close this baby up with the enclosure cover.

The cellular antenna conveniently has a sticky adhesive that peels off like a sticker, so that you can affix it securely to the outside of the enclosure.

Add rad decals for effect, plug something in, and try it out!

Trying it out

As soon as you plug it in, power should be enabled to the outlet. You'll want to wait a couple minutes for the Hologram Dash to boot up and connect to the cellular network, but once that's been established, it will be fully operational to control the power to the outlet. You can now text your Dash directly from the Hologram Dashboard, or from your own cell phone (if you setup a phone number for your device).

The provided program code supports the following commands:

OFF Turns the power off

ON Turns the power on

RESET Turns the power off for 30s, then turns the power back on