Delay using LM356 as comparator

Thread Starter

Mezzer26

Joined Jan 11, 2016
26
Hey guys,
IMG_20160111_165107_Mezzer26.jpg

Ive just started to dabble with electronics and thought that this would be a good project to learn about transistors. The goal is to have a mechanical switch (normally open) that when closed turns on a motor, but then stop the motor after ~20 seconds if the switch doesn't become open again. I currently have the op-amp set up so that Vcc+ = 9V, Vcc- = 0, V- = 1V, and V+ is the voltage across the cap (Vc). The issue is that the led turns off when V+ = V- but then turns back on right after.

Most of the resistor values are 330 or less, the drain resistor R is 33k, C is 220uF, op amp output when switch is open is 7.5V and then drops to .88V when closed and to .05 when V- is reached and then jumps back to .88V, the cap gets charged to a max of 7.5V and then drains to .45V. The NPN's are 2n3904 and the PNP is 2n3906. Right now I'm just using LEDs to test the circuit and will get adequate components to run the motor, and I removed the resistor from the output to the base.
The last thing to note is that when I make Vcc- = -9V, the circuit works as I had intended and goes down all the way to -9V as expected, -.88 or something akin to that.

My questions are essentially: Why does the op amp output voltage drop so low when the switch is closed and why does it go from on to off and back to on? Why does -9 work? Any info you can give me on operation is much appreciated as well as any other circuit ideas. Also, I am trying to stay away from IC's so I can get a better handle on transistor switching (first time using them) but any ideas with them are welcomed so i know for future use.
 

dl324

Joined Mar 30, 2015
11,000
I couldn't find a datasheet for LM356. All references gave me LM386; which wouldn't make a good comparator.

Do you mean LF356? It would work a as a comparator, but it would be a waste.
 

wayneh

Joined Sep 9, 2010
16,398
I'm having trouble following. Could you draw in the resistor values and show how the power is applied? I don't understand what you mean about setting Vcc to -9V. That would destroy the op-amp.

I assume LM358 op amp?
 

Thread Starter

Mezzer26

Joined Jan 11, 2016
26
Just double checked, it is an LF356. That brings me to a new question, what datasheet specs should I look for in a comparator?
 

Thread Starter

Mezzer26

Joined Jan 11, 2016
26
yeah. when Vcc- is set to ground and the second 9v supply is removed (so only the top 9v supply remains) it goes off once it reaches the reference of 1 volt and then after dropping .2 volts it turns back on
 

hp1729

Joined Nov 23, 2015
2,304
Hey guys, View attachment 98493

Ive just started to dabble with electronics and thought that this would be a good project to learn about transistors. The goal is to have a mechanical switch (normally open) that when closed turns on a motor, but then stop the motor after ~20 seconds if the switch doesn't become open again. I currently have the op-amp set up so that Vcc+ = 9V, Vcc- = 0, V- = 1V, and V+ is the voltage across the cap (Vc). The issue is that the led turns off when V+ = V- but then turns back on right after.

Most of the resistor values are 330 or less, the drain resistor R is 33k, C is 220uF, op amp output when switch is open is 7.5V and then drops to .88V when closed and to .05 when V- is reached and then jumps back to .88V, the cap gets charged to a max of 7.5V and then drains to .45V. The NPN's are 2n3904 and the PNP is 2n3906. Right now I'm just using LEDs to test the circuit and will get adequate components to run the motor, and I removed the resistor from the output to the base.
The last thing to note is that when I make Vcc- = -9V, the circuit works as I had intended and goes down all the way to -9V as expected, -.88 or something akin to that.

My questions are essentially: Why does the op amp output voltage drop so low when the switch is closed and why does it go from on to off and back to on? Why does -9 work? Any info you can give me on operation is much appreciated as well as any other circuit ideas. Also, I am trying to stay away from IC's so I can get a better handle on transistor switching (first time using them) but any ideas with them are welcomed so i know for future use.
Would it work better with an LM393?
 

dannyf

Joined Sep 13, 2015
2,197
Why does the op amp output voltage drop so low when the switch is closed
Because that's how you designed it.

and why does it go from on to off and back to on?
The oscillation is by design:

1) when the circuit is first powered on, the opamp outputs a low, as the capacitor is being charged up.
2) once the voltage of the capacitor reaches 1v, the output is turned high;
3) which turns on the left most transistor;
4) which closes the relay;
5) which turns on the middle transistor;
6) which cuts off the right most transistor;
7) which allows the capacitor to discharge via the resistor in parrallel with it;
8) that discharge stops once the voltage over the capacitor dips below 1v;
9) at that point, you go back to 1)/2) above.
 

ronv

Joined Nov 12, 2008
3,770
Boy, is that an ugly IC. :eek:
I think your problem may be that the inputs can only work at 3 volts above the negative supply. See common mode range in the data sheet.
You need an IC made to run on a single supply. A comparator like mentioned in post #9, or if you want to use an op amp an LM358 would do it.
 

hp1729

Joined Nov 23, 2015
2,304
Because that's how you designed it.



The oscillation is by design:

1) when the circuit is first powered on, the opamp outputs a low, as the capacitor is being charged up.
2) once the voltage of the capacitor reaches 1v, the output is turned high;
3) which turns on the left most transistor;
4) which closes the relay;
5) which turns on the middle transistor;
6) which cuts off the right most transistor;
7) which allows the capacitor to discharge via the resistor in parrallel with it;
8) that discharge stops once the voltage over the capacitor dips below 1v;
9) at that point, you go back to 1)/2) above.

3) turns on the transistor if the switch is closed.

Current condition since power on, the left transistor is on and the capacitor is charged. The op amp output is high, enabling the left transistor.

When the switch is pressed the left transistor turns on the middle transistor. The right transistor turns off. Eventually the capacitor discharges below 1 Volt and the op amp output goes low turning off the left transistor.

... depending on how long the switch is pressed.
 

Thread Starter

Mezzer26

Joined Jan 11, 2016
26
Thanks for all the replies, I'll order some proper comparators in the morning. Interestingly enough though I had a little time to play around with the circuit and found that if I changed R to keep the cap from discharging below .85 volts the circuit works as planned. Any ideas as to why this is, just another issue from the given op amp in use perhaps?
 

hp1729

Joined Nov 23, 2015
2,304
I'm having trouble following. Could you draw in the resistor values and show how the power is applied? I don't understand what you mean about setting Vcc to -9V. That would destroy the op-amp.

I assume LM358 op amp?
I don't understand what you mean about setting Vcc to -9V.
Original drawing has -V of the LF356 going to ground. It worked better after putting -V to -9 V, no surprise there.
And yes, the LM358 would be a good choice.
 

ebeowulf17

Joined Aug 12, 2014
3,274
The datasheet also says the recommended supply voltage is +/-15V. You're getting 3/5 of the way there with +/-9V, but only half of that with +9V. Elsewhere on the website they list 10V minimum total supply voltage (+10 or +/-5)
 
Top