Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Have problem on getting analog values from lane tracking sensor (http://www.chiefdelphi.com/forums/showthread.php?t=91431)

xinchi.he 10-02-2011 15:10

Have problem on getting analog values from lane tracking sensor
 
Hi everyone. I am new here. Here I met with a problem for sensors. My professor would like to use the analog sensor to receive the brightness of the black and white which means I should get values with a range from 0 to 700 whatever. But I couldn't find the method to access it. Anyone could help??

THXX!!!!!!

************************************************** *************************
We are not using the digital sensor that provided by FIRST, instead we use our analog sensor which should plug to the analog side card. Is there a method that in java that could access to the analog value it returns??

byteit101 10-02-2011 16:06

Re: Have problem on getting analog values from lane tracking sensor
 
the line tracking sensors as found in the kop are not analog, they are simply digital inputs that return true or false. You can customize the threshold on them, but you can't get more detail unfortunately.

xinchi.he 10-02-2011 16:35

Re: Have problem on getting analog values from lane tracking sensor
 
Quote:

Originally Posted by byteit101 (Post 1020058)
the line tracking sensors as found in the kop are not analog, they are simply digital inputs that return true or false. You can customize the threshold on them, but you can't get more detail unfortunately.

Thanks a lot! But we are not using the digital sensor that provided by FIRST, instead we use our analog sensor which should plug to the analog side card. Is there a method that in java that could access to the analog value it returns??

Thanks!!!!

michael714 12-02-2011 06:03

Re: Have problem on getting analog values from lane tracking sensor
 
If you have an analog sensor, just plug it into the one of the analog ports on the analog breakout. If your sensor provides an analog value, you could just use GetAnalogIn() (you can find more in the WPI lib reference or the java docs).

Aside from that, you should really be using the provided line sensors. It looks like there will not be a strong contrast in colors between the line and the carpet. However, the line is reflective and the included line sensors work perfectly even from 6 to 12 inches high!

eddie12390 12-02-2011 09:23

Re: Have problem on getting analog values from lane tracking sensor
 
1. Import AnalogChannel

2. Use this is to initialize the sensor:

Code:

AnalogChannel color = new AnalogChannel(channel number);
3. Use this to read the value:

Code:

System.out.println(color.getValue());
That'll probably take a ton of testing to figure out what darkness is what but you'll get there with enough work.

DCRich 12-02-2011 11:34

Re: Have problem on getting analog values from lane tracking sensor
 
Quote:

Originally Posted by xinchi.he (Post 1020044)
Hi everyone. I am new here. Here I met with a problem for sensors. My professor would like to use the analog sensor to receive the brightness of the black and white which means I should get values with a range from 0 to 700 whatever. But I couldn't find the method to access it. Anyone could help??

THXX!!!!!!

************************************************** *************************
We are not using the digital sensor that provided by FIRST, instead we use our analog sensor which should plug to the analog side card. Is there a method that in java that could access to the analog value it returns??


Note that the Analog input channels are -10 v to +10 v voltages outside that range will be over-range and may not read correctly.

The default IR sensors put out 1 v low and 12 volt high so they are not true digital signals. If you run 12 v into the GPIO lines it will look digital but it is over the max input value and could cause the line to fail. You should check the voltage and make a divider to drop the signal levels down to the 5 v level required.

Ether 12-02-2011 11:45

Re: Have problem on getting analog values from lane tracking sensor
 
Quote:

Originally Posted by DCRich (Post 1021250)
The default IR sensors put out 1 v low and 12 volt high so they are not true digital signals.

The default lane-tracking sensors are just NPN switches (hi/lo impedance). They are not intended to source any voltage.

Hook it up as follows:

brown wire to +24volts (solenoid breakout)
blue wire to ground
White wire to a DIO input

The internal pullup on the DIO provides the voltage. The switch just shorts out the voltage (provided by the pullup) to provide the digital hi/lo signal.



garyk 12-02-2011 14:38

Re: Have problem on getting analog values from lane tracking sensor
 
Quote:

Originally Posted by Ether (Post 1021256)
The default lane-tracking sensors are just NPN switches (hi/lo impedance). They are not intended to source any voltage.

Hook it up as follows:

brown wire to +24volts (solenoid breakout)
blue wire to ground
White wire to a DIO input

The internal pullup on the DIO provides the voltage. The switch just shorts out the voltage (provided by the pullup) to provide the digital hi/lo signal.


The KOP optical sensors are part number 42EF-D1MNAK-a2. The paper data sheet and the plastic bag in which they come says they require 11 - 30 VDC. We have then running fine on 12V from the power distribution board. There's no reason to hook them to 24V. You should save the 24V for the cRIO and the pneumatic solenoids.

Ether 12-02-2011 14:41

Re: Have problem on getting analog values from lane tracking sensor
 
Quote:

Originally Posted by garyk (Post 1021385)
The KOP optical sensors are part number 42EF-D1MNAK-a2. The paper data sheet and the plastic bag in which they come says they require 11 - 30 VDC. We have then running fine on 12V from the power distribution board. There's no reason to hook them to 24V.

Do a little searching in the forums and you'll see why I said to use 24V.




All times are GMT -5. The time now is 10:51.

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