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.

53 thoughts on “Power Cycling A Problematic Modem

  1. @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.

  2. 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.

  3. @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 ;)

  4. 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..

  5. 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.

  6. 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 (:

  7. 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.

  8. 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.

  9. 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.)

  10. 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…

  11. 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.”

  12. 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.

  13. 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.

  14. 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.

  15. @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.

  16. 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.

  17. 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 :)

  18. 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.

  19. 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.

  20. 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.

  21. “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!

  22. 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.

  23. 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 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.

  24. 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.

  25. 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.

  26. @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.

  27. 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.

  28. @nyder

    Your normal internet connection is a router with 1 public address and many internal private addresses, say in the 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.

  29. 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

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.