Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Input noise, best way to filter?

Solved!
Go to solution

Hi there,

I'm using a cRIO (w/ LV 8.5) to do some throttle control on an electric racecar, and the throttle signals from the driver are either 0-5V or 0-5kOhms.  Right now, i'm working with a 0-5V signal for some testing.  So this 0-5V throttle input comes in, the cRIO looks at a few conditions, and if everything is okay, it just passes that 0-5V right on through to the motor without changing it at all.  So I've got an NI 9201 AI module and an NI 9263 AO module.  Our first time hooking this system up to a motor on our dynamometer though, we quickly realized that there's too much noise getting into this throttle signal, and the motor jerks around, kinda like it's possessed.  We thought maybe we could live with this, kind of like the irregular rumble you get from a burly V8, thinking this might be nostalgic for older racers, but it's a little tough for our testing in the lab in the mean time.

 

I've had a look at some examples of using a low-pass butterworth filter on the FPGA, and this seems to be a nice implementation.  My stumbling block comes from the fact that I've been using calibrated data, engineering values coming out of the modules, and just passing the Voltage value from my AI on to the AO.  Meanwhile, the Butterworth filter can only work with integer values.  I then tried setting both the Input and Output modules to Raw data rather than Calibrated giving me integer data instead of FXP, and then passing the input through the filter and then straight into the output module.  This seemed to work at first, but then I realized that my output wasn't mapping to my input, the voltage output was way off from what I was inputting.  This is because the calibration from raw data to engineering values is different for the two modules, and the Integer values i was passing from one to the other don't correspond to the same voltage values.  Then I thought I could take in the raw data from the Input module, filter it, then pass it through a calibration block to turn that into Voltage values, and send calibrated data to the output module (reset the output back from Raw to Calibrated, but keep the Input in Raw data.)  That's when I realized that any of the calibration from raw to engineering values I've seen has always happened in the Host vi, and that the FPGA doesn't support the calibration blocks that I found in the examples.

 

I can think of how to proceed now (maybe throw in a gain to adjust the output data until my input maps correctly to the output) but it has me thinking that there must be a more legit way of filtering data coming in from an AI module and passing that onto an AO module.  Thanks in advance for your help!

 

Jeff

McGill Hybrid Racing Team 

0 Kudos
Message 1 of 9
(11,983 Views)

Hello Jeff,

 

It looks like LabVIEW FPGA 8.6 adds support for the fixed point data type on the butterworth filter express vi.  http://zone.ni.com/reference/en-XX/help/371599D-01/lvfpga/fpga_butterworth_filter/ is the help file with the relevant information.

 

If that isn't an option for you, is it feasible for you to do the filtering on the RT side?  That is aquire data on the FPGA, pass it to the RT application, filter it, and then pass it back to the FPGA for output?  I realize this is not as high performance but perhaps it is sufficient for your application.

 

Otherwise assuming your filter requirements aren't too demanding a low pass filter circuit can be built relatively easily with a few simple components.  You could consider doing the filtering before the input stage.  If you need help with this, let me know and I can point you to a few resources.

 

One other option would be to implement your own filter on the FPGA that works with FXP data.

 

Sebastian

0 Kudos
Message 2 of 9
(11,972 Views)

I should also add that taking steps to reduce the noise in the first place would also be a good idea.  I imagine the environment you are testing in is electrically quite noisy.  I'm not an expert on this sort of thing so I suggest you do a bit of research in order to see what is applicable to your situation. 

 

To help get you started, some things I have done in the past  to solve this sort of issue include twisting the motor wires together, a capacitor (typically a small ceramic one) across the motor leads, and the use of shielded cables.  I'd also recommend checking for proper grounding.

0 Kudos
Message 3 of 9
(11,966 Views)

I agree with the statement to reduce the root noise is the best option.

 

However, you should be able to use the 8.5 filter routines as 16 bit integers pretty easily.

What is the raw range of the AI?  what is the raw range of th AO? I would filter the raw AI and manipulate the result to fit the raw AO.

if you are interested in calibrated values rather that factory default scaling factors, this can also be accomodated fairly easily.

Stu
0 Kudos
Message 4 of 9
(11,948 Views)
Solution
Accepted by topic author Jeff MHRT

I have attaced a LabVIEW 8.5 project that shows an example of what you are trying to do.  There is a windows test case as well showing the result of the filter.  I think this may help.

The analog input is 12 bit and the output is 16 bit that I am sure is part of the issues you were dealing with.

Message Edited by stu@viewpointusa.com on 01-25-2009 10:03 PM
Stu
0 Kudos
Message 5 of 9
(11,944 Views)
Thanks a lot for the responses Stu and Sebastian.  I think putting a physical low pass filter on the throttle output of the cRIO is definitely a good idea, but I"ll take a look at what I can do in terms of manipulating the raw data.  Thanks for the example Stu, I'll give it a look and get back to you on that.
0 Kudos
Message 6 of 9
(11,938 Views)
Just wanted to confirm that Stu's suggestion performs pretty much exactly as expected.  The AO tracks the AI exactly, minus the noise.  Now i'm just playing with the filter to get a decent response time while still taking care of the noise.
0 Kudos
Message 7 of 9
(11,887 Views)
One thing that would help in your evaluation is to get a shapshot of the data (DMA stream) as the A/D is reporting it.  evaluate the noise.  is it random or single point excursion spikes.  if they are single point, a three point median filter would clean it up with much less phase delay than a low pass filter.  if there are several excursions, a larger median filter might work.  Also try a higher order filter (it will take up a bit more FPGA fabric).
Message Edited by stu@viewpointusa.com on 01-29-2009 01:11 PM
Stu
0 Kudos
Message 8 of 9
(11,884 Views)

Hi everyone,

 

Do you know if 785x cards have an embedded antialiasing filter on its analog inputs? Maybe it could be a source of "noise" as described below...

 

Thanks,

 

Pierre

0 Kudos
Message 9 of 9
(11,033 Views)