I have a small web server in our apartment which needs a reliable internet connection 24/7. For one reason or another, either my ISP or my router somehow figure out when we're overseas and use that as an opportunity to break our internet connection. When the connection is broken, the router needs to be rebooted, but when we're overseas I can't do this until we get back (I obviously can't remotely log-in when the network is down).
I contemplated a solution that used a timer to simply turn the power off/on at midnight, but this wasn't an elegant solution since it would lead to unnecessary outages, extra wear and tear, and also would lead to a potential maximum outage of over 23 hours if the outage occurred immediately after a reset.
I also contemplated some fixed-line phone based solutions such as this one or this one, but my entire home is on VoIP so when the network is down, I can't dial-in either. Also, international calls on a mobile phone are expensive, but SMS messages are not.
So, my objective became an ability to remotely switch a device on/off from anywhere in the world using an SMS sent from my mobile phone (which I always carry with me).
I essentially needed to combine three distinct items:
- A device to receive SMS messages and send a command to item #2
- A device to safely turn the power on/off to a 240V AC device
- An inexpensive mobile phone plan for a device to receive SMS messages
Item 1 - SMS receiver / Processor
A Google search came up with some very expensive industrial/enterprise grade solutions such as this and this. There are also some completely DIY solutions such as this one but it requires a specific model of Ericsson phone. I also found a few cheaper "kits" such as this and this which required a specific model of Nokia phone. My view is that having an old mobile phone in the solution just adds another point of failure.
Then I stumbled across this device (RhinoCo TSMS) which is actually intended to be part of a car alarm system. It has a SIM card slot and several inputs/outputs. With this device you can independently control 4 outputs (3 latching and 1 momentary). It also has inputs that can trigger SMSs to be sent. It can send custom messages to (or ring) up to 5 different phone numbers and it can receive commands from an arbitrary number of phones via SMS (with security passwords). This was EXACTLY the device I needed. It's marketed as a car alarm add-on, but this device is essentially a generic SMS/GSM remote control! I was fortunate enough to find a brand new unopened TSMS on eBay for under $150, but they are also available at places that sell car alarms. A list of distributors is given on their web site. I'm sure there are other car alarms with this type of feature as well which could be used in the same way.
Item 2a - Trigger-based Power Switch (Cheap Option)
I decided that I didn't want to hack the actual router (or the router's power supply), so I went looking for a device to switch the 240VAC mains power. The Rhino device above provides an output which is 0V when "off" and 12VDC when "on." So I needed something to take this low voltage and switch the high voltage that goes to the router power supply. The easy option here was to go with a solid state relay (a.k.a. an SSR). The local electronics shop had this one (a HONGFA HFS15 - click here for the data sheet) in stock. It's a pretty standard device that takes an input voltage of 3-32VDC and then switches 240VAC on/off. I won't go into the details of how to assemble this, but keep in mind that you'll be working with DANGEROUS HIGH VOLTAGE POWER. If you need a more step-by-step set of instructions on how to put something like this together, have a look here at this great article at instructables.com.
Item 2b - Trigger-based Power Switch (Easy Option)
If the thought of working with dangerous high voltages puts you off, another option is to use an X10 controller system. All you need then is a "Lamp Module" and a "Trigger Module." The trigger module would take a signal from the car alarm and then send it to the lamp module over the power lines using the X10 protocol. In Australia you can get these items here: (Lamp Module / Trigger Module). In the US you can look here. In Europe you can look here.
Item 3 - Cheap Long Expiry Phone Plan
This whole project is useless without a phone service to access the device. Phone companies (at least those here in Australia) typically want you to sign up for some sort of monthly plan or a pre-paid service with credit that expires in 30 days. After scouring all the major providers, I found that Vodafone currently offers a 365-day prepaid plan which works perfectly! Basically for $20 you get a phone number to receive SMS messages - that's all you need. Incidentally, there is also such a company called iSIM which offers a $10 recharge which lasts 186 days (with 186 day extension for receive-only).
So I put all the pieces together this weekend and it works perfectly! In fact with this setup I can arbitrarily control any 3 devices in the apartment just with my phone. It also has inputs so I can later do some fancy stuff like notifying me if the router is down (with a photodiode on the router's LINK light), etc. My assembled device also has LEDs to tell me the status of the three Rhino TSMS outputs. I found this neat site to help me figure out the right current-limiting resistors to use for the LEDs.