This product has been discontinued. This page serves as reference. Please refer here for the updated LINE-02: https://osepp.com/electronic-modules/sensor-modules/119-line-follower-array
The OSEPP IR Line Sensor Module differentiates the reflections between dark and light surfaces. It utilizes the Fairchild QRE1113GR miniature reflective object sensor and the NXP PCA9691 A/D converter. The 8-bit A/D converter digitalizes the sensor output. The sensor operates by emitting an IR signal via an LED, and then measuring the amount of reflection to determine the blackness of the surface.
The module uses the I²C interface for data communication. The I²C lines are packaged with the power and ground lines into a modular connector, which allows easy plug and play operation. There are two connectors on the module to enable daisy chaining of multiple I²C devices together.
This sensor module is ideal for designs that required to track black line on a white surface (or vice versa), such as in a line-following robot, or used to detect the outer perimeters of a competition ring.
Specifications:
I²C Addresses (7-bit) | 0x48, 0x49, 0x4A, 0x4B |
Form Factor | 23 mm x 36 mm |
Power Consumption | 400 mW |
Connector Pin Definition | Pin 1: Power Pin 2: I²C Data Pin 3: Ground Pin 4: I²C Clock |
Features
- Plug and play with OSEPP I²C Expansion Shield
- Two IR sensors per board with independent outputs
- Flexible blackness threshold that can be set via software setting
- 8-bit ADC for digitizing sensor output, sample rate up to I²C frequency
- Support I²C interfacing with 4 programmable 7-bit address: 0x48, 0x49, 0x4A, 0x4B
- Provides pass-through connector to support daisy chaining of multiple sensors from the OSEPP Sensor Module family
- Provides 0.1” breakout points for power and I²C interface pins access
Downloads |
|
OSEPP™ IR Line Sensor Module Schematic (PDF) |
Stock Code | Product Name |
LINE-01 | OSEPP™ IR Line Sensor Module |
Learning Centre
Setup
- Connect one end of the cable into either Molex connectors on the sensor
- Connect the other end of the cable to the Arduino board:
- RED: 5V
- WHITE: I2C SDA (pin A4 on Uno; pin 20 on Mega)
- BLACK: GND
- GREY: I2C SCL (pin A5 on Uno; pin 21 on Mega)
- Set the DIP switch on the sensor to set the sensor address (check back of sensor for possible addresses)
Example Sketch
// OSEPP IR Proximity Sensor Example Sketch // by OSEPP
// This sketch demonstrates interactions with the IR Proximity Sensor #include
// Possible sensor addresses (suffix correspond to DIP switch positions)
#include
#define SENSOR_ADDR_OFF_OFF (0x26)
#define SENSOR_ADDR_OFF_ON (0x22)
#define SENSOR_ADDR_ON_OFF (0x24)
#define SENSOR_ADDR_ON_ON (0x20)
// Set the sensor address here
const uint8_t sensorAddr = SENSOR_ADDR_OFF_OFF;
// One-time setup
void setup() {
// Start the serial port for output
Serial.begin(9600); // Join the I2C bus as master
Wire.begin(); // Turn on the sensor by configuring pin 1 of the GPIO expander to be an
// output pin; the default output value is already HI so there's no need
// to change it
WriteByte(sensorAddr, 0x3, 0xFE); }
// Main program loop
void loop() {
uint8_t val; // Get the value from the sensor
if (ReadByte(sensorAddr, 0x0, &val) == 0) { // The second LSB indicates if something was not detected, i.e.,
// LO = object detected, HI = nothing detected
if (val & 0x2) {
//Serial.println("Nothing detected");
}
else {
// Serial.println("Object detected");
}
}
else {
//Serial.println("Failed to read from sensor");
} // Run again in 1 s (1000 ms) delay(1000);
float volts = val*0.0048828125;
float distance = 65*pow(volts, -1.10);
Serial.println(distance);
} // Read a byte on the i2c interface
int ReadByte(uint8_t addr, uint8_t reg, uint8_t *data) {
// Do an i2c write to set the register that we want to read from
Wire.beginTransmission(addr);
Wire.write(reg);
Wire.endTransmission(); // Read a byte from the device
Wire.requestFrom(addr, (uint8_t)1);
if (Wire.available()) {
*data = Wire.read();
}
else { // Read nothing back
return -1;
}
return 0;
} // Write a byte on the i2c interface
void WriteByte(uint8_t addr, uint8_t reg, byte data) {
// Begin the write sequence
Wire.beginTransmission(addr); // First byte is to set the register pointer
Wire.write(reg); // Write the data byte
Wire.write(data); // End the write sequence; bytes are actually transmitted now
Wire.endTransmission();
}