Author Topic: How to set reference for a sine wave with dc supply  (Read 6070 times)

0 Members and 1 Guest are viewing this topic.

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
How to set reference for a sine wave with dc supply
« on: June 18, 2018, 03:12:39 pm »
Hey all,

I am trying use a comparator to read an ac voltage and get HIGH when the voltage goes below 30vac and a LOW it goes above 30vac. Can somebody please help me here. I can understand setting a reference voltage for a dc when sensing the same but sensing the AC is something new.
« Last Edit: June 18, 2018, 07:31:29 pm by anishkgt »
 

Offline pelule

  • Frequent Contributor
  • **
  • Posts: 513
  • Country: de
  • What is business? It’s other people’s money
Re: How to set reference for a sine wave with dc supply
« Reply #1 on: June 18, 2018, 04:44:56 pm »
Do you want to controle/regulate VAC peak to peak 30VAC (+/-15V referred to zero/gnd)?
So you could use a AC-to-DC circuit - a bridge rectifier (diodes) and a buffer capacitor to convert the AC voltage to a DC level and compare with a comparator.
/PeLuLe
You will learn something new every single day
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #2 on: June 18, 2018, 04:56:58 pm »
Well i just need to monitor the 30vac. I did think of using a bridge but had a few concerns,
  • would the dc voltage change as the voltage ac changes
  • the same line would have a mains supply as well

The LOAD here is a MOT (microwave oven transformer). The 30vac is the voltage when the MOT is not energized for spot welding but will have this voltage just to sense the voltage drop when the secondary are shorted, which simulates a weld.
 

Offline exe

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: How to set reference for a sine wave with dc supply
« Reply #3 on: June 18, 2018, 06:08:29 pm »
I'm not sure I understand the task because there are so many things on the schematic that look to redundant.

Please see "my" way. It's not ideal, but should be good enough. As a precation, I picked random opamp, no clue if it's suitable for this application. Also, many opamps have diode clamp between input, those are not suitable for this. Also, opamp works quite slow because output has to swing a lot. I'm pretty sure there are better comparators.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #4 on: June 18, 2018, 06:14:33 pm »
Thank you exe. Yes the schematic is not the best just on the paths of learning and following google images.

I've got one as well which i've done with the best i've learned. The truth table for a comparator is like this

If V+ > V-  then, Vcc
If V+ < V- then, Vee

but i don't see any change in the output, wonder why.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #5 on: June 18, 2018, 07:08:08 pm »
Realized it was the voltage follower that was connected in the wrong manner.
 

Offline exe

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: How to set reference for a sine wave with dc supply
« Reply #6 on: June 18, 2018, 09:00:45 pm »
What's the purpose of voltage follower?
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #7 on: June 18, 2018, 09:04:38 pm »
I read it would be a good to have it in designs to keep the voltage stable. but i guess those are used when a heavy loads are used ? i just have a NPN transistor connected to an LED and a microcontroller.

Is it necessary in this design ?
 

Offline exe

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: How to set reference for a sine wave with dc supply
« Reply #8 on: June 19, 2018, 07:26:58 am »
Is it necessary in this design ?

I still not sure I fully understand what your circuit does (like, why there is a resistor from V+ to output? why U2 in inverted configuration? Is R6 for hysteresis?), but no, U2 doesn't add any value _in this case_ as it has same driving capabilities as U1. I'm pretty confident just one opamp is enough.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #9 on: June 19, 2018, 09:33:03 am »
Here is the final schematic that i think would work. The load here is a MOT. The contact sense part was what i was designing.

The idea is to avoid manually triggering the SCR via switch. Here the voltage drop at the primary of the MOT is sensed by the comparator and send to the microcontroller which switches ON the SCRs. The Spot welding can be done by just shorting the secondary.
 

Offline exe

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: How to set reference for a sine wave with dc supply
« Reply #10 on: June 19, 2018, 11:51:55 am »
Sorry, can't follow the schematic. It's not drawn a conventional way. Like, inverted T3 that has GND on top makes it hard to read. Or single +5V port used for all the connections. R23/R23 divider drawn in a very strange way making it hard to see it's just a divider. The picture is also too small so some symbols not readable.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #11 on: June 19, 2018, 12:27:12 pm »
Hopefully this should be better.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #12 on: June 28, 2018, 10:43:38 pm »
Well, things are never as it seem on a computer simulated environment than in real life.

I just got the boards made, soldered them and they don't seem to be working as i thought it would. I checked to see the ac voltage it is 33vac and at pin 4 (Non-inverting pin) the voltage does not change when there is a voltage drop at the ac line. The voltage drops to 28vac.

