亿迅智能制造网
工业4.0先进制造技术信息网站!
首页 | 制造技术 | 制造设备 | 工业物联网 | 工业材料 | 设备保养维修 | 工业编程 |
home  MfgRobots >> 亿迅智能制造网 >  >> Manufacturing Technology >> 制造工艺

自制 Arduino 电视遥控器:3D 打印外壳、电池供电、支持三大品牌协议

项目起因

女友电视遥控器损坏,两人均为工程师,决定封锁期间合作自制。技能互补:硬件焊接/3D 建模/固件编程全流程自主完成,兼作学习红外通信协议的实战演练。

功能定义

精简为 6 个核心命令:电源开关、信号源切换、频道+/–、音量+/–。采用 Arduino UNO + IRremote 库实现。

硬件设计

主控与电源

按键电路

红外发射电路

3D 打印外壳

固件核心逻辑

完整代码


#include 
#include 
#include 

#define OnOff 1
#define Source 0
#define CH_plus 4
#define CH_minus 5
#define Vol_plus 6
#define Vol_minus 7
#define Interrupt_Pin 2

#define SONY_TV  // 取消注释切换品牌
//#define LG_TV
//#define SAMSUNG_TV

#ifdef SONY_TV
  unsigned long on_off_code = 2704;   // 0xA90
  unsigned long vol_plus_code = 1168; // 0x490
  // ... 其余 4 个码
#endif

IRsend irsend;
unsigned long debounce_time, last_time;

void setup() {
  analogWrite(13,0);
  pinMode(OnOff,INPUT_PULLUP); // ... 其余 5 键同理
  pinMode(Interrupt_Pin,INPUT_PULLUP);
  power_adc_disable(); power_spi_disable(); power_timer1_disable();
  power_usart0_disable(); power_twi_disable();
}

void loop() {
  checkButton(OnOff, on_off_code);
  checkButton(Source, source_code);
  checkButton(CH_plus, ch_plus_code);
  checkButton(CH_minus, ch_minus_code);
  checkButton(Vol_plus, vol_plus_code);
  checkButton(Vol_minus, vol_minus_code);

  if (millis() - last_time > 5000) going_to_sleep();
}

void checkButton(int pin, unsigned long code) {
  if (!digitalRead(pin)) {
    debounce_time = millis();
    while (millis() - debounce_time < 40);
    if (!digitalRead(pin)) {
      #ifdef LG_TV irsend.sendNEC(code, 32); #endif
      #ifdef SAMSUNG_TV irsend.sendSAMSUNG(code, 32); #endif
      #ifdef SONY_TV irsend.sendSony(code, 12); #endif
      last_time = millis();
    }
  }
}

void going_to_sleep() {
  sleep_enable();
  attachInterrupt(digitalPinToInterrupt(Interrupt_Pin), wake_up, LOW);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_cpu();
}
void wake_up() { sleep_disable(); detachInterrupt(digitalPinToInterrupt(Interrupt_Pin)); }

原理图与源文件

制造工艺

  1. 集成二维码、RFID与体温验证的门禁控制系统
  2. 树莓派无需 LIRC 捕获红外遥控指令:Python UART 方案
  3. PiCy:打造您的微型树莓派机器人
  4. Arduino Nano 与 MPU-6050 构建实时陀螺仪游戏
  5. ESP32-CAM 运动检测安防相机,推送照片到 Discord
  6. 智能存钱罐:Arduino Nano 控制硬币识别器实现余额显示
  7. Unopad:基于 Arduino 的无缝 Ableton Live MIDI 控制器
  8. Arduino + HC-05 蓝牙控制 LED:MIT App Inventor 手机 App 开发全攻略
  9. 自制简易红外避障传感器:IR LED + 光电二极管 + Arduino
  10. 打造功能完整的 Arduino 驱动 3D 打印机械臂:分步指南
  11. 现代工业远程生产控制的5大核心优势
  12. Millport SmartLathez 1740 CNC车床:精密与动力的结合