Arduino Cut power!

I don't know what you thought of the title but here's what its about.

As some may know windows 7 has wierd Internet Connectivity problems.
And from my earlier thread i said i had to cut the power for the router every now and then.

How can I use the Arduino to cut power for the router at precisely midnight every day for 30secs then continue powering the router.

I'm not letting you do all the work. Here are some ideas I planned.
In the code make the arduino sleep.
I know how to do the code.

I need help hardware-wise. How would I connect 12 volts to an arduino to have it cut the power.

Wall -> 12 volt adapter -> arduino (external power) -> router

Use an relay to do that.

Specifically, a relay that has "normally closed" contacts. When the relay is energized, the contacts are opened (the circuit is broken).

Specifically, a relay that has "normally closed" contacts. When the relay is energized, the contacts are opened (the circuit is broken).

Yes, that would make for a very simple 'black box'. It would have a 12vdc input jack from the wall wart transformer and a 12vdc output cable with a plug that fits the router's power input jack. Inside the box could be a any simple "bare bones" type Arduino board that will accept 12vdc power (that is, has it's own internal +5vdc regulator).

The Arduino would then drive a small SPDT +5vdc relay, such as ( http://www.allelectronics.com/make-a-store/item/RLY-496/5VDC-SPDT-REED-RELAY/1.html ) that can be driven directly from a Arduino output pin. Do wire a reverse connected diode directly across the relay coil terminals. The relay coil's two terminals will wire to your assigned output pin and the Arduino ground pin. Turning the output pin HIGH will energize the relay, causing the normally closed contact to open, thus removing power to the router until the output pin is brought LOW.

The +12vdc input wires to both the Arduino power input and to the normally closed relay contact. The power input jack ground wires to both the Arduino board and the negative wire of the 12vdc output cable/plug. The relay's common contact wires to the positive output wire of the 12vdc output cable/plug.

I would just use a simple sketch using the millis() function to initially turn on the relay coil for 30 sec, then off, and then again on every 24 hours worth of millis() time for 30 secs. You could wire an external reset switch to the box wired between ground and the Arduino reset pin, so you could force a immediate 30 sec 'power off' state and then start the 24 hour wait for the next automatic power interruption.

Good luck with your project, and giving Windows 7 a little Arduino helper :wink:

Lefty

Ive had 7 for about a month now on my "main" pc, never had a issue with its network

my pos netgear wifi router on the other hand ... so yes good luck on your idea

Just got my relay, looks like the one from all electronics but it was from my local hobby shop.

Thanks for the hardware help! :slight_smile:

Just got my relay, looks like the one from all electronics but it was from my local hobby shop.

Just be sure to check the relay coil current requirments. If it's more then 30ma or so you will have to use a switching transistor instead of directly driving it from an Arduino output pin.

Lefty

And the relay's switching (load) current spec - if you overload it it will weld itself short-circuited. Hopefully the router is low current.

Even it the relay doesn't need more than 30ma direct driving it with the arduino is risk due the current spike generated by the relay.

I agree. I always use a transistor with my relays no matter what (paranoid, I know :P).

sure, I can use a transistor as a switch rather than connecting it directly to the relay. I'm just putting things on a breadboard right now. This weekend it'll be operating.

Oh, well I would still recommend a relay, but use a transistor to operate the relay (seems a bit redundant, I know). It's using a switch to activate a bigger switch :). Thus avoiding high current draw directly from an Arduino pin.

Even it the relay doesn't need more than 30ma direct driving it with the arduino is risk due the current spike generated by the relay.

That is the reason to always wire a reverse biased diode right across the relay coil terminals, no matter what voltage or device is driving the coil. I have had no problems driving low current (<30ma) relays directly from an Arduino output pin when properly protected by the transisent suppression diode installed across the relay coil.

Lefty

As much as I love to see arduinos used.....
Surely this would do exactly what you need for a few $$$

I didn't even think of that, daveg..that could work just as well if not better...

But still, I vote use the Arduino ^_^!

I would open up the modem and play around with the power switch and control it from the arduino. We tried something like this on an old modem and fixed it.

Cheers,
Pracas

LOL, practical people spoil all the fun sometimes!

Here's what I suggest:

At midnight, the Arduino lights an LED on pin 13, which the light sensor on pin 12 detects and triggers an interrupt. Watch for the interrupt and start a count-down on one of the PWM pins that reduces the PWM value to zero over 20 seconds. The PWM pin is connected to a missing pulse detector. When the the PWM reaches zero, the output of the missing pulse detector goes high, which is connected to pin 4 of the Arduino. When that happens, the stepper motor holding the accelerometer that is being monitored through software serial on pins 8 and 9 de-energizes and the accelerometer drops. As soon as the acceleration value goes negative, pin 5 goes high, energizing a relay, cutting power to the router and starting a 30 second timer.

After 30 seconds of outage has elapsed, the LED on pin 13 goes out, causing the light sensor on pin 12 to set another interrupt, which reverses the PWM count-down, putting the missing pulse detector back to low, which causes the stepper motor to return to its regular position, which causes the accelerometer to read positive acceleration, de-energizing the relay and restoring power to your router.

It's as simple as that. :wink:

30 second timer? Pah! Why not use a sandclock with another steppermotor and an IR-LED/photodetector-pair to measure when all sand has fallen down the clock?