Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does my DAQ counter count more when a capacitor is used to eliminate noise

Hi,
In my application i need to measure the speed of the motor using an encoder. The output of the encoder is a bit noisy (around 200 mV of noise.).Actually we are using a Siemens variable speed drive and it is the switching noise even after perfect shielding. Also the ouput of the encoder has a DC shift in waveform fr 383mV.When i connect to the counter channel (source :to count the pulses or gate :to measure frequency) the readings are high than actual. Then we conected a 0.1 microfarad capacitor across the counter channel and the DIO Ground. Then checked the waveform using a 60 mHz tecktronic oscilloscope. The waveform was without noise but the shape was a bit distorted, meaning there was no sharp rising edges and has a slow rise.But still there was a dc level shift for 383 mv.When i measured using counter the count was abnormal.Actual reading should show 1000 pulses /second, but with a capacitor it was counting 4789,5000, 356 etc.

Please let me know where the problem is. IS there any specific input signal rise time/fall time etc that the counter requires. Also will the dc level shift of 383 mV affect the counting.
I am using DAQ mx example vi(namely low frequency count as my freq range is 0 to 4000 hz)and also tried with simple digital count. Also please tell me if there is any problem in the connections

Thanks,
Sudha
0 Kudos
Message 1 of 7
(4,230 Views)
It sounds like you are doing something similar to my application. I have a 60 Hz sample clock that I had noise on as well, you should read about digital filtering options in the thread "Digital Filter for shared PFI line". One counter is for low frequency (to get period) and the other is just sampling the encoder. So I get 60 continuous and correlated samples of encoder and frequency per second.

Once the filter was in place the problems disappeared and it was very simple after the correct commands were known.

Ed
0 Kudos
Message 2 of 7
(4,218 Views)
Hi Ed,

Thanks for the reply. I am not fully understanding the idea you have suggested. If time permits can u please describe about it also if you are having the LabVIEW code of this please e-mail me. i am using a PXI 6052 DAQ card.

Thanks,
Sudha
0 Kudos
Message 3 of 7
(4,199 Views)
I am not using LabView, but C++ and NI-DAQmx driver directly so sample code will have to come from another source. What I can tell you is we did not have counting problems on the encoder (we are using quadrature counting mode), but we did have serious problems with the 60 Hz square wave which acts as a sample clock for the encoder. The 60 Hz is also fed into the gate of the other counter to get a frequency measurement. The speed is then the change in position times the frequency.

We also tried analog filtering using a 1kOhm in series and a .1uF across the signal to ground - this did very little to correct the problem. We then purchased the SCB-68 (noise shielded breakout) which improved the problem but did not eliminate it. The digital filter with a width of .00256 seconds did the trick, but it also reduced the resolution of the frequency measurement (this may not affect you). Attempts at using the smaller filter width did not work.

Hopefully someone familiar with LabView will offer some assistance.

Ed
0 Kudos
Message 4 of 7
(4,198 Views)
Sudha,

I may be misunderstanding your problem but it sounds like you need a Schmitt trigger on the encoder output to square up your signal and add some hysterisis. In case you are unfamiliar, a Schmitt trigger will wait for a threshold voltage to be passed before switching its output very fast and cleanly, and as it does this, a new lower threshold is set for detecting the falling edge. In this way it is quite immune to noise whose amplitude is within the switching point hysterisis.

Jamie
0 Kudos
Message 5 of 7
(4,189 Views)
Jamie, that makes some sense but why would this be needed on any commercial encoder? I agree that it would correct problems if the wave wasn't as expected. We use a lot of encoders and unless there is something wrong with it the output should be a nice square wave to begin with. Really hard to tell without looking at the scope. I've been surprised by "noise" in my counters that I can't see on the scope so it is hard to locate for us.

Ed
0 Kudos
Message 6 of 7
(4,184 Views)
While putting the capacitor between your signal and ground will git rid of any transients, it will also "round" out your signal. Your square wave provided by the encoder can be approximated by the sum:


y(t) = a_0 + sum(k=0...infinity, a_k*cos(k*f*t)) + sum(k=0...infinity, b_k*sin(k*f*t))


The capacitor has a frequency-depenent resitant (called reactance) which decreases with increasing frequency.
The reactance is:


X(f) = 1 / 2*PI*f*C


Where f is your frequency and C=1uF. What happens is the capacitor shorts the higher frequency harmonics to ground and makes your square waveform "ring" at the edges.

If this ringing causes you to swing high-and-low close enough to the switching point, then you could count pulses that really aren't there. What you really need is some sort of hysteresis to prevent this false switching. You should put this after the bypass capacitor and before the counter.

Also, another question is: What are the output levels of your encoder? The 383mV DC offset shouldn't affect a counter, but if your logic "high" voltage doesn't exceed about 2V then you might be hitting a region of metastability: where the counter randomly switches high/low.

Regards,
Chris_B
0 Kudos
Message 7 of 7
(4,164 Views)