LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pedometer Software in LabView

Hello,

 

I'm working on a Senior Project at DeVry University, where I implement an accelerometer into LabVIEW via DAQ.  G-force is applied to the accelerometer on an X, Y, and Z axis and voltage will be applied among the X, Y and Z pins. I want to create a pedometer from LabVIEW by having the Y values spike up and down as the acceleromter is attached to a person on a treadmill.

 

After a voltage passes an 'N' value it will increment a counter on how many steps the person has taken. My problem is that LabVIEW grabs too much of voltage values passed 'N' and will count 3-4 more steps for every step. I tried to create a boolean to grab data and increment the counter only when it is within a certain voltage, along with changing the sampling rate. Any help or suggestions is deeply appreciated.

 

Here is a general boolean table I am looking for:

Passes voltage amount A,     Passes voltage amount B,     Outputs increment

0                                         0                                          0

0                                         1                                          0

1                                         0                                          1

1                                         1                                          0

0 Kudos
Message 1 of 6
(2,965 Views)

Please post your current code.

0 Kudos
Message 2 of 6
(2,955 Views)

Here is my VI, I hope this helps.

0 Kudos
Message 3 of 6
(2,943 Views)

Posting the actual VI is more helpful than an image.

 

You are doing a lot of unnecessary calculation in your VI.  Why multiply by 1 near the TIME DELAY label?  You can implement the reset in a simpler way by using a Select node.  I assume the problem with the step counting is somehow related to the formula node, but we can't see what's in the formula from the image.  Where on your diagram is the Voltage A and Voltage B mentioned in your original post?  Have you tried writing a VI to simulate the step counting portion only?

0 Kudos
Message 4 of 6
(2,908 Views)

Sorry, I have other stuff going on with my VI, and I have cleaned it up a little bit last night.

Here is a better and more understanding version for this situation.

0 Kudos
Message 5 of 6
(2,897 Views)

Right now, your VI takes a very complicated approach to do the following: add one to the counter if the voltage is greater than 1.  Try it out: replace the DAQ read with a numeric control, enter different values, and see what happens.  Clearly that's not what you're trying to do.  Here are a few suggestions:

 

1) Put your code inside a while loop so it will run continuously (do NOT use the "run continuously" on the toolbar; it's not intended to be a substitute for a while loop).  Make sure that your while loop has a stop condition and a wait inside it.

 

2) Replace the analog input with a numeric control - a slider might be a good choice - so you can easily simulate different voltages.

 

3) Take advantage of the boolean data type and use a select or a case structure, rather than trying to manipulate a boolean into a numeric value that you can add or multiply.

 

Once you've simplified your code, then look at the logic.  What pattern of voltages should trigger a step count?  In your logic table, which is greater, voltage A or voltage B?  Is your logic table actually helpful, or is there another way of thinking about it?

0 Kudos
Message 6 of 6
(2,866 Views)