AC Zero crossing detect, H11AA1 troubleshooting - Page 1
Forum section: electronics / beginners

author: aeberbach
author_rank: Regular Contributor
timestamp: January 26, 2015, 11:49:51 am
content: I'm building an Arduino controlled water heater. A DS18B20 1-wire sensor is giving a nice reading for current temp. I will write some PID code to control the heater element of a 400W Birko jug via a MOC3052 opto and Q6015L5 triac. This will hopefully cook eggs, sous vide style and maintain a nice even temperature for a hide glue pot in the shed when it isn't cooking eggs.The resistors are IRC GS-3 3W 1% 47K. Both measure spot on. On the Arduino side it doesn't seem to matter if pins 4 and 5 are connected as shown or left hanging.When I apply power the house RCD trips, so it's a journey to the fusebox to reset. The circuit is definitely as shown here - have rewired 3 times, tripped power 3 times. Resistance measured across the mains terminals is around 16.3M. I have two H11AA1 chips here and both do the same. Any suggestions as to what is going on? I should mention that the RCD seems sensitive, sometimes it will trip when the AC or motor in the central gas heater switches on also but this shouldn't happen.

author: mij59
author_rank: Frequent Contributor
timestamp: January 26, 2015, 12:06:24 pm
content: If the rcd trips there's probably a earthing fault in the electric installation or in one or more appliances.What is the nominal trip current of the rcd ?The 240 Vac side of the circuit you use can not cause the rcd to trip, what is connected to arduino side ?

author: wraper
author_rank: Unknown
timestamp: January 26, 2015, 02:14:01 pm
content: No way this circuit could trip RCD unless you counting optocoupler pin numbers incorrectly. Therefore likely there is a leak somewhere else outside this circuit or you do not understand what you are doing. What happens if you disconnect one lead of 47k resistor? Does RCD still trip? Maybe stupid question, but is it really neutral? Don't you connect your circuit between Line and Earth by chance?

author: Ice-Tea
author_rank: Super Contributor
timestamp: January 26, 2015, 02:37:02 pm
content: You could have a grounding error if as you have both the net and GND connected to that opto. Wiring fault? Dead opto? Disconnect your setup from the net, measure resistance between pins 1 and 2 and 4.

author: jlmoon
author_rank: Unknown
timestamp: January 26, 2015, 03:05:40 pm
content: I notice in your schematic you have a 240VAC source.. I hope that isn't a (N) for neutral, but a L2.. right?In this design what are you using as a return reference? Ground -- I hope not.If you're using 240VAC might I suggest you use a control transformer (step down) to manage those dangerous voltages a little, you only need a few volts to bias those diodes. Adding a transformer might provide you the isolation to faults that your RCD requires too.

author: Kjelt
author_rank: Super Contributor
timestamp: January 26, 2015, 03:12:06 pm
content: +1 recommend small fixed 6VAC orso transformer as isolation.Then on pin 4 the ground symbol is drawn as electrical safety ground instead of a low voltage return (ground), what is it, I hope the 0V belonging to the +Vcc of the arduino and not the earth ground?And another thing, a standard water heating element is almost a short when it is cold, it only has real resistance when hot. You might want to start applying power very slowly till it is a bit warm.

author: wraper
author_rank: Unknown
timestamp: January 26, 2015, 03:20:26 pm
content: Quote from: jlmoon on January 26, 2015, 03:05:40 pmLikely he is not in US, for example, Australia have 240V single phase.

author: aeberbach
author_rank: Regular Contributor
timestamp: January 26, 2015, 10:47:53 pm
content: "or you do not understand what you are doing"Fair comment, I'm a software guy.Thanks all for the comments. I am in Australia.I do have brown/blue connected, not green on the AC side. The Vcc/GND on the right of the opto is Arduino, no AC connection other than shown.My only explanation is that I have two faulty H11AA1 - perhaps I did have the connection wrong at one time and destroyed both. I will start again on a new board and if it trips again with only the AC connected I guess I'll be ordering more. It looks OK because there is around 15M between pins 1 & 2...WRT transformer - this looks suitable?http://au.element14.com/block/vb0-35-2-6/transformer-0-35va-2-x-6v/dp/1131608?MER=MER-BPR-4PPM-PD-BLK-TF&If I am going to be driving a triac with the arduino via MOC3052 will adding a transformer on the zero crossing opto add much?(I will be getting an electrician in to look at the RCD, it's nice that it trips when there is a fault but is a real pain most of the time - either it is a unit designed for less power than we use or there is some real fault in house wiring.)

