Stufin
Home Quick Cart Profile

3mm IR Pair

Buy Now on Stufin

IR Emitter

+ Anode (A) - Pin 1

+ Cathode (K) - Pin 2

IR Detector

+ VCC - Pin 1

+ OUT - Pin 2

+ GND - Pin 3

Diameter

3mm

Height

1.5mm

Lead Pitch

1.5mm

Conclusion

The 3mm IR Pair is a versatile and compact infrared transmitter and receiver pair, ideal for use in a wide range of IoT applications. Its low power consumption, high sensitivity, and noise immunity make it an attractive solution for designers and developers of IoT devices.

Pin Configuration

  • 3mm IR Pair Component Documentation
  • Pin Description:
  • The 3mm IR Pair component has a total of 4 pins, which are described below:
  • Pin 1: VCC
  • Function: Power Supply
  • Description: This pin is used to provide a positive voltage supply to the IR LED and photodiode. Typically, a voltage range of 3.3V to 5V is recommended.
  • Connection: Connect to a power source (e.g., a battery or a voltage regulator output) to provide power to the IR Pair.
  • Pin 2: GND
  • Function: Ground
  • Description: This pin is used to provide a ground connection for the IR LED and photodiode.
  • Connection: Connect to a ground terminal (e.g., a breadboard's GND rail or a microcontroller's GND pin) to provide a common reference voltage.
  • Pin 3: IR LED Anode
  • Function: IR LED Positive Terminal
  • Description: This pin is connected to the anode (positive terminal) of the IR LED.
  • Connection: Connect to a microcontroller's digital output pin or a transistor's base to drive the IR LED. Apply a logic high signal to turn on the IR LED and emit infrared light.
  • Pin 4: Photodiode Cathode
  • Function: Photodiode Negative Terminal
  • Description: This pin is connected to the cathode (negative terminal) of the photodiode.
  • Connection: Connect to a microcontroller's analog input pin or a comparator's input to read the photodiode's signal. The photodiode generates a voltage signal when it detects reflected infrared light.
  • Connection Structure:
  • To connect the 3mm IR Pair component, follow this structure:
  • VCC (Pin 1) Power Source (e.g., battery or voltage regulator output)
  • GND (Pin 2) Ground Terminal (e.g., breadboard's GND rail or microcontroller's GND pin)
  • IR LED Anode (Pin 3) Microcontroller's Digital Output Pin or Transistor's Base
  • Photodiode Cathode (Pin 4) Microcontroller's Analog Input Pin or Comparator's Input
  • Notes:
  • Ensure that the power supply voltage (VCC) is within the recommended range to avoid damaging the IR LED and photodiode.
  • Use a current-limiting resistor in series with the IR LED to prevent overcurrent and ensure proper operation.
  • The photodiode's signal output may require amplification or buffering before being connected to a microcontroller's analog input pin.

Code Examples

3mm IR Pair Component Documentation
The 3mm IR Pair component is a popular IrDA (Infrared Data Association) compliant infrared transmitter and receiver module used for wireless communication over short distances. It consists of an IR LED transmitter and an IR photodiode receiver, both packaged in a 3mm diameter plastic casing.
Pinout:
IR LED Transmitter:
	+ Anode (A): Connect to digital output pin of microcontroller
	+ Cathode (K): Connect to ground (GND)
 IR Photodiode Receiver:
	+ Anode (A): Connect to digital input pin of microcontroller
	+ Cathode (K): Connect to ground (GND)
Technical Specifications:
Wavelength: 940nm
 Transmission distance: up to 1 meter
 Modulation frequency: 38 kHz
 Receiver sensitivity: 10 mV/mA
Code Examples:
### Example 1: Basic IR Communication using Arduino
In this example, we will demonstrate how to use the 3mm IR Pair component to send and receive data between two Arduino boards.
Transmitter Code (Arduino):
```c
const int irLedPin = 2;  // IR LED connected to digital pin 2
void setup() {
  pinMode(irLedPin, OUTPUT);
}
void loop() {
  // Send a 38 kHz modulation frequency carrier wave
  for (int i = 0; i < 100; i++) {
    digitalWrite(irLedPin, HIGH);
    delayMicroseconds(13); // 38 kHz period
    digitalWrite(irLedPin, LOW);
    delayMicroseconds(13); // 38 kHz period
  }
// Send a byte of data (e.g., 0x12)
  for (int i = 0; i < 8; i++) {
    if ((0x12 >> i) & 0x01) {
      digitalWrite(irLedPin, HIGH);
      delayMicroseconds(30); // 30 us pulse width
      digitalWrite(irLedPin, LOW);
      delayMicroseconds(30); // 30 us pulse width
    } else {
      digitalWrite(irLedPin, LOW);
      delayMicroseconds(60); // 60 us pulse width
    }
  }
delay(1000); // wait 1 second before sending next byte
}
```
Receiver Code (Arduino):
```c
const int irReceiverPin = 3;  // IR receiver connected to digital pin 3
volatile byte receivedData = 0;
void setup() {
  pinMode(irReceiverPin, INPUT);
  attachInterrupt(digitalPinToInterrupt(irReceiverPin), irReceiverISR, CHANGE);
}
void loop() {
  // Process received data
  if (receivedData != 0) {
    Serial.print("Received data: 0x");
    Serial.println(receivedData, HEX);
    receivedData = 0;
  }
}
void irReceiverISR() {
  static byte bitCount = 0;
  static byte data = 0;
if (digitalRead(irReceiverPin) == HIGH) {
    // Rising edge
    bitCount++;
    data = (data << 1) | 0x01;
  } else {
    // Falling edge
    bitCount++;
    data = (data << 1) | 0x00;
  }
if (bitCount == 8) {
    receivedData = data;
    bitCount = 0;
  }
}
```
### Example 2: IR Remotes using Raspberry Pi (Python)
In this example, we will demonstrate how to use the 3mm IR Pair component to receive and decode IR remote control signals using a Raspberry Pi.
Receiver Code (Python):
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Define IR receiver pin
ir_receiver_pin = 18
# Set up IR receiver pin as input
GPIO.setup(ir_receiver_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def decode_ir_signal(channel):
    # Read IR signal
    signal = []
    while True:
        signal.append(GPIO.input(ir_receiver_pin))
        time.sleep(0.00001)  # 10 us sampling rate
        if len(signal) > 100:
            break
# Decode IR signal
    # ... implementation of IR signal decoding algorithm ...
return decoded_signal
# Set up interrupt on IR receiver pin
GPIO.add_event_detect(ir_receiver_pin, GPIO.FALLING, callback=decode_ir_signal)
while True:
    time.sleep(1)  # wait for IR signal
```
Note: In this example, we assume a simple IR signal decoding algorithm is implemented in the `decode_ir_signal` function. The actual implementation may vary depending on the specific IR remote control protocol used.