IR
Overview
Using a TSOP38238
IR receiver diode.
Datasheet for TSOP38238 | tsop382.pdf / tsop382.adafruit.pdf |
Adafruit infosheet | adafruit-ir-sensor.pdf 1 |
ESPHome config
Set up a remote_receiver
component, these settings work well for me with
a TSOP38238
diode:
remote_receiver:
id: recv_ir
pin:
number: ${receiver_pin}
inverted: true
mode:
input: true
# Enable the internal pullup if you dont have any external pullup
# resistors in the circuit and are getting unreliable readings
pullup: false
# Decode and dump thse remot protocols/codecs to the logger
# on log_level INFO
dump: "all"
# Percentage that the remote signal lengths can deviate in the
# decoding process
tolerance: "50%"
# Filter pusles shorter than this
filter: 250us
# How long a signal shold remain stable (not change) to be considered
# complete
idle: 4ms
# Default for ESP32
buffer_size: "10kb"
# only on ESP32
memory_blocks: 3
on_rc_switch: {}
Watch the log output, point an IR remote in the vague direction of the IR diode
and press some buttons. The keycodes get dumped into the log and you can set
up binary_sensor
components or automations for them.
The remote for my amplifier uses the nec
protocol:
binary_sensor:
- platform: remote_receiver
id: ir_nad_vol_down
name: "NAD VOL_DOWN"
icon: "mdi:volume-minus"
entity_category: ""
nec:
address: 0x7C87
command: 0x738C
filters:
- delayed_off: 2s
- platform: remote_receiver
id: ir_nad_vol_up
name: "NAD VOL_UP"
icon: "mdi:volume-plus"
entity_category: ""
nec:
address: 0x7C87
command: 0x7788
filters:
- delayed_off: 2s
Creates two binary_sensor
entities that briefly turn true
when the
keycodes for the volume buttons are emitted and detected.
References
IR communication archived from original on sparkfun.com
IR control wiring guide for TSOP38238 archived from original on sparkfun.com
IR basic connection - Arduino Stack Exchange: answers explain the difference between a 2-leg photodiode and 3-leg module.
ESPHome IR blaster example - Home Assistant forum: Includes C++ code examples with type casting