LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for advice for digital filtering touchscreen signal and coding recommendations

For my senior design project I am using a 5-wire resistive touchscreen as a sensor to detect the position of a ball that will be rolling around on it. I have the touchscreen hooked up to a myRio with the 4 digital output wires in the MSP DIO connectors and the analog input wire in the AI connector.

 

The problem I am having is that there are frequent voltage spikes from the touchscreen that will lead to inaccurate data, so I am trying to find a digital filtering method that will get rid of these voltage spikes without reducing the response time of the touch screen too much. I think that some kind of comparative filter would work, where my code compares the most recent touch screen voltage values to the previous ones, and if they differ by more than a certain amount, then the new values are discarded and the old values are used again. However, I am quite new to Labview and am unsure of how to implement this in my code.

 

I've attached my 2 VIs; the FPGA VI and the host VI. The FPGA VI is simply setting the digital output values to set the electrode voltages (because the x and y coordinates must be measured individually) and then measures the analog input value 10 times and stores it in an array. There are pauses between setting the digital outputs and reading the analog inputs because touchscreens have a certain "settling time" before they reach a steady state after setting the electrode voltages.

 

The host VI is simply calling the FPGA reference and I attempted to pass the values through a median filter but this was not successful in getting rid of the voltage spikes. It is then plotted in a waveform chart. I think the median filter was not successful because the arrays are erasing and rewriting themselves in every iteration of the while loop in the FPGA code instead of buffering with previously read values, but that will be something to investigate further.

 

If anyone has any experience working with touchscreens, or any recommendations for modifying my code, any help is much appreciated. Thanks for reading.

Download All
0 Kudos
Message 1 of 4
(2,832 Views)

When dealing with noisy signals, there are a number of filtering schemes you can use.  Noise is usually at higher frequencies than your signal (you describe the noise as a "spike", and the ball as "rolling around" (slowly), so a low-pass filter of some sort seems appropriate.

 

What do you know about digital filters?  About signals and filters in general?  About acquiring a signal digitally?  With a little knowledge, you should be able to solve this yourself.  I'd recommend (unless you have a good "signal-based" reason) starting with linear filters rather than a median filter.

 

Bob Schor

0 Kudos
Message 2 of 4
(2,750 Views)

Hi Bob, thanks for your reply. 

I did try a low pass RC filter but did not have much success with that. I've actually been able to successfully implement a median filter since I posted this thread and it seems to have eliminated basically all the noise I was concerned with.

I simply made arrays of x and y coordinate readings from the touchscreen, and took the median of those arrays  so that all the too high and too low values are eliminated, then update the array by rewriting the oldest values with the newest values as new coordinates come in.

It seems to be working very well, but am open to trying other things if you think they might perform better.

0 Kudos
Message 3 of 4
(2,738 Views)

The median filter is often the preferred method for dealing with outliers. However, if the "real" data changes enough during the data set submitted to the filter that the median value is not a good representative for that data, then another choice may be better.  For example if nine of the points are on a parabolic curve and the outlier is between the minimum and maximum values of the parabola, the median filter will not help at all.

 

So, the question becomes: How fast and in what manner does the data change during those 10 samples? How many spikes occur in that time?

 

Note that when you post a VI it is good to make the appropriate input values default and to include some typical output data, also saved as default. We can help much more if we can see your data.  Also try to avoid overlapping wires and wires hidden behind other objects. It makes it very difficult to tell what is connected to what.

 

Lynn

0 Kudos
Message 4 of 4
(2,737 Views)