3 phase zero crossing detecting algorithm

Dear all.

I am looking for sample code
http://engineerexperiences.com/3-phase-smart-energy-meter-using-arduino.html

if I am using above ckt . i wanted to measure zero crossing in each phase in order to measure phase angle.

How can i detect same phase In this case

Have you done a site search with any of those terms?

Both of those circuits (ammeter and volt-meter) reduce the input to a DC voltage so you won't see any zero crossings at the Arduino inputs. You will need to add separate zero-crossing detectors and apply those to different inputs on the Arduino.

a simple zero crossing detector can be made with a few resistors and an opto-coupler.

Simple zero crossing detector circuit for one phase.
zerocrossX.png

zerocrossX.png

Zero-cross.JPG

Or a double phase (increase resistor values for higher voltages)
The pin will go high when the voltage comes near 0v
For accuracy you could use 2 interrupts 1 for rising and 1 for state-change and measure the time between both. Halfway would be exact zero-cross (minus the cycles used to get there)

Zero-cross.JPG

240V AC RMS / .707 = 339V AC Peak
Three 100k resistors in parallel = 33.333k
Two of those in series = 66.666k
339V / 66666 Ohms = 0.0051 Amps (5.1 milliamps)
That looks like a good safe value for an LED.

Because of the bridge rectifier you will get two short pulses per AC cycle. I would think that a single diode in series would be better, to get one big pulse per cycle. Make sure the diode can handle at least 400V reverse voltage.

johnwasser:
That looks like a good safe value for an LED.

It is. And cheap to build.

johnwasser:
Make sure the diode can handle at least 400V reverse voltage.

like a 1N4007 or something.

This one i am using.