Go to Post No disclaimer on earth lets you disassociate yourself with your team or what you represent because you want to say something not particularly nice, but lets you be associated again when you want to say something to encourage others, etc. - Amanda Morrison [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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 25-01-2014, 15:53
pabigfe97 pabigfe97 is offline
Registered User
no team
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Boston, MA
Posts: 7
pabigfe97 is an unknown quantity at this point
IR Sensors

Hello All!

How can I code a Sharp IR sensor in Labview so that it accurately measures distance and changes in distance.

Thanks in advance for your help!

Last edited by pabigfe97 : 25-01-2014 at 18:26.
Reply With Quote
  #2   Spotlight this post!  
Unread 25-01-2014, 17:34
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 430
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: IR Sensors

We used one in 2012 for detecting the balls in our hopper.
It was a sharp IR sensor.

Java code was something like this
Code:
AnalogChannel ballDetector = new AnalogChannel(channelNumber); //where channelNumber is the port you've plugged 

...

public double getBallDetectorUpper(){
    double sensorVoltage = ballDetector.getVoltage();
    
    if(sensorVoltage > 4.0 || sensorVoltage < 0.0){        //dont add in bogus data points
        sensorVoltage = 0.0;
    }
    return sensorVoltage;
}
Our code was a little more involved than that, but this is the general idea.

If you wanted to convert the voltage measured to a value in inches, there is usually a curve in the datasheet for the sensor which correlates voltages to distance. This can be used to generate an equation to convert voltage to distance.
We found that this wasn't necessary, at least for our uses in 2012. If the voltage was below a certain level a ball was considered present, otherwise a ball was not present. No need to determine the distance away in inches...
__________________
http://team2168.org
Reply With Quote
  #3   Spotlight this post!  
Unread 25-01-2014, 21:22
Doc Wu's Avatar
Doc Wu Doc Wu is offline
Registered User
AKA: Al Gritzmacher
FRC #1507 (Warlocks)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Lockport NY
Posts: 207
Doc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant futureDoc Wu has a brilliant future
Re: IR Sensors

Quote:
Originally Posted by pabigfe97 View Post
Hello All!

How can I code a Sharp IR sensor in Labview so that it accurately measures distance and changes in distance.

Thanks in advance for your help!
First of all, everybody, read what he asked. He said Labview.

What you didn't say was the model of the Sharp sensor. But don't even bother telling us that until you've taken that model number and put it into Google and found a spec sheet. That will tell you what kind of output it gives you. It may answer your question, or it may just let you ask a more specific question that people can give you help on.

Many such sensors give an analog output that is proportional to the distance. The spec sheet will give you a formula or a chart that shows the voltage that corresponds to a distance.

Good news is you have analog inputs on the Crio. They accept 0-5 volts. If the sensor also gives an output of 0-5 volts, you're good. If it's more, say 0-10 volts, you will need to scale it. That can be done as simply as a voltage divider with a couple of resistors.

If the sensor has some other output, say serial or I2C, you may be up to programming it or not. I don't know you level of programming ability.

But the first thing you need to know is what you're up against. The spec sheet will tell you that.
__________________
-= Mentor Lockport Warlocks -=- Team 1507 =-
Amateur Radio Callsign: AE2T

2016 Robot Inspector - Fingerlakes, Pittsburgh
2015 Robot Inspector - Pittsburgh, Champs. Judge Observer - Champs
2014 Robot Inspector - Tech Valley, Fingerlakes, Buckeye, Championship
2013 Robot Inspector - Fingerlakes, Buckeye, Championship
2012 Robot Inspector - Fingerlakes, Buckeye, Championship - Website Evaluator - Fingerlakes, Buckeye, Championship
2011 Robot Inspector - Fingerlakes 2011 Safety Advisor - Fingerlakes

Reply With Quote
  #4   Spotlight this post!  
Unread 25-01-2014, 21:42
BitTwiddler's Avatar
BitTwiddler BitTwiddler is offline
electronics/programming mentor
AKA: Mr Tanguay
FRC #1726 (N.E.R.D.S.)
Team Role: Mentor
 
Join Date: Oct 2008
Rookie Year: 2006
Location: Sierra Vista, AZ
Posts: 243
BitTwiddler is on a distinguished road
Re: IR Sensors

If it's the Sharp 2D120X IR reflective sensor here's a snippet of Labview code that I used on our trainer. I set the threshold to 2 volts which corresponds to a object being sensed at about 7 cm from the sensor.
Attached Thumbnails
Click image for larger version

Name:	IR senser - begin.PNG
Views:	16
Size:	5.1 KB
ID:	15956  Click image for larger version

Name:	IR sensor - Timed Tasks.PNG
Views:	13
Size:	6.4 KB
ID:	15957  
Reply With Quote
  #5   Spotlight this post!  
Unread 25-01-2014, 22:48
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,565
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: IR Sensors

Quote:
Originally Posted by Doc Wu View Post
First of all, everybody, read what he asked. He said Labview.
That was added a few hours after the original post.
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


All times are GMT -5. The time now is 02:13.

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