Delay using LM356 as comparator

Discussion in 'The Projects Forum' started by Mezzer26, Jan 11, 2016.

  1. Mezzer26

    Thread Starter New Member

    Jan 11, 2016
    17
    0
    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.
     
  2. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    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.
     
  3. wayneh

    Expert

    Sep 9, 2010
    12,120
    3,046
    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?
     
  4. Mezzer26

    Thread Starter New Member

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

    Thread Starter New Member

    Jan 11, 2016
    17
    0
    Wayneh,
    this is the configuration in which it is currently operating,

    IMG_20160111_182850_Mezzer26.jpg
     
  6. wayneh

    Expert

    Sep 9, 2010
    12,120
    3,046
    Great, thanks. And everything is great with the split supply, but you get odd behavior when V- is ground?
     
  7. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,043
    3,807
    How about updating your title - look just above the first post on this thread - EDIT option (I think).
     
  8. Mezzer26

    Thread Starter New Member

    Jan 11, 2016
    17
    0
    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
     
  9. hp1729

    Well-Known Member

    Nov 23, 2015
    1,951
    219
    Would it work better with an LM393?
     
  10. dannyf

    Well-Known Member

    Sep 13, 2015
    1,809
    361
    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.
     
  11. wayneh

    Expert

    Sep 9, 2010
    12,120
    3,046
    4). There is no relay
     
    absf likes this.
  12. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,290
    1,255
    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.
     
  13. hp1729

    Well-Known Member

    Nov 23, 2015
    1,951
    219

    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.
     
  14. Mezzer26

    Thread Starter New Member

    Jan 11, 2016
    17
    0
    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?
     
  15. hp1729

    Well-Known Member

    Nov 23, 2015
    1,951
    219
    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.
     
  16. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
  17. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    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)
     
Loading...