Opamp Comparator oscillating GND and VCC

Discussion in 'Analog & Mixed-Signal Design' started by anishkgt, Apr 3, 2018.

  1. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    Hi All,

    i am trying to keep the out of the opamp to GND when the input at the inverting pin goes above 0.2v set ref. At the moment it oscillates at GND and VCC. How can i achieve it ?

    cs1.JPG
    R4 and C1 makes the low pass filter.
     
  2. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    6,181
    1,442
    As your input goes above and below the 0.2V reference voltage so the output switches between high and low.
    You can see the effect of the reference voltage as the high part of the output waveform is wider than the low part.

    What are you trying to achieve?
     
    anishkgt likes this.
  3. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    Ah Thank you that explains the pwm.

    I'll try to explain the whole idea behind this. The source of the signal is from the mains but parallel to Microwave Oven Transformer (MOT) with its secondary rewound with 3AWG cable for spot welding. When the MOT is OFF there is a voltage of 1.2vac at the primary and when the secondary are shorted a voltage 0.2vac. The MOT switch ON is controlled via two SCR in a back-to-back configuration. Basically a TRIAC. So the voltage at the primary is the leakage from the SCR's which am using it as an advantage to avoid a button.

    Lets assume we have a push button switch to switch ON the spot welder. We press it and that switches ON the MOT and we spot weld nickel tabs to 18650 cells. All looks good and Hunky-Dorey. Now lets say you have to build a battery pack of 300 cells and pressing the switch 300 times or a foot switch would be........a little uncomfortable or your legs get exhausted while pressing the pedal 300 times to spot weld those cells.

    Here we are replacing the 'SWITCH' by sensing when both electrodes makes a contacts on the nickel tabs. When it does current is drawn from the MOT and that draw will show a voltage drop at the primary and that voltage-drop is something that am trying to sense which would fed into an Arduino to activate the MOT.
     
  4. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    6,181
    1,442
    So, let me get this clear. The voltage must be off, then press the electrodes against the tab, then turn on the voltage?
    Does the voltage need to be switched off before the electrodes are removed?
    Is the voltage to be applied for a specific time or does the operator decide when the weld is complete?
     
    anishkgt likes this.
  5. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    “The voltage must be off” you mean the mains ? The opamp out I am guessing. I would just need the some output either high or low when the secondary are shorted. I could achieve it by adding a diode but wanted a second opinion. The signal is fed into a MCU and with code the MOT would be switched ON. The max weld time would be 500ms with the lowest being 10ms.
     
  6. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,596
    1,950
    Try a diode in series with R4.
     
    DickCappels likes this.
  7. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    Yes I do get the required output. But wanted a second opinion on it.
     
  8. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    Did that and it does work but are there any other concerns ? the max time 240vac would pass through would be 500ms.
    Capture1.PNG
     
  9. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,596
    1,950
    C1 will need a discharge resistor.
    If Vin can be 240VAC then the whole circuit would be at a dangerous potential and components would need to be mains-voltage rated. 500mS is more than enough time to electrocute you!
    1.2VAC is hardly enough to drive an optocoupler to give you mains isolation, but perhaps you could wind a small isolating transformer to go in series with the MOT primary?
     
    Last edited: Apr 3, 2018
  10. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    C1 capacitance is quite low. That is part of R4 which makes the RC filter.

    Yet to try this on pre-board but from the looks of it, seems to work.
    Capture1.PNG
     
  11. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,596
    1,950
    I'd be inclined to change some of those values, to avoid an electrolytic cap and bearing in mind the high voltages possible.
    Try :-
    R4=100k,
    Replace C1,C2 by a single 33n,
    R5 = 2 x 470k in series,
    R1 = 2 x 470k in series,
    D2 = 3V zener.
    I still think some form of mains isolation should be used, unless there's no prospect of anyone touching any part of the circuit.
     
    anishkgt likes this.
  12. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    Thanks that did help me avoid a beefy cap.

    The pcb will be inside an enclosure so that would take care of anybody accidentally touching it.
     
  13. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    This just crossed my mind, would it be ok to have the neutral from the mains connected to GND in this circuit or should it be isolated as shown.

    [​IMG]
     
  14. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,596
    1,950
    I'd leave it isolated. Depending how your property is wired and your power company operates you might trip a ground-leakage circuit-breaker if you short neutral to ground. In principle they are already shorted at some point. In the USA this is at the consumer panel, but in the UK it may only be at the generator station and there can be several volts between neutral and ground at the consumer end.
     
  15. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    6,181
    1,442
    Agreed.
    Then for the circuit to work properly the ground on the isolated side must be connected to mains earth.
    I suggest that the lower ends of C19 and D8 should be disconnected from neutral and connected to the mains earth.
     
  16. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    Thank you guys. Appreciated.

    So am trying to avoid the earth wiring as much as possible since i'd only need the transformer connected to Earth and nothing else.

    "I suggest that the lower ends of C19 and D8 should be disconnected from neutral and connected to the mains earth." why would would it be needed. I mean i don't get it really, would it work ?
     
  17. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    Wouldn't resistors R21 & R36 drop voltages when a 1.2vac and .2vac goes through because that is what am trying to sense here.
     
  18. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    6,181
    1,442
    As the circuit stands, if there is any spike of voltage between neutral and earth then C19 couples that spike direct to IC6 input.
    D8 limits the voltage at the mid point of the R21, R36 divider but, again, as it stands that limited voltage is referenced to mains neutral and it would be better referenced to the IC6 0V (mains earth).
     
  19. anishkgt

    Thread Starter Member

    Mar 21, 2017
    179
    7
    Would this be correct ? shouldn't there be a 1Meg resistor in series to that pin ?
    cs.JPG
     
  20. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    6,181
    1,442
    EP should be connected to GND and GND should be connected to mains earth.
     
Loading...