Project: Dual outlet switch box

There isnt a project category, so I am putting it here in hardware, hopefully this can inspire others to make something similar, and together we can share the projects with each other. :smile:

I am working on a box with two outlets. The purpose of this box is to easily be able to switch the outlets on and off, in a not too ugly looking box, and wires hanging out left and right.

This is the box I found. It is pretty cheap (30dkk), got two outlets, and they are not connected together inside.

As you can see, on the inside there is plenty of space to add some extra electronics, and then still not much…

The big problem is to find a power supply small enough to fit in between the two out lets, find room for the TTL adapter so it is possible to re-program it inside the box, have room for the relays, and also have enough room to geet some wires from the relays and up to the terminals for the outlets.

To get room for everything, and hold it in place, I decided to go with SMD components, and design a PCB for it all.
On this PCB, from the top, we got the two relays (still missing the transistor to drive them), in the middle the connector where mains voltage will come in, further down to the right, the regulator which will bring the 5v down to 3.3v for the ESP8266. Just below the voltage regulator a series of capacitors to help stabilize the output from the regulator, and just below those the ESP8266, which is the brain in this thing. Above the ESP8266 to the right, there are two resistors, which will later be connected to the transistors for the relays.
In the middle in the bottom, we got the power supply which will convert the 230V mains into 5V DC. To the left of the power supply, there is a 6 pin header, so we can connect the TTL adapter and re-program the ESP8266 easily. Just below the TTL connector, there is the option to connect a jumper and bring the ESP8266 into flash mode.

Before continuing, I wanted to see how much space I got between the components.

Found a few places where it was a bit too tight, so I had to move a few components 0.5mm, that was all I had, and luckily it seems to be enough. :smile:

Update 2015/11/01
All components are in, now I am just waiting for another power supply to arrive. The one I started out with was a 600mA 12V, but there is a 700mA 5V version, in the same size, which is much better suited for this.

Another update today, this time with a lot of the copper pour removed, to give a higher isolation from the mains voltage.

Update 2015/11/02

Printed the design out, and tried how it fits in the box. I am glad I did, because the first version was way off…

Update 2015/11/22

Finally did a bit of cleanup in the schematic, so here it is.

Stay tuned for more updates. :smiley:


First post updated, got all components in. :smile:

Cool project!

I am sure you know what you are doing, but I just wanted to provide a “word of warning”.

From the identifier on your PCB it looks like you are planning to use a relay of type OMRON G6M-1A. As far as I can determine from the web, this relay is rated at 3A / 250 VAC. I am not sure how it is in your country (Denmark, I presume?) but here in Norway at least, a “normal” circuit in a household would be rated somewhere between 10 and 16 A (depending on how old your house is, etc.)

If the same is true at your place you may be building a “fire starter”, and that is not a cool project, :slight_smile: or :frowning: really.

Also, in case you decide to step up your relay to one that is rated higher, I would make sure the PCB lanes for the mains is up to the job as well.

I don’t want to be a party pooper, but please make sure you consider the risks before building this device.

I have considered those things, but not found a way to do it. My solution to it, for now, is to place stickers inside each outlet with “Max 150w” so total through it should max be 300w. :smile:

My idea with this box is only to control small lights, like outdoor christmas lights and such, and that will probably even be below 20w in total.

Good to hear that you have considered this, and that you will not try to operate your biggest power drill on this outlet, :slight_smile:

As a safety measure (since this is potentially dangerous stuff you are “playing around with”) I would add a 3A fuse inside your box just in case someone does not obey your sticker.

If there was room for one, I would have added one too. The problem is, if I add a fuse, I want it to be replaceable, and there isn’t room to put one of those fuse holders in. Only place there is a bit room left, is in front of the screw terminals, and that space is needed for the wires to go in.

More progress, today I printed the layout on a piece of paper, cut it to size how the pcb would be when finished, and tried it in the box… and voila… it didn’t fit at all… :unamused:

After a few tweaks, I finally fit perfectly, now I just need the new power supplies, and I am ready to order the first batch. :smile:

Added schematic to the first post. :smiley:

Your Q1,Q2 C E are backwards.

Ah yes, totally forgot it was not the right component in Eagle I used, on the PCB it should be correct for a 1AM though.

Pretty neat. Which power supply component do you use? Judging from the picture above it is an integrated sub-component - can you tell me which type they are?

It is one of these

@Mikey Thanks! I don’t want to spoil the fun, but I have another safety concern with these. After looking more closely I think the capacitors are just regular types, but it is hard to tell. Since at least one of them will span between line and neutral, it should be at least an X2 safety capacitor.

I would not use them in a mains-connected circuit. I have used AC/DC converters before - the Mean Well IRM-05-3.3 worked quite well for me, and has all the safety-relevant certificates.

On the other hand, I also have cheap appliances, and probably there are power adaptors in my home that do not have a proper capacitor connecting to mains. There is a tradeoff with everything :wink:

I would not use these in anything that would be connected directly to buttons or connect to other appliances, but for something totally encased, I would. They don’t have proper isolation on the pcb either, but if something happens, it would not be able to jump to something someone could could touch.

Those Mean Well would not even fit in this box, these power supplies are 30x20.6x16.5mm

I might not even finish this… Got more hooked on modifying the 433mhz kits to house a esp8266 instead.

Started the new project today… Got a set of those 433 MHz receivers, and took one apart… this should be doable :smiley: