Zero crossing detection

Discussion in 'The Projects Forum' started by atferrari, Jul 2, 2006.

  1. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    Using a 18F452, I was planning to measure basic things in a 380 V tri phase system (basically V and I) to calculate power, besides frequency and eventually cos fi.

    Obviously, I have experimented with different zero crossing circuits. But when I was about to start implementig it, my friend, who really knows a lot about, told me that nowadays, even zero crossing detection for V or I is made using no external hardware after the current transformers and eventually some simple filters. Just with micros.

    How is that possible? I recall reading something about using the Schmit trigger in the inputs. Am I right? Got the feeling that the value obtained is not reliable, isn't it?

    O should I do that in software? This last, seems to me, means continuous ADC conversions and testing with the inherent tremendous software overhead required for at least four (VR, IR, IS, IT) parameters.

    In other forum I recall somebody advising to make a previous absolute value rectification to take advantage of the 10-bits resolution on the 0 - Vpk always positive range.

    Yes, too many unknowns but once solved zero crossing detection and "absolute value yes or no" I think I could start experimenting.

    Any concrete ideas? Gracias for any help.

    PD: Just in case, I googled for months about, with no concrete details on the zero crossing with a micro only.
  2. Gorgon

    Senior Member

    Aug 14, 2005
  3. pebe

    AAC Fanatic!

    Oct 11, 2004
    You could measure the time it takes the waveform to get from +x volts to –x volts, and half that time.

    Wire your 380v through a 100K resistor to an input port. The port will have protection diodes to prevent it going outside its supply rails, but you could add a couple of external diodes to be sure.

    Wait for the port input to change from ‘1’ to ‘0’ then start a timer. Wait until the port goes to a ‘1’ again and measure the elapsed time. Halve the value (= Tus). Use that value for a countdown timer.

    Next time round wait for input to change to ‘0’ and start timer and set the timer interrupt. When the interrupt occurs you have your zero crossing time.
  4. n9352527

    AAC Fanatic!

    Oct 14, 2005
    Or you could use the capture/compare unit in the PIC... no other circuit is needed except signal conditioning and very little software overhead.

    You could also find more information on the scheme Pebe proposed above in one of the Microchip application note. Depending on the oscillator frequency, you would need to adjust the time by some values for better accuracy if that is important in your application. I don't have the AN number, but it was about an X10 home automation unit using 16FXXX.
  5. atferrari

    Thread Starter AAC Fanatic!

    Jan 6, 2004
    Got the documents! Quite informative.

    Thanks a lot!:)