Shop OBEX P1 Docs P2 Docs Learn Events
filter for zero crossing determination — Parallax Forums

filter for zero crossing determination

pemspems Posts: 70
edited 2008-08-30 16:26 in Propeller 1
Hi crew, need some help

Here is the problem: I am trying to come up with a solution on a prop to reliably determine zero crossings in various vr-sensors' signal. (has to be compatible with different models/makes of vr sensors)
In practice, there may be quite a bit of noise picked up by the signal wire, which could result in 'fake' zero crossings which absolutely must be filtered out (as some critical operations depends on those zero crossings).
As the vr-sensor reads motions of a large mass mechanical device, the transients shouldn't be that great (perhaps that would help with separating noise from real signal). The signal itself is in the range of 500 to 20,000 HZ

I'm only starting to learn about signal processing and applying it in practice, so please take it easy on me and any help in that direction is welcome.

Thank you

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-08-29 22:07
    A voltage comparator with hysteresis is probably the simplest way to do what you want. You can set the hysteresis band to be wider than the noise amplitude to eliminate false triggers. Be aware, though, that any filtering, whether it be hysteresis, moving-average, or some other method, will impose a delay on the zero-crossing output.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • pemspems Posts: 70
    edited 2008-08-29 22:27
    Thanks Phil

    Comparator with hysteresis has been tried and still led to fake zero crossings. Besides, i would like to create a system that would be able to adjust itself to different 'flavors' of vr signal. Consider that noise amplitude (the dangerous 'fake' spikes) can be same as the real signal amplitude.

    I understand about the delay and would be fine with 1 or 2 periods of it (but 1 is better as the system is very realtime in nature).
  • Sniper KingSniper King Posts: 221
    edited 2008-08-29 22:37
    Can you get rid of the noise on the signal wire? Capacitor or something. This is right up my alley here as I am adopting a VR device for use with a camera to "look around"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·- Ouch, thats not suppose to be hot!··


    Michael King
    Application Engineer
    R&D
    Digital Technology Group
  • pmrobertpmrobert Posts: 673
    edited 2008-08-29 23:47
    Look at LM1815 - works very well for zero-crossing detection.

    -Mike
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-08-29 23:53
    Try a lowpass filter, followed by hysteresis. The filter will knock down short-duration spikes to keep them within the hysteresis band.

    -Phil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Still some PropSTICK Kit bare PCBs left!
  • pmrobertpmrobert Posts: 673
    edited 2008-08-30 10:50
    Phil, I'm here to learn - but - wouldn't a lowpass filter introduce a phase change? I played around with a similar situation as pems is describing (toothed crank wheel on an internal combustion engine) and tried the lowpass - it worked, but since this is a very time sensitive application if providing ignition, there was a frequency dependent delay introduced when using the filter so was a no-go. Perhaps I had something else going on.

    -Mike

    Edit: disregard - I failed to thoroughly read your earlier message!
  • evanhevanh Posts: 15,658
    edited 2008-08-30 16:09
    You've got three options (You can combine all three options):
    1: Keep it clean.
    2: Model it and predict.
    3: Filter it.

    Getting number one sorted is by far the most important. On that note: What is this sensor? Non-contact is best. How is it wired? Is there local buffering and conditioning at the sensor? Is the cable shielded? Are ground loops possible?


    Evan
  • pmrobertpmrobert Posts: 673
    edited 2008-08-30 16:26
    I'm jumping in here because I've a little experience in sensing these things. Clean is good, absolutely. I'm going out on a limb here and presume that the OP is referring to an engine based VR sensor. Shielded cable and using differential input is very important as these things are operated in a very dirty environment with lots of potential for induced noise from ignition components and associated wiring, relays kicking on and off all the time, etc. They typically do not have any active components at the sensor head; just a magnet and a coil creating a signal due to a teeth on a wheel sweeping past. See http://smrmicro.com/vrwaveform.jpg for a typical raw waveform. In my experience, simple is better. I personally use the prev mentioned LM1815 very close to the sensor and send the generated square wave back to the processor. Examining the patents from Bosch, Ford, etc., shows that they also like to use a discrete zero popint discriminator rather than doing it in software. As always, YMMV, there are many ways to skin a cat and I have no doubt it can be successfully done in software. Personally, I'm happier letting the 1815 do the job thus offloading that chore from the main processor.

    -Mike
Sign In or Register to comment.