Wireless Completely Programmable Power Strip

Hello World!

I am happy to be amongst some people who could help me make a 5+ year dream for me a reality!!! I hope to be worthy of all of your support with my project.

Project Name: Wireless Completely Programmable Power Strip

Project Description

A power strip that every single outlet can be programmed Monday - Sunday with up to 5 timers on/off (or less user specified) per outlet per day and have it all done via a GUI on my PC using wireless communications.

My Knowledge

I have a very limited knowledge on anything I have an A+ Certification I do not program things on a regular basis and have really only written small and simplistic programs using C#. Only other programming done was 8 bit ASM based programming and that was very limited as well. I have plenty of equipment and some spare time which is limited as well. Just consider me new to everything because I have to reference nearly everything that I do in some way shape or form.

Reason For Needing Such Device

I have been into green since before it was really the "in" thing. This project has the "Green Stamp" all over it. I find for myself if I could find was to be green without really changing my daily routine I am more apt to do it. For example everyone complained about CCFL lighting and in the beginning I was not that impressed by it either. But I looked into it further and I actually found that they make CCFL lighting that is way betting then any Edison based bulb. They are daylight CCFL bulbs which save you money and provide you with a much higher quality lighting allowing you to see colors like you have never seen them before and providing a brightness that is better then any standard light bulb a color that is not dingy and yellowish looking and doing so all while saving money it was a no brainer for me folks and I suggest you give them a try for at least a month once you do you'll never go back. So with this project it is the same principal I would like to easily be able to have things shut off in my home without really having to think about it and if I do need to change the times on a per week basis I want to be able to do it without having to physically pushing buttons like on a digital timer based outlet... I don't want any control outlet solutions where you shut one device off and it in turn turns off all of the devices on a strip as there are some things that I may want running day in and day out like a wireless router or something similar. I believe if such a product did indeed exist people would actually use it.

What do I need help with

Well the short answer is everything I am completely new to all of this. Some of the stuff for starters: What arduino would be best suited to do the job? What other hardware (relays, Wireless hardware etc.. Would be required) What are some good programming examples and info I could use to hit the ground running.

Thank all of you that respond in advance....

Finally would this be the best hardware for the task? (the arduino)

Ok so far I think I located a possible relay board that will work not 100% sure but 5v relay that is 10A 250v AC perfect for switching the HOT on and off the only thing I am not sure of is if the arduino operates at 5v or not so I'll have to figure that out for sure before purchasing ...

http://www.ebay.com/itm/Electronic-8-Channel-2-Channel-5V-Relay-Module-Board-Arduino-PIC-AVR-MCU-DSP-ARM-/290857665796?pt=LH_DefaultDomain_0&var=&hash=item43b877c504

This is the relay board I am referring to. This should allow for 8 outlets spaced fairly well.

Wouldn't mind more outlets but 8 is a decent number and the price is right if it does the job.

What arduino would be the best for this would it be the mini the uno or the newest version ? I am thinking the mini would be ideal because of space constraints but not entirely sure...

Any takers on this for starters?

Keep in mind that a standard outlet is only rated for 15 AMPs and a powerstrip outlet is typically rated for about 8A max. This is why you don’t see 100 outlet power strips. That doesn’t mean you can’t create one, but you will need to make sure that everything that will be on at the same time does not exceed these ratings.

You are also going to want an RTC module to keep track of the time. Just about every module out there uses the DS1307. It doesn’t include any alarm outputs. You could either keep checking the time against times stored in the EEPROM to match your schedule or you can buy one of these modules and buy a Microchip MCP7490 which is pin compatible with the DS1307 and solder that into the module. It has two independent alarms that replace the SQW output of the DS1307. To use that, you would set the alarms for the next two events to occur. When the time happens, it triggers an interrupt to your microcontroller. You process the alarm, and then re-set it with the next event.

Since this is really the only thing your micro is doing, it probably isn’t a problem to simply check the time once per loop against your table of alarms using the normal DS1307.

Correct well I was going to use a 10A 120v fuse I don't plan on running a table saw, hot air station and a shop vac all on my power strip at once lol... I always take that into consideration even while running electrical items in my home... Basics people should almost be forced to learn in high school imho.

Any how I am not familiar with what you speak of here beyond the fact that it is a real time clock module or RTC module for short and the chip number I'll have to check the data sheet for it.

Thanks a million and I appreciate your answer basically it is better to start off with safety when someone tells you assume they know nothing.

