Go to Post Can you believe we have 8 FRC teams in Arkansas this year??? Not quite Michigan, but... - Meredith Novak [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-01-2009, 23:19
IceStorm IceStorm is offline
Mentor FRC 5046, FTC 8688
AKA: Chad
FRC #5046 (Jacked Up Jackets)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Michigan
Posts: 134
IceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of light
Send a message via AIM to IceStorm Send a message via Yahoo to IceStorm
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 31-01-2009, 23:49
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-02-2009, 00:36
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-02-2009, 09:02
IceStorm IceStorm is offline
Mentor FRC 5046, FTC 8688
AKA: Chad
FRC #5046 (Jacked Up Jackets)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Michigan
Posts: 134
IceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of light
Send a message via AIM to IceStorm Send a message via Yahoo to IceStorm
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
Reply With Quote
  #5   Spotlight this post!  
Unread 03-02-2009, 23:11
IceStorm IceStorm is offline
Mentor FRC 5046, FTC 8688
AKA: Chad
FRC #5046 (Jacked Up Jackets)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Michigan
Posts: 134
IceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of light
Send a message via AIM to IceStorm Send a message via Yahoo to IceStorm
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
Attached Files
File Type: zip UpDown Counter.zip (39.2 KB, 41 views)
Reply With Quote
  #6   Spotlight this post!  
Unread 04-02-2009, 02:00
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,560
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
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
Reply With Quote
  #7   Spotlight this post!  
Unread 04-02-2009, 07:06
IceStorm IceStorm is offline
Mentor FRC 5046, FTC 8688
AKA: Chad
FRC #5046 (Jacked Up Jackets)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Michigan
Posts: 134
IceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of lightIceStorm is a glorious beacon of light
Send a message via AIM to IceStorm Send a message via Yahoo to IceStorm
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
Reply With Quote
  #8   Spotlight this post!  
Unread 04-02-2009, 10:14
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,560
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: analog input help

Quote:
Originally Posted by IceStorm View Post
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 View Post
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.
Reply With Quote
  #9   Spotlight this post!  
Unread 04-02-2009, 10:24
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,076
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: analog input help

Sounds like you have a resolver.
Reply With Quote
  #10   Spotlight this post!  
Unread 04-02-2009, 11:42
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 03:53.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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