[Solution] ESP32 Infrared WiFi Module (ESP32E-N4 Infrared Transmitter Receiver) - Correct Pinout for ESPHome

Hi everyone,

I wanted to share the correct configuration for a common “Generic ESP32 IR Shield” (often sold as ESP32E-N4 Infrared Transmitter Receiver NEC or similar on AliExpress).

Most online documentations and even some silk-screen prints on the PCB are incorrect regarding the IR Receiver pin.

After some troubleshooting and multimeter testing, here is the working pinout for this specific board revision (WROOM-32E):

  • IR Receiver: GPIO14 (Inverted) – Note: Many guides say GPIO5, which is wrong for this board
  • IR Transmitter: GPIO4
  • Hardware Power: GPIO21 (Crucial: This pin must be HIGH to provide power to the IR components)

Working ESPHome Configuration:

# Hardware Power Management (Necessary for this board to power IR LEDs/Receiver)
switch:
  - platform: gpio
    pin: GPIO21
    id: ir_power_21
    name: "IR System Power"
    restore_mode: ALWAYS_ON

remote_transmitter:
  pin: GPIO4
  carrier_duty_percent: 50%

remote_receiver:
  pin:
    number: GPIO14
    inverted: true
  dump: all

# Optional: Setup as a Proxy for Home Assistant
infrared:
  - platform: ir_rf_proxy
    name: "IR Proxy Transmitter"
    remote_transmitter_id: ir_tx
  - platform: ir_rf_proxy
    name: "IR Proxy Receiver"
    remote_receiver_id: ir_rx
2 Likes

Hi @balu79,

I have the same board, but I’m having trouble connecting to it.
Can you give a brief rundown on how you connected to the board to flash esphome to it?

Thanks.

Steve…

Yes, that was another problem which I was fighting in the beginning. Couldn’t get the connection via USB working, ended up connecting it to my Wifi and then uploaded the firmware via Wifi connection (with the help of Home Assistant and ESPHome Device Builder)

Just for curiosity, how you orient it to get good rx/tx since it has fixed components at 90deg…?

Yes, I think that could be a problem, but for my own setup that didn’t really matter (sender and receiver are pretty close and for that it didn’t matter too much). Not sure how that would behave in other scenarios and what the best orientation and solution to that would be.

Stupid design to my opinion, they could have left the component legs out for orientation.