Shop OBEX P1 Docs P2 Docs Learn Events
Zero detect and sync to AC with P1? — Parallax Forums

Zero detect and sync to AC with P1?

Is there any chance this would have a value for fan speed control: Zero crossing detect opto triac driver ie MOC3041 and triac BTA40_600 and some other device to detect zero crossing. Have the Prop turn on a pattern of cycles for a pseudo PWM. 50% duty = 1 on then next off. 1 2 on then 3 off. 3 on 1 off. 3 on 2 off. etc. The point being to reduce noise by not turning on the triac at random places. If so what would a nice device be to look at the AC and fire a logic level output for the prop to lock to cycle by cycle.

https://www.onsemi.com/pub/Collateral/MOC3043M-D.pdf
«1

Comments

  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2021-01-17 16:23
    What are wanting trying to accomplish in the end results
    How much amperage are you needing

    The reason I am asking because there are readymade solutions that are out there can be interference with a micro controller board so if you are interested in something like this please let me know and I will post some web site links where you can find one

    “ Zero crossing detect opto triac driver ” —>
    ( you would have to reverse engendering that portion of the circuit [ the part of the circuit that sense zero crossing to the micro controller portion of the circuit ] to understand how it is done )

    You do need to tell me which amperage range you need they come in two flavors 40 amps and 100 amps ones

    These readymade devices are used in battery spot welding machines ( these modules are easily modified-able
    with a little bit of work ) [ these are transformer controllers or motor controllers { theses controllers do not work very well with incandescent light bulbs they flicker some what on low voltage level } ] you would also need to use the optic sensor

    As you can see in the picture the portion that is on the high voltage side of the optic sensor is part of the controller board that you would want on your board that you would like to control ( one note this is the 100 amp version )

    One other note on this particular module you might have noticed that it needs a 9 to 12 volt AC ( not DC voltage will not work correctly ) input this is for the micro controller circuit portion of controller [ but they are very hack able as well with a little bit of work ]

    One final note there are versions of controllers out there that do not require a separate 9 to 12 volt transformer because it is incorporated on circuit board but this version is very limiting in its functionality ( for battery spot welding) but might be something to look at as well

    Very soon I have a project thats what I might be doing because these control boards for battery spot welders are Smile the micro controller chips do not last very long and it is very seldom that the high voltage side of the circuit is the part that fails

    The one good thing about these controllers is that they are not very expensive to buy I have bought several different versions of this type of controller board to try find one that would last but have not been very successful in doing this so far

    I hope this helps you with what you are looking for

  • kwinnkwinn Posts: 8,697
    edited 2021-01-17 16:33
    T Chap wrote: »
    Is there any chance this would have a value for fan speed control: Zero crossing detect opto triac driver ie MOC3041 and triac BTA40_600 and some other device to detect zero crossing. Have the Prop turn on a pattern of cycles for a pseudo PWM. 50% duty = 1 on then next off. 1 2 on then 3 off. 3 on 1 off. 3 on 2 off. etc. The point being to reduce noise by not turning on the triac at random places. If so what would a nice device be to look at the AC and fire a logic level output for the prop to lock to cycle by cycle.

    https://www.onsemi.com/pub/Collateral/MOC3043M-D.pdf

    Built a circuit to do this many years ago using flipflops and a CD4017 to turn AC on/off for a number of cycles. Worked for 1/3, 1/2, 2/3 on/off cycles on my furnace fan.Should be simple to try it out now that we have sub $1.00 micros to control the triac.

    PS For AC motors you must use full AC cycles. This (what I call AC cycle control) type of control works really well for maintaining temperature in ovens and larger chambers.
  • A zero-crossing triac is NOT what you want. That's the sort of triac you'd use if you wanted it to just turn it on like a relay, but only when the voltage is at the zero cross point, to reduce EMI. What you want is to detect the zero cross and then delay from there into the cycle before turning on the TRIAC so as to vary the power by phase control. The zero cross can be a simple AC opto (back to back LEDs) so that you would couple the npn collector to the micro via a pullup. When that signal goes high it is then close to the zero cross and you can start your delay from there. There are plenty of triacs and opto-triacs to choose from.
  • The zero cross can be a simple AC opto (back to back LEDs) so that you would couple the npn collector to the micro via a pullup. When that signal goes high it is then close to the zero cross and you can start your delay from there. There are plenty of triacs and opto-triacs to choose from.

    Could you please post some part numbers so I could look at the data sheet to see what the differences are

    Thanks
  • kwinnkwinn Posts: 8,697
    He is referring to an AC input optoislator such as these. The ic needs a current limiting resistor on the input and a pullup resistor on the output. When the AC input is close to zero volts the npn transistor will stop conducting so the pullup on the collector will pull it high.
  • T ChapT Chap Posts: 4,198
    edited 2021-01-17 20:11
    Peter. That’s not what I’m trying to do. It is very easy to delay phase as you say and turn on the triac at some point to “chop” the phase down to reduce speed etc. what I’m wondering is about keeping an entire phase in tact. Have the prop turn on full phases but skip some full phases so that you may drop speed with less power. The point is that when you turn on a phase at some point after zero you get noise in various forms. So if I can do all switching at zero the system runs with less emi noise etc.

    Kwinn thanks for the part I’ll test those out. That is the idea. Although from your description it does not have a method to indicate the start of a rising voltage to make the start of a full cycle. it only shows Zero? But with code you could maybe get by just turning on a full cycle whether it starts out going low or high. Maybe a full cycle “is” just a full cycle for motor and heat purposes. Once you can control the triac at a cycle level you can the skip cycles. With split phase 240 the noise can be large when switching on mid cycle at peak.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2021-01-17 21:23
    What would this circuit look like hooked to a micro controller input
  • kwinnkwinn Posts: 8,697
    T Chap wrote: »
    ....

    Kwinn thanks for the part I’ll test those out. That is the idea. Although from your description it does not have a method to indicate the start of a rising voltage to make the start of a full cycle. it only shows Zero? But with code you could maybe get by just turning on a full cycle whether it starts out going low or high. Maybe a full cycle “is” just a full cycle for motor and heat purposes. Once you can control the triac at a cycle level you can the skip cycles. With split phase 240 the noise can be large when switching on mid cycle at peak.

    The output from the zero crossing optoisolator will go low for each half cycle so you can use that to count down the on/off cycles. The on/off cycles would of course have to be multiples of two to have the on/off times be full ac cycles.
  • kwinnkwinn Posts: 8,697
    BTW, this can be done using a few gates and counters along with some switches, although a micro is much easier.
  • What would this circuit look like hooked to a micro controller input

    Sam thanks for the ideas. I have a prop board controlling lots of devices so I wont be looking at other devices to hack as you suggested. The circuit would look like an Opto device as Kwinn linked that would trigger on AC voltage and allow a logic level output that connects to the Prop. The code would look at the AC and when the voltage is at zero the Prop gets a pulse. On that pulse the Prop can count 2 more pulses from that one to determine that it has seen a full AC sine wave cycle. Understanding that the code can determine what a full cycle, it can then send a signal to an Opto Triac Driver ie MOC3041 which turns on a Triac at a simultaneous zero crossing. I suppose in a sense the Zero Crossing Triac Driver is a redundant to code watching for zero crossing, however it insures the effect of only turning on at zero volts. When the code and circuit can handle cycle by cycle management, my idea was to be able to have the code run a pattern to achieve reduced speed on a fan by skipping AC cycles as needed to achieve a desired lower speed. The circuit connected to the prop is very simple. The output of the Opto AC detect IC has a pullup resistor to 3v3 which is what the input to the Prop wants.

    317 x 243 - 8K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2021-01-18 00:19
    T Chap,

    The circuit you've posted would probably be destroyed by an AC input. The reason is that the opto LED's reverse voltage max would be exceeded. To keep this from happening, you need to put a reverse diode across the the LED's inputs.

    Also, it won't be triggered on a zero cross, but at whatever the LED's forward voltage is.

    -Phil
  • I thought you were after a circuit that detects zero cross so that you can do whatever you want in software. Whether you make it do regular phase control which is choppy, or you turn on a few cycles as needed, doesn't change the circuit itself. If you use a regular uni-directional opto then you need a reverse diode across the LED as Phil mentioned but bear in mind that the signal won't be balanced. You could of course use a bridge before the opto but that is old school.
  • Which would be be a better option you half of a cycle or use both side of the cycle
  • Depends upon the load and it doesn't matter what you do to a resistive load such as a heater element but inductive and complex loads should take be given full cycles which ideally is what you should always do but trying to control power that way is not as smooth. However heater elements don't care and the thermal inertia smooths everything out.

    If you don't care about isolation you can run the control circuit hot and do away with optos altogether, but this is only suitable for a fully sealed and simple circuit.
  • I would want to use isolation I am not fond of the other option
  • T ChapT Chap Posts: 4,198
    edited 2021-01-18 02:24
    Phil I just grabbed a diagram off their PDF for the H11aa1. Here is another better drawing that shows direct connection to 24VAC and 110, I've seen the same for 240VAC.

    Interestingly here is an old thread on the same part connected to a prop with discussion by the usual suspects. I grabbed a screenshot from a circuit in that thread.

    http://forums.parallax.com/discussion/107216/resistors-connected-to-h11aa1-getting-hot

    Another circuit added.
  • I used the H11AA1 for ZC detection in a 4-channel AC light dimmer that uses the P1. As Peter indicated, you look for the zero cross, and then delay the on signal the triac to reduce output. In my code, I start by looking for ZC signals and then calculating the timing between them so the board will work at 60Hz (US) or 50Hz (Europe and elsewhere).
  • jmgjmg Posts: 15,140
    Which would be be a better option you half of a cycle or use both side of the cycle

    Power companies do not like you using half cycles, so any control should always take care to switch pairs of half cycles to keep the load balanced.
  • jmgjmg Posts: 15,140
    T Chap wrote: »
    Is there any chance this would have a value for fan speed control: Zero crossing detect opto triac driver ie MOC3041 and triac BTA40_600 and some other device to detect zero crossing. Have the Prop turn on a pattern of cycles for a pseudo PWM. 50% duty = 1 on then next off. 1 2 on then 3 off. 3 on 1 off. 3 on 2 off. etc. The point being to reduce noise by not turning on the triac at random places. If so what would a nice device be to look at the AC and fire a logic level output for the prop to lock to cycle by cycle.

    Keep in mind power companies have an aversion to 'nasty loads' - anything other than an ideal sine load, causes more heating in their transformers.

    As well as the balanced load requirements, you may come under the flicker specs too.

    Google finds this comment around sub-mains frequency components

    https://www.newtons4th.com/electromagnetic-compatibility-iec61000-3-32013-flicker-analysis/
    " The graph below (taken from IEC61000-3-3:2013) illustrates the overall concept, we must remember that if the performance of the equipment under tests lies under the Pst = 1 curve then the disturbance to the supply network is deemed to be acceptable in the short term (we will distinguish between short term and long term later in this article)."

    It's unlikely a crude mains cycle chopper would meet those specs for volume commercial production, but if it is one-off, you can experiment :)
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2021-01-18 02:41
    I started to talk about "if everyone used half-cycles" how that would affect the generators and transformers etc, but that is a long story and isn't really relevant because it wouldn't happen.

    Be aware that a simple resistor current limit can get quite hot and I would use 2W, not 1W for this on 240VAC. You can use the reactance of a capacitor plus resistor for this too. Another thing to be aware of is that you will get noise on the line that messes with the nice clean zero cross signal. There are various methods to deal with this but one of the things you can do is to maintain a phase timer so that you only accept a zero-cross signal within a certain window and if you didn't get that signal you would still trip on where it should have been anyway. When you do get a valid zero-cross you can resynch that phase timer which btw can be the same one used to measure phase delay.
  • jmgjmg Posts: 15,140
    edited 2021-01-18 04:07
    T Chap wrote: »
    Phil I just grabbed a diagram off their PDF for the H11aa1. Here is another better drawing that shows direct connection to 24VAC and 110, I've seen the same for 240VAC.
    Interestingly here is an old thread on the same part connected to a prop with discussion by the usual suspects. I grabbed a screenshot from a circuit in that thread.

    Reliable Mains Zero Cross is a topic in itself, but you can use software to lower the BOM costs, and lower the power dissipation in the LED dropper
    * Pick an opto coupler rated for lowest IF, to allow lower drive currents for lower power loss.
    * If you measure edge plus period, you can SW correct for Opto CTR and mains voltage variation, and you can phase correct to the true zero cross.
    * Dual LED opto couplers are more expensive (and lower CTR) than single LED ones, but single ones need a reverse diode.

    Addit: A good example of a sensitive optocoupler is the TLP293(BLL, which specs 200~400% CTR band, at 500uA.
  • JonnyMac wrote: »
    I used the H11AA1 for ZC detection in a 4-channel AC light dimmer that uses the P1.

    Is this the one that you had on your website years ago because I have a couple of them and I almost forgot about it

    If is what you are talking about there some Basic Stamp code for this board



  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2021-01-18 03:21
    I use little 4-pin optos since I can stack them or replace them with an array version. You can pass less current through these optos but the zero-cross signal will be wider so you have to adjust an offset in software which you would do anyway since any zero-cross is only "near zero-cross" and never super precise anyway. Instead of a HHHLLLLLHHHH signal for instance you might see a HHHLLLLLLLLLLLLLLLLLLLHHH signal for the active low zero-cross, but it is simply a matter of timing. In fact you can have very little current and simply rely on timing. The same would be true if you simply sensed any voltage above 50% peak for example. When you use a micro, the sense circuit can be a lot simpler.
  • Well if using a >50% circuit you can have the benefit of detecting only the + phase. Also if you know the phase trigger point you care could rather accurately determine zero if you studied it with a scope for a bit. Then you could trigger on a zero. Of course real world stuff such as noise maybe a factor on all methods of detection.
  • kwinnkwinn Posts: 8,697
    Using an AC input opto isolator like the H11AA1 has two advantages. It avoids the need for an external diode, and allows the software to switch the load triac closer to the actual zero crossing by measuring the time between the rising and falling edge of the zero crossing input signal.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2021-01-19 00:02
    I have two questions about this

    Moved to this post

    Zero crossing detection for a battery spot welding machine with what parts should be used
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2021-01-19 00:22
    *deleted*
  • T ChapT Chap Posts: 4,198
    edited 2021-01-21 15:12
    Everywhere I read you can’t vary speed with a triac on a PSC. I tried a lutron ceiling fan control but it didn’t reduce speed at all, either on or off. I put a BTA40 triac on the main hot wire input pre-motor, also on the neutral line post motor. Didn’t work. I cut the capacity lead as shown and inserted the BTA triac there. In spin set On to wait 4_000_000 and Off 24_000_000 and it gets very slow without a lot of noise. You can hear the ON barely but you can’t notice it in RPM. Not using any zero detect, probably quieter with zero detect switching. (It’s Just random on off points in the phase = some peaks are chopped) Working perfectly at 15 minutes with no heat yet. The motor is on a fan and it’s all cool to touch. When reducing the fan substantially like this, the noise the switching makes is much less than the fan noise at full speed. So noise is not a thought. There are various ways to reduce RPM ie VFD or coil tapping (variac) or other voltage reducers but I want Prop control for closed loop and dynamic speed. I don’t see how to reduce voltage without hacking some store bought speed control. If this doesn’t die then it’s idea for fans.
  • kwinnkwinn Posts: 8,697
    edited 2021-01-21 18:49
    Cycle switching does work on induction motors. Used many years ago on a sample conveyor so the conveyor could run at high speed until a sample came close to the sample elevator. Then the speed was reduced so the sample could be stopped precisely at the elevator position.
  • T ChapT Chap Posts: 4,198
    edited 2021-01-22 22:31
    This was an interesting learning experience with these H11aa1. Got some today. 120vac Zero shows in yellow. Blue is spin code outputting a pulse on every detect.
         Repeat
          waitpeq(%10, %10, 0)   
          outa[0]~~   ' output to scope 
          outa[0]~ 
          waitpeq(%00, %10, 0)   
    
Sign In or Register to comment.