Grove - Infrared Reflective Sensor is used to detect the presence of an object within a specific range. The sensor consists of an IR LED and a photosensor (phototransistor) pair. The light emitted by the IR LED gets reflected by any object placed in front of the sensor and this reflection is detected by the photosensor(phototransistor). Any white (or lighter) colored surface reflects more than black (or darker) colored surface.
When the reflected light is detected, it produces Digital HIGH (or Binary 1) output on the SIG pin. The on-board LED indicator will also glow. If no reflection is detected or if the object is too far from the sensor, the output on the SIG pin stays at Digital LOW (Binary 0). The on-board LED indicator will be off as well. The detectable range of this sensor is 4–16 mm. The module incorporates a Rail-to-Rail Operational Amplifier to amplify the output of phototransistor. There is a potentiometer which can be used to adjust the gain of the amplifier, that is, sensitivity of detection.
With this sensor, you can build the following (but not limited to) applications: line following robots, optical encoders and object counting applications.
Note: This product is also mildly sensitive to non-IR radiations and hence any bright light on photosensor impairs or disturbs IR light detection.
Product version | Release date | Support status | Notes |
Versions older than v1.2 | June 2012 | Not supported | None |
Version 1.2(current version) | April 2016 | Supported | None |
Operating voltage(V) | 4.5–5.5V |
Operating current(mA) | 14.69–15.35 mA |
Effective detectable distance | 0.5–4.5 cm |
Response time | 10 μs |
Phototransistor: Peak sensitivity wavelength | 800 nm |
IR LED: Peak light emitting wavelength | 940 nm |
Reflective photosensor | datasheet |
Output operational amplifiers | datasheet |
Weight | 4 g |
Platform | Seeeduino/Arduino | Rasberry Pi | LinkIt One | Beaglebone | |
Supported status | Supported | Supported (using GrovePi) | Not Supported | Supported(only with Grove Base Cape for Beaglebone) | |
Notes | If no version number is mentioned for a specific platform, it means this product supports all versions within this platform. But, you will need additional Grove Shield like Grove - Base shield v2 board. |
Parts name | Quantity |
---|---|
Grove - Infrared Reflective Sensor | 1 piece |
Grove cable | 1 piece |
Let us see how to implement few basic applications with this module:
This sensor can be used to help a robotic car follow a black line.
Let us implement simple optical encoder to detect the speed of a motor
unsigned int counter=0; void blink() { counter++; } void timerIsr() { Timer1.detachInterrupt(); //disable the timer1 Serial.print("The speed of the motor: "); Serial.print(counter,DEC); Serial.println("round/s"); counter=0; Timer1.attachInterrupt( timerIsr ); //enable the timer1 } void setup() { Serial.begin(9600); Timer1.initialize(1000000); // set a timer of length 1sec attachInterrupt(0, blink, RISING); //INT0 Timer1.attachInterrupt( timerIsr ); // attach the service routine here } void loop() { ; //do nothing }
5. Open the Serial Monitor to read the data.
import time import grovepi # Connect the Grove Infrared Reflective Sensor to digital port D4 # SIG,NC,VCC,GND sensor = 4 grovepi.pinMode(sensor,"INPUT") while True: try: # Sensor returns HIGH on a black surface and LOW on a white surface if grovepi.digitalRead(sensor) == 1: print "black surface detected" else: print "white surface detected" time.sleep(.5) except IOError: print "Error"
Copyright (c) 2008-2016 Seeed Development Limited (www.seeedstudio.com / www.seeed.cc)