Summary: I'm building a device that will power-cycle my DSL modem when it craps out (which it does about once every three days).
Progress so far: I've etched a PCB with a 328 on it, a Max232, a relay, a 7805 and places to hang 5 LEDs. The PCB can connect via serial at 4800 bps to my ancient Linux box, and communicate reliably with the shell.
Question: Should I put the "is the internet connection okay" code in the 328, or have that code running as the login shell for the 328 when it connects?
I was thinking something like: Ping a few IP addresses (google, my Qwest-supplied DNS addresses, etc.) and if the packet loss is oh, say, greater than 80%, flop the relay.
If I put the code in the 328, then when I replace the linux box with a newer box, I'll have to reprogram the 328, but it'll be darn cool to have a little arduino login to a linux box, and reboot the DSL modem.
If I put the code on the linux box, then I can just port the source to a new box.
For the second option, I was thinking of code that runs (as a login "shell") that displays things like:
L150 L230 L350 L420 L5100 (set led 1 to 50%, 2 to 30%, 3 to 50%, 4 to 20% and 5 full on)
or
RESET
to flopify the relay
For the first option, I'll basically have to write a bunch of expect-send code for the 'duino, and although it would be cool, I think I'd rather have the code on the linux box....
How about an all-in-one solution? Add an Ethernet shield to the Arduino and have it all self-contained, no Linux box required. Probably use a lot less power than it takes to power the Linux box.
--
The MegaRAM shield: add 128 kilobytes of external RAM to your Arduino Mega/Mega2560
Well, the linux box is also:
my webserver
my mailserver
my firewall
my timeserver
It's got ridiculous uptimes (not lately, cause I rebooted it a bunch of times trying to get getty to work...) but 6 or 7 months are not atypical uptimes for it.
Once it had an uptime of over 18 months. That was pretty cool. Damn power failure...
I thought about an ethernet shield, but my main question is where to put the code? I'm thinking it would be easier to maintain if the code were on the linux box than if it were in the arduino.
It won't be as cool, but when I move to a new linux box, it should be a heck of a lot easier to migrate (scp dslwatch.c dsacmul@newserver:~/dslwatch.c; ssh newserver; cc dslwatch.c -o dslwatch)...
The current linux box it's logging into is running Redhat 7.0 (gasp!)
uname --all
Linux gendep.com 2.2.18 #11 Fri Sep 20 18:39:55 MDT 2002 i686 unknown
Yep. Last kernel compile was 9 years ago. Still stable as hell...
If you're running the Linux box anyways then might as well put as much intelligence/programmability there and consider the Arduino as a relay interface (at least that's the way I'd think about it).
Rather than make the Arduino log in I'd run a cron job to do the connectivity check, and if it fails send a magic serial packet to the Arduino to tell it to open the relay.
--
The Basic Motor Driver: simple, inexpensive motor driver for 1 stepper motor or 2 DC motors