3
\$\begingroup\$

I'm building a Latching circuit using 555 IC. The schematic is as follows: enter image description here

The Input voltage is 12V and is used to operate the 555 IC that switches a relay coil through a transistor. When the circuit is implemented on a breadboard, it turns on when the power is first connected. How can I change it to be off when power is first connected? Also, it turns on when button is pressed and then off when pressed again. How to make it turn off by long press?

\$\endgroup\$
7
  • \$\begingroup\$ Sounds like you want something like this. In this example, PB is your push button state (it can jitter at the leading and trailing edges) and "long" is a one-shot triggered by the rising edge of PB and set with a timer for your "long hold" period. "clk" is generated using another one-shot with a very short time and is only allowed to trigger from the falling edge of PB if either "pwr" or else "long" is LO. "pwr" is an FF clocked by "clk" and reset by a power-on event. Is that about what you want? \$\endgroup\$ – jonk Apr 9 at 3:31
  • \$\begingroup\$ Yes. How can I edit the above circuit to be off when long pressed? And how to make it off when power is first applied to it? \$\endgroup\$ – ElectroMechanical Apr 9 at 10:12
  • \$\begingroup\$ An MCU in SOT-23-6 would be the obvious choice. But that requires programming tools and skills. A boutique IC part would also be obvious. Do you want to do this discretely? Or do you want to use the 555 and logic parts? Or? \$\endgroup\$ – jonk Apr 9 at 11:50
  • \$\begingroup\$ I want to use the 555 ic and edit the above circuit to get the desired output \$\endgroup\$ – ElectroMechanical Apr 9 at 19:00
  • \$\begingroup\$ I think you may need two 555s. At the very least. As well as, perhaps, some other parts. Also, I would not use your above circuit. Is that okay? If not, I probably can't be much use to you. \$\endgroup\$ – jonk Apr 9 at 19:07
3
\$\begingroup\$

Behavioral Overview

Although a SOT-23-6 MCU is the obvious approach, if you want to avoid the toolchain and coding work involved in using one, then the following timing diagram illustrates one approach:

enter image description here

  • pwr is a power-on flip-flop that is clocked by clk. It is reset by a power-on event.

  • long is a one-shot with a long time period that represents your long-press period. It is always triggered by the rising edge of your push-button. It is assumed that its time is very much longer than the debouncing time required by the push-button when pressed.

  • clk is a one-shot with a time period long enough to form a good clocking pulse for the pwr FF and also long enough to cover the debouncing period required when the push-button is released. It is triggered by the falling edge of your push-button when \$\overline{\textbf{long}}\:+ \:\overline{\textbf{pwr}\vphantom{\textbf{long}}}\$.

  • PB is the push-button.

The power will be engaged upon the release of the initial power-on button-press (any short press will work) and will continue until very shortly after the release of a long-press of the button. If the button-press is too short to turn the power off then the falling edge of PB will occur before long goes low and, as both long and pwr are still high, clk will not be triggered and pwr will remain active.

Again, if the toolchain and coding effort is acceptable to you then a SOT-23-6 MCU would be a better choice here. Small, cheap, programmable to your specific needs, etc. But if that's a problem, then I think you are asking for something like the above.

555 Design

To implement the above with 555 devices would require something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

The power-on reset signal is generated by an RC and a CD40106B Schmitt inverter. This will be used to generate a clean reset for the circuit.

(There are six Schmitt inverters in the CD40106B package and this circuit uses three of them. So the package will be half-used.)

The push-button is just a pull-up resistor and the switch to ground.

There are two one-shots made out of the 555 IC.

The first (at bottom, above) provides a long timing pulse that is triggered by the rising edge of the PB input. You can adjust the resistor or capacitor values that are attached to the discharge and threshold pins to adjust the long timing period to your liking. I've set it here to about \$3\:\text{s}\$.

The second (at top, above) provides a short clocking pulse for the power FF that is triggered by the falling edge of the PB input. However, in this case, there are times when we don't want to allow the short clocking pulse. So the BJT transistors are added here, along with four resistors, to form a circuit designed to inhibit the clock pulse generation when both LONG and PWR are both HIGH. Otherwise, it's allowed.

Finally, there is the power-on state FF portion. You can use its output to drive a BJT circuit that activates your relay, for example. Or for other purposes. It's active-HIGH. This uses the CD4013B IC, which contains two FF devices. (Only one is used.)

Here's an illustrative output from a run on LTspice of the circuit:

enter image description here

Above, you can see the push-button events on the bottom green curve. (I had to sum three separate switches in LTspice to emulate that.) The next up, red, is the PWR output. You can see that it is switched off when the push-button is held for \$3\:\text{s}\$ but that it is not switched off when the push-button is held for \$2\:\text{s}\$ on the second attempt (right half.) Above that, light blue, you can see the LONG timer output. It responds to the rising edge of the push-button and is used to measure the duration of the push-button. And finally at top, in violet, is the CLK that drives the PWR FF, if the falling edge of the switch is allowed to pass through to it.

Now you can see why no one ever did this until MCUs were available. With an MCU, it's just a cheap, tiny, push button switch and a user who is now forced to learn that holding a switch for a while turns things off.

(There is another use, which is that the MCU isn't forceably turned off when it's not expecting it. It's allowed to 'do things' before turning off or to go into a sleep mode. None of which applies in your case.)

A question might be, "Why would you go to all this trouble just to emulate an MCU rather than simply use a slide or toggle switch?" It's easy. 'On'/'Off'. And more available around the world, too.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ If someone wonders how did we live before MCUs, here is a perfect answer... terribly ;) \$\endgroup\$ – Maple Apr 10 at 3:54
  • \$\begingroup\$ @Maple Yes. I never had to solve this problem in 1980. But if I needed to, I suppose this might have been one way. It sure takes one back a bit. ;) \$\endgroup\$ – jonk Apr 10 at 4:07
1
\$\begingroup\$

I think the best way to modify your schematic to do what you want is to throw away most of the parts and use LTC2954 push button controller. It is designed exactly for one button control, does debouncing for you, supports adjustable power on and power down times and works up to 26V. Oh, and it does not assert output when you first apply power to it.

\$\endgroup\$
1
  • \$\begingroup\$ I don't have this IC in my country. I want to edit the above circuit to perform the required function. \$\endgroup\$ – ElectroMechanical Apr 9 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.