Toggle circuit doubts

Thread Starter

xox

Joined Sep 8, 2017
936
I'm trying to put together a simple toggling circuit using op amps. You know, press a momentary switch and the output goes low, push it again and it goes high.



toggle.png



I haven't bread-boarded the circuit yet, just a simulation with ideal op amps, so I have no idea if it'll even work at this point.

Does it look kosher to you guys?

Also, the ultimate goal of this project is to interface with the household wiring in such a way that I can turn the lights in my study on and off by simply tapping a button. What's the best way to do that, a relay? I'd like the control circuit to draw as little power as possible.
 

OBW0549

Joined Mar 2, 2015
3,566
Does it look kosher to you guys?
No.

The (+) input of your left-hand op amp is connected to 0V while its (-) input is connected to +5V, regardless of the position of the switch. Thus its output is always low, and never changes.

The (+) input of the right-hand op amp is also grounded, and the (-) input is connected to +5V when the switch is closed; in that condition, the op amp output will be low. When the switch is opened, however, the op amp's (-) input is floating, thus the output is undefined.

Your concept needs some work.
 

soyez

Joined Aug 17, 2020
51
Only two states, high and low, similar to any computerized rationale. On the off chance that you need to do various states that you're pushing through, I feel that would require a microcontroller. You'd likely have one in your circuit in any case for tha
 

Thread Starter

xox

Joined Sep 8, 2017
936
Yep, it was a crappy design TBH. The CD4013 should work fine with a simple NPN driving the power relay. Thanks guys!
 

dl324

Joined Mar 30, 2015
18,326
Here's another option from Popular Electronics April 1977:
clipimage.jpgclipimage.jpg

You'll probably need to buffer the output.
 

AnalogKid

Joined Aug 1, 2013
12,129
If you are powering the circuit with an *isolated* 5 V supply, they you will need some kind of isolated power switch: relay, solid state relay, optically-coupled TRIAC driver, etc.

OR - an impulse relay can do both the latching and the power driving, so you just need a power source for the coil and the pushbutton switch. If you use a relay with a 120 Vac coil, now you're down to just two components. Note: this is a physically large and expensive solution, but is is simple.

Note: The circuit in post #7 can be built with just about any type of inverting gate.

ak
 

Thread Starter

xox

Joined Sep 8, 2017
936
If you are powering the circuit with an *isolated* 5 V supply, they you will need some kind of isolated power switch: relay, solid state relay, optically-coupled TRIAC driver, etc.

OR - an impulse relay can do both the latching and the power driving, so you just need a power source for the coil and the pushbutton switch. If you use a relay with a 120 Vac coil, now you're down to just two components. Note: this is a physically large and expensive solution, but is is simple.

Note: The circuit in post #7 can be built with just about any type of inverting gate.

ak
I would like to power the circuit with a simple 120v-to-5v isolated power supply, so I guess the first option would be best. Do you have any recommendations for which relay to use? Inexpensive, preferably.
 

Thread Starter

xox

Joined Sep 8, 2017
936
Okay, thanks guys. Maybe something like this then?


toggle.png


The op amps are all single supply configuration. One possible issue however, I don't think the initial state is guaranteed. I thought of using a pull-down resistor on the inputs but then again that might cause the circuit to toggle by itself unexpectedly, so not quite sure how that would be best solved. Also may be some issues with all the inputs being close to the rails. I'll try the circuit with both the LM324 and LM741 just to see how different types of op amps behave with that setup.
 

Thread Starter

xox

Joined Sep 8, 2017
936
Okay, this version is little better. I've moved the capacitor to the other side of the switch, so now it starts up in a predictable state.


toggle.png


The only real issue now is the fact that if you hold down the switch for long enough, the circuit effectively becomes an oscillator! Not a deal breaker in and of itself however, since I'm actually okay with that behavior so long as it only happens for extended presses. I just don't want it to happen mid-press. It would be nice though if it didn't oscillate at all. Any ideas?
 

crutschow

Joined Mar 14, 2008
38,505
It would be nice though if it didn't oscillate at all. Any ideas?
It oscillates because it's build differently from the circuit in post #7, which doesn't oscillate.
Your circuit is a relaxation oscillator.

If you want the circuit in post #7 to power up in a known state, add a small capacitor to the input of the left gate to either ground or +V.
 

Thread Starter

xox

Joined Sep 8, 2017
936
Replacing the negative feedback resistor with a buffer seemed to do the trick.


toggle.png


Allows for a much broader range of values for the capacitor too, which is kind of nice. Overall it seems very stable. Just need to breadboard it now.
 

crutschow

Joined Mar 14, 2008
38,505
Replacing the negative feedback resistor with a buffer seemed to do the trick.
Still looks problematic.
Your negative-feedback loop will want to settle at a voltage where the capacitor equals 1/2 the supply voltage.
 
Last edited:

Thread Starter

xox

Joined Sep 8, 2017
936
Still looks problematic.
Your negative-feedback loop will want to settle at a voltage where the capacitor equals 1/2 the supply voltage.
I see, and so that would make the circuit unstable as the biasing resistors are feeding 1/2V to the + input terminals, correct? Maybe I could just lower the resistance of the right hand resistor such to raise the biasing point somewhat above 1/2V?
 

Thread Starter

xox

Joined Sep 8, 2017
936
How would that help?
It still would want to settle at that voltage.
Well I assumed that was what you were implying, that it would conflict with the biasing circuit. Apparently not. Could you please explain what issue you were alluding to then?

Why not use the post #7 circuit?
Well, I thought I had, to be honest. An op amp with it's + to 1/2V should act like an inverter in this case. When the negative input rises above the 1/2V the output should be ~0V, whereas when it falls below 1/2V it should output close to V. So post #12 should work basically the same as #7, shouldn't it?
 
Top