Would it be because of the the filters cap and the diode ?
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #13 on: June 28, 2018, 11:30:37 pm »
Do you want to controle/regulate VAC peak to peak 30VAC (+/-15V referred to zero/gnd)?
So you could use a AC-to-DC circuit - a bridge rectifier (diodes) and a buffer capacitor to convert the AC voltage to a DC level and compare with a comparator.
/PeLuLe
That was something I had done but I am not sure if I have the wiring correct. I have the return from the ac voltage divider back to the neutral. Should it be back to GND ?

When I reduce the voltage at the ac I can see a drop in voltage the cap but that voltage cannot be fed in the opamp as it is quite high, 38v. Should I drop the values on the resistors of the voltage divider at the ac side ? I have a 5K trim pot.


Www.Georgehobby.wordpress.com

Equipments: DSO104z, Hakko FX888D, Brymen BM869s
 

Offline exe

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: How to set reference for a sine wave with dc supply
« Reply #14 on: June 29, 2018, 06:26:28 am »
Well, things are never as it seem on a computer simulated environment than in real life.

I just got the boards made, soldered them and they don't seem to be working as i thought it would. I checked to see the ac voltage it is 33vac and at pin 4 (Non-inverting pin) the voltage does not change when there is a voltage drop at the ac line. The voltage drops to 28vac.

Would it be because of the the filters cap and the diode ?

Hod did you measure the voltage? Before diode it is AC and normally measured with RMS voltage. After diode it is half-wave and I wouldn't measure it as as AC. Rather, I'd looked at peak value.

Concerning the circuit, I don't understand the whole upper block. Doesn't look right to me. Like, why it uses thyristor and not triac. Or why fuse on live_out and not on live, etc. Why using C3? I think it shouldn't be there, as it rectifies voltage, that's not what you want for peak detector.

But even if it was needed, it should have been placed after resistor divider. This way it can be much smaller, smaller voltage rating, and less current through diode.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #15 on: June 29, 2018, 09:16:13 am »
Quote
Hod did you measure the voltage? Before diode it is AC and normally measured with RMS voltage. After diode it is half-wave and I wouldn't measure it as as AC. Rather, I'd looked at peak value.

Concerning the circuit, I don't understand the whole upper block. Doesn't look right to me. Like, why it uses thyristor and not triac. Or why fuse on live_out and not on live, etc. Why using C3? I think it shouldn't be there, as it rectifies voltage, that's not what you want for peak detector.

But even if it was needed, it should have been placed after resistor divider. This way it can be much smaller, smaller voltage rating, and less current through diode.

The RMS voltage was what is measured at 33vac. Earlier i did not measure the peak it was from a DMM. But now checked it with a scope and it reads about 76vac max.

Talking about the upper block, It is quite common to use Thyristors in an industrial environment as they handle more current in a back-to-back configuration. A triac would also work but i decided to go ahead with thyristors. There are two fuse to the whole circuit one at the input and the second at the output (LIVE_OUT). The C3 was used to get a DC voltage for the comparator to compare against the reference voltage of 2.6v. Secondly, at the put, there is 240v as well. The reason being the once the opamp output goes high the microcontroller would switch on the thyristors for welding.

Attached two screen shots from scope. Transformer_OUT is the voltage from the spot welder transformer. Since i did not have way of isolating the mains voltage to use a scope. Second, After_DIODE is the voltage (referenced to GND) after the diode into the cap C3.

The voltage 33vac is applied via a microcontroller with a phase shift after the zero cross is detected, a common way to control power on ac. as explained here http://www.bristolwatch.com/arduino/arduino_power_control.htm
« Last Edit: June 29, 2018, 10:00:42 am by anishkgt »
 

Offline exe

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: How to set reference for a sine wave with dc supply
« Reply #16 on: June 29, 2018, 10:12:16 am »
Ah, now I noticed the second SCR. They are drown a little bit apart, so didn't notice at first glance, sorry.

Did you fix the lower circuit? E.g., removed the capacitor? Without fixing it first taking waveforms doesn't make much sense. I'd also removed upper circuit until the lower part proven to be working.

Labels are also sort of confusing to me. There is live and neutral on the schematic (making me thinking this is important), but it doesn't really matter. I'd just call it AC1 and AC2 or something.

I know you think I'm nit-picking, but what I suggest really helps reading the circuit for a random reader.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #17 on: June 29, 2018, 11:05:09 am »
Thank you for the time. I've removed C3 and attached the wave form.

I can't remove the upper circuit which is where the voltage is coming through as they are driven from microcontroller. I'don't have a bench power supply or a wave form generator.

The LIVE and Neutral are actually how the wiring goes. The neutral the one connected the one of the primary of the transformer and the LIVE goes through the thyristors which is why it is LIVE_OUT. Basically and switch in series with the transformer.

Do let me know if there is anything more i would need to help you understand better.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: How to set reference for a sine wave with dc supply
« Reply #18 on: June 29, 2018, 12:24:12 pm »
What's the purpose of the project?

If you want to control a load, with zero crossing, then an opto-coupler can be used with built-in zero crossing, such as the MOC3041.

If it's an undervoltage protection circuit, then use a low pass filter, before the comparator circuit, to get the average voltage of the rectified waveform.
 
The following users thanked this post: anishkgt

Offline exe

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: How to set reference for a sine wave with dc supply
« Reply #19 on: June 29, 2018, 12:51:42 pm »
To me the resistor divider and diode work: I see truncated sine wave. Not sure where 4V offset comes from. But!

Do you have opamp's ground connected to neutral? They must be connected for this to work. **But this also makes this circuit unsafe.**
 
The following users thanked this post: anishkgt

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19523
  • Country: gb
  • 0999
Re: How to set reference for a sine wave with dc supply
« Reply #20 on: June 29, 2018, 01:04:27 pm »
**But this also makes this circuit unsafe.**
Why? I think you've forgotten this circuit is ELV.
 
The following users thanked this post: exe, anishkgt

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #21 on: June 29, 2018, 08:33:16 pm »
Quote
What's the purpose of the project?

If you want to control a load, with zero crossing, then an opto-coupler can be used with built-in zero crossing, such as the MOC3041.

If it's an undervoltage protection circuit, then use a low pass filter, before the comparator circuit, to get the average voltage of the rectified waveform.

This is part of a spot welder using a MOT. This part of the design is used to avoid using a pedal to trigger the MOT for a weld. The difference in voltage is seen when the secondary are shorted. hence using that as a way to detect when the electrodes touch the nikel plates for a weld.

The idea of a optocoupler with built-in zero crossing is good. But in a inductive load it should not start at zero but has to be at the peak of ta sine wave as to overcome the inrush current from the core of the transformer. Supporting notes (http://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=13C3206_AppNote&DocType=CS&DocLang=EN) and (https://www.st.com/content/ccc/resource/technical/document/application_note/2f/f7/75/f5/9d/3d/44/04/CD00003867.pdf/files/CD00003867.pdf/jcr:content/translations/en.CD00003867.pdf)

This is not a protection circuit but yes it does require a low pass filter but i was concentrating on this and latter add it.
To me the resistor divider and diode work: I see truncated sine wave. Not sure where 4V offset comes from. But!

Do you have opamp's ground connected to neutral? They must be connected for this to work. **But this also makes this circuit unsafe.**

I was thinking of connecting the Neutral to the common GND as the opamp does. Should i do that ?

I've attached the schematic as well with some changes. My PCB is made as per this.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #22 on: June 30, 2018, 09:26:03 am »
Quote
I was thinking of connecting the Neutral to the common GND as the opamp does. Should i do that ?
Nope that did not work either. no voltage at all.
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: How to set reference for a sine wave with dc supply
« Reply #23 on: June 30, 2018, 12:07:53 pm »
   anishkgt

There are two ways to do what you want.

You can sense the voltage between the spot welding contacts.

You can sense the current when the spot welding contacts are shorted.

So think of it this way, When you short the spot welding contacts it turns on a light, The light turning on causes trigger to fire your high current source.

As Hero999 stated you can use a opto-coupler in place of the above light and get isolation from your micro-controller,
 
So you have an opto-coupler led in series between one connection from transformer and a spot welding contact.
Your high current output switch(SCR's) is connected in parallel to this.

When on the SCR's will cause
1. opto-coupler above to go out, the scr's are placing a short across the opto-coupler input.
2. Enable the high current path to the spot welding contact.

Now the input led of opto-coupler does not turn on at 0 Volts but requires some voltage & current. Here you will need a series resistor to protect the LED from full voltage of transformer. By using a combination of voltage divider and series resistor you can make the turn-on of led higher.

To say the above a different way
You are using a opto-coupler to detect the state of the SCR's when your spot welding contacts are shorted.

You have
spot welding contacts open, opto-coupler output off, SCR's off
spot welding contacts shorted, opto-coupler output on, SCR's off
spot welding contacts shorted, opto-coupler output off, SCR's on

C

 
The following users thanked this post: anishkgt

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: How to set reference for a sine wave with dc supply
« Reply #24 on: June 30, 2018, 02:25:40 pm »
Can you please share a rough diagram. I feel you have a valid point but i am unable to follow it completely.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf