How to compare an ac signal with a dc reference using a comparator?

Discussion in 'Digital Circuit Design' started by anishkgt, Jun 30, 2018.

  1. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    To answer the title question, the only way i could think of is this ? but they don't seem to be working. The AC rms voltage at the input is 33v and the reference voltage at pin 3 is 2.6v. voltage at pin 4 is 2.2. The opamp output is always high even when i change the voltage 26vac. I wanted the opamp to go low when the voltage dropped below 30vac.

    The reason for the large cap is that mains voltage comes in momentarily hence a protection zener diode D2.
    Capture.PNG
     
  2. ericgibbs

    Moderator

    Jan 29, 2010
    7,831
    1,592
    Cautionary Warning.
    This project should be enclosed and in a secure location where unskilled persons cannot come into contact with the electrical circuitry.
    It is the sole responsibility of project builder/installer that their local electrical safety codes are followed and equipment displays the appropriate warning/hazard labels.

    Ref safety guidelines:
    http://www.repairfaq.org/sam/safety.htm
     
    anishkgt likes this.
  3. ericgibbs

    Moderator

    Jan 29, 2010
    7,831
    1,592
    hi anishkgt,
    Could you please confirm what is the voltage on these pins and its source.?
    E
    AA1 30-Jun-18 11.57.gif
     
  4. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    7,826
    2,202
    There is no DC relationship between IC1 pins 3 and 4. Pin 4 is completely floating with respect to GND. For the comparator to work correctly, both inputs must have a common reference potential - not connected directly to the same voltage, but connected to voltages that are reverenced to the same GND.

    ak
     
  5. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    That would 33vac when the secondary are open and when the scr are triggered they would have mains voltage going through but that would be for 500ms max time.
     
  6. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    thank you that was something new for me.

    In that case would it work when C1 were in parallel between pin 4 and GND ?
     
  7. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    7,826
    2,202
    What is the electrical relationship between NEUTRAL and GND?

    ak
     
  8. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    From the schematic, they are indeed isolated.
     
  9. DickCappels

    Moderator

    Aug 21, 2008
    5,519
    1,722
    If it is what I call a "real neutral" neutral is earthed somewhere in the electrical system. In my house that is at the breaker panel.

    The current from the line should return to Neutral, not ground. All the stuff that connects to ground in your circuit should connect to neutral instead. Your reward, in addition to possibly saving a life is that your circuit can function more reliably since the reference point for your circuit (ground in your circuit) will not have to go all the way back to the distribution/breaker box or in some cases all the way back to the distribution transformer to connect to neutral.

    Where does the +5V supply come from and how does it connect to ground and neutral?

    The presence mains voltage for much less than 500 milliseconds can (I think) kill a person. I have accidentally come in contact with 240 VAC and I can assure you that the contact lasted mere milliseconds but was very painful.

    May we see what else is connected to this detector circuit?
     
  10. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    The GND is the actual GND to which the other components on the circuit connect to. The neutral line, as in LIVE NEUTRAL and EARTH. on a mains electrical wiring. The +5v comes from pcb transformer on the PCB which goes into a bridge and a regulator IC.
     
  11. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    Attached full schematic.
     
    • SPW.pdf
      File size:
      94.9 KB
      Views:
      34
  12. DickCappels

    Moderator

    Aug 21, 2008
    5,519
    1,722
    Thank you for posting the complete schematic.Now we can see what is what and why you are doing things the way you are doing them.

    Please confirm that your circuit ground will connect with the earth ground. Otherwise you can't count on the low voltage detector to work.

    It looks like you have about a 1 volt offset between neutral and your circuit ground. You can fix that if you return R21 to your circuit ground instead of Neutral. In that case I would raise R1 to 10 Meg ohm and R2 to 1 Meg. This keeps the available current very low. I checked your comparator's data sheet and it looks like the 910 k impedance presented by the larger divider values are unlikely to be a problem.

    Edit: Increased suggested values for R1 and R2.
     
    Last edited: Jul 1, 2018
  13. WBahn

    Moderator

    Mar 31, 2012
    24,207
    7,538
    Perhaps I missed it, but what does it mean (for your purposes here) to "compare" an AC signal with a DC signal? Do you mean when the RMS voltage is above the DC reference? Or any time it is instantaneously above it? What do you want the circuit to do, given that even for a large AC signal the AC voltage is going to be rising above and below the DC reference each cycle?

    It looks to me like this circuit would turn the LED on continuously when the LIVE line is always below the DC threshold. This should result in the comparator output a HI (which is an open in this case), so the pullup turns on the transistor and you should get two or three millamps through LED. At the AC signal increases, it should start going off momentarily (each cycle) once the peak signal, divided down, is larger than the DC reference level. As the AC amplitude increases further, the LED will spend more and more of it's time off, so the LED brightness will appear to dim as the signal increases.

    Is that the behavior your want? If not, what is the behavior you want?

    Also, what is the purpose of R4? You have a potentiometer supplying your reference singal, why doesn't it provide a suitable reference?

    Why are the 1 kΩ resistors 1/4 W? If they were directly across the 5 V supply they would only dissipate 25 mW.

    Your resistors result in the transistor base current, when on, being pretty nearly equal to the collector current. Is there a reason to drive the transistor that hard into saturation?
     
    DickCappels likes this.
  14. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    Partially yes, I wanted the LED to go ON when the ac voltage dropped below the reference voltage and OFF when it went above it.

    R3 and R4 made the voltage divider to set the reference voltage. Just replaced R3 with a trimm pot.
    Did not do any calculation whatsoever just designed taking an example such as "transistor as a switch".

    Since that did not work i thought working these out at the secondary would be better. With the schematic attached the 33VAC is detected by the opto-couplers and it sends a pulse to the MUC which switches on the SCRs and this TRIAC. Basically the TIRAC acts like a crowbar shorting the contacts AC1 and AC2. This circuit would be in series with the secondary. Just not sure if the TRIAC would be able handle the current passing through. The Transformer is rated for 800A but that much would not be going through at any given time.
    Capture.PNG
     
  15. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    That TRIAC wouldn't stand that huge current, practically that could blow-up.

    Anyway of replacing that triac with something else ?
     
  16. WBahn

    Moderator

    Mar 31, 2012
    24,207
    7,538
    Actually, you didn't just replace R3. R3 is a two-terminal device and you replaced it with a three-terminal device in such a way that it is no longer a simple voltage divider with R4. You can eliminate R4 because your trim pot is effectively both R3 and R4. R3 is the part of the trim pot between the wiper and ground and R4 is the part between the wiper and 5 V.
     
  17. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    Are there any components that could replace the function of the triac in the schematic.
     
  18. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    9,689
    2,340
    Depends how often the triac is being switched. If only occasionally, a contactor would do the job.
     
    anishkgt likes this.
  19. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    Well it would conduct for 50ms max but how long would kill it ? Haven’t really measured the weld current during a spot weld I am guessing it would table about 300A. The open RMS voltage is about 2.6v and VPP is 8v
     
  20. anishkgt

    Thread Starter Member

    Mar 21, 2017
    348
    13
    The sense voltage is 400mV and the frequency is 100Hz. A Low pass RC filter is15.9kΩ resistor and 0.1uf ceramic cap. Since i did not have a 15.9k resistor i connected five 1k resistors and a 10k in series on a bread board but that even blocked this signal within the 100Hz. Is it because of the bread board that this happened or should the be a single 15.9k resistor ?
     
Loading...