Connect with us

automatic on/off button presser

Discussion in 'General Electronics Discussion' started by geoffwoz, Feb 2, 2012.

Scroll to continue with content
  1. geoffwoz


    Feb 2, 2012
    Apologies for the simplicity of my description, I'm a bit of an electronics hack, and while I can put together a circuit given a schematic, my ability to design with discrete compoments is non-existent. So to my problem...

    I have a piece of equipment that is battery powered, and has a single on/off switch. Hold for 2 seconds and it powers on, hold for 2 seconds and it powers off.

    I would like to power on/off this device based on existence/non existence of a external 5v power supply.

    So, normally the device will be off, but when an external 5v source (basically USB VCC) is provided to a circuit, I would like to close a relay across the on/off switch, the relay has to be held for 2 seconds so that the device will power on. The device itself is 4.2 v internally powered by a li-ion battery, so I don't believe the relay would need to be very beefy (or perhaps there is a better way than a relay (an transistor ?)...

    Now once this has happened the device will be operating and all will be good.

    At some subsequent point the external 5v supply will be lost, and what I would like to do is to again pulse the on/off button for 2 seconds to switch off the device. The problem is without tapping into the power supply of the device itself. (I'm assuming that I would need to utilise a CAP of some form to hold enough charge to do this when the external power is removed.

    Is there any neat way that I could do this without requiring a lot of bulky componentry that could effectively do this.

    Apologies for the complete noob-ness of this request, I really don't know where to start.
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    Nov 17, 2011
    You could start with a circuit like this:
    On power on (external 5 V), the current through C1 opens Q1 and in turn Q2 so a current flows through Rload (that would be your relay). Also, charge is stored on C2 for the power off sequence.
    On power off, the left side of C1 becomes 0 V. Thus the right side becomes negative (since the voltage across a capacitor can't change instantaneously). The negative voltage makes a current flow though the zener diode D2 into the base of Q2, thus again generating a load current. Without the help of C3 Q2 will shut off too early and the 2 s for the OFF-Timer would not be reached.

    This is a quick and dirty design which surely needs further evaluation. You could simulate it (as I did with LTSpice) or build a breadboard - it should be easy, there aren't that many components.

    Of course, using a real timer (say, NE555) plus some more logic this could be made much more precise.

    Oh, by the way: I didn't include a free-wheeling diode in my schematic (didn't need one with Rload). If you control a real electromagnetic relay, a diode (anode to GND, Kathode to (+) of relay coil) is required across the relay coil to avoid damage to Q2 when the relay is turned off (induced voltage).


    Attached Files:

    • idea.jpg
      File size:
      125.1 KB
  3. geoffwoz


    Feb 2, 2012


    Many thanks for the detailed look into this for me, I'll get the components and put something together, I think you're right a dedicated timer would be better, but I'm guessing that its operation for the no power state would be undefined, so I'd then have to make sure I power it, the requirements are actually quite limited so I think your circuit will hopefully do the trick.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day