author: wraper
author_rank: Unknown
timestamp: January 27, 2015, 03:43:51 am
content: Quote from: aeberbach on January 26, 2015, 10:47:53 pmVery unlikely to be so. There is very strong insulation between emitter and coupler with Isolation test voltage: 5300 VRMS. You can destroy them, so they no longer work but not damage the insulation.

author: wraper
author_rank: Unknown
timestamp: January 27, 2015, 03:46:33 am
content: QuoteThe question is, are those brown/blue wires connected to the proper pins in the mains plug? If you disconnect Arduino and there is only optocoupler with resistors left, does RCD still trip?

author: Kappes Buur
author_rank: Regular Contributor
timestamp: January 27, 2015, 08:38:33 am
content: In any case, it would be advisable to use a stepdown transformer.Such as 240 VAC to 9 VAC at 500mA. They are not too expensive.

author: Psi
author_rank: Super Contributor
timestamp: January 27, 2015, 09:59:31 am
content: Most likely someone will spot the problem in under 5 minutes if you post a photo of your actual circuit with everything visible.There really has to be a wiring error for that circuit to be triggering the RCD, that or the H11AA1 is dead.You sure you didn't mistakenly pick 47ohm resistors

author: aeberbach
author_rank: Regular Contributor
timestamp: January 27, 2015, 10:38:17 am
content: I pulled everything apart. Checked the cable (it's a molded computer cable I chopped for the project, so not likely to be bad). Rewired everything carefully. And here's my zero crossing pulse with no trips to the fusebox:For this project I had planned to use an AC-DC converter, mains input, 3.3V @300mA out. Instead I will use aBlock 6V PCB mount transformerand detect the zero crossing on the 6V output. Then use a diode bridge and LM317 with 6V AC input to get 3.3V for the arduino.For 6V, aiming at 10mA across the diodes in the H11AA1 I would use 600R resistors, 680R would be close enough - sound right?

author: wraper
author_rank: Unknown
timestamp: January 27, 2015, 12:48:56 pm
content: If using transformer you do not need optocoupler at all. It can be made with one diode and resistor. No other parts needed.

author: Kjelt
author_rank: Super Contributor
timestamp: January 27, 2015, 12:52:03 pm
content: And then ofcourse in the software you have to compensate the delay between detecting the pulse and switching the optotriac else you are still to late with the switch on.

author: jlmoon
author_rank: Unknown
timestamp: January 27, 2015, 02:54:24 pm
content: Just another thought... someone correct me if I am wrong.. A properly working RCD can detect microamps of differential leakage current in reference to ground and phase differential between neutral (if used) and and line side. Is it possible there is enough leakage current in the material of the HC11 causing a fault current created by a loop from that arduino supply and your mains? Just another path to ground .. per sè

author: mij59
author_rank: Frequent Contributor
timestamp: January 27, 2015, 03:16:08 pm
content: Quote from: jlmoon on January 27, 2015, 02:54:24 pmA microamp rcd is not practical, you would not be able to switch it on.In a domestic environment 30 mA is considered to safe.

author: eneuro
author_rank: Super Contributor
timestamp: January 27, 2015, 04:03:02 pm
content: Quote from: aeberbach on January 26, 2015, 11:49:51 amWhat about low reverse voltage of its input diodes?I used even LEDs as 230VAC indicators, but they were protected by 1000V 1N4007 in series with current limiting resistorsHowever in spot welder project I used SS495A hall sensor inside cut toroid core with a few turns to monitor current under resistive load and detect zero crossing in ATTiny85 MPU by moveing averages processing based on sensed analog response from Hall sensor...so noise can be easy filtered digital, etc...

author: wraper
author_rank: Unknown
timestamp: January 27, 2015, 04:43:00 pm
content: Quote from: eneuro on January 27, 2015, 04:03:02 pmThere are 2 LEDs in reverse-parallel arrangement in H11AA1 optoucoupler. It is specially designed for AC/zero crossing.

author: eneuro
author_rank: Super Contributor
timestamp: January 27, 2015, 05:34:55 pm
content: Quote from: wraper on January 27, 2015, 04:43:00 pmChecked its datasheet and no reverse voltage specs or I missed something, so maybe it is capable to work even at 230VAC, but it looked very strange

author: wraper
author_rank: Unknown
timestamp: January 27, 2015, 06:15:47 pm
content: Quote from: eneuro on January 27, 2015, 05:34:55 pmThere is NO reverse voltage.This optocoupler does not care about voltage polarity. Don't you see how LEDs are drawn in the datasheet?

author: Richard Crowley
author_rank: Super Contributor
timestamp: January 27, 2015, 06:25:30 pm
content: So follow the usual troubleshooting (AmEnglish) or fault-finding (BrEnglish) procedures.Does it trip with the brown and blue wire hanging in the air? With the two resistors in series across the line? With an ordinary incandescent lamp?Although, it is not clear why you need ZC detection at all? Its not as if you are dimming lamps here.You are regulating the temperature of something with a substantial amount of thermal mass.Typically, power to heating elements is controlled in integer cycles, phase-angle is of no consequence.Use a ZC opto isolator (or SSR) and you don't even need to know or care about ZC.

author: eneuro
author_rank: Super Contributor
timestamp: January 27, 2015, 08:16:31 pm
content: Quote from: wraper on January 27, 2015, 06:15:47 pmEverybody see this, but this is what is seen on its input-each diode inside must have some reverse voltage and probably is low.Never tried something like this with crappy common LEDs-lets say this bule: 3Vf5Vronly .http://www.tme.eu/en/Document/06c97902c4f80b821a05430ac96f9a0d/OSG3DA5121A-TU.pdfReally only with current limiting resistors such two diodes in this configuration can subsist 230VAC 50Hz without any additional elements?Lets find it out tomorow: 2 x 50k resistors 2 x such diodes @ 230VAC -> around 2mA with 50% duty on each diode and 0.26W loses.

author: eneuro
author_rank: Super Contributor
timestamp: January 27, 2015, 08:39:50 pm
content: Quote from: aeberbach on January 27, 2015, 10:38:17 amIn setup with 240VAC and 2x47k resistors (input Vf in H11AA1 is typical 1.2V ) you had 3.6mAmax only

author: wraper
author_rank: Unknown
timestamp: January 27, 2015, 08:52:41 pm
content: Quote from: eneuro on January 27, 2015, 08:16:31 pmDon't you get that reverse voltage is limited by another led to approximately 1.5 V?

author: mrflibble
author_rank: Super Contributor
timestamp: January 27, 2015, 09:30:16 pm
content: Quote from: eneuro on January 27, 2015, 08:16:31 pmOkay, another way you can think of this ... forget the optocoupler. Just take 2 regular boring diodes in anti-parallel configuration, similar to those two LEDs.When diode A is forward biased, it will clamp it's voltage to let's say 0.7 V. Or maybe with a larger current through it 0.8 V. Then yes, the other diode is reverse biased and will see that -0.8 V. And in case you are worried about reverse breakdown voltage, then yes both diodes will have a reverse breakdown voltage. But you will never get close to that due to the voltage clamping done by the forward biased diode.And the exact same thing is going on in that H11AA1 optocoupler, only it's a bigger voltage drop. Quick look at the datasheet: voltage across led is something like 1.0 V - 1.4V, depending on temperature. And if you check Figure 1 in the datasheet you can even see precisely what wraper is talking about.

author: eneuro
author_rank: Super Contributor
timestamp: January 27, 2015, 10:07:33 pm
content: Quote from: mrflibble on January 27, 2015, 09:30:16 pmIt is clear from the begining how it work for low frequency, but now lets take crappy LEDs in the same configuration and connect it not to 50Hz AC, but.... hundreds kHzThen diode recovery time doesn't count ?http://www.diodes.com/pdfs/apd/AN-1012_TRRComparison_v0.2.pdfIf this Vf of one diode will protect another no problem, but at higher frequency who knows -real electronic component is not ON/OFF device and many nonlinear regions....so not everything which seams to work at low frequency will work at much higher frequency...It is interesting if this H11AA1 has such frequency at witch those diodes will fails , eg. do to recovery times?

author: bktemp
author_rank: Super Contributor
timestamp: January 27, 2015, 10:24:17 pm
content: Why should the diodes fail due to recovery time? They will simply keep conducting and slow down the other diode turning on. Since the current is limited nothing bad will happen. It may only stop emitting light, because the parasitic capacitors will take all the current and prevent the diodes from conducting.If the forward recovery time would be high, then the reverse voltage could reach high values, but on almost all diodes the forward recovery time is negligible. Only high voltage diodes show significant forward recovery effects.

author: wraper
author_rank: Unknown
timestamp: January 27, 2015, 10:43:18 pm
content: Quote from: eneuro on January 27, 2015, 10:07:33 pmOh my, recovery time doesn't matter at all in this situation. You do care if it opens fast enough (and that time is much faster than recovery time), not stops conducting as one LED protects another led while conducting, not being in closed state. Secondly, most of the optocouplers are no good after few tens of kHz, therefore not usable at such frequencies. Thirdly, with reverse protection diode in series as you suggested, is when you will get reverse recovery time issue with fast rise time AC voltage and LED can be damaged with reverse voltage.With diode being in reverse-parallel you can consider that if rise will be so high that reverse recovery comes in play. One diode reverse recovery time will be much longer than time at which another diode starts conducting, therefore overlaping. Because of that always protected from overvoltage.

author: aeberbach
author_rank: Regular Contributor
timestamp: January 27, 2015, 10:44:45 pm
content: Quote from: Richard Crowley on January 27, 2015, 06:25:30 pmI might one day. This thing is controlled by a RFDuino, it's a box with a mains socket and a plug to the wall. Control of temperature (or light) is done by an iPhone app through Bluetooth LE. That's the easy part and it's done already.

author: aeberbach
author_rank: Regular Contributor
timestamp: January 27, 2015, 10:48:46 pm
content: Quote from: Kjelt on January 27, 2015, 12:52:03 pmI'm expecting to lose a very small part of the cycle but that won't matter much, just reduce the speed that the heater can come up to temperature. The PID control algorithm could take care of maintaining temp if that is ignored because it's getting constant feedback.Depending on how this transformer is wound I expect either 180 degree phase shift or none, so I should be able to ignore that - the zero crossing point remains the same.

author: mrflibble
author_rank: Super Contributor
timestamp: January 27, 2015, 10:57:26 pm
content: Quote from: eneuro on January 27, 2015, 10:07:33 pmDoes reverse recover time count? Sure it does, the diode is still the same. It just doesn't have all that much influence here.Take two red leds from the crusty old parts bin, put them anti-parallel, and add a suitable series resistor. Then connect to a sine wave of lets say 5 Volt or 10 Volt amplitude. Then try it for 50 Hz and for 100 kHz. Do you see anything that you attribute to reverse recovery time of the led?And fail due to recovery times? Yeah sure, no doubt. Pump 1 GHz into it and it will probably fail. But that's not all that relevant to the use case here. Especially because the use case here involves an optocoupler, and the photodiode part of it usually is bloody slow anyways.So no worries about that reverse recovery time on the LED side. You won't come anywhere near the frequency that reverse recovery becomes a problem. The photodiode will have given up long before that.

author: mrflibble
author_rank: Super Contributor
timestamp: January 27, 2015, 11:26:11 pm
content: Just thought of something. I mentioned that 1 GHz jokingly, but even with that kind of frequency reverse recovery will not be an issue. You won't even get any mobile carriers at that frequency for a random crap led from the parts box. Probably something like parasitic capacitance will have spoiled the party already.

author: aeberbach
author_rank: Regular Contributor
timestamp: January 28, 2015, 05:55:33 am
content: Mystery solved!My RCD tripping saved my new oscilloscope, and Dave has saved me from doing this again.

author: eneuro
author_rank: Super Contributor
timestamp: January 28, 2015, 10:34:38 am
content: Quote from: mrflibble on January 27, 2015, 10:57:26 pmI've soldered something like this with random 3mm yellow diodes:230VAC(L) -> 2x100k + 2xLEDs + 2x100k <- 230VAC(N)"Unfortunatelly", no mains fuses fired and no smoke smell, so you must be right and it passed 230VAC 50Hz testThis configuration above means only about 2.3mA current with 100k resistance, since only one diode (50% "PWM") at average 1.1mA at day light those diodes not such visible, but at dark environment this simple 230VAC power indicator might be usable sometimes (power loses on each of 0.25W 100k resistors only 0.121W, so not so bad).Anyway, this current is quite small and does H11AA1 works as detector with output pulled up to 5Vcc at direct input 230VAC (240VAC close to this) and around 100k series resistance?Such small curents (range 1.6mAmax -1.1mA avg) are fine to triger and detect those zero crossing using H11AA1?Did you tried to count lets say 1 hour zero crossing count and compare with expected number of crossing if perfect sine 50Hz wave AC power supply was?This test should give around 360k /hour such zero crossing. It will be interesting to compare it to Hall based methods of mains current monitoring

author: mrflibble
author_rank: Super Contributor
timestamp: January 28, 2015, 02:20:35 pm
content: Quote from: aeberbach on January 28, 2015, 05:55:33 amGood thing that you solved it, and thanks for sharing the problem/solution.Incidentally, this is a good example of why it helps to show a photo of the measurement setup. Chances are pretty good that if someone sees a mains connected <whatever> being measured with a scope they go"Heeeey waitaminute, how is that connected exactly?"

author: mrflibble
author_rank: Super Contributor
timestamp: January 28, 2015, 03:06:34 pm
content: Quote from: eneuro on January 28, 2015, 10:34:38 amBonus points for doing the experiment.If you happen to have something that can generate a similar waveform at higher frequency (100 kHz) then you should see the same boring effect of no explosions.QuoteAre you making me open up the datasheet again?From a quick read yesterday I recall the answer to that is yes. After all you have ~ 1 mA of photocurrent going into the base of that photodiode/phototransistor, get some conversion losses, and then apply the transistor gain ... yeah, 1 mA should be enough to make that transistor pull the output low. Looks like it will be switching fairly slow at 1 mA led current though, but for 100 Hz fast enough (I think). To know for sure one would have to check the datasheet. Well, or build the circuit and just measure what it does.Datasheet attached for convenience.

author: eneuro
author_rank: Super Contributor
timestamp: January 28, 2015, 04:43:59 pm
content: Quote from: mrflibble on January 28, 2015, 03:06:34 pmMaybe missed something reading its datasheet, but wasn't able to figureout its cutoff frequency or turn on/off times which is easy to find for eg. for slow PC817 or fast 6N137Looking for something very fast to disable Enable pin in 6N137 (http://www.fairchildsemi.com/datasheets/6N/6N137.pdf) in the case of active/shorted half part top/bottom of 1 of 3 half-bridges in 3 phase optoisolated from MPU motor controller and it could be nice to have such AC capable input like in cheap H11AA1, but have no idea for the moment which can be its switching frequency limits, or will find fast double input optocoupler and make pcb connections to have those diodes in parallel like in H11AA1 and make tests and compare those switching limits while need 6 such AC detectors per controller to disable without MPU knowledge 6N137 enable pin to switch off N-channel mosfets 3A driver to prevent short cut, so need to know safe delay time in AC current detection circuit, but in my case 10mA current is not a problem since I need detect not zero but current maximum

author: wraper
author_rank: Unknown
timestamp: January 28, 2015, 05:02:25 pm
content: What hard to find?

author: eneuro
author_rank: Super Contributor
timestamp: January 28, 2015, 06:03:21 pm
content: Quote from: wraper on January 28, 2015, 05:02:25 pmIt looks like it depends on manufacturer and in ISOCOM datasheet this Tr~4us and Tf~3us are easy to findhttp://www.tme.eu/en/Document/9d740051576413a595b2de55776108d8/H11AAx-I.pdfThose times at given output current looks fine for me

author: mrflibble
author_rank: Super Contributor
timestamp: January 28, 2015, 06:09:49 pm
content: Quote from: wraper on January 28, 2015, 05:02:25 pmTo be fair, that"Switching characteristics"section you show is from the H11A1 datasheet, found here:http://www.vishay.com/docs/83730/h11a1.pdfA similar section is not listed in the H11AA1 datasheet, found here:http://www.vishay.com/docs/83608/h11aa1.pdfIn the H11AA1 datasheet more reading between the lines is required, which usually doesn't help. Anyways, good thing you posted this, because with some luck you can use the H11A1 datasheet to fill in some blanks on the H11AA1 datasheet.And while browser Mouser I noticed that for example Fairchild also produces the H11AA1, so you can shop around to 1) find a cheaper option and 2) find a manufacturer with more complete datasheets (which helps in design IMO).