Subject:
|
IR Port as Proximity detector.
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Fri, 8 Jan 1999 06:15:11 GMT
|
Reply-To:
|
nospam-dcchen@pacbell.netANTISPAM-nospam
|
Viewed:
|
1951 times
|
| |
| |
Someone (Can't remember who, so unfortunately unable to give credit for
the idea appropriately) posted the fact that the IR port used as a
emitter coupled with the Light Sensor unit as the reciever can be used
as a IR proximity sensor.
Seemed like a good idea. Had not heard of it done before on this news
group. Thought I'd give it a try.
NQC code as follows for a test program called Ping.
/*
* Ping
* ===========
* Reads light level into level, transmitts it out via SendMessage.
*
* Mapping:
* OUT_A: empty
* OUT_B: empty
* OUT_C: empty
* IN_1: empty
* IN_2: light sensor
* IN_3: empty
*
*/
#define THRESHOLD 70
int level;
task Ping
{
while(true)
{
level = Input(1);
if(level > THRESHOLD)
PlaySound(1);
SendMessage(level);
}
}
task main
{
// Set up the sensors
Sensor(IN_2,IN_CFG(STYPE_LIGHT, SMODE_PERCENT));
// Start Tasks
start Ping;
}
This has the RCX sending infrared pulses out constantly, if the
reflected pulse is > THRESHOLD (arbitrary values, see below), then it
beeps.
THRESHOLD values I have found to cause beeps when Light Sensor is within
the following distances to a wall painted white (flat wall indoor
paint). Your milage may vary depending on ambient light.
Threshold: 75 70 60 55-
Range: 6" 4" 3" Triggers constantly at with the
ambient light.
Perhaps a routine to adjust for Threshold = average ambient level + 20
would work?
Whoever's idea this was, it was a brilliant one. Now you have an IR
object detector/range detector to use along with your 2 touch sensors.
I can now use the touch sensors for side collision detection and IR
sensor for front.
Next, use a 3rd motor for side to side scanning of objects...
Dave Chen
|
|
Message has 4 Replies:
13 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|