Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   analog input help (http://www.chiefdelphi.com/forums/showthread.php?t=73385)

IceStorm 31-01-2009 23:19

analog input help
 
we have a very unique sensor that we are trying to encorporate into our design. it uses an analog channel and outputs a voltage ranging from 0 - 5 volts. when hooked to a motor in generates a sine wave with the teeth of the sine either rising or falling depending on which way the motor is spinning and the space of the pulse varries with the speed of the motor. we are hoping to use this as an encoder from our drive motors but need to create a bit of code to count the number of pulses, time between pulses, and if they are an increasing or decreasing pulse

has anyone else done anything similar to this that would be willing to provide some sample code or even able to think of any functions within labview/frc examples that would help with this.

thanks in advance.

EricVanWyk 31-01-2009 23:49

Re: analog input help
 
Can you link us to a datasheet?

This sounds like a job for analog trigger + counters. One of the beta teams did something using continuous pots that had a semi-similar waveform.

Alan Anderson 01-02-2009 00:36

Re: analog input help
 
I'm guessing you mean sawtooth wave instead of sine wave, and you're using a magnetic absolute position sensor. Perhaps something like the MA3 from US Digital. Its output is very similar to a continuous-rotation potentiometer, but with no "dead spot".

We used one for sensing our arm position last year, so all we needed was the raw analog value. For motor speeds, we've used quadrature encoders. While I don't have any working example code to help, I think I can suggest some ways to get what you want.

Sample the analog voltage often, looking for a large transition. If it went from high to low, it's spinning one way. If it went from low to high, it's spinning the other way. Record the time when the transition occurred, and subtract it at the next transition; that will give you the period. Add to or subtract from a running counter each transition; that will give you the number of rotations.

IceStorm 01-02-2009 09:02

Re: analog input help
 
Alan,
You are correct. I did mean sawtooth wave. I even read over the post twice and somehow missed that. The unit we are using is a halleffect sensor that can sense the poles of the magnet moving. I can't remember the company that makes them at the moment or where the datasheets can be found they are all printed out at the shop where we don't have any working internet connection.

your idea of sampling the values and comparing them is kinda what I had in my mind that we needed to do, I'm just not sure how to nudge are team members in that direction with the code.

Thanks

IceStorm 03-02-2009 23:11

Re: analog input help
 
1 Attachment(s)
having spent about 6 long hours working on this now and getting no where i'm throwing this back out there for anyone that may be able to help us.

we've managed to get it to show which direction we are traveling in and even count the number of rotations but can't get it to reset the counter when we switch the rotation

here is a link to a video on screencast that shows our dashboard as we spin a magnet over the hall effect sensor first in a forward motion and then in a reverse motion
http://www.screencast.com/users/mill...6-179947561613

attached is also a copy of our code that we will eventually need to make into a sub vi for our main program to use for each of our hall effect sensors.

any help would be great

Joe Ross 04-02-2009 02:00

Re: analog input help
 
You only have the up source of the counter connected. If you want it to count down, you'll need to connect the down source also. You'll also want to connect the output type of the dig src VI.

You may want to look at http://forums.usfirst.org/showthread.php?t=10546

IceStorm 04-02-2009 07:06

Re: analog input help
 
We weren't necessarily trying to get it to count up and down as long as we were able to get it to count 1 direction and have the ability to reset the count when the direction changes would have worked as well for us.

I've pulled down a copy of the examples you posted from NI and will test them with the team tonight.


It looks pretty straight forward other than we will need to adjust our high and low triggers and I'm not sure (with only looking at the code for a few seconds) what type of value in need to put in for Max RPS.


Thanks,
Chad

Joe Ross 04-02-2009 10:14

Re: analog input help
 
Quote:

Originally Posted by IceStorm (Post 813842)
We weren't necessarily trying to get it to count up and down as long as we were able to get it to count 1 direction and have the ability to reset the count when the direction changes would have worked as well for us.

You could use the falling output from the analog trigger to reset the counter.

Quote:

Originally Posted by IceStorm (Post 813842)
It looks pretty straight forward other than we will need to adjust our high and low triggers and I'm not sure (with only looking at the code for a few seconds) what type of value in need to put in for Max RPS.

The analog triggers are susceptible to noise on the analog inputs. One way to combat this is to enable averaging of the analog inputs. However, if you average too much, you'll miss transitions. If you put in the Maximum Reveolutions Per Second (or in your case transitions per second) that the sensor will see, the library I wrote will calculate the right amount of averaging for maximum noise rejection and still catch all transitions. You can also help it by making sure a very high sample rate is used for the analog module.

Jared Russell 04-02-2009 10:24

Re: analog input help
 
Sounds like you have a resolver.

EricVanWyk 04-02-2009 11:42

Re: analog input help
 
Might be slightly off topic here, but has anyone tried using the "unwrap phase" vi to do this? I think you'd have to manipulate the analog signal so it is temporarily in the range of -pi to pi, but it could work. They stole my cRIO, so I can't test it myself.


All times are GMT -5. The time now is 08:47.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi