Page 1 of 4 1234 LastLast
Results 1 to 10 of 37

Thread: I can has teh interwebnetz?

  1. #1
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default I can has teh interwebnetz?

    Ok so my house is over 200 years old, which means everything from plumbing to phone wiring wasn't pre-installed. This leads to issues such as flaky phone wiring interfering with my DSL modem. Every once in a while the modem will lose it's internet connection. This requires me to go down to my parent's house and manually turn off the modem, wait a few minutes, then turn it back on, then run back up to our apartment. My house was long ago split into 3 separate living spaces (from one HUGE colonial). The main portion my parents live in and the 2 separated spaces are apartments, the upstairs of which my wife and I rent.

    It's not a huge deal for me to do it once a week when it usually drops out, but on occasion it's every day or sometimes even several times a day. I know it's not the modem as Verizon has sent different models as replacements, all of which suffer the same issue. They've also sent a tech out to inspect out lines from the pole to the house, again to no avail.

    So I figured there's got to be an easier way for me to reset this thing. So I came up with this

    Here is the modem we use:


    And here is what I came up with to do my bidding:




    I'll make a framework out of black acrylic that will hold the PCB and servo. The PCB in the illustration is an ATMega8A dev kit from Protostack that I was going to use, but it's a tad overkill for this purpose. I ended up using the ATMega8A that came with the dev kit, as the code was small enough to fit on it and save one of my 328's for a bigger project. I used this guide to load the Arduino bootloader onto the ATMega8A (I used the Arduino-to-breadboard illustration at the bottom as I only have one Arduino), then uploaded the code and tested it and it works perfectly!

    Yet another HUUUUUGE thanks to crenn for helping me with the coding for this!

    Here it is (servo positions still TBD):

    Code:
    #include*<Servo.h>
    
    #define dropouttime  30000
    #define offtime         120000
    #define connecttime  180000
    
    enum {
        waitingDrop='A',
        dropDetected='B',
        waitingConnection='C'
    };
    
    enum{
        turnOff=20,
        turnOn=160
    };
    
    int photocellPin = 0;
    int photocellReading;
    char state = waitingDrop;
    char laststate;
    unsigned char servoval = turnOff;
    long looptimer, servotimer;
    Servo servo;
    
    void setup()
    {
      Serial.begin(1200);
      servo.attach(9);
      servo.write(servoval);
      delay(2000);
      servoval = turnOn;
      servo.write(servoval);
      servotimer=millis();
      looptimer=servotimer;
    }
    
    void loop()
    {
      if (((millis()-servotimer) > 50) || (state != laststate)) {
        servo.write(servoval);
        servotimer = millis();
      }
      laststate = state;
      if (state == waitingDrop) {
        photocellReading = analogRead(photocellPin);
        Serial.print("Analog reading = ");
        Serial.println(photocellReading);
        servoval = turnOn;
        if ((photocellReading <= 400) && ((millis()-looptimer) > dropouttime)) {
          state = dropDetected;
          Serial.println("Dropout detected");
          looptimer = millis();
        }
        else if ((photocellReading > 400) && (state == waitingDrop))  {
          looptimer = millis();
        }
      }
      else if (state == dropDetected) {
          servoval = turnOff;
          if ((millis()-looptimer) > offtime) {
          Serial.println("Turning Modem On and waiting for connection");
            state = waitingConnection;
            looptimer = millis();
          }
      }
      else if (state == waitingConnection) {
          servoval = turnOn;
          if ((millis()-looptimer) > connecttime) {
            state = waitingDrop;
            Serial.println("Waiting for Dropout");
            looptimer = millis();
          }
      }
      else {
        Serial.print("States: ");
        Serial.print(waitingDrop);
        Serial.print(dropDetected);
        Serial.println(waitingConnection);
        Serial.print("Invalid state: ");
        Serial.println(state);
        if ((millis()-looptimer) > dropouttime){
          state = waitingDrop;
          looptimer = millis();
        }
      }
    }
    What this will do is monitor the "Internet" light (internet connection status indicator) and control the servo to manually turn the power switch on and off. However, to prevent it from cycling when the light blinks (normal activity) there's a timer built in. When the light goes out it starts the timer. If after 30 seconds the light doesn't come back on, it moves the servo will switch off the modem, wait 2 minutes, switch it back on, then wait 3 minutes (for the modem to power itself on and re-establish the connection) then start reading again.

    I made up the following in Fritzing.


    The PCB layout.


    The .pdf for etching the board.


    I decided I'd have a go at etching my own board. It turned out a lot easier than I was expecting.

    I printed the etch .pdf onto plain paper to check the pin spacing and alignment. Once everything checked out ok I printed it on a sheet of photo basic gloss for INKJET printers with my dad's laser printer. The reason for this is the toner will not adhere to the inkjet photo paper.


    I then cut a small piece of the Radio Shack copper clad that would fit the circuit with room for mounting. In this pic I've notched where I'm going to cut it.


    Now the next step is to heat the toner paper on the copper board with an iron on it's hottest setting. You need to press firmly and be sure to move the iron every 5-10 seconds to evenly heat it. This melts the toner and transfers it to the copper.

    After you've got it good and crispy (yes the paper will brown, this is normal and shows you're heating it thoroughly), you let it cool, then soak it in hot water for 5-10 minutes to soften the paper. Then you simply peel it off, and gently rub off any remaining paper with your fingers. If it all goes well, you get this:


    Then you put the PCB into a plastic container with your etchant. I used the Radio Shack etchant, but there's lots of recipes on the web about making your own using muriatic acid an other household chemicals. You need to constantly agitate the mixture to keep fresh fluid over the surface to speed up the etching. Mine took about 20 minutes, but time will vary depending on how old your solution is and how much copper needs to be etched away. After it's all good and etched, take it out and rinse it under tap water. If there's still copper left, soak it longer. Once it's etched, you are left with this:


    Then you simply wipe off the toner with acetone (I used carb cleaner because I had it readily available), and you're left with a ready-to-drill board! The whole process took about an hour and was really easy.


    That's all for now, I still need to drill the board and mount the components, and fab up the framework.

  2. #2
    Its not cool till its watercooled. Fuganater's Avatar
    Join Date
    Oct 2007
    Location
    Kinshasa, DRC
    Posts
    2,843

    Default Re: I can has teh interwebnetz?

    lazy much? but awesome awesome idea.

  3. #3
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: I can has teh interwebnetz?

    well when it's once a week it's not bad, but when it's EVERY DAY it gets really annoying, especially if it's raining or snowing outside, that just makes it worse lol. Or if I run down without my keys, in the rain, to find them not home, I need to run back up, get my keys and go back down lol.

  4. #4
    Stupidity feeds my children blueonblack's Avatar
    Join Date
    Feb 2008
    Posts
    2,616

    Default Re: I can has teh interwebnetz?

    Don't listen to the naysayers. Necessity is *NOT* the mother of invention. Laziness is.

    +rep for an awesome solution to an annoying problem!
    “Do not trust people like me. I will take you to museums, and parks, and monuments, and kiss you in every beautiful place, so that you can never go back to them without tasting me like blood in your mouth. I will destroy you in the most beautiful way possible, and when I leave you will finally understand why storms are named after people.”

  5. #5
    Its not cool till its watercooled. Fuganater's Avatar
    Join Date
    Oct 2007
    Location
    Kinshasa, DRC
    Posts
    2,843

    Default Re: I can has teh interwebnetz?

    I'm amazed your making your own circuit board... Never knew you could do that.

  6. #6
    Overclocked Munty's Avatar
    Join Date
    Dec 2008
    Location
    Littlehampton, UK
    Posts
    392

    Default Re: I can has teh interwebnetz?

    Good work, I wouldn't call it lazy at all. Though I have to say if it was me even this fix wouldn't be enough. 5 minutes without the internet is enough to really ruin my day, even if it is only every few days :p

  7. #7
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: I can has teh interwebnetz?

    lol it sucks...usually I'll be in the middle of something actually important (like BFBC2) when it cuts out. Sometimes it goes weeks or months without cutting out while other times it's several times a day.

  8. #8
    Fox Furry crenn's Avatar
    Join Date
    Apr 2005
    Location
    In the shadows behind you
    Posts
    4,067

    Default Re: I can has teh interwebnetz?

    Hehe, I know all about etching your own PCBs, well... only in theory, I've never etched a PCB myself. I have all the tools, I just need a design I can etch. I work mainly with SMD micros.

    But you're welcome for the help, it was a nice chance to code up something useful.
    Antec Sonata II | Pioneer DVR-212
    Good news! You can follow my website or follow me on twitter!

  9. #9
    ATX Mental Case RogueOpportunist's Avatar
    Join Date
    Sep 2010
    Location
    Canada
    Posts
    173

    Default Re: I can has teh interwebnetz?

    Cool little project but did you take any steps to check and see if it is your power source? Power surges and brownouts can cause your modem to "hang" just like a computer. If you lose your connection and that connection does not come back without a hard-reset something is wrong, the modem should always try to reconnect after a couple of minutes when it loses connection and it will keep trying until it regains connection, the delay between connection attempts varies between makes and models but either way when the modem is functioning normally it will continually try to reconnect, if it isn't there is something wrong internally.

    If you are dropping connection quite often like that and the telco says it's not their line my first guess would be dirty power and hooking your modem up to a 30$ UPS might solve the issue entirely.

  10. #10
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: I can has teh interwebnetz?

    Quote Originally Posted by crenn View Post
    Hehe, I know all about etching your own PCBs, well... only in theory, I've never etched a PCB myself. I have all the tools, I just need a design I can etch. I work mainly with SMD micros.

    But you're welcome for the help, it was a nice chance to code up something useful.
    My first time doing it. I was going to make one for Tempest SXR, but it was too complex and required a double-sided board, which as a noob I wasn't going to attempt my first try. I was also thinking about making one for Power House, but that's got the same set of issues. I ended up just point-to-pointing it on a perfboard.

    Quote Originally Posted by RogueOpportunist View Post
    Cool little project but did you take any steps to check and see if it is your power source? Power surges and brownouts can cause your modem to "hang" just like a computer. If you lose your connection and that connection does not come back without a hard-reset something is wrong, the modem should always try to reconnect after a couple of minutes when it loses connection and it will keep trying until it regains connection, the delay between connection attempts varies between makes and models but either way when the modem is functioning normally it will continually try to reconnect, if it isn't there is something wrong internally.

    If you are dropping connection quite often like that and the telco says it's not their line my first guess would be dirty power and hooking your modem up to a 30$ UPS might solve the issue entirely.
    It is plugged into a UPS actually, the same one the computer it's next to is plugged into. Just happens randomly, but occasionally it will reconnect by itself after a minute or two, but 95% of the time it needs to be turned off and back on

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •