Introduction: Main Power Restoration Delay / Device Saver

We, as I presume most of you do as well, have a single electricity provider and that provider has clients that are at the very edge of provided service. I am NOT one of those clients but if my neighbor ever moves I'm hosed! Yes, my area is on the very edge of that service area and as such we experience an inordinate amount of power outages. Clear weather, stormy weather, there's always at lease some chance of a problem.

So hearken back with me to yesterweek when we had a storm come through and the power dropped. Loss of power isn't as bad as it could be. We have a generator for essentials, UPS' for some of my equipment and strip surges on everything else. My problem is rarely the power "loss" but always with their attempts to RESTORE power. On, off, on, off, high voltage, low voltage, VERY low voltage, wash, rinse and repeat. My favorite is when they rapid fire pulse the power.

It takes its toll and the toll last week the toll was a piece of equipment I left running in my shop. No one was home to shut it down (my fault) and when I returned it was toast (it was in a strip surge for all that was worth). I checked the logs from my UPS and saw the story. What is one to do?

All of this could have been avoided if I kept the device powered down while the power company plays with the mains and once the power is up and stable THEN power up my equipment. And so I built this. A simple power restoration delay box. When power is returned, the box waits 30 seconds to enable the outlet. So, next time when the power is doing gymnastics coming back up, my equipment can sit it out and wait until the power is up and stable.

/*/*/* WARNING *\*\*

This Instructable deals with electricity. Not only can it kill you but it will hurt like heck the entire time doing so! I'm what they call an expert moron, so I do what works for me. Please do your research, check your work and take all the precautions.


And as always, the motto I live my life by...

" If the women don't find you handsome, they should at least find you handy." Red Green

Supplies

PARTS / PIECES

  • Arduino Micro Pro (5v)
  • Relay-NC (5V)
  • USB Charger
  • Dual 120v Outlet
  • 220ohm Resistor
  • Plastic Dual-Gang Outlet Box
  • Cover Plate / Outlet / Switch
  • LED
  • 24g Wire (Cat5)
  • 14g Wire (House Power - Braided is easier than solid)
  • Shrink Wrap Tubing
  • Misc Nuts/Bolts
  • Power Cord
  • USB to Micro-USB Cable

TOOLS

  • Wire Cutter / Stripper
  • Pliers (i used bent chain nose)
  • Screw Driver
  • Drill / Drill Bits
  • Heat Gun
  • Hot Glue Gun
  • Solder Station
  • Label Machine (optional)
  • Computer (to program the Arduino)
  • Voltage Meter
  • Breadboard / Testing Wires
  • 3D Printer
  • Digital Caliper (Optional - Critical if you want to make your own parts or modifications)

Step 1: The Design

You may or may not have seen any of my other Instructables but everything starts out with some sketches on a half sheet of paper. Original concept to a refined design down to measurements and notes, everything lives on the half-sheet.

My first thought was to have a mechanical button that crosses the relay and once powered the relay would continue until the power drops. Great, simple and no complex electronics. Only problem, I'd have to hit all the manual resets every time the power blips. Did I mention it blips a LOT. So, I nixed that.

How would you design the delay box? Perhaps you'd use a micro controller to run the basic of basic codes. Your code might count to 30, flip on the relay and then exit. Come to think of it, you might even want a visual indicator so you'd have the code flash an LED during the count up (1/2 sec flash and then 1/2 rest) and then go solid when the relay is active.

Really? Me too!!

I wanted something simple to design, simple to build, easy to fix and as cheap as I could make it. It had to power on the load all by itself so I added the micro-controller to my original design. I can change the dwell time and they're not expensive to replace if they fry.

Step 2: The Code

Here's the code. Like I said it's simple and straight forward. After defining the pins, the code simply does a loop count (flashing the LED) and once it reaches the magic number it turns on and leaves on (pins to HIGH) both the relay and the LED. Done!


const int RELAY = 14;

const int LED = 7;

int count = 0;


void setup() {

 // run once:

pinMode (RELAY, OUTPUT);

pinMode (LED, OUTPUT);

}


void loop() {

 // to run repeatedly:

while(count < 30 )

{

 digitalWrite (LED, HIGH);

 delay(500);

 digitalWrite (LED, LOW);

 delay(500);

 count=count +1;

}

digitalWrite (RELAY, HIGH);

digitalWrite (LED, HIGH);

}


Step 3: Off the Shelf Parts

I used a standard double gang outlet box from my LHS (local hardware store) as the main project box. Everything will be in or on this box. It's not the "wall" box that you'd find in a wall rough-out but it's labeled as "water proof". Thick grey plastic.

I used a standard 120v dual-gang outlet but contemplated using a GFI and when I do this again I will.

I also grabbed a dual face plate, plastic (non-conductive). One side fit my outlet and the other was for a single switch, which we'll use for the LED.

I had cast offs from other projects so out I pulled an Arduino Micro Pro 5v (HiLetgo) and a relay (10a) from an old Arduino "kit". I believe the green LED and 220ohm resistor also came out of that same kit.

