Introduction: Arduino Power Outlet With Exposed Pins

About: I'm a generic and standard robot manufactured for the sole purpose of typing, I type on walls, wires, on the sidewalk and even sometimes on the air.

I found my self often trying to plug stuff at home with Arduino. So I thought it would be good to have a system that you can just plug your sensor, plug the appliance and code something to see how it goes. I never liked breaking apart an appliance to find the right spot on the electronics, or peel off the wire.

What do you need? A common plug, for example think of a lamp, then you plug it on the wall wart, so how do we get Arduino into the pot? Cutting the wire has being always an option, but then if you want to re use the hardware for something else, the wire would be broken. However sometimes is not an option, the appliance wire can't be cut. So we interact with the plug. But this is dangerous, so... better not do it. Alternatives? Lets box it all up, the high power and electronics. Using a outlet big enough, lets you put the electronics inside the box and avoid exposing all the high power wires that usually are not coated or protected inside these boxes.

This is plug system with an integrated power supply and an Arduino. Will let you test your coding skills and tests sensors on different scenarios on the go just losing some plugs from the outlet.

The list:

PartsSourcePrice

Outlet 6 connectors

Local store / Radio Shack?10$

Arduino Leonardo with Xbee socket

DFRobot WiDo20$

Extension shield

DFRobot WiDo14$

Power supply for Arduino

Local store

5$

2 Relays

DFRobot WiDo

5$

Soldering tools and extra wire borrow it

Scavenging time

54$ for a reusable smart Arduino plug. And this is how it looked like before, when it was broken.

Step 1: Unscrew, Open the Lid and Take a Peek

This is the time you want to decide the internal layout of the electronics. Main concerns are separating and covering High Power voltage from the rest of the electronics. And leaving enough space for the Arduino pins to keep them exposed. Another note, would be to keep The Arduino connector right next to the border of the outlet so a hole can leave access to programming without opening the hole thing

Each outlet has slightly different setup, Mine was recovered after the fuse failed. However as you can see the fuse is not located in the outlet, but it in the plug.

Step 2: Cleaning Up, Making Room.

The outlet has a button, that will become useless now. I was considering the option of leaving the button on to bypass the relays in case I need the outlet for something else. But if that turns out to be a common case, I can just leave the Relays to always on, and turn off the Arduino.

Step 3: Internal Power Supply

The power supply for the Arduino can be grabbed out of any common USB charger. Make sure it is powerful enough for whatever you are going to use it. Since I'm always trying to reuse the whole thing, I'm guessing I'll need quite a bit of power.

I went for this one at first, 300mA. Don't make the same mistake. At first, I took it for granted that it was at the very least 500mA, but most likely 1A. Turned out it was not enough to even power the Relays. I found another one with 2A and switched it back. I forgot to grab a picture of the Power supply but is just a bit larger and a bit bigger. Had to cut some more plastic out of the outlet.

WARNING, be really careful, when plugging and wiring and powering it. If you are not extremely sure if the polarity of the wires, make sure you are not “nearby” when you plug it! If it breaks, and you have something else powered from the wall wart, everything will go dark. So take all necessary precautions!

Step 4: Layout Draft

With the parts at hand and enough space, I started my first quick draft of the layout.

By the time I did the layout I had already cut the plugs. Would be better to put the Arduino on the right side, and the plugs with the High power all together. Separated and covered.

I've grabbed a bit of blue-tack sticky glue thing to hold the parts together. If you have gum and watched a lot of MacGyver then just go ahead. I've kept the high power wires from the relays outwards since I believe this is better, hope someone can correct me on this since I'm not entirely sure.

Step 5: Wiring, Soldering and Screwing.

Added a few holes on the back, Arduino form factor. I don't like the screws going outside, but I wanted this quick and held in place. Then soldered wires for the relay power system and kept it separated from the rest of the electronics. Drilled a hole for the USB.

I do have to say, that after I changed the power supply, I added an extra USB hole, since the new power supply had an USB connector. This way the outlet would be able to charge phones as well.

Note that I went for DFRobot leonardo, since it has 3 sensor connectors and a Xbee socket. This way, I can add the relays+sensor and a wireless module with the bare dfrobot leonardo. The board has 3 pins near the ICSP that are very easy to plug on the sensors. But for now I am using the expansion shield since I am planning to attach several more sensors for my next project. The secondary serial port for the wireless system is also going to be very convenient when It's Internet enabled.

Step 6: Conclusion

This makes for a perfect smart power system. You won't need to interface with unknown electronics. Or peel off wires from your home appliances. It gets as smart as you want it to. From a simple turn on the light if is dark. To a clever system with several sensors and automatic calibrating system.

You can keep the relays always open, so that the outlet is just an outlet when you don't need the Arduino ( is just a bigger bulky outlet without button ).

The key is having the pins exposed and most of what is needed reachable.I'm thinking to put a plastic lid on top of the pins as soon as something is settled.

I would really appreciate if someone would suggest some safety measures for building it! ! !

Step 7: The Code

I've used this simple sketch to get a feeling of it.

<p>#define RELAY1_PIN 8<br>#define RELAY2_PIN 9
#define IR_PIN    10
#define LED_PIN 13</p><p>void setup() {                
  pinMode(RELAY1_PIN, OUTPUT);     
  pinMode(RELAY2_PIN, OUTPUT);  
  pinMode(LED_PIN, OUTPUT);
  pinMode(IR_PIN, INPUT);  
}
void loop() {
  if (digitalRead (IR_PIN)) {
    digitalWrite (RELAY1_PIN, HIGH);
    digitalWrite (RELAY1_PIN, HIGH);
    digitalWrite (LED_PIN, HIGH);
  } 
  else {
    digitalWrite (RELAY1_PIN, LOW);
    digitalWrite (RELAY1_PIN, LOW);
    digitalWrite (LED_PIN, LOW);
  }
}</p>

I've used a ranged sensor to trigger the relay

The relays are connected on the expansion shield, since the coding is just a draft, but it should probably better to hide the wires and connect them directly to Leonardo on the bottom side. Anyway, with this, whenever I'm close the light will lit automatically. And it's being working very nice for the past couple of days.

EDIT: make it networked --> Instructable outlet power, part 2