New in the store – IR distance sensor w/cable (10cm-80cm)

Sharpdist Lrg
This SHARP distance sensor bounces IR off objects to determine how far away they are. It returns an analog voltage that can be used to determine how close the nearest object is. Comes with 12″ long 3-JST interface wire. These sensors are good for short-range detection. For over 1 m distance, we suggest using sonar sensors

To use, connect black wire to ground, red wire to 5V and white wire to analog input. The analog voltage out will range from 3V when an object is only 4″ (10 cm) away and 0.4V when the object is 32″ (80 cm) away

For more information, please see the datasheet – and check it out in our store

Here’s a quick and simple project you can do with an Arduino, a breadboard, 2 servos and the IR distance sensor – a edge detecting robot!


#include "Servo.h"

Servo leftServo;  
Servo rightServo;  
int distSensor = 0; 

void setup() {  
  leftServo.attach(10);  
  rightServo.attach(9);
}   

void loop() {  
  distSensor = analogRead(0);
  if (distSensor < 500) {
    leftServo.write(180);
    rightServo.write(0);
    delay(400);
    leftServo.write(180);
    rightServo.write(90);
    delay(900);
  } 
  else {
    leftServo.write(0);
    rightServo.write(180);
  }
}


Filed under: announce — by adafruit, posted May 16, 2009 at 7:47 pm


Try Adafruit's new iPhone & iPad app for makers! Circuit Playground! "Incredibly handy for anyone working in electronics. Perfect for engineers and non-engineers alike."
Looking for engineers, makers and the builders of dreams? Try our Adafruit job boards.
Join our weekly Adafruit SHOW-AND-TELL at 9:30pm ET every Saturday night! Then at 10pm, ASK-AN-ENGINEER with Ladyada and the Adafruit team!

2 Comments

  1. what if there is an object closer that 10cm from the sensor? does it output higher voltages?

    Comment by cmartin0 — May 17, 2009 @ 4:23 am

  2. the voltage goes back down when objects are closer than 10cm, see the datasheet for a graph

    Comment by ladyada — May 17, 2009 @ 9:34 am

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

www.flickr.com
adafruit's items Go to adafruit's photostream
www.flickr.com
items in Adafruits More in Adafruits pool