|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||||
|
|||||
|
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. |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
Re: analog input help
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 |
|
#6
|
||||||
|
||||||
|
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 |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
||||||
|
||||||
|
Re: analog input help
Quote:
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. |
|
#9
|
|||||
|
|||||
|
Re: analog input help
Sounds like you have a resolver.
|
|
#10
|
|||
|
|||
|
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Analog Input Errors... | Tach'ko | Electrical | 1 | 11-01-2008 11:37 |
| HELP: analog input | Tottanka | Programming | 19 | 18-02-2007 19:27 |
| Analog Input Trouble | Matt Krass | Programming | 10 | 20-01-2005 21:09 |
| Resistance to Analog Input Value. | Josh Hambright | Electrical | 12 | 15-04-2003 16:12 |
| DC Motor current to an Analog Input | junkyarddawg | Motors | 43 | 04-04-2002 15:53 |