Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Keyes IR: Examples, Pinouts, and Specs

Image of Keyes IRDesign with Keyes IR in Cirkit Designer

Introduction

The Keyes IR Sensor Module, manufactured by ETC_BVN (Part ID: uno), is an infrared sensor used for detecting objects and measuring distance by emitting and receiving infrared light. This versatile component is widely used in various applications, including obstacle detection, line-following robots, and proximity sensing.

Explore Projects Built with Keyes IR

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!

Technical Specifications

Key Technical Details

Parameter Value
Operating Voltage 3.3V - 5V
Operating Current 20mA
Detection Range 2cm - 30cm
Output Type Digital (High/Low)
Dimensions 32mm x 14mm x 7mm
Weight 2g

Pin Configuration and Descriptions

Pin Number Pin Name Description
1 VCC Power supply (3.3V - 5V)
2 GND Ground
3 OUT Digital output (High when object detected, Low otherwise)

Usage Instructions

How to Use the Component in a Circuit

  1. Power Supply: Connect the VCC pin to a 3.3V or 5V power supply and the GND pin to the ground of your circuit.
  2. Output Signal: Connect the OUT pin to a digital input pin on your microcontroller (e.g., Arduino UNO).

Example Circuit Diagram

  Arduino UNO          Keyes IR Sensor Module
  ------------         -----------------------
  5V  ----------------> VCC
  GND ----------------> GND
  Digital Pin 2 ------> OUT

Arduino UNO Example Code

// Keyes IR Sensor Module Example Code
// Connect the OUT pin of the sensor to digital pin 2 on the Arduino UNO

const int sensorPin = 2; // Pin connected to the sensor's OUT pin
const int ledPin = 13;   // Pin connected to the onboard LED

void setup() {
  pinMode(sensorPin, INPUT); // Set sensor pin as input
  pinMode(ledPin, OUTPUT);   // Set LED pin as output
  Serial.begin(9600);        // Initialize serial communication
}

void loop() {
  int sensorValue = digitalRead(sensorPin); // Read the sensor value

  if (sensorValue == HIGH) {
    digitalWrite(ledPin, HIGH); // Turn on the LED if object is detected
    Serial.println("Object detected!");
  } else {
    digitalWrite(ledPin, LOW);  // Turn off the LED if no object is detected
    Serial.println("No object detected.");
  }

  delay(100); // Small delay to avoid serial monitor flooding
}

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Detection:

    • Issue: The sensor does not detect any objects.
    • Solution: Check the power connections and ensure the sensor is properly powered. Verify that the object is within the detection range (2cm - 30cm).
  2. False Positives:

    • Issue: The sensor detects objects when there are none.
    • Solution: Ensure there are no sources of infrared interference nearby. Adjust the sensor's position and angle.
  3. Inconsistent Readings:

    • Issue: The sensor provides inconsistent readings.
    • Solution: Verify stable power supply and proper grounding. Ensure the sensor is not exposed to rapid changes in ambient light.

FAQs

By following this documentation, users can effectively integrate the Keyes IR Sensor Module into their projects, ensuring reliable object detection and distance measurement.