Electrical cables. First off, everyone should have a box full of CAT5 scrap. Great source of scrape cables for low voltage projects. I have some scrap 14 and 12 guage solid wire that I use for wall-power projects but if you strip those power cords you snipped earlier you have a good supply of stranded cable - MUCH easier to use than solid. Just tin the ends to keep the ends from fraying.

I grabbed a small USB charger from the junk drawer and snipped the power cable off of an old piece of junk yet to find its way to the recycler (I snip ALL the cables off of defunct equipment, they always come in hand).

NO, I am NOT a HOARDER! Ok, maybe, just a little...


I tend to use the dual-gang box design because it allows for both the high voltage outlet and the controlling electronics. I like these thick grey boxes because they're sturdy and meant to be used outside of an external support (stud). They're tuff and can hold up to use and abuse. I can also add a single gang to the dual gang if I want separate out the high voltage from the low voltage.

Step 4: 3D Printed Parts

With this build I strayed from my standard methodology of just jamming things together and decided to print some mounting hardware. There are two pieces, the electronics holder and the LED holder.

Electronics Holder

The relay and Arduino are mounted to a bracket this between two of the boxes mounting poles and does a decent job of separating them from the high voltage, so to speak. The relay mounts to the bracket with some small nuts and bolts while the Arduino stradles bracket's top section, held in place with a dab of hot glue.

The bracket is designed with some holes and dimples to allow the passage of the different wires and is held in place with friction. Push it all the way down and it will stay there. You can glue it in place but I wanted to be able to remove everything in case something fails.

LED Holder

The LED holder of course holds the LED but it also pulls extra duty by filling the space on the right side of the cover plate (keeps it from rocking back and forth once screwed to the outlet) and has pins that fit into the box's mounting holes, to keep everything from moving.

Step 5: TEST EVERYTHING!

This is probably the most important part of any project - TEST EVERYTHING!

Before you start screwing everything together you'll want to test everything you can. Does the code work? Are you getting the right voltages? Is ground good across everything? And very importanly, is anything crossed or shorted? If you apply voltage, are you going to see a flash that lets out all the magic smoke in your IC?

In all seriousness, get a meter and run a test on everything before you plug anything in, especially if you're mixing high and low voltages (ya gotta keep em seperated!) and are keeping them in close proximity. You'll want to make sure nothing is shorting on anything else, everything is projtected, covered, and non-exposed. Use electrical tape, use shrink wrap tubing, make sure that everything is routed properly and not just shoved together. Make sure all the screws are tight and that all the solder points are secured. You really don't want anything coming loose and burning everything down, let alone causing immense pain all the while it's killing you.

Test, connect, test, assemble and test again.


Step 6: !Putting It All Together!

The project has gone from concept to design to prototype to this, final assembly.

This phase was very straight foward and required little or no deviation from the plan.

Assemble the Main Bracket

  • Attached the Relay and run main power cables from the relay, through the routing holes out to the box.
  • Attach the Arduino
  • Plugged in a short USB-USB Micro cable to the arduino for power.
  • Soldered 24g wire to the legs of the Arduino for power, ground pin 7 (LED) and pin 14 (relay)
  • Connected ground, power and pin 14 wires to Arduino
  • Routed the ground and pin 7 out of the bracket for the LED
  • Small dab of hot glue to keep the Arduino in place
  • You'll see that the pins fit through the opening at the top of the bracket and it sits flat on its circuit board.
  • Insert bracket into box, carefully routing wires

LED Holder

  • Insert LED holder into the cover plate
  • Attach with screws
  • Insert LED
  • Solder wires onto LED (with resistor on the positive side)
  • Cover with Heat Shrink
  • Dab hot glue to keep the LED in place

Insert Power Cord

  • Strip off outer jacke of power cable by six inches and insert into box
  • User (2) power cable chocks to secure cord into cable opening on box
  • Use some super glue to make sure they stay put

USB Power Adapter

  • Attach HOT from main power and HOT from RELAY to one leg (Shrink Wrap)
  • Second leg, run NEUTRAL cable to NEUTRAL on gang outlet (Shring Wrap)
  • Use hot glue to secure blow gang outlet

Gang Outlet

  • Screw GROUNDto outlet
  • Screw HOT from Relay
  • Verify NEUTRAL from USB Charger
  • (TEST EVERYTHING!)
  • Secure gang to box

FINAL

  • Secure face plate
  • Test that there are no crossed wires on main power
  • Plug into outlet
  • LED should flash for 30 seconds
  • After 30 seconds the LED will go solid and you'll hear a "click" from the relay
  • Test voltages

Walla, she is done!


Step 7: Co-Co-Cool Daddy-O

Next project will have what I did to this one after I was finished and I would suggest you do as well.

Rubber Feet

For the bottom to keep it from maring the floor

Breathing Holes

I drilled a series of vent holes on the bottom of the box (relay side) and then some more on the side up towards the top. The faceplate is by no means air-tight but I just wanted to make sure there was enough flow to keep things from overheating. Nothing was "hot" after prolonged use but, an ounce of prevention, yada, yada, yada...


Lemmeknow!!!


Microcontroller Contest

Participated in the
Microcontroller Contest