I need to detect zero crossing for a soft starter. A long while ago, I have done it using a 1 Mega ohm resistor directly connected to micro controller at one side and live power at another side. I was successful but is it advisable ? what other way I can do it cheaply and reliably ?
Answer
I have designed soft starters using the PIC16C74A/F77 processors. Zero crossing can be tricky if you also have to work in noisy environments.
If you don't need the processor to be isolated from the line, there's nothing wrong with a couple high-value resistors feeding a CPU pin. I would use a couple shottky diodes to augment the internal protection diodes just as a matter of robustness, but it'll work fine. If you need isolation, use a transistor output optoisolator. Pay attention to the switching speed of the opto and minimize the transistor collector current to maximize switching speed.
Having said that, let's move on to noise. If you're phase-controlling anything other than resistive heating you'll have noise to contend with which means it's very likely you will have zero-crossing noise to deal with. Don't do the rookie mistake of feeding the zero crossing input to an interrupt pin; that will turn your software into a smoking mass of nastiness when the processor tries to deal with a gazillion interrupts. (I speak from experience.) Throwing an RC or more advanced low-pass filter on the line will just introduce phase shift. If you can work with that, great. If not (I had to deal with 50/60 and 400Hz systems) then you have to try other means.
On my own design I took care of it in software by polling the line and essentially making a voting routine that ignored transients. The phase shift was within what I could handle, it was fast and it wouldn't crap out even in heavy noise. (Tested in a facility where they removed the filter caps from an induction furnace, I've never seen such a noisy line before!) If I were to redesign it I think I might try an external solution involving a one-shot that would "latch" the zero cross and then the microcontroller would acknowledge it before the next interrupt could be set.
All said, I think that reliably finding the real zero crossing in any practical situation was one of the trickier bits of the soft starter design. Closing the control loop was secondary, but it was mostly just tuning. It seems like a dead-simple thing to do but I learned quite a bit about the difference between theory and practice during that time. :-)
edit to describe "voting" routine:
If I remember correctly, I had an I/O line that was high when the line was above zero and low when the line was below zero. The voting routine simply polled that line and if 2 of the last 3 samples were the same, I accepted the fact that the line had crossed zero. It's very similar to a UART's voting circuit to detect mark and space. The benefit of a circuit like this is that your phase shift is fixed (2*sample rate) and you can tune it for the type of noise you're experiencing. I do not remember offhand how fast the polling was but if I were to hazard a guess I would say 8kHz, as that number sticks out in my mind.
No comments:
Post a Comment