LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA Zero Crossing Detection on noisy signal (back-emf)

Good day all,

 

Im trying to detect the zero-crossings on a fairly noisy back-emf signal on a brushless dc motor, the signal is more less the purple signal below, with six commutation spikes per period. 

Back-emf signal

Unfortunately, the zero-crossing detection block in LabView FPGA also detects the commutation  spikes. I would like to filter the signal (for example with a moving average) to get rid of te spikes or make them smaller. I tried to implement the built-in Butterworth Filter (cut-off 5, 10, 20kHz, samplefreq 200kHz), but this did nothing, my program still detects false zero-crossings. 

How can I filter these false zero crossings out? Note that this is for a high speed application, with fundamental frequency of 20 to 30 kHz, so the filtering should be sufficiently fast.


Thanks in advance,

Kind Regards.

0 Kudos
Message 1 of 9
(4,920 Views)

Are you using an appropriate hysteresis level to avoid repeated zero crossing detections? A good filter should be able to reduce your spikes to, say < 20% of you fundamental signal and if you use a hysteresis window of 50% that would prevent false triggering. If your signal amplitude changes over time you could update the hysteresis level continuously (for example by using a 50% level of previous peak value).

0 Kudos
Message 2 of 9
(4,837 Views)

Hi LocalDSP, 

Thank you for your answer.

Could you explain what you mean by a hysteresis window of 50%? How would this be implemented in labView FPGA?

Furthermore, I am limited in using filters, too much filtering causes a delay in the detection of the zero-crossing.

0 Kudos
Message 3 of 9
(4,822 Views)

Hi CoffeeSipper,

 

    Best would be if you could post some time domain data either as a data file or as saved by default on a LabVIEW graph and then post the VI. I can look at what type of filtering would work best. For hysteresis look for example at the following explanation. It is used for triggering but the same concept can be used in your case.

 

http://www.ni.com/white-paper/4363/en/

Message 4 of 9
(4,817 Views)

How fast do you need to detect the zero crossing?

Sample length of spikes? 

A good filter for spikes is the median filter, don't know how good that could be implemented in a FPGA.

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 5 of 9
(4,808 Views)

A very efficient method would be to use a debounce filter. Effectively only count it as a zero crossing if the last n samples have all crossed zero. It does introduce some lag into the signal though.

 

The faster response would be the opposite - If I have had a zero crossing in the last n signals don't register a new one. This way you still get the first edge to cross but not the extras.

 

This will handle multiple triggers at the crossings - with a high frequency cutoff for the spikes might work

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
Message 6 of 9
(4,801 Views)

Hi Henrik, thank you for your answer.

The zero-crossing needs to be detected almost instantaneously, because at that exact moment the BLDC needs to commutate. Some deviation in time (in order of microseconds or tens of microseconds) is possible, but this decreases the efficiency of the machine.

The sample length is about 40 to 50 microseconds. I might implement the median filter, I have a fairly good idea of how that should be implemented. I'll keep you posted on what I do.

0 Kudos
Message 7 of 9
(4,794 Views)

Hi James_McN and LocalDSP,

 

I'll answer to both of your posts here, since some more explanations from my side are needed.

I have decided not to use filtering, only as a last resort, since it will introduce too much time delay. Even with a simple moving average, it will not be easy to reduce the spikes without introducing significant delay.

However, the spikes are not random noise. They are caused by commutations of other phases of the motor, which I control from within labView FPGA. Each time a commutation happens (right before the spike) I generate occurence that sets a variable that prevents measuring for a fixed time. This prevents my zero crossing algorithm from detecting the spikes.

Now as for detecting the true zero crossings, I think a debounce filter will be excellent. Right now I try to do the opposite as you suggested, but this causes the zero crossing to be very inconsist. A debounce filter might be more stable.

Thank you both for your suggestions. 

 

0 Kudos
Message 8 of 9
(4,789 Views)

hi sir ,

my project is''control a sensorless brushless motor using FPGA" now i'm so blocked to write the code vhdl that's why i' ask you can you show me you code VHDL please of zero crossing detection .

thank you 

regards.

0 Kudos
Message 9 of 9
(4,014 Views)