LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect the position of an object over your sensor sheet and save it over time

Hello, 

 

I'm working on multiple SubVIs and most of my previous posts include all the problems and the questions that i'm facing. 

 

now i'm trying to detect the position of the object over my sensor sheet. 

i have a pressure sensor sheet (4 Rows X 4 Columns) connected through Arduino UNO to read the measurement of the pressure that placed over it. 

 

my idea is, how can i detect the position of the object on the top of the sheet (no matter how the position changed, the VI should detect it). and how I can save it over time such as (how many times this object place for the last hour, day, week, month and a year) also how I can show the shape of the object. such as (circle, triangle , rectangular, and square)

 

I have no idea about the Logic of such project, that's why i'm asking this question. it might be silly but for me is very competitive. 

 

looking for help please. 

 

 

here's my pressure code. 

http://forums.ni.com/ni/attachments/ni/170/1010849/1/Pressure-Temperature-Details.vi

 

 

 

 

Thanks. 

0 Kudos
Message 1 of 5
(3,052 Views)

N.Ghrayeb wrote:

 

here's my pressure code. 

http://forums.ni.com/ni/attachments/ni/170/1010849/1/Pressure-Temperature-Details.vi

So this code looks pretty similar to that in a previous question. Is it working nicely now? I notice that you've got a front panel control for the 'Read Bytes' input to your VISA Read but I would guess that you're not changing it - perhaps a block diagram constant is more appropriate. The Serial Open VI has none of the optional inputs wired, but if it's working, that's great.

 


N.Ghrayeb wrote:

now i'm trying to detect the position of the object over my sensor sheet. 

i have a pressure sensor sheet (4 Rows X 4 Columns) connected through Arduino UNO to read the measurement of the pressure that placed over it. 

 

my idea is, how can i detect the position of the object on the top of the sheet (no matter how the position changed, the VI should detect it). and how I can save it over time such as (how many times this object place for the last hour, day, week, month and a year) also how I can show the shape of the object. such as (circle, triangle , rectangular, and square)

 

I have no idea about the Logic of such project, that's why i'm asking this question. 

 

Your graph shows amplitudes between 0 and 1000. Is there some cutoff point that you observe when the object is over the sensor? If so, you can consider using a function like the simple 'Greater Than?' on your 2D array with a single cutoff value - this will produce a 2D array of booleans. Since you're scanning one line at a time, you might want to only check each new full image, so when the result of your Quotient/Remainder primitive returns 0 (or perhaps 3). You could use a case structure to make the comparison based on that input.

 

In terms of recording your data, you'll need to look at some of the options for File I/O. A useful comparison is available here but it seems to me a little biased towards the TDMS format (not surprising, since TDMS is the NI format). Alternatives include perhaps an SQL database. The options are really pretty varied and I don't know what will be best for your situation. Presumably you'll need to store the data you're gathering along with a timestamp - then you can search through saved data for results in a specific period. An intensity graph might be able to display the data in a pleasing way for you.

 

I don't know how you'll go about finding shapes from a 4x4 array. Possibly you have a far larger array and you're using this as a simplified example. In that case, you might have some luck with image recognition (I've never used it, so I have no idea...). With a 4x4 array, I can't imagine that your listed shapes differ at all on a binary threshold, so then you'd need some cleverer way to interpret your values (the 0-1000 or similar). I can't imagine that has a simple solution.

 

 



GCentral
0 Kudos
Message 2 of 5
(2,987 Views)

Hey There, 

 

thanks for reply 

 

Is it working nicely now?

yes it is, thanks for your tips

 

Your graph shows amplitudes between 0 and 1000. Is there some cutoff point that you observe when the object is over the sensor? If so, you can consider using a function like the simple 'Greater Than?' on your 2D array with a single cutoff value - this will produce a 2D array of booleans. Since you're scanning one line at a time, you might want to only check each new full image, so when the result of your Quotient/Remainder primitive returns 0 (or perhaps 3). You could use a case structure to make the comparison based on that input.

 

that's what i called it scaling, and now i'm just working on raw data, i'll scale later. I'll try to check the idea of case structure. 

 

 

finding shapes from a 4x4 array. Possibly you have a far larger array and you're using this as a simplified example

 

that is spot on mate, i'm working so hard to have the proof of concept and afterwards i'll work on large scale of sensors. 

 

however, I'm not quite sure about TDMS but i'll give it a go. but still my biggest concern is the security of such files. 

 

 

 

Thanks for your help mate. I do appreciate that

0 Kudos
Message 3 of 5
(2,970 Views)

N.Ghrayeb wrote:

however, I'm not quite sure about TDMS but i'll give it a go. but still my biggest concern is the security of such files. 

 

Can't get out of quote but regardless of weird formatting, here goes.

 

To be clear, I didn't mean you should use TDMS. It might work for you, it might not. I'm not really a big fan for my applications but maybe it just depends what you're doing. I only mentioned TDMS explicitly to point out the link suggests TDMS is always best and I don't know that that is justified (but like I said, it's not surprising that NI supports the NI file format...)



GCentral
0 Kudos
Message 4 of 5
(2,967 Views)

Depending on the data, position information is probably trivial. Simply threshold you matrix (that is, replace all values in the matrix that are less than a threshold value with 0 and all those larger than a threshold value with 1). Then take a weighted average of the 1's in the matrix in X and Y. So for each data point in X, multiple it's x position by its value and add it to an accumulator, or running sum. Then divide by all the values that had 1's in them. That will give you the average X position of the 1's. Then do the same for Y's. This can be done very fast. Certainly, you will be hardware limited.

 

Shape is way harder. If you have a library of shapes (that are also thresholded images that have 0's and 1's, such as a binary image of a triangle, etc), then you can compare the input to library using some IMAQ libraries that try to minimize the difference between a pattern and an image. It's called IMAQ Match Pattern. You also get position and rotation for free. Though the VI will take some experimentation with your data and this assumes you can make a library of shapes beforehand.

0 Kudos
Message 5 of 5
(2,958 Views)