This is great I got my first response and first lead just getting off the ground love it thanks!

So I guess I need to figure all of this out.....

The application has to have: The outlets pictured and numbered 1-8. 5 On/Off timers Sunday - Saturday so technically 35 timers per outlet per week. A program button to program times set within the program. Time Sync button to sync time with internet time server. The software must update time tables via wireless communication once you hit the program times button. Remote access would be nice but if you need remote access to this there are remote access to your PC software programs that already are out there don't want to have feature creep just wanna keep it simple.

The Hardware Needed: Arduino What Version? Arduino Wireless B/G/N shield 14 Gauge Green, Black, And White Wire 8 Snap in outlets 1 10Amp 120VAC fuse 1 fuse holder RTC (Don't understand the need for this unless the arduino is not able to keep time on its own? Well I guess they do sell them with CR2032 Batteries on a board setup and they are super cheap so what the hey would be nice not to have to remember to push the time sync button when the power is lost suppose?) 8 Relay Board Project box to hold everything 1 line filter with small 8-32 x 1/2" bolts with keps nuts to hold it in place on the strip. 1 Computer Power Cable 1 Power connection for the arduino ( How is it powered Via USB or 9V if I remember correctly from reading? If so would a 9v brick be better or a 120v to usb outlet be better probably 9v to leave usb open?) Silver Bearing Solder 1 New Tip for my soldering/hotair station. New Cutting wheel for my dremel.

Any thing else that I would need to complete this project.

Other then learning how to code for the arduino.... I think I have it covered whew this will be a pricey power box but well worth it when finished...

Well, you want ethernet, so I would suggest the Arduino Ethernet: http://store.arduino.cc/ww/index.php?main_page=product_info&cPath=11&products_id=197 Unless you want wireless. Then use whatever arduino appeals to you and a wifi shield. You could even get away with a mini for this.

If you have ethernet, you don't really need an RTC since you can just get the time over NTP. However, when you lose power, you will lose the time. Personally I would use an RTC chip and ocassionally update it over NTP to keep it accurate and have battery backup.

In order to support your alarms, you are either going to need something that keeps track of time and triggers an interrupt on alarms, or you are going to need to keep polling the time and comparing it to an alarm table. Since this is the main function of your project, it is not unreasonable to simply poll the time once per loop as I suggested. If you were doing a ton of other stuff, I would suggest moving that function outside of the arduino to free things up.

Also, think about your relay setup. If you use normal standard relays, you will either need to keep them energized the entire time you have an outlet on or energized when they are off. A latching relay or an SSR/Triac might be a better choice.

Also think about what you want to happen if you lose power or if the Arduino loses its mind. You will want some type of fail-safe. In the case of the latching relays, perhaps some type of circuit that would energize all the resets on them in the case of power loss (using a cap that can run that circuit long enough when power is lost.)

You don't need to dive right in and build the relay/powerstrip part right from the start. Work with LEDs to simulate the relays while developing your code.

So, to start you would want an arduino with ethernet, RTC, and a bunch of LEDs.

hrmmm interesting,

I actually am not needing ethernet but wireless b/g/n I do not want the extra wires per say this is fairly interesting so far I think I am a bit more puzzled by the new things added which is not a bad thing it will force me to look so in all technicality being that I could depend on NTP servers for my information I would not need a real time clock that is what I figured while I agree it would be best to have an RTC now that you mention it...

I guess my main difficulty is the understanding the alarms on the hardware side a bit better could you elaborate what the issue is with switching relays with the alarm and such I guess the idea here is to save power I when the outlets are off I want them to be off when they are on I want them to be on what is the most efficient way to do this relays or something better I don't really know all of the options yet...

I thought the code will keep time and send triggers at specified times not only will I need to keep track of time but also the day of the week..... Sunday - Saturday.

Basically when not a creature is stirring I want all of the outlets to shut off that are not required to be on thus limiting drain by power bricks and standby type power draws in multiple devices. In the whole scope of things I want the greenest power strip that is easily programmable from my PC with zero wires. Simply put this is it in a nutshell.

Like I say though basically I will have to have a loop that checks for time and the day and if it matches the time of one of the alarms then it will check which outlet 1-8 it is on and disable that outlet in the code part of it I can think of how to do this with simple if then else while statements I dunno how it work for arduino though as I said it's not something I ever programmed for per say ... last thing I coded was java and I still have to reference stuff don't code often enough to remember what I did last lol.

Anyhow I really do appreciate your help I am just shocked that more people would not want a solution like this I think about this every time I see my electric bill and I think of all the stuff that's plugged into my power strips drawing power for no particular reason other then being to lazy to flip a switch or unplug the strip technically I am wasting money while it might not be much I don't make that much either so every little bit counts and besides I could continually just let it happen and shell out the extra cash for it or I could choose to do something about it!

Some of your questions do show your confusion ;)

