Auto Off For Any Circuit

autooff

Properly configured, your computer will go into sleep mode when left unattended for a long enough time. So will your cell phone, and just about every other piece of sufficiently complex electronics. Much simpler circuits, though, are left at the mercy of a SPST switch; if you forget to turn a flashlight off, it will be dead next time you need to use it. Wanting an auto-off circuit simple electronics, [Kyle] threw together this auto shutoff circuit.

The basic idea behind the cirucuit is to use a microcontroller as a timer controlling two transistors. When [Kyle]’s circuit is power cycled, the timer inside an AVR starts, making a pin high, and when the timer is up, making the pin low again. This pin feeds into a PNP transistor which is in turn connected to a NPN transistor, creating a very tiny auto off circuit for anything with an SPST switch.

[Kyle] says there are a few improvements to be made – using MOSFETS to handle higher currents and possibly using a smaller microntroller like an ATtiny 4/5/9/10 to shrink the circuit’s volume. It’s a great idea, bringing the idea of a flashlight with auto shutoff into reality.

54 thoughts on “Auto Off For Any Circuit

  1. I did the same thing for my car, it makes the dome light dim out rather than snap off. Only difference is I used 1 transistor, 1 capacitor, and 1 resistor. But hey, at least with an AVR you could make it usb too.

      1. It will show low battery. Good to use it for dual purpose indicator. I.e. “to prevent battery drain auto shut down is being activated.” To negate it one must press power button again. I hv one more idea. Use backlight switch for dual purpose. Do take the gate drive power from backled. In this was you dont have to mod the case for push button.

  2. i have seen these before but there flaw is there based off a micro-controller … i have done it before using a 555 … … R1 240k and C1 being 3600uf you get 15 minutes on after you release the button
    use a 100uf for 30 secounds … 220 for a min exc

      1. no if you get a 6.3 volt electrolytic 3600uf is surprisingly small
        than as you said super caps or a few smaller caps

        yes in the end its probally going to be a tad bigger (tho not by to much) but its easier (and probally cheaper) than programming a bunch of $5 microcontrollers … and you can remove the socket

      2. Indeed. And caps aren’t very accurate either. And high-impedance resistors make the circuit more sensitive to outside influences. There’s nothing wrong with a microcontroller, assuming you are already comfortable programming it. It’s small, accurate, and can be easily adapted.

        1. your accuracy is within a few seconds at 15 minutes so its not a problem … and your outside influences would have to be shockingly high with an LM555 with proper resistors if thats your problem you would fry any mcu …

          1. Simply by using different value Capacitor than the one calculated to overcome the tolerance.

            I have a 555 for my Alarm calculated for 5 Minutes and it shuts off after 4.2 – 4.5 minutes using the calculated values with an inaccurate resistor.

            If i needed 5 minutes flat i could get a little off of the calculation.

            It really isn’t that bad..

          2. Capacitor value varies with voltage and temperature, so you can’t overcome the tolerance by using a different value. Also, the value ranges are limited. You can get a 3300 uF capactor, or a 2700 uF one, but there’s not much choice in between. And time used for fiddling with the right component values is easily more than it would take to program a controller.

            I agree it’s not that bad, if you don’t mind a few minutes off on the 15 minute timeout, but I wouldn’t want to claim you can get it within a few seconds by using an RC circuit.

          3. Please allow me to disagree.

            If you need 3000uf you can either get a 3300uf or a 2700uf and a 330uf,the same way you will add a 20ohm (18ohm actual) resistor in series with your 1000ohm that ended up being 982ohms measured on DC.

            I haven’t ever seen significant capacitance-time variation on 555 based RCs due to temperature change,i’ve been through as low as 15c to as high as 40c ambient room temperature.

            The time is never the same twice,even if you reset and go again it will varry from a few seconds to quite a few more seconds in the same environment,but the few minutes off is nothing i’ve seen.

            It’s pretty obvious the Microcontroller is much more accurate than a Circuit based on ancient technology but that doesn’t mean that whoever wont use one is going to the slaughter.

            If you need something nearly 100% accurate and have a few ATtiny’s in hand and no problem programming them i don’t see why not.

            If someone needs something easy,cheap and in a hurry the 555 based Circuits are the best solution.

            Now if someone needs a 3-4 second delay the best would be a discharging resistor and a 2200uf Capacitor in series with a 12V PCB Relay.

            It’s about what you need and you have.

      3. You can use a smaller capacitor and different value resistor mounted vertically.

        If you want,you’ll find a way,but i understand some people like to play with Microcontrollers.

    1. Thanks biozz :) Between this article and your component based one, I think the dreaded Kawasaki auto off timer has been solved :) It was a problem I came across sometimes with circuit bending and had just snipped wires (with varying degrees of success) on, but thanks to all of you I now get a better picture of what was going on and am now sure that one of the lead wires went to an internal cap in the black blob. Thanks for the help :)

      1. np! … also if you need to use it on a circuit with a switch a simple one shot circuit with a cap and a diode works great

        and a reply to Arlet … if your caps are 20% off you need to get a different brand … i test all my caps before using them and there never more than a few percent off if new and not bulk happy-fun-time-super-cool-american-capacitor brand from china XP

  3. I have made these using a 40106 mosfet inverter as a timing device, you can pretty much ignore the input load and just calculate timing based on capacitance and resistance. 10µF and 10M ohm will give you roughly 100s of delay.

    The micro controller is only ever a better choice if you want some intelligent variation. Say you include a separate button to power only the micro, and also toggle an input pin (using a diode to separate the two), you could have for example a flashlight that would stay on for one extra minute every time you push the button, or shuts off when you hold the button down for a long press. 5 minutes of light, 5 short presses. Shut off, hold for 1 second.

  4. Microcontrollers tend to require a nice clean low voltage to work well so I can’t recommend them in every simple circuit. You could use a 10F200 if you insist though. It’s in a SOT23-6 package and so barely takes up any room. I’ve used a few in mods for C64’s and they ain’t hard for what you want. Why don’t you use a comparator? It’s cheaper than a 555.

  5. Hm I doubt using your 3V powered incandescent bulb flashlight with an 0.7V forced voltage Drop (over the
    conducting transistor) is a good idea with respect to brightness.

    And powering your whatevervoltage LED flashlight with driver (aka constant current source) will reduce your battery lifetime, because the driver will have to compensate for the lower supply voltage by drawing a higher average current.

    And remember: We’re talking about 20% loss of functionality!
    Not the best circuit. And I thought any hackaday editor should have seen that at the first glance, since it’s “transistor 101 for newbs”.

    1. Running this in simulation, the lamp sees no diode drop. The only downside is that the micro won’t work below 1.8V or so and the ballast current of (Vbat – .7V)/1kohm. But the point behind the Sziklai pair is that both are in saturation and bootstrapped by the 1nF capacitor. And other point is that the micro isn’t powered at all when the switch is off or after the micro has turned everything off. (Not that I would personally have worried about 1uA of sleep current, but…)

      In simulation, I’m seeing 12-13mV on the virtual ground provided by the 2N2222, for all battery voltages from .3V to 5V.

      1. The voltage drop of the emitter-collector junction of a bi-polar transistor in saturation is roughly 200mV, which in most circuits is perfectly fine. Yes, below 1.8V the uC will quit working but how many electronics will actually work at that voltage anyway?

    1. The art of using circuits at all is becoming lost on the ‘every project needs a microcontroller’ crowd. The first project here that really got me bitching was an arduino mousetrap, with the controller set up to repeatedly poll a pressure switch to see if it was closed i.e. a mouse in the box, then turn on a motor to release a catch and drop the lid onto the box to catch the mouse. basically at that point, the arduino is replacing a length of wire. I still don’t know why anyone with more than grade school electricity would think that was a good idea, unless they started with ‘lets use an arduino’ and went from there.

  6. You could always use a simple oscillator with a medium-length period driving a simple digital counter chip. They still sell the divide-by-2 ones right? So you’ve got, IIRC, up to a factor of 1024 to divide by. Just connect your output to the highest pin, and use one of that transistor pair to invert the signal.

    Simpler than programming an MCU, more reliable than a long-period 555 timer.

    1. None of this changes the fact that almost all of the flashlight users out there don’t need fractions of a second accuracy for how long the flashlight is on. When it turns off, if you’re still in the dark you toggle the switch again and get another ten minutes or so. I really can’t think of any realistic scenario where you’d need the flashlight to last exactly a certain amount of time.

      It is dark. You might be eaten by a Grue…

  7. Why not try making an Set Reset Latch and then make it T-flip flop style with out a clock? Yeah, I’m going to bitch on this one bc you really don’t need a micro in here. I don’t even like the idea of using a 555 timer. But then again I’ve Been fortunate to have taken classes on digital design.

  8. Why not use a S – R latch and use some gates to make it T-flip flop style (with out the clock)? I’m sure you can make a simple feed back circuit. Yeah, you definitely do not need a computer in this circuit. If you haven’t taken a digital design course, i warmly recommend learning about it!

  9. Nice work- it’s a change of perspective on how/ why too. And some good on topic comments! :}

    It also can be built into a battery shell or an advance on “Dead Bug with components glued to the chip & flyleaded. There’s a lot of surface on both sides of a chip…. Or package like some 1 wire “button” designs? Seriously- many micro’s are NOT needing to be write once. Hmn.. that 1 wire bus as a reprogram?

    Optoisolation and/or mechanical relays still&all grants some ESD hardening.

    But for many Hack/Make uses- This is well suited to using as shown.

    Good Enough-Is.

  10. Hello, I’m glad that many of you liked my circuit. I first experimented with 555 timers and other ways to create a timer circuit. My only problem was that it’s virtually impossible to create a 555 circuit for 15 minutes without using huge capacitors/resistors. You could try to get away with a +10M-ohm resistor to charge the capacitor but the leakage current of most capacitors would mean that it would never reach the 2/3Vcc needed to trigger. A huge capacitor would make this difficult to fit into a small enclosure. You could also go down the road of flip-flops, digital counters, etc but they would just add to the overall size. In the end I chose a microcontroller simply because its fast, easy, small, and I have lots of them on hand. By using one of those 6-pin versions, this can be made quite small and placed almost anywhere. In terms of cost, I got my lot of ATtiny85 microcontrollers for about $1.60 each, which is still cheaper than a 555 or flip-flop/counter circuit. By using a ‘tiny4 you can get the cost down to 63 cents and build the entire circuit for under $1.

  11. “It’s a great idea, bringing the idea of a flashlight with auto shutoff into reality.”
    They have existed for a long time. The flashlight i keep on my uniform has a button that has 3 brightness modes, 2 flash modes, and will automatically turn off after about 10 minutes if you dont push the button when the light flashes.

  12. I saw this on the front page before there were comments then remembered … this is Hack A Day! How can you use an AVR for something that COULD be done with a 555 and get away with it? I was waiting for someone to complain that 555s are overkill, Luckly I didn’t have to wait long. He should have etched a silicon die of the 555 circuit and fabbed it himself!

    1. He actually should have mined his own raw materials and then made his own transistors and passives – what are we, elementary school children that BUY our components because we need to be spoon fed our electronic designs? Come on, its not like programming might be easier to some people than calculating RC values – its easier for me, therefore thats how you should have done it!

      1. Mining? In my day we didn’t have mining. We just watched the stars until a bright one fell to the earth then we tracked it down over hill and dale until we found the impact crater. That was real man’s work, hunting down the death of stars to find the precious metal for making weapons and tools.

        1. You were lucky enough to have stars – I remember being told about only having amorphous gas clouds, with mostly light elements, and having to wait for heavier elements to be created by fusion. Things were tougher, by by God, they were better!

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.