08-23-2011 02:37 PM
Hi all!
I'm trying to program a velocity monitor to keep track of how fast a motor is going so that I can start a recording once it reaches my desired constant velocity. I'm measuring the velocity of my motor with a light sensor that senses a piece of white tape attached to the outer edge of my motor (aka, it pulses once per rotation) which means that if I know the time between pulses I can calculate the velocity. I think I understand how to do this for one iteration but I want to keep on measuring the velocity after I tell it to change until it's the constant velocity I desire. Can anyone help me with a program to continually measure the velocity?
Thank you,
Lost Student
08-23-2011 02:53 PM
Lost,
Since you can do it for one iteration, you already know quite a bit.
Please post what you have tried, and point out what does not work. It is much easier for us to help you understand what you are doing that does not work that to try to explain something which might be completely different from what you have in mind. Also, you learn more this way.
Hint: Shift register.
Lynn
08-23-2011 04:34 PM
Hi Lynn,
I think to get the velocity I need to be able to reset the "tick count" whenever the statement is "True."
08-23-2011 05:55 PM
I would forget the tic counts and base everything on your sample time:
08-25-2011 03:09 PM
I'll try that, what is the first box (the one with three symbols) that you connected the DAQ assistant to?
08-25-2011 03:40 PM
Min/Max of an array. The way you had it the event would only trigger if the last digit of the data set was HI. This way you will not miss an event within the array.
08-29-2011 03:18 PM
OK, now I have this. Could you explain what I should put in the "False: box? Also, how do I keep track on the velocity outside of the big while loop? When it hits the wall of the T/F block it needs something on the false side to exit.
08-31-2011 09:01 AM
Falcon9a,
Based off of Citabria's comments in his code, for the false condition you would just wire the integer input of the case structure directly do the exiting integer tunnel on the right side of the case structure. Then another thing to note is that he uses shift registers to keep track of changes to the value after each iteration of the while loop. You can change those blue boxes on the edges of the while loops to shift registers by right clicking on one and then select change to shift register.
Regards,
Danny F
09-01-2011 04:08 PM
OK, I set it up as follows but I'm not getting very logical numbers. For a fairly constant rate they vary in series like 6, 3, 1.5, 2, ext which would mean I'd be going something like 1 rotation every ms, which I am not doing. Do I need to change something in the DAQ assistant? I think Citabria's program is measuring the the total sample times before the T/F is satisfied, which would solve for the time between high voltage pulses but I'm not sure how his program adds the times.
Thank you
This is what I'm measuring, there is a 10v pulse every time the white tape is hit with a light
09-01-2011 05:22 PM
Your "1" represents seconds (Rate is in sec.). Do you want it to be seconds? Maybe you should represent it in ms if that's what you're measuring. Also, are you passing the accumulated time (the blue integer) straight through the false statement? Also, look what I did with the Min/Max call. You need this! Setup that thing to output an array, not a scalar. The way you have it setup you could completely miss a 10V event.