ok, let's try to break it down a bit.

We talked about relays. If you use a normally open relay, you need to power the coil to close the switch. As soon as you remove power from the coil, the switch will open. So you would need to keep the coil powered the whole time you have something connected to that outlet powered on. If you used a normally open relay, you would have to constantly power the relay the whole time the outlet was off. Using a latching relay, you have a set and reset line. Pulsing SET turns the switch on. And it mechanically latches. It requires no more power to keep it ON. When you pulse RESET, it opens the switch. Also, no more power is needed to keep it off. Now, the only concern here is if it was latched ON when power was lost to the controller. When power is restored, the relay will still be latched ON. Maybe not a big deal.

With a TRIAC, you only need a pulse to get current flowing through it. So you also don't need to constantly power it. The advantage to a TRIAC is that it is overall smaller than a relay with regard to it's current and voltage capability. And it won't suffer the eventual mechanical failure that a relay will. The disadvantage is that it more complex to design than a simple relay.

A SSR (Solid State Relay) is basically just a predesigned module based on a TRIAC or IGBT. Thought it will be typically much larger than a relay, it has the advantage of longer lifespan and you use it pretty much like a normal relay.

For the alarms and keeping track of time. You have the right concept and yes, Arduino would work like that. "Polling" that I mentioned just means ocassionally checking the status of something. For example, let's say I asked you to write a letter for me. In the polling example, I would need to keep stopping what I was doing and go over and ask you the status. With an interrupt, I would just keep doing what I am doing and you would come and tell me when you were done. As you can see, both you and I would get more done in the interrupt example since I didn't need to stop what I was doing and you wouldn't have to keep stopping what you were doing to answer me when I come to check on you 100 times (nevermind the annoyance that would cause both of us!)

So if your arduino was busy doing a lot of things, it would make more sense to send some other hardware off to do a task and come back and tell it when it is done. In your case, the only major function is watching the time and triggering relays. So the "task" pretty much IS checking the time against alarms. So, polling would be ok.

NTP is network time Protocol. Basically, it just means that you set your time over the network. The Arduino does not have a built in timekeeping clock (some AVR models do, but the Arduino core doesn't support it as it is.) It does have millis() function which will keep track of the number of milliseconds since the last reset/power on. However, certain timer functions will interrupt this and the count may not be extremely accurate over long times. Also it is a long, so it will run over and reset back to zero after some time (approximately 50 days.) Can you see why that wouldn't really be ideal for your application? An RTC module would just keep chugging along and you wouldn't need to keep converting time into seconds, minutes, hours, days, etc... The RTC also has dayofweek so you know when it is Tuesday for example. See how this makes more sense for your application?

Now, I mentioned that most modules you will find will use a DS1302 or DS1307 as the timekeeping chip. These two chips do not have alarms built in. But, you could just keep checking them periodically (polling) and compare them against a table of alarms that you keep inthe EEPROM. You would keep them in your eeprom because you wouldn't want to lose them if the power was lost.

The MCP7490 and DS1337 DO have alarms built in. They have two independent alarms. When the alarm trips, it changes the state of a pin causing an interrupt. Your Arduino would then go and check which alarm triggered, act on it, and then re-set the alarm to the next event to occur. You would still need to keep a table of alarms because you can only have two at a time with these.

The only real difference is that these will let your Arduino basically just sit idle until an alarm is tripped. In fact, you can tell it to go to sleep and wait for the interrupt. This would draw very little power (that's your goal, right?) http://playground.arduino.cc/Learning/arduinoSleepCode

OKay! sweet explanation on that I was actually familiar with the different types of relays just wasn't sure about some of the other things... Also familiar with NTP ;)

But the triac to me sounds like the ticket low power usage and small package... How does this work I don't quite get this if it is not mechanical how would it interface in physically if there is no mechanical latch how do you have a latch this sounds like the whole spintronics type concept to me lol but anyways hey I learn daily and love it. I dunno why I was thinking variac when you said triac errr whatever kinda like the whole ethernet wireless thing for you.

OK the other thing that I am not to sure on with your idea is the sleep mode does the wireless shields and arduino have WOL capability cause lets say one week I go program this thing according to everyones schedule and then find out I can't wake the dang thing up to communicate and program new times...

What's the easiest way to power the arduino and what would be the best version of the arduino for this project?

You are probably going to hate me, but here is more than you probably ever wanted to know about thyristors (of which TRIACS are a bi-direction type suited for AC): http://www.onsemi.com/pub_link/Collateral/HBD855-D.PDF

The short version is that you apply a pulse to the gate long enough for the current through the triac to exceed it's latching current. Then when you remove the gate current, it will continue to conduct. You apply a reverse current to the gate to interrupt the current flow to bring it below the holding current. Well, that's simple in an SCR (unidirectional thyristor) but what is a reverse current when you have alternating current? I said it would be much more complex to design, didn't I? Essentially you have to control it when the AC signal is in the correct quadrant. So you need some way of knowing what phase it is in.

I tried to find a circuit example for you, but I didn't have any luck so far.

You should power the arduino right off the mains voltage in your power strip. I would personally design a custom board in your final design, but you can develop with an UNO, no problem. The reason I would go custom is so that you can make use of the picopower AVR versions, make the whole thing small enough to fit in your strip, insulate it, isolate it, etc... basically make it fit this exact application.

But you can cross that road when you get to it. You can easily experiment with code using the Arduino Uno and some LEDs. If you can get the LEDS to switch on your alarms, you can get the outlets to. The next step is designing the circuits to control the outlets and then testing them. When you are at that point, you will know enough about the Arduino and your control circuit to design a custom board.

So step in the water, it's warm.

nope not mad at all thyristor is familar I have actually read a bit about them when I was reading about thermistors when repairing an SMPS...

Anyhow variac I do not recall not that I probably didn't see the term or name used just not sure on them.

Anyhow the bridge I am trying to cross I at least know where it is on a map but I'm afraid I don't want to be putting tons of effort and cash into something that will not function other than in theory so it would make perfect sense that I am aware of the hardware that will be required to operate the strip correctly.

Research is an awfully long process that can often be simplified by asking questions and getting answers to these questions in a swift laymens terms which I have gotten so far the only real understanding issue I am having here is the direct approach would seem to be the best approach in this case if I spend time lighting up led's I might get too interested in coming up with next years christmas lights beating to the sound of noel or something errr ok maybe a stretch but I have thought about it while not the first to do it.

Thanks for letting me know the water is warm but I still need more facts to back up this theory before I feel comfortable to jump in is the water contaminated are there aligators lurking water snakes maybe? lol

Ahhh yes I have seen these with opticouplers when I was modifying a projector with a different light socket turns out the lamp and socket I chose ran way to hot for the device and it just was not the light as described by the seller but the color wheel was damaged as well very discouraging but I am now able to modify most projectors with a different light socket now that I know what to look for and the opticoupler is the common driver IC's for the variac.

The only thing I do not understand about a variac lets say I get a variac rated for 600v 8 amps does it mean that I will have to use 600v or does the rating of the variac mean that it will handle up to that? I am assuming that is it will handle up to 600v @ 8 amps or about 4800 watts of power for a brief period so going on that assumption it would likely better to get a higher rated variac to allow cooler operating temps and zero bottleneck of power. IDK this is a lot of assumption and thinking out loud so you can see my thought process and tell me where I am going wrong....

I'm not sure where you keep getting variac from. A variac is a varial transformer. Not related to a triac at all.

Obviously you will want a triac that can handle more than you intend to use for the reasons that you mentioned. But understand that the higher the rating, the higher your latching and holding current will be. Whatever you are powering needs to be drawing enough current to keep the triac on, otherwise it will shut off as soon as you remove gate current.

So you are looking for a triac that can handle your loads, but also have a latching and holding current that is appropriate for your loads. Most of the commerical modules have circuitry built in to feed a bit of the current from the load back in to the gate so that it will latch. When you short that to ground, it drops the holding current through the triac enough to stop conducting. They also include feedback to ensure that enough current will flow independent of the load, and also circuitry to accomodate inductive loads and resistive loads.

As for getting distracted by making christmas lights instead of finishing your project. I can relate somewhat. My projects wonder all over the place. You know yourself best, so stick to whatever method will keep you on track.

lol sorry triac I cannot believe I confused that again ....

Triac does sound like a bit of a challenge ... I have my phone charger on one hand and a TV on the other hand how do I make it so that no matter which device I plugin does not turn off then?

I guess if I want to power everything from phone charger to the big screen will the triac be able to accomplish this in an energy conserving manner? I guess what rating would you suggest for a triac?

so M1 would be the input of the hot and M2 would be the output of the hot if I am reading this correct and if the gate has enough current M1 will flow to M2 and if it is lower the power will not flow out of M2 to the outlet thus disabling the outlet...

Hot------------------> 10A fuse --------------->120v Plain --------> Triac M1 --------> Through Gate if open stop here if closed ---------->Triac M2 --------->output outlet Neutral --------> Neutral Plain ------------> Output outlets Gnd --------> To Gnd Plain --------> Output outlets

120v plain will also have to go to a DC conversion circuit to get my dc 9v power which I may just disassemble a power brick from a 9v adapter and slap that in there to save me the hassel off of the line filter... So if the DC conversion circuit goes south I could just swap it out for a new one easily rather then using a bridge rectifier and the rest of the conversion circuit to get 9v it will also be a bit cheaper to run the uno...

So goal is to figure out the parts required so that I can start ordering parts the most expensive piece is going to be the wireless shield... From the looks of it I just wonder why this shield is so friggin expensive you would think someone would come in and undercut the heck out of these wireless shield makers and make a fortune selling it at like 1/2 the price and force the competition to lower their prices or fold.

Anyhow there is a lot that goes into designing something even as simple as what I am trying to achieve...

I am fairly sure that some of the x10 modules use mechanical latching relays as I remember hearing audible latching sound with the socket rocket setup with motion sensor transceiver .... That think is still working after about 6 years of running so this makes me wonder about the life of mechanical latching relays should be fairly decent I would imagine...

Anyhow this is a head full already I better not ask to much more or I will scare the help away!

I am not discouraging using a mechanical relay at all. It is far simpler and works easily with all types of loads. I just initially presented a few different options and you expressed an interest in the triac. That's how we got on that tangent. A relay would be fine. Get a good quality relay and it will probably out-live most of the electronics you plug into it. lol

It has been a long time since I have messed with triacs, so I would really have to go back and study them again to be of any more help than explaining how they work. There are a number of tricks to handle the various scenarios and unfortunately the majority of circuits that you find online using them do not make use of the latching/holding current and instead just use them as a normal switch (which you could do as well.) You do not NEED to use the latching current, etc.. You could just keep the gate powered and it would keep conducting. The latching part is just to keep current flowing when the gate is removed.

So, it doesn't need to be as complex as it is getting. But if you want absolute minimum power consumption, that would be the way to go. Perhaps just build 'something' using relays or whatever so you get your feet wet and start understanding all that is involved and then upgrade and enhance it in future iterations?

perhaps I will use standard relay instead will not be most conserving I see but the 20ma per relay I could save by turning my backlight down a notch on my tv...

So ...

For the RTC is there any reason I could not use this breakout board https://www.sparkfun.com/products/10160

For the wifi shield I will use the WIFI BGN 210

For the relay board I will use standard relays ...

Basically everything will be ready made so I can slap myself in the water...

Unless there is some wild reason these won't work let me know but I think I will go with an uno board for starters...

I would like to in the future when I figure all of this stuff out and get some code going make this product a bit cheaper the only issue I see is finding a cheap wireless module I may be better off going with bluetooth IDK so many questions really and I just want to get started on this and possess the items physically... So I can start to assemble my dream I may be better off starting with leds as you say IDK I just want to do something so maybe I'll just purchase the uno tonight so I can at least get the ball rolling on that and before I purchase anything else I will await your expertise on any issues I may have with the setup...

by the way here is the relay board I am talking of http://www.ebay.com/itm/370792476569

here is the wifi shield I am talking of http://www.ebay.com/itm/320899439629 (it also allows for sleep mode)

I figure if I can have the wifi sleep and the arduino sleep I will be saving big on power and the RTC will run from a battery...

I am thinking it may be smart to use these as well to ensure a solid connection to the wire coming off of the board.

I really respect your thoughts and look fwd to them

PS if I said variac anywhere in this I mean triac ..... As I will likely be trying to take the easy and bulky route the first time through this so I can get it off the ground at least. Overall this should conserve a fair amount of power over the course of a month I would imagine.

wow this thing is going to be pricey how about this http://www.digital-loggers.com/lpc.html and an ethernet bridge I accomplish exactly what I want to do quickly and cheaper hrmmmm....

:) I already ordered the arduino uno oh well ! I will like it more if I make it...

So suggestions are still welcome...