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

Computer on-off switch

  1. Dec 4, 2011 #1

    So recently I've been playing with 555 timers. And I am beginning to understand how powerful they can be.

    With that reset pin switching capabilities are endless.

    But that led me to thinking.

    How can I make that switch, which you have at your computer, that power on and off switch. The switch is one way. You turn it on and off in same position, in some way.

    I think you send signals to some IC that processes that. Can this be realised through 555 timer?

    Again, I am talking about that switch which you have on your PC, that one way switch. ( I don't know how its called, help me with the terms here).

    So I want a switch which basically has one push position. When I push it, I turn on the circuit.(when I release it, the circuit is still on) When I push it again, the circuit goes to off state.
  2. jcsd
  3. Dec 4, 2011 #2


    User Avatar
    Science Advisor
    Gold Member

    I don't know specifically how they do it in a PC but I suspect it is through a dedicated power controller chip that also has a pin connected to the processor. Maybe it's even part of the PC power supply. I've designed circuits with this type of power switch. It can be done in many ways. One way is to use a mechanical latching relay and arrange the contacts so that they change which coil the switch is wired to. Another way is to have the push button switch activate a relay or mosfet, etc. which is then controlled by the microcontroller. As long as the microcontroller is running it always holds the relay, mosfet, etc. in the on state which keeps the device powered up. However, the microcontroller also reads the state of the pushbutton switch. When the microcontroller is running and sees activity on the push button switch it then deactivates the relay, mosfet, etc. powering itself down. I can't say the timing function of a 555 would be necessary to do something like this. It just depends. It has to be built in such a way so that holding the button in does not cause repeated on and off cycling.
  4. Dec 4, 2011 #3
    Yes I am running away from PICs for like 2 months. I guess I will have to start working with them some day. Ah, off to shopping for PIC programmer :/
  5. Dec 4, 2011 #4


    User Avatar
    Science Advisor
    Gold Member

    Doing things with PIC microcontrollers opens up a whole new way to do things. Especially if you like programming in a higher level language. Of course that is not to say that you cannot achieve your switching goal without a microcontroller or the relay I described.
  6. Dec 4, 2011 #5
    Yes I do love programming. But I do not like programs which have like 5000 lines. That is murder for me to do. I like doing small compact programs. I am known in my group for writing and solving complex problems in most simple possible way there is.

    My mates have a code of lets say 50 lines, mine has 15 or so. I hope PICs don't go beyond 500 lines, but I understand this depends of how much complexity my operation of PIC is.
  7. Dec 4, 2011 #6


    User Avatar
    Science Advisor
    Gold Member

    5000 lines or 50 lines is really irrelevant. You can make it as long or as short as you want as long as it gets the job done and there is room for it in the memory. If your code is set up right you won't have one big long program of a bazillion lines. You may have many smaller chunks that you routinely call which makes it much easier. The total number of lines may well exceed what you like to do.
  8. Dec 4, 2011 #7
    Thanks for the heads up. I've seen a lot of tutorials how to program these PICs. I feel I will have it under control.
  9. Dec 4, 2011 #8


    User Avatar
    Science Advisor
    Gold Member

    I learned it on my own using C. I had never used C nor done any microcontroller programming. Only troubleshooting. I had alot of experience with VisualBasic doing instrument control. The only thing I had to go by was the datasheet for a PIC 18F2520 and a book on C that someone gave me. If I can do it I'm sure you can too.
  10. Dec 4, 2011 #9
    Hi, Bass your switch is called a 'toggle switch'.

    The idea being that each press or activation of the switch steps or 'toggles' through all the available states in sequence, eventually returning to the original one.

    Years ago this could only be implemented in mechanical switching, then came logic circuitry and finally (micro)computers made such a process available through software, so today we have many devices from cellphones to washing machines that allow us to 'scroll through the options.'

    One of the simplest hardwired circuit with this behaviour is called a bistable or flipflop (google?).

    The power switch on a (modern) PC is rather different as there is an interplay between the motherboard and the power supply on power up. This is necessary for complicated modern logic systems.
    Notice the term power up, rather than switch on. This is because when you first apply the mains to the power unit it takes a finite time for the rail voltages to build up to their correct values.
    Whilst they are building up the circuitry within the power unit provides a single 5V supply to very simple circuitry on the motherboard. This simple circuitry monitors the 'power good' signal line from the power unit. The power unit holds the power good line in the off state until its monitors tell it that the voltages rails have stabilised at their correct values. then The power unit sets the power good line to on.
    At this time the circuitry on the motherboard allows the memory, processor and other components to turn on.

    If this complicated process did not happen the pc could turn on with the voltages values on its data lines set to random or non indeterminate values and anything could happen.

    PS I have an attached two position toggle switch with the positions entitled

    Nap now
    Nap again

    go well
    Last edited: Dec 4, 2011
  11. Dec 4, 2011 #10
    Yes yes! flip flop was the original circuit from where I got the idea. Thats why I posted this thread, I wanted to modify that flip flop somehow to make it turn between high and low state through one and the same toggle button. Averagesupernova told me that can only be realised through PIC or some other micro controller.
  12. Dec 4, 2011 #11


    User Avatar
    Science Advisor
    Gold Member

    No I did NOT. Read again.
  13. Dec 4, 2011 #12
    Exclude the "only" part. Sorry.

    I will however try to realise it through PIC. Or invent my own thing :D
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook