PDA

View Full Version : I can has teh interwebnetz?



SXRguyinMA
05-16-2011, 03:30 PM
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 :D

Here is the modem we use:


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/modem.jpg

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


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/skp.png

http://www.thebestcasescenario.com/sxrguyinma/personal/modem/dimensions.png

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 (http://www.protostack.com/boards/microcontroller-boards/atmega8a-development-kit) 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 (http://arduino.cc/en/Tutorial/ArduinoISP) 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! :banana:

Here it is (servo positions still TBD):


#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 (http://www.fritzing.org).


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/modem_bb1.png

The PCB layout.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/modem_pcb1.png

The .pdf for etching the board.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/etch.png

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.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/1.png

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.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/2.png

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:


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/3.png

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:


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/4.png

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.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/5.png

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

Fuganater
05-16-2011, 03:39 PM
lazy much? but awesome awesome idea.

SXRguyinMA
05-16-2011, 03:54 PM
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.

blueonblack
05-16-2011, 04:05 PM
Don't listen to the naysayers. Necessity is *NOT* the mother of invention. Laziness is. :)

+rep for an awesome solution to an annoying problem!

Fuganater
05-16-2011, 04:15 PM
I'm amazed your making your own circuit board... Never knew you could do that.

Munty
05-16-2011, 04:25 PM
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

SXRguyinMA
05-16-2011, 04:31 PM
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.

crenn
05-16-2011, 04:32 PM
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.

RogueOpportunist
05-16-2011, 05:58 PM
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.

SXRguyinMA
05-16-2011, 11:02 PM
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.


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

SXRguyinMA
05-16-2011, 11:09 PM
And the PCB is done! :D

I picked up a cheap set of Tungsten drill bits at Harbor Freight and got to work.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/6.png

I used a block of wood to drill into as the hole in my drill press is way too big just to set this small board over it. I selected the bits based on what fit into an empty PCB I had laying around that has similar components.

After some patience and a few bit swaps for different sized holes, I got it all drilled out. I had a problem with the smallest bit, it seems either I was drilling with too slow of a speed or too fast through the PCB, as it chipped the backside. Not a huge deal as the components will be covering the majority of it anyhow.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/7.png

Next it was off to the scroll saw to clean up the PCB. I just cut along the copper box that the .pdf file left, then sanded the edges down smooth and clean.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/8.png

Next step was to place all the components and bend their leads in preparation for soldering.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/9.png

After I soldered the components and clipped their leads I tinned all the traces. This keeps the exposed copper from oxidizing.


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/10.png

And the completed board!


http://www.thebestcasescenario.com/sxrguyinma/personal/modem/11.png

http://www.thebestcasescenario.com/sxrguyinma/personal/modem/12.png

I'm happy to report that I plugged it in with a 9v wall wort and the servo shown in the picture, and it works 100% :banana:

Now all that's left is to fab up the mounting system and calibrate the servo, and she's done!

AmEv
05-17-2011, 12:29 AM
Wonder what Verizon'll think when they see this rig-up???

SXRguyinMA
05-17-2011, 12:48 AM
Well if we weren't "renting" the modem from them I'd tear it open and wire it directly to the LED and a relay for the power source, and it'd be all enclosed and stealthy :D

But seeing how if we ever terminate our service (read - move to cable) with them we need to send it back or they charge us, I'll go this route lol

OvRiDe
05-17-2011, 01:29 AM
The servo is cool but seems like you could have just used a relay to power it off and back on?

Either way... I am looking forward to seeing it in action. :)

crenn
05-17-2011, 03:35 AM
I'm guessing that it was a case of this is what he had on hand so could just build it.

SXRguyinMA
05-17-2011, 07:34 AM
The servo is cool but seems like you could have just used a relay to power it off and back on?

Either way... I am looking forward to seeing it in action. :)

Well I didn't want to open it up, and the servo was more fun :D


I'm guessing that it was a case of this is what he had on hand so could just build it.

This is true as well, although I have several small 5v and 12v relays, but again, it would have required me opening it up, or finding an exact match for the power jack they used on it

crenn
05-17-2011, 04:16 PM
The best way to do power cut off without modifying the wall-wart or the modem itself is making a PCB which has the relay with the ground connected through it, so the wall-wart plugs into the PCB and the PCB has a lead which plugs into the modem.
Some callipers would quickly turn this into a problem of where to get the plug and connectors!

Oneslowz28
05-17-2011, 09:13 PM
Awesome job! +rep

OvRiDe
05-18-2011, 03:28 AM
If you used a relay you could just cut the 110V like a light switch does. Just take an old extension cord and and put the relay in the middle. That way you wouldn't have to modify the modem or wall wart at all.

But it is true, the servo will look much cooler.

