From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous real time spatial resolution

Solved!
Go to solution

Hi everyone, 

 

I started this project on NI LabVIEW while ago and left it due to some problems that i needed to take care of.

 

I'm trying to read in real time from 4 analogue inputs in Arduino and display it over intensity graph on VI 

 

I have a sensor mat that can detect pressure, I wrote my code through Arduino to send a high voltage from 4 digital pins each one at a time, and read from the 4 analogue pins in each time i send a high voltage to the sensor mat (surface).

 

my VI can read continuously and store in 2D array, but display over an intensity graph up to one time then stop processing the rest unless if i'm stopping the program then activated again. 

 

what i want is: reading my data every time and the most important see the spatial resolution changes due to change the weights over this sensor mat. like detecting the position of the weight over the sensor mat and see it in real time. 

 

i'm reading the data through a serial USB connection between the PC and Arduino, reading from VISA and store it in 2D array then try to display it. 

 

in the attachment you'll fine a picture about what i mean by sending high voltage at a time and read from the analogue pins . also my VI that i'm trying to work on it from long time, but unfortunately i couldn't touch it for a while now. 

 

 

looking for your knowledge and help. 

 

 

 

Thanks

 

 

 

 

Download All
0 Kudos
Message 1 of 19
(2,928 Views)

Hi everyone, 

 

I started this project on NI LabVIEW while ago and left it due to some problems that i needed to take care of.

 

I'm trying to read in real time from 4 analogue inputs in Arduino and display it over intensity graph on VI 

 

I have a sensor mat that can detect pressure, I wrote my code through Arduino to send a high voltage from 4 digital pins each one at a time, and read from the 4 analogue pins in each time i send a high voltage to the sensor mat (surface).

 

my VI can read continuously and store in 2D array, but display over an intensity graph up to one time then stop processing the rest unless if i'm stopping the program then activated again. 

 

what i want is: reading my data every time and the most important see the spatial resolution changes due to change the weights over this sensor mat. like detecting the position of the weight over the sensor mat and see it in real time. 

 

i'm reading the data through a serial USB connection between the PC and Arduino, reading from VISA and store it in 2D array then try to display it. 

 

in the attachment you'll fine a picture about what i mean by sending high voltage at a time and read from the analogue pins . also my VI that i'm trying to work on it from long time, but unfortunately i couldn't touch it for a while now. 

 

 

looking for your knowledge and help. 

 

 

 

Thanks

 

 

 

 

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

Hi N.Ghrayeb,

 

What is the example output of the Serial Read for one iteration of your While loop?

Presumably the read is terminated by a termination character (I guess you don't get 1000 points, and timeout would stop the loop with an error) but it's not obvious to me if you get all 4 points or just one per read (Sorry if this should be obvious from the picture of code).

 

Do you want to store the results, or just display the current distribution of weight?

 

Note that nothing is writing to your bottom shift register (your output from the Replace Array Subset is not wired) but this isn't feeding any of your graphs anyway.

 


GCentral
0 Kudos
Message 3 of 19
(2,883 Views)

Hi cbutcher,

What i'm trying to do is, reading from my serial bus and feeding the Array, after that store each 4 inputs in the Output array, each individual time. 

 

after storing those data in the output array, i want to display them on intensity graph. 

 

i do have several intensity graphs, cause i'm still trying to reach my goal. 

 

if you run the VI you'll find that the program feed the Array all the time, but store in the Output array only once and display on intensity graph once as well.

 

i'm trying to make it run over the time and change the data with time in both the output array and intensity graph. 

 

for example, if i placed 500g over the sensor mat. i should have the weight on the output array and display over the intensity graph. 

 

the output of Replace array, break my wires as i'm connected to anything !! trying to figure out how to do it.

 

please check the attachment and you'll see what i mean.

 

 

thanks for your help

0 Kudos
Message 4 of 19
(2,876 Views)

Ok - that picture was quite helpful. Unfortunately, we can't run your VI because likely most people reading this forum don't have an Arduino with your code and suitable hardware to simulate the data! However, with the text indicator you have, at least some input is visible now!

 

It seems like you have a row of 4 numbers, followed by a row of 4 zeros, sometimes read in two sets. Is this intentional, or should there always be non-zero values? In any case, it seems likely this depends more on your Arduino code, but perhaps your timing settings are too fast?

 

In some lines of your input, only one zero is being read, with the 3 remaining zeros from that line taking too long to be produced - you might want to slow down your LabVIEW loop iterations? I would guess putting a 'Wait (ms)' timer inside the loop will help clear up your input (since the picture of your code showed a 1s wait - I don't know if that's between rows or points.

 

The reason I asked about number of points per read (looks like 4) and current data only, is that you need a way to determine where data should be displayed on your graph, and when to overwrite old data.


GCentral
0 Kudos
Message 5 of 19
(2,867 Views)

I'll try the Wait ms now and i'll let you know. 

 

the idea those zeros, when there's no load on the sensor mat. and as u mentioned the zero in one line then followed by 3 zeros, that was an error in the code and i fixed it. 

 

but still want to know how to make the VI as a master to clear the data and load other. similar to the idea of master and slave, but make the labview is the master and arduino is the slave. 

 

also i'm trying the idea of handshake between them to clear the data from the output array and load the new one with time. 

 

it is hard for me as i haven't touch labview for ages now. but still trying to learn myself from every source available. 

 

thanks 

0 Kudos
Message 6 of 19
(2,859 Views)

I got the same, 

 

i added a Wait ms (100), he is not clearing the data from the output array and never change the intensity graph. 

 

check the attachment. 

 

 

Thanks for your help and patience 

0 Kudos
Message 7 of 19
(2,856 Views)

Ok, seems like things have improved since you fixed whichever problem you had with your code.

 

Am I right in thinking you have a 4x4 array of inputs which are read in a rolling loop of 1 row of 4 points at a time?

 

If so, you can use the replace array subset and quotient/remainder primitives with a 4 wired to the QR to choose which set to overwrite.

 

Then wire that shift register to your graph.

 


GCentral
0 Kudos
Message 8 of 19
(2,844 Views)

Am I right in thinking you have a 4x4 array of inputs which are read in a rolling loop of 1 row of 4 points at a time?

 

that is exactly what i'm doing, 100% True. 

 

replace array subset and quotient/remainder primitives with a 4 wired to the QR to choose which set to overwrite

 

how that should happen, as if i connected the output of the Replace array to X, and 4 constant to Y, i have two outputs, one can goes to the intensity graph but i should delete the one from the reshape array, otherwise it will break the wire. 

 

Then wire that shift register to your graph

 

this one i didn't get it. 

 

 

do you mind to attach a picture about what you mean.

 

 

 

 

 

Thanks 

 

0 Kudos
Message 9 of 19
(2,840 Views)

Sorry - I mean that you can wire the 'i' to x and 4 to y, then take the upper output (remainder) as the index to the Replace Array subset.

 

Have the shift register contain a 2D 4x4 array and wire a 1D array with the 4 newest values as the input to RAS.

 

Branch the shift register wire after the RAS and connect it to your graph.


GCentral
0 Kudos
Message 10 of 19
(2,832 Views)