Power cycling a problematic modem

[Gigawatts] struggled against a shoddy Internet connection for quite some time. Changing modems, having the line serviced, and spending far too much time on the phone didn’t do any good. In fact, the only thing that fixed the problem was power cycling the modem once it stopped responding. His solution was to automate the power cycling process. He added a cron task to his router which is running DD-WRT, a favorite firmware alternative for hacked routers. The script monitored the WAN connection and when it went down it would toggle one of the serial port pins. He whipped up an outlet box with a relay in it and used that serial pin to cut the power going to the modem. A workaround yes, but it was the only thing that brought an end to his frustration.

Comments

  1. WHAAAT

    I totally did this months ago

    it works well for certain scenarios

    http://transistor-man.com/lazarus.html

  2. PS nice hack, may want to include an in-line fuse.

  3. Gottabethatguy says:

    @transistorman, what you did is nowhere close to what this person did. You basically built a really expensive timer. You could achieve the same 8AM restart with a plugin mechanical timer from walmart. Woopy.

    This dude actively monitors the network and resets it as needed. Way cooler.

  4. osgeld says:

    I use one of those xmass tree extension cords with the switch on it

    not nearly as much fun, not automated, but its a good lazy mans version

  5. cotmm68030 says:

    Had a similar problem a long while back involving a Wifi bridge.

    I scrounged up whatever junk was laying in my pile and used a 386 running some floppy based Linux distribution, an old dot matrix printer, and some brackets from the back of the PC case.

    Split the DC line going to the bridge and ran either side to the two brackets. Mounted one to the printer’s head and the other to the inside edge of the printer so that resting position of the head completed the circuit. When the 386 detected the link went down it printed out a long line of blank characters, moving the brackets apart and power cycling the bridge.

    Horribly unsafe, but it looked pretty cool.

  6. Erik says:

    @transistorman What’s wrong with DD-WRT’s built-in router reset cron function?

    Also, this is to reset the ISP modem, not the access point and it niftily just cuts the modem’s power supply to reset it. This can probably be done by one of the X10 modules as well but everyone knws its better to just do it yourself ;)

  7. @Erik, this sounds like a great reuse for that X10 I found in my junk drawer…now only if I can find my serial to USB convertor to use it :)

  8. Anonymous says:

    Or you could always call your ISP and request another modem…

  9. cantido says:

    The annoying thing is that the processors in these modems probably have perfectly good watchdogs that could reset the modem sensibly.. sigh.

  10. McSquid says:

    @ anonymous: yes because calling your ISP is always a fun and rewarding experience…

    nice hack. whatever you gotta do to minimize the problem.

  11. qwerty says:

    Most broadband routers/modems often hang or crash because they aren’t designed to sustain a high number of concurrent connections, this happens a lot when doing heavy p2p.
    In this scenario the only solution is to drastically reduce the number of maximum connections or to swap the router/modem with a more powerful one such as the Billions and their clones..

  12. Hitek146 says:

    *I* did the same thing five years ago, using OpenWRT instead of DD-Wrt, and wrote a looping script instead of using a cron job to monitor the gateway address. This was to monitor a custom Routerboard Access Point that was installed 200 feet up on a tower in the middle of nowhere that locked up every few weeks…

    http://hackaday.com/2010/01/31/120v-switching/#comment-121114

  13. steve says:

    I had this problem too a while back.

    I used an ioBridge with two relays and the ioBridge’s fail-safe the engages when it loses internet connectivity to power cycle the modem.

  14. Concino says:

    It looks like his schematic is wrong. He is connecting collector of an NPN transistor to ground instead of emitter. It either needs to be a PNP transistor or the 3.3V and ground lines needs to be switched around.

  15. Eric says:

    DD-WRT can power cycle itself. I have been running it for years. I believe the setup is on the same tab as the cron job setup.

  16. CRJEEA says:

    My remedy as I’m not so good at the firmware side of things or very fine soldering was to use the power going to the LED indecating the Internet was connected and having a simple circuit which is basicly a timer in the form of a capasitor to compaire that signal against so it doesn’t react to general activity then the switching was done within the router case it’s self with a couple of mosfets. Small and simple fits in the case with no modifications does the job well saves me having to reset it all the time when it’s having an off day (:

  17. bbsux says:

    I like this. I may in fact implement one of these. Maybe even set it up with another transistor so I can power cycle the router/access point remotely using a bash command.

    The only problem I can see is if the script he made doesn’t automatically wipe itself when the log gets too big.

  18. Seth says:

    I have the same problem with my Verizon internet – the modem also needs to be power cycled to solve the problem. The origin of the issue has never been isolated…

  19. The Arbiter says:

    Did the same thing, altho much lower tech. My “lair” is in the finished basement. Router and cable modem are directly above me in the living room. I ran the power cords for both up thru the floor, through the same hole as the Cat5. I attached the wall warts to a surge strip hanging in the corner. When the net goes out, I no longer have to trudge my fat bulbous bulk (inb4 “need exercise” comments) up the stairs, I can merely reach up, flip the switch off, then back on. Works nicely.

  20. Derrick says:

    This sounds like a caching problem with RAM – usually RAM fills up with junk and then won’t run garbage collection appropriately – I’ve personally seen this a bunch of verizon modems, I know mine had the same problem (except you know, I didn’t have the same clever solution.)

  21. Erik says:

    I guess I should mention that I have to do something somewhat similar: My *nix box doesn’t always like to auto-reassociate with my wireless router when it loses signal even though it’s set to do so, so I have a cron job running every 5 minutes that checks the local IP – if there is no IP (192.168.) then it failed to reassociate so I have it call cnetworkmanager to manually associate back to the access point.
    I suppose I should file a bug report with the NetworkManager team…

  22. Shadow says:

    @cotmm68030
    Ha! I’d much rather have the print head knock domino’s and cascade all the way to the mains switch

  23. NatureTM says:

    I don’t like it. Sorry, and it’s not like I’ve never done a workaround before, but when I do, I’m not happy about it. It’s very dissatisfying. If I had this in my house, it would haunt me until I found the answer, especially during the rare times I would notice it. I know how he feels, spending all this time and not finding a solution. Still, I can’t help but say to myself, “too bad.”

  24. kristian says:

    @Shadow
    HaD should host a Rube Goldberg contest lol

  25. Failure in.. says:

    Just a thought….
    Wouldn’t it be much better to put the relay after the transformer for the router. This would put the relay on a much lower voltage line (mistakes less painful) and if the transformer was of the coil variety I would imagine there is a high chance of creating inductive spike which could be suppressed easily in dc with a Shockey diode.

  26. GCL says:

    I like it! Comcast can be quite dense regarding service related issues, including that one. Now as to the schematic he posted. I included that in my comment on his page. I invite everyone here to do that.

  27. Fred says:

    I know there is probably a reason for this, but why would you get the cron script to execute a “shutdown -r now” as apposed to an external power cut?

  28. Bob says:

    This is good but what if a device further up your ISP’s line needs to be reset? How about a “program” that you install on the computers at the regional power station that checks to make sure your internet connection is ok? If it finds your AP is not accessible, it cycles the power to the county you are in. Then you’d be fixing the internet connection for thousands of people.

  29. Defecation says:

    @Failure in..
    Thats exactly what I thought why switch 240? (sorry 110) When you can switch the low voltage dc. Wouldn’t have that massive plug box either. The whole mod could be inside the modem case. Heaps better IMO.

  30. ReKlipz says:

    What a coincidence. I’m having this exact same issue with my Motorola SB5120 cable modem. The ISP is Cox Communications, and I’ve never noticed a problem until recently, so it is quite odd. Power cycling the modem usually does the trick, however sometimes it needs to be done twice. There seems to be no real correlation to anything I can think of that is causing this; it’s not related to bandwidth consumption, total throughput, or time of day; it’s seemingly random.

  31. Gigawatts says:

    Hey guys, thanks for all the comments. I already replied on the blog, but yes I did have the transistor flipped, but only in the schematic. That’s what I get for drawing the diagram AFTER I completed the circuit and put it to work :P It’s fixed now.

    @NatureTM: This device was only created after going round and round with Comcast for months and them not having a clue what was wrong. I posted a few more details about my experience with the techs in the blog comments. So yes, this is not an ideal solution to the problem, but at that point, when there were no other options other than switching ISPs, I figured, why not :P Plus it was fun to build!

    @Failure in: I thought about putting it on the DC side, but I didn’t want to destroy the “rented” modem’s power supply and I also liked the idea of being able to reuse the device to switch on lamps or Christmas lights or whatever else I please :)

  32. Andy says:

    I had to implement a similar scheme for resetting my Scientific Atlanta cablemodem when it hangs.
    I own an APC MasterSwitch, which has 8 individually controlled power outlets, so it was not much of a hack. You can use a variety of methods for switching outlets, including SNMP (it does have a network conection).
    The cable modems (cable router in my case) usually hangs on too many TCP connections. I think mine has a connection table (the equivalent of ip_conntrack in linux) with 256 entries. When it overflows, it totally hangs.
    I’ve written a small shell script on my home server which verifies the modem status and when it is not responsive, uses SNMP to the MasterSwitch to power-cycle it.

  33. therian says:

    DD-WRT have whole page ‘Keep Alive’ with have
    WDS/Connection Watchdog
    Schedule Reboot
    Proxy/Connection Watchdog
    wasn’t this enough ?

  34. Life2Death says:

    ITS HOOKED UP TO THE MAINS EVERYONE IS GOING TO DIE OMG!

  35. Life2Death says:

    You guys should check the cable modems status page at 192.168.100.1 and look for the power levels – they should be within spec (look here: http://www.speedguide.net/read_articles.php?id=1197) to verify. sometimes cable techs could be stupid (no, kidding?) and set levels too high or too low. Happens often. It also gives leverage to help combat stupid, since you know whats wrong.

  36. Garbz says:

    Our ISP fails to correctly toggle between off-peak download usage and on-peak download usage unless the connection is cycled when the timing cuts over, causing offpeak data to be attributed to onpeak usage.. We used to have a system which simply sent request to the modem to reset, however our new modem doesn’t have this function sadly.

    This would have been a great alternative, however always going for the easiest option I simply bought one of those mains timer boxes and set it to turn off from 3 to 3:15 in the morning.. This looks like a nice hack.

  37. Paulius says:

    Hello. I have done similar thing about an year ago: My “RouterRebooter” uses windows application to detect a router failure and resets it throu unused ethernet cable wires with some analog electronic circuit and relay. I have writen an article about it in my website: http://www.modding.lt/Straipsniai/Router_rebooter Sorry, it’s only in Lithuanian, but you can always use google translator if you like :)

  38. nimitzbrood says:

    Umm…it’s nice and all but I did this with an X10 serial port transmitter and an appliance module.

    I have a cron job that pings the border router, google, and the ISP dns server and if it doesn’t get a response on any of those it power-cycles the dsl bridge.

  39. CorticalVortex says:

    I took a more direct route:

    The new router works flawlessly.

  40. strider_mt2k says:

    “Call and ask for a new modem”

    Wow, bad enough not to read the article, but to even skip the caption is pretty bad.

    I think it’s a great work around. Go dude!

  41. DarkFader says:

    I have this 433MHz remote control transmitter that could reset a modem. But I still need to write a cronjob to check for connectivity. But I can control my lights with my phone already.

  42. Gosh dangit. I was about to do the same thing, almost exactly like he did, except I was going to use one of those x10 things that interface with computers.

  43. version 2 should automatically call the ISP and play them a pre-recorded complaint. Bonus points if you write down their scripted responses and have your automated call work like a reverse turing test.

  44. Ian says:

    I had a similar problem and solved it a similar way as @Life2Death. Comcast wouldn’t admit to a problem, but they kept sending techs out.

    I set up small app to poll the router at 192.168.0.1 every minute and returned the stats. I parsed the data that came back and logged the power levels to a file. I let it run for a few days then when the Comcast tech came out to fix the line again (for about the 6th time in 2 months, after this had been going on for about 4 months) I let him see the log file and he said “Hey – great program. I can see you have a problem here.” It took him about 15 mins to diagnose a faulty connection at the pole down the street and my connection was as good as ever after that.

    As ever, find the root source of a problem and it keeps the solution simpler.

  45. jeff-o says:

    I’ve got a similar problem, but with my wifi router. Once in a while I’ll notice the internet connection is down (or my wife will call me at work), and I (or she) has to hard-reset the router. I haven’t automated the process yet, since the router is within arm’s reach. It sure would be nice if it were automatic, though.

  46. Matt says:

    I remember doing something a lot like this with my brother a very long time ago. We didn’t know anything about hacked firmware, and there may not have been anything for our basic router.

    We came up with a solution where we had an XP service ping some major websites and if they were unreachable, it would send a signal on the serial port. The box would be used to reset both the modem and the cheapie router. I built a 555 one shot circuit with some circuitry to boost the signal from the serial line. The PC was upstairs, the modem and router were in the basement so it needed some ‘conditioning’. But I was still pretty new to electronics and I made an error, I didn’t do anything to filter the input. When the equipment was connected to the box, the additional EMI from the current draw of the modem and router were enough along with the relay that the circuit would sometimes retrigger :) My ‘fix’ was to put a couple plates of something ferrous enough to block the EMI to make it work reliable for a few years.

  47. Defecation says:

    @LifetoDeath

    Everyone is not going to die. He wanted to keep the modem untouched which is fine. Its just that things other than a nasty zap can come into play with high voltage like the life of the relay. The spark created will we bigger when the relay closes with high voltage AC wearing it out quicker. With high usage devices RC snubbers are a must.

  48. nyder says:

    I’ve found most people’s internet problems came from programs on their computer set wrong. Sometimes, for whatever reason, your internet can’t handle lots of connections at the same time. Limit them. Most common when people are using file sharing programs, and also some years ago when their was some virus/trojans going around that was chewing up connections.

    What commonly would happen is your web access will hardly work, but some other programs will be fine.

    Not saying this is his case, but alot of times people think this is a hardware problem, when it’s a system config problem.

  49. Andy says:

    @nyder

    Your normal internet connection is a router with 1 public address and many internal private addresses, say in the 192.168.0.0/24 range. That means NAT. And a NAT table. One entry per TCP connection.

    When the NAT table overflows, cheap routers usually hangs. And cheap routers can have NAT tables with as little as 200 entries.

    Not only file sharing can quickly fill up the NAT table. Oppening a firefox browser with 70 ~ 80 tabs stored from the previous session will open too many TCP connections for a cheap router to handle. Try it. Clean the browser cache first.

  50. cgmark says:

    A better way of doing this is to open up the problematic modem and find the reset line for the cpu inside. You can then pull it low usually, sometimes high for a second and the modem will reset. This way you don’t need but just 2 wires between the two boxes and do not need a relay or to touch anything involving the power supply.

    If you wanted to isolate the two boxes you could use a single optoisolator between the two. A logic output is more than strong enough to drive one and there are plenty of them that have enough capacity to handle the currents of a reset line.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 92,138 other followers