SXRguyinMA
05-18-2011, 08:18 AM
well the modem itself uses a wall wart, just not sure what size. The standard ones you can buy are usually 2.5mm, this one's a lot smaller. Ah well, the board is made :D maybe down the road I'll look at doing it the other way

x88x
05-18-2011, 11:19 AM
Interesting solution to an annoying problem. +rep

Are you sure you're renting the modem from Verizon? I thought I was too, but when I canceled my service with them I discovered that I had gotten it for free when I signed up with them. ...on a completely unrelated note, if you want a DSL modem to tear apart and modify for a more seamless solution, I have an extra one that I don't anticipate I'll ever use in the foreseeable future.

AmEv
05-18-2011, 12:29 PM
Well, when we signed up for our WiMax service, it said the main "brick" was theirs; the USB modem is ours to keep because we bought it! Sooooo.....

Fuganater
05-18-2011, 12:31 PM
You have to rent Verizon modems now?? I've never had to pay for them before.

SXRguyinMA
05-18-2011, 12:44 PM
Well not "rent" but it's included in the bill. IIRC you need to send it back if you cancel service. If it's ours to keep I may just say F-it and tear it apart and do it nice and clean-like and just chock this up to a learning experience with etching :D

SXRguyinMA
05-18-2011, 12:54 PM
OK so after doing some reasearch, it appears that I own the modem. They bill you at the time of service startup. This changes things I believe :D

From this link:
http://www22.verizon.com/foryourbusiness/DSLInternetServices/internetaccess/sub_products/dslpackageb_e.asp


Modem billed at $99, plus applicable taxes at time of order.

I think I'll pop it apart and see if I have room to put the components inside it, and just use a relay instead of a servo on the internal connections to switch it on and off. I'll report back after work tonight....

Fuganater
05-18-2011, 12:59 PM
Ah that must be a new thing.

Waynio
05-26-2011, 10:03 PM
Hehe :D Brilliant solution to a bugging problem :D +rep for you & to crenn for the codage :D, wish I could get motivated to learn a bit of coding & diy electronics to do some interesting stuff but wow it must take a long time to learn.

SXRguyinMA
05-26-2011, 10:27 PM
That's the beauty of Arduino....it's quick and REALLY easy. I had ZERO experience with coding until I got mine, and basic things are a breeze to me now. The more complex I need crenn for though :D

SXRguyinMA
06-18-2011, 11:02 PM
It's done! :banana:

I got all the parts cut out and glued together

http://www.thebestcasescenario.com/sxrguyinma/personal/modem/13.png

Here you can see the tab to act as a guide for the actuator arms

http://www.thebestcasescenario.com/sxrguyinma/personal/modem/14.png

I ended up having to put a small piece of wire to hold the main actuator rods together. They were moving outwards and missing the on/off switch completely.

http://www.thebestcasescenario.com/sxrguyinma/personal/modem/16.png

And the final shots. In the second pic you can see the sensor shroud I made out of black foam poster board. This shields all but the internet indicator light from the light sensor.

http://www.thebestcasescenario.com/sxrguyinma/personal/modem/15.png

http://www.thebestcasescenario.com/sxrguyinma/personal/modem/17.png

http://www.thebestcasescenario.com/sxrguyinma/personal/modem/18.png

and the final code (thanks again crenn!!)


#include*<Servo.h>

#define dropouttime 30000
#define offtime 120000
#define connecttime 180000

enum {
waitingDrop='A',
dropDetected='B',
waitingConnection='C'
};

enum{
turnOff=79,
turnOn=119
};

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 <= 100) && ((millis()-looptimer) > dropouttime)) {
state = dropDetected;
Serial.println("Dropout detected");
looptimer = millis();
}
else if ((photocellReading > 100) && (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();
}
}
}

billygoat333
06-19-2011, 12:41 AM
Video of this thing in action? eh?

SXRguyinMA
06-19-2011, 12:52 AM
none but I can get it for you :D

diluzio91
06-19-2011, 03:47 AM
lol.. you should sell this to verizon...

mDust
06-19-2011, 11:00 AM
lol.. you should sell this to verizon...

Get them really, really drunk first.

Awesome project though. I like how overly complex it is.:)

Waynio
10-15-2012, 03:56 AM
I missed the conclusion to this, for once the spammers bumped it up & it had a good side effect. :D:up:

Turned out awesome. :banana:

Just noticed the stars on this log so just gave it 5.

Stonerboy779
10-15-2012, 05:57 AM
Missed this too and find the final solution so full of win. Ahaha :D

d_stilgar
10-15-2012, 01:38 PM
Yeah. I'm not sure how I missed this, but it's pretty sweet.

SXRguyinMA
10-16-2012, 08:55 PM
It's still working flawlessly :)