Infrared Signal Transmitter Module HS-S29-L

Infrared Signal Transmitter Module HS-S29-L

1. Introduction

This will introduce the infrared signal transmitting module, in fact, they play an important role in our daily lives.This kind of device is widely used in many household appliances such as air conditioners, televisions, DVD players, etc., it is based on wireless sensing, and is also a remote control, it is necessary to study its principle and how to use it.The infrared emitter and receiver are devices that directly convert electrical energy into near infrared light, belonging to the diode category, and the infrared emitting diode emits a modulated signal.

2. Schematic

Module Parameters

Pin Name

description

G

GND (Negative Power Input)

V

VCC (Positive Power Input)

S

Digital Signal Pin

  • Power Supply Voltage: 3.3V / 5V

  • Connection Method: PH2.0 Terminal Wire

  • Installation Method: Double Screw Fixed

4, Circuit Board Size

5 of Arduino IDE example program

Library file:Click to download

1. Infrared Signal Transmission Module Program (equivalent to an infrared remote control)

Arduino UNO Example (for Mixly IDE, Arduino IDE):Click to download

#define IR_SEND_PIN 3
#include <IRremote.h>

IRsend   irsend;

void setup(){
  // ๅฏๅŠจๅ‘้€๏ผŒๅนถๆŒ‡ๅฎšๅผ•่„š๏ผ›ๅผ€ๅฏArduinoไธปๆฟL็ฏๅ้ฆˆ๏ผ›
  IrSender.begin(IR_SEND_PIN, DISABLE_LED_FEEDBACK);
  pinMode(8, INPUT);
}

void loop(){
  // ๅฎšไน‰็บขๅค–ๅ‘ๅฐ„็ฎก่„š.

  if (!digitalRead(8)) {
      while (!digitalRead(8)) {
        delay(10);
      }
      // ๅ‘้€็บขๅค–็ผ–็ ๅ€ผ
      IrSender.sendNEC(0xFF00,0x45,0 );

    }

}

2. Infrared Signal Reception Module Program

Arduino UNO Example (for Mixly IDE, Arduino IDE):Click to download

#include <IRremote.h>

volatile int a;
const String IR_PROTOCOL_TYPE[] = {
  "UNKNOWN",
  "PULSE_DISTANCE",
  "PULSE_WIDTH",
  "DENON",
  "DISH",
  "JVC",
  "LG",
  "LG2",
  "NEC",
  "PANASONIC",
  "KASEIKYO",
  "KASEIKYO_JVC",
  "KASEIKYO_DENON",
  "KASEIKYO_SHARP",
  "KASEIKYO_MITSUBISHI",
  "RC5",
  "RC6",
  "SAMSUNG",
  "SHARP",
  "SONY",
  "ONKYO",
  "APPLE",
  "BOSEWAVE",
  "LEGO_PF",
  "MAGIQUEST",
  "WHYNTER"
};
IRrecv irrecv_11(11);

void setup(){
  a = 0;
  Serial.begin(9600);
  pinMode(5, OUTPUT);
  irrecv_11.enableIRIn();
}

void loop(){
  if (irrecv_11.decode()) {
    struct IRData *pIrData = &irrecv_11.decodedIRData;
    long ir_item = pIrData->decodedRawData;
    String irProtocol = IR_PROTOCOL_TYPE[pIrData->protocol];
    Serial.print("IR TYPE:" + irProtocol + "\tVALUE:");
    Serial.println(ir_item, HEX);
    irrecv_11.resume();
    Serial.println(ir_item,HEX);
    //ๆŒ‰ไธ‹ๅฆไธ€ๅ—ๆŽงๅˆถๆฟโ€œD8โ€ๆŒ‰้”ฎ็ผ–็ ๅ€ผ๏ผšBA45FF00ใ€‚ๆŽงๅˆถๅผ€ๅ…ณ็ฏใ€‚
    if (0xBA45FF00 == ir_item && a == 0) {
      digitalWrite(5,HIGH);
      a = 1;

    } else if (0xBA45FF00 == ir_item && a == 1) {
      digitalWrite(5,LOW);
      a = 0;
    }

  } else {

  }

}

1. Infrared Signal Transmission Module Program (equivalent to an infrared remote control)

Example Program (ESP32 Development Board โ€” Based on Python language, cannot be uploaded with Arduino IDE)

import machine
import irremote
import time


pin13 = machine.Pin(13, machine.Pin.IN)
ir_tx = irremote.NEC_TX(4,False,100)
while True:
    if not pin13.value():
        while not pin13.value():
            time.sleep_ms(10)
        ir_tx.transmit(0x45,0xff00,0)

2. Infrared Signal Reception Module Program

Example Program (ESP32 Development Board โ€” Based on Python language, cannot be uploaded with Arduino IDE)

import machine
import irremote


pin15 = machine.Pin(15, machine.Pin.OUT)
value = 0
Mode = 0
ir_rx = irremote.NEC_RX(14,8)
while True:
    if ir_rx.any():
        value = hex(ir_rx.code[2])
    if value == hex(0xba45ff00):
        Mode = 1 - Mode
        value = 0
    if Mode == 0:
        pin15.value(0)
    if Mode == 1:
        pin15.value(1)

6, Miciqi Mixly Example Program (Graphical Language)

Arduino UNO Graphical Example Program:Click to download

1. Infrared Signal Transmission Module Program (equivalent to an infrared remote control)

2. Infrared Signal Reception Module Program

Example Program (ESP32 Python):Click to download

1. Infrared Signal Transmission Module Program (equivalent to an infrared remote control)

2. Infrared Signal Reception Module Program

7, Test Environment Setup

Arduino UNO Test Environment Setup

Prepare Components:

  • HELLO STEM UNO R3 Development Board *2

  • HELLO STEM UNO R3 P Expansion Board *2

  • USB type-c data cable *2

  • LED module (HS-F08L) *1

  • Infrared signal transmission module (HS-S29L) *1

  • Push-button switch module (HS-KEY1L) *1

  • Infrared receiver module (HS-S23L) *1

  • PH2.0 double-ended terminal line *4 pieces

Circuit wiring diagram:

ESP32 Python test environment setup

Prepare Components:

  • ESP32EA MOC development board *2

  • ESP32-EXP1 expansion board *2

  • USB type-c data cable *2

  • LED module (HS-F08L) *1

  • Infrared signal transmission module (HS-S29L) *1

  • Push-button switch module (HS-KEY1L) *1

  • Infrared receiver module (HS-S23L) *1

  • PH2.0 double-ended terminal line *4 pieces

Circuit wiring diagram:

8. Video tutorial

Arduino UNO video tutorial:Click to view

ESP32 Python Video Tutorial:

9. Test conclusion

Arduino UNO Test Conclusion:

After the device is connected to the wires, burn the above program to the Arduino UNO development board, then connect the infrared signal transmission experiment according to the description in the document, and burn the infrared receiver program to another Arduino UNO development board. Power it on and you can see the transmitting and receiving effects.

ESP32 Python test conclusion: