Arduino Power Outlet With Exposed Pins

9.7K6410

Intro: Arduino Power Outlet With Exposed Pins

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:

Parts Source Price

Outlet 6 connectors

Local store / Radio Shack? 10$

Arduino Leonardo with Xbee socket

20$

Extension shield

14$

Power supply for Arduino

Local store

5$

2 Relays

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

9 Comments

I have to say that this project (and the following wifi-controlled socket using it) raises MAJOR safety concerns to me. It would not pass any safety standards in the US or Europe doe to it's construction method, proximity of mains to low voltage signals, and the ability to get a finger/teaspoon/hairclip into the workings. While standards can be relaxed for development within a restricted access area, the thought of a 1 year old child picking one of these up sends shivers down my spine.

To anyone considering this, can I suggest all the high voltage is put in a good quality abs hobby box, along with the relay so that there is only a safe low-voltage link to the arduino. A fuse is a great idea too - either a panel mounted 20mm or a polysnap resettable. Solid-state relays are ideal as they can be driven safely directly from a digital port (e.g. Radioshack: http://www.radioshack.com/nte-rs1-1d4-21-ssr-4amp-... or CPC: http://cpc.farnell.com/jsp/displayProduct.jsp?sku=...

This advise applies to US 110V but doubly so to 230V parts of the world, where the consequences of mistakes can be even more fatal.

Hi and great idea!

Where did You find the "Power supply for Arduino 5$" ?

Is it safe to use?

Thank you!

haha, that is a good question indeed! It's as safe as it gets, but make sure your outlet keeps it protected. I didn't change anything from the power supply except from the casing. So in your outlet, make sure all the High power is well separated, isolated and best if is covered. Like adding a plastic wall piece, just in case you put your fingers inside or something like that..

my Power supply is generic, can't remember from where, but I saw another one here:
http://www.dfrobot.com/index.php?route=product/pro...

Yeah thank you!

Didi You connected the arduino in parallel with the AC plugs?

I mean everything is powered from the same AC outlet, or not?

Camillo

Thats right, parallel. This way, you can use the outlet as a standard outlet if you put the relays on always ON, and bypass Arduino if needed. ie, you take the Arduino for a while to use in another project. What do you think?

a safe and cheap AC plug for arduino would be very handy.

your project is very good indeed, i am just looking a way to use arduino clones in real projects... it is very difficult!

turn on the dehumidifier or AC for that matter.. good project

Thanks! as it is, is not much without sensors and stuff like that, but I'll write more on that as soon as I have something.. got several ideas in mind