กลับไปหน้ารวมไฟล์
arduino-text-lcd-display-receive-infrared-remote-code-5cf0d4.md

ชื่อโปรเจกต์: Arduino Text LCD Display & Receive Infrared Remote Code

การถอดรหัส Telemetry อินฟราเรด: รีโมท TV สู่ LCD

รีโมท TV ทั่วไปไม่ได้ปล่อยแสงออกมาง่ายๆ แต่จะปล่อยลำดับพัลส์ที่ถูกโมดูเลตความหนาแน่นสูงถึง 38 Kilohertz และมองไม่เห็น ซึ่งประกอบด้วยเพย์โหลด Hexadecimal ที่เข้ารหัส 32-bit จำนวนมหาศาล เพื่อระบุปุ่มที่ถูกกดอย่างแม่นยำ! ระบบ Receive Infrared Remote Code เปลี่ยน Arduino ให้เป็น Universal Protocol Decoder! ด้วยการใช้อัลกอริทึม IRrecv object ที่ทรงพลัง ระบบจะสกัดกั้นแสงแฟลชที่ลอยอยู่ในอากาศ สร้างสตริงข้อมูลขนาดใหญ่ขึ้นมาใหม่ด้วยหลักการทางคณิตศาสตร์แบบบิตต่อบิต และแสดง Raw Hex code ออกมาบนหน้าจอ 16x2 LCD Panel อย่างชัดเจน!

ac_light_relay_ir_remote_arduino_1772681534011.png

การ Demodulate Matrix 38KHz (IRremote.h)

การต่อ LED ทั่วไปเพื่อตรวจจับแสงจะล้มเหลวโดยสิ้นเชิง เพราะรีโมท TV ใช้ "Carrier Frequency" ที่ 38,000 แฟลชต่อวินาที เพื่อทะลุผ่านสัญญาณรบกวนจากแสงแดด!

  1. คุณต้องใช้ VS1838B Infrared Receiver Modulator แบบพิเศษ ซึ่งมี Microscopic IC อยู่ภายในที่สามารถกรองแสงแดดออกได้อย่างสมบูรณ์ และส่งผ่านเฉพาะ Pure Digital Binary Square Waves เข้าสู่ Arduino Digital Pin 11 โดยตรงเท่านั้น!
  2. ไลบรารี <IRremote.h> ขนาดใหญ่ใช้ Hardware Timers ที่ทำงานอยู่เบื้องหลังเพื่อวิเคราะห์ความยาวไมโครวินาทีที่เฉพาะเจาะจงของช่องว่างพัลส์ HIGH/LOW เพื่อระบุว่าเป็น Protocol ของแบรนด์ใด (เช่น Sony, NEC, Panasonic!)
#include <IRremote.h>
#include <LiquidCrystal_I2C.h>

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results; // Massive struct object holding the parsed payload!

void loop() {
  if (irrecv.decode(&results)) { // The burst was captured!
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("BUTTON CODE HEX:");
    
    lcd.setCursor(0, 1);
    lcd.print(results.value, HEX); // Decrypt the payload straight to the LCD natively!
    
    // Switch on the Light if "POWER" button was matched!
    if(results.value == 0xFFA25D) { 
      digitalWrite(RELAY_PIN, !digitalRead(RELAY_PIN)); 
    }
    
    irrecv.resume(); // Flush the trap to prepare for the next code sequence!
  }
}

การรวม Telemetry LCD Pipeline

จอแสดงผล 16x2 ช่วยให้นักพัฒนาสามารถทำงานได้โดยไม่ต้องเชื่อมต่อกับ Laptop!

  • คุณสามารถเล็งรีโมท AC, TV หรือ Radio ทั่วไปไปที่ Arduino และบันทึก Hex codes ได้ทันทีโดยไม่ต้องดู Serial Monitor เลย!
  • ด้วยการรวม I2C PCF8574 Backpack ที่บัดกรีเข้ากับจอ 16x2 LCD ทำให้ Arduino ใช้เพียง Analog Pins สองขา (A4/A5) ในการแสดงผลตัวอักษร ซึ่งช่วยสงวน Digital Pins ไว้สำหรับการสร้าง Relay Networks ขนาดใหญ่ เพื่อตอบสนองต่อ InfraRed commands ที่ตรวจจับได้อย่างราบรื่น!

ฮาร์ดแวร์ที่จำเป็นสำหรับการ Demodulation

  • Arduino Uno/Nano (จัดการ 8-bit Timer Arrays ภายในที่แม่นยำสำหรับ IR Library ได้อย่างสมบูรณ์แบบ)
  • VS1838B / TSOP4838 38KHz IR Receiver (อุปกรณ์ 3-pin นี้จำเป็นอย่างยิ่ง Photodiode แบบ 2-pin ทั่วไปจะถอดรหัสข้อมูลล้มเหลวโดยสิ้นเชิง)
  • 16x2 LCD Display with I2C Module (ช่วยให้สามารถสร้าง Two-Wire ASCII String Execution Matrices ขนาดใหญ่ได้)
  • รีโมทคอนโทรลอินฟราเรดในครัวเรือน ทั่วไป (รีโมทรูปแบบ NEC ให้โครงสร้าง Hexadecimal ที่สะอาดที่สุดสำหรับ Interception Pipelines ที่เชื่อถือได้)

ข้อมูล Frontmatter ดั้งเดิม

title: "Arduino Text LCD Display & Receive Infrared Remote Code"
description: "Optical data interception matrices! Establish an aggressive NEC protocol demodulation algorithm directly into an Arduino pipeline utilizing a 38KHz IR receiver, accurately interpreting remote hex payloads and visualizing them instantly onto an I2C 16x2 Text Display."
category: "Remote Control & Drones"
difficulty: "Intermediate"