Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How can I program a switch?

  1. Apr 3, 2015 #1
    I want to switch either a standard AC socket or a USB outlet on and off on a programmed cycle. But although there are many consumer-ready timers available to do this at set times of day, programmable to the minute, I want to be able to randomize the cycles and have it programmable to the second, or even the millisecond.

    I think either a device that I can program with a computer or something I could trigger remotely with a programmable app would work. Maybe there's an open source home automation system that would let me do this?

    Any ideas on what might work for me, half-baked or not, would be greatly appreciated.
  2. jcsd
  3. Apr 3, 2015 #2


    User Avatar
    Gold Member

    Like you said, you can easily buy these from the store.....
    But if you are hell bent on designing your own, I would use some sort of programmable digital device on a breadboard.
    Use something like VHDL to program it (like a if, when, else state machine).
    Obviously your output will be either on or off.
    The digitial circuit will trigger it, but you then need your output switch to be heavy duty enough to handle the switching load of your output.
    I'm sure there are many ways....but this is just one that popped into my head from senior design in school.
  4. Apr 3, 2015 #3
    Can you find anything that can actually be programmed for random intervals (like any amount of time between 30 and 90 minutes) as well as programmable to at least the second (so something could blink on and off for one second)? This is a level of programming that I haven't found in consumer devices.
  5. Apr 3, 2015 #4


    User Avatar
    Gold Member

    You could use one of these:
    http://www.powerswitchtail.com/Pages/default.aspx [Broken]
    with one of these:

    You would get the device you want and learn something in the process.

    You can also hook this:

    up to the Arduino with this:

    If you say "I want a programmable <insert concept or action here>" There is probably a widget out there to get the job done.

    Last edited by a moderator: May 7, 2017
  6. Apr 3, 2015 #5

    jim hardy

    User Avatar
    Science Advisor
    Gold Member

    1. Be very careful tinkering with wall power.

    2. There's a thriving industry for such products, just search "Home Automation:
    this line dates back to 1980's
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook