Go to Post I might be singing a different tune if I get a water jet for Christmas. :) - FrankJ [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, 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: 432
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
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 14:41.

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