LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Butterworth Filter problems FPGA

Solved!
Go to solution

Hello-

 

I am currently trying to extract certain frequencies from analog inputs in a single board RIO. I am using two butterworth filters to isolate 500Hz and 7kHz square waves. I have set up the FPGA code similar to

http://zone.ni.com/reference/en-XX/help/371599F-01/lvfpgaconcepts/fpga_filtering/

 

When the FPGA is compiled and I try to test the isolation using a signal generator, I recieve negative voltages at those specific frequencies. And yes, grounds are connected...

 

I have a NI 9205 AI running at 250kS/s (4us conversion time). For the 7 kHz filter I use a low pass fc = 15 kHz filter in series with a high pass fc = 5 kHz filter. Theoretically, this should easily pass a 7 kHz signal.

 

Any thoughts?? I really appreciate the feedback!

 

--Eli

0 Kudos
Message 1 of 11
(6,100 Views)

the filter code you are using applies to sinusoids, not square waves.

 

you can verify this by creating a test case in windows using the same code that you are trying to see the result of known waveform input vs output.

 

you would do better to threshold the data and debounce it if you think you have noise.  there is an analog period measurement express vi on the fpga pallete as well.

Stu
0 Kudos
Message 2 of 11
(6,094 Views)

Hi Stu-

 

Thanks for the help! It would be best if I could apply filters. How would a bandpass ptbypt filter work for me if it were implemented on the host code? Would it be better suited? If so, would you set the 'sampling frequency' to the same as if it were on the FPGA (250kS/s)?

 

--Eli

0 Kudos
Message 3 of 11
(6,080 Views)

Eli-

Have you tried just getting your signal from the actual phototransistor getting flashed by the beacon? I dont think that gives a good square wave with all the multiple IR sources and we may have better luck using the software filters. Also I am going to try to window the signal to make it look more sin(ish) possibly helping out the software?

 

Also we can use a bandpass filter. Ill try it out on Wed.

http://zone.ni.com/devzone/cda/pub/p/id/1169

 

Matt

0 Kudos
Message 4 of 11
(6,079 Views)

you have told me what you are trying to do but not what you want to do.  what does the raw signal look like and what do you want to do with it?

 

Stu
0 Kudos
Message 5 of 11
(6,071 Views)

Hi Stu-

 

Basically, I will have two potential square waves input into my sbRIO of different frequencies: 500 Hz, and 7 kHz. I need to locate either one or the other. This is for a robotics project...

 

So, if I'm on a one team, I will be emitting 7 kHz IR but looking for 500 Hz - or vice versa.

 

So, what I would like to do is, if I am looking for 500 Hz, I will send my incoming analog signals through a 500 Hz filter, take the mean and if the mean is greater than some threshold, then I can say that my robot "sees" the other robot and take appropriate action. If a 7 kHz signal finds its way to my sensors, then the 500 Hz filter should filter this out.

 

Matt-

 

I haven't had this issue. Are you using a signal conditioner?

 

--Eli

0 Kudos
Message 6 of 11
(6,064 Views)

what does the raw analog signal look like.  if you measure it with a scope, what is the magnatude, minimum, rise time, ring etc.  post a picture. as has been suggested, why isn't a threshold with hysterisis and measurement of period adequate to do the job?

Stu
0 Kudos
Message 7 of 11
(6,038 Views)

I will send a picture later today. Using a function generator with a square wave 0-5V, threshold = 2.5 and some hysteresis, I cannot get the analog period measurement to detect any crossing, or period. Here's how I use it:

analog period meas.png

I've tried without a sequence as well. I must be using it incorrectly...

0 Kudos
Message 8 of 11
(6,023 Views)
Solution
Accepted by EliKuhlmann

here is a test case for analog period measurement.  how does your data differ from test case data?

 

maybe you want to post your project,  or a simplified version of your project.

Stu
Message 9 of 11
(6,018 Views)

As a follow up question,

 

Is there a way to use multiple inputs and create an array with another "for loop" that will process the period measurement faster? I am hoping to add 8 channels, and if I do individual "for loops" for each channel, the sample rate slows to a level that is unusable for me: I need to sample at least 7000 samples per second to detect a 7 kHz signal.

 

Here is what I thought would work for multiple inputs, but doesn't. Any hints?

 

Thanks so much!

--Eli

0 Kudos
Message 10 of 11
(5,993 Views)