Request: will any user successfully using ESPhome as a remote IR transmitter please post their yaml

Thanks for the info. At some point I was doing something like that but my knowledge in circuitry is limited. I am at an intermediate level right now. Do you have pictures of your rig? Again, thanks for the information.

I feel like if you look at the circuit diagram you’ll figure it out. But for what it’s worth, here’s what my project looked like when it was on the breadboard: https://imgur.com/3nrbtLV

That’s the exact circuit as described in the diagram. I can’t show you the finished one because it’s inside the wall, and lovely as you are, internet stranger, I’m not pulling it out for you :smiley: But the one pictured worked. You can get the values of the various components from the circuit diagram and its associated text.

You can totally do this. It’s shoving some components into a breadboard. You got this.

2 Likes

thank you! I can definitively replicate that. The breadboard picture is what I needed!! I really appreciate your willingness to step up and help me. That’s the amazing benefit of being part of this community. Thanks again! And I don’t blame you for not getting it from the wall. :joy:

You’re welcome; just paying it forward, as I have been helped here many, many times myself. Pay me back one day by answering someone else’s question, too.

By the way, I find the range of the transmitter circuit to be 2-3m, which is not amazing, but is kinda sorta ok enough for my purposes. I was building mine to control a ceiling fan so I mounted my emitter in the ceiling, 2m away from the fan. Has been working reliably for just under a year now.

That’s plenty of distance for what I want to have. Thanks again. I will keep you posted on my results.

Hi everyone.

Thank you all for this useful post! I could solve some problems sending RAW IR codes with ESPHome.
Now I can send IR Raw codes to many devices.

But what I’m trying to do is control some Air Conditioners. I have a NodeMCU with an IR receiver and decode the codes, but it seems to be two codes each time I press the buttons (i’ve got the same result with other A/C remotes).

This is an example:

[21:01:05][D][remote.raw:028]: Received Raw: 9047, -4438, 676, -552, 654, -551, 656, -1653, 655, -1652, 655, -1654, 654, -553, 654, -552, 658, -548, 655, -552, 653, -552, 656, -551, 655, -1653, 654, -551, 657, -550, 655, -551, 656, -551, 655, -552, 654, -552, 654, -552, 655, -551, 
[21:01:05][D][remote.raw:041]:   655, -552, 655, -552, 654, -1653, 655, -553, 652, -553, 655, -552, 654, -552, 654, -552, 654, -1654, 680, -552, 654, -1654, 655, -552, 654, -552, 655, -1653, 655, -551, 655
[21:01:05][D][remote.raw:028]: Received Raw: 675, -1653, 655, -551, 655, -1653, 654, -553, 655, -552, 655, -551, 655, -551, 655, -551, 656, -552, 655, -551, 655, -552, 655, -551, 654, -553, 653, -552, 655, -1652, 655, -552, 654, -552, 655, -551, 654, -554, 653, -551, 655, -553, 654, 
[21:01:05][D][remote.raw:041]:   -553, 654, -551, 656, -554, 651, -553, 655, -550, 655, -551, 656, -551, 654, -552, 655, -1654, 654, -551, 656, -552, 655

I know I should merge the splited lines. But you can notice that the output has two “Received Raw:”, and If I try to merge them in one single code array I got the error “Values must alternate between being positive and negative”.

Have any idea how to send this codes?

Thanks!

Have you tried sending the two codes separately? I mean to merge the first two lines into one code to send, and then the last two lines into another code to send? The error is because the last value of the 2nd line and the first value of the 3rd line are both positive. It simply looks like a single button press on your remote sends two separate messages to the device - so you should do the same.

Would you guys try to help me too?

I am trying to spoof the signal of an IR remote that controls a LED ceiling lamp. It does not work and my problem is very confusing.

I have set up two NodeMCU boards, one with an IR emitter, one with a receiver. This is the signal I am emitting in the code:

  - platform: template
    name: White Button
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [-4558, 4450, -607, 527, -605, 527, -605, 1632, -606, 525, -607, 1629, -608, 525, -607, 1631, -607, 526, -605, 1631, -607, 526, -606, 526, -605, 526, -606, 526, -605, 525, -606, 525, -607, 525, -606, 1630, -608, 1631, -606, 527, -605, 526, -605, 526, -605, 525, -606, 526, -606, 526, -605, 526, -605, 525, -606, 526, -605, 1631, -607, 1631, -606, 525, -606, 1631, -607, 525, -606]
          repeat:
            times: 5
            wait_time: 16ms
          carrier_frequency: 38kHz

However, when I press the button, this is the raw code that the receiver receives:

22:24:01][D][remote.raw:028]: Received Raw:  -4459, 616, -494, 654, -494, 654, -1631, 623, -495, 654, -1631, 623, -494, 654, -1631, 624, -494, 653, -1631, 624, -495, 655, -494, 653, -494, 653, -495, 654, -493, 654, -494, 654, -493, 654, -1631, 623, -1631, 623, -528, 621, -528, 619, 
[22:24:01][D][remote.raw:041]:   -528, 620, -527, 620, -528, 621, -494, 654, -494, 653, -528, 620, -528, 620, -1656, 598, -1655, 598, -528, 620, -1655, 601, -527

Now, if I put these too below one another, they are very similar, although the received signal is shorter. It almost seems to me as if the high signals got sent low and vice versa, with two lost somehow.

The modified third line below shows what I mean. If I invert the signals it almost looks like the first line, doesn’t it?.

sent:		-4558, 4450, -607, 527, -605, 527, -605, 1632, -606, 525, -607, 1629, -608, 525, -607, 1631, -607, 526, -605, 1631, -607, 526, -606, 526, -605, 526, -606, 526, -605, 525, -606, 525, -607, 525, -606, 1630, -608, 1631, -606, 527, -605, 526, -605, 526, -605, 525, -606, 526, -606, 526, -605, 526, -605, 525, -606, 526, -605, 1631, -607, 1631, -606, 525, -606, 1631, -607, 525, -606
received:	-4459, 616, -494, 654, -494, 654, -1631, 623, -495, 654, -1631, 623, -494, 654, -1631, 624, -494, 653, -1631, 624, -495, 655, -494, 653, -494, 653, -495, 654, -493, 654, -494, 654, -493, 654, -1631, 623, -1631, 623, -528, 621, -528, 619, -528, 620, -527, 620, -528, 621, -494, 654, -494, 653, -528, 620, -528, 620, -1656, 598, -1655, 598, -528, 620, -1655, 601, -527

modified:	-4459, xxxx, 616, -494, 654, -494, 654, -1631, 623, -495, 654, -1631, 623, -494, 654, -1631, 624, -494, 653, -1631, 624, -495, 655, -494, 653, -494, 653, -495, 654, -493, 654, -494, 654, -493, 654, -1631, 623, -1631, 623, -528, 621, -528, 619, -528, 620, -527, 620, -528, 621, -494, 654, -494, 653, -528, 620, -528, 620, -1656, 598, -1655, 598, -528, 620, -1655, 601, -527, xxx

Is there any explanation or am I just missing something very basic. I have set up a very simple circuit with a cheap transmitter. It does transmit though and I do receive a signal. Just not the one I am looking for :slight_smile:

@lukastillmann, your project is exactly like mine was. Would you mind sharing your YAML config for the listener? That’s where I screwed up - I forgot to invert the pin. Also, it matters what pin you are using.

Let us see your full yaml for both sides.

Sure. I did’t think I needed to invert the pins. I had a warning when I used D0, but D1 and D2 I thought should work.

esphome:
  name: receiver
  platform: ESP8266
  board: nodemcuv2

remote_receiver:
  pin: D1
  dump: all
esphome:
  name: transmitter
  platform: ESP8266
  board: nodemcuv2

remote_transmitter:
  pin: D2
  # Infrared remotes use a 50% carrier signal
  carrier_duty_percent: 66%
  
switch:
  - platform: template
    name: White Button
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [-4558, 4450, -607, 527, -605, 527, -605, 1632, -606, 525, -607, 1629, -608, 525, -607, 1631, -607, 526, -605, 1631, -607, 526, -606, 526, -605, 526, -606, 526, -605, 525, -606, 525, -607, 525, -606, 1630, -608, 1631, -606, 527, -605, 526, -605, 526, -605, 525, -606, 526, -606, 526, -605, 526, -605, 525, -606, 526, -605, 1631, -607, 1631, -606, 525, -606, 1631, -607, 525, -606]
          repeat:
            times: 5
            wait_time: 16ms
          carrier_frequency: 38kHz

Can anybody please share a hardware wireing with Node MCU. I am trying to power an IR LED using NODE MCU. Not able to transmit any code. Even tried using BC547 transisitor, still not working. I am a noob in the world of electronice. Please help me.

@lukastillmann If you scroll back through this thread, you’ll find the post where I finally got it working. Have a look at my YAML there.

There are three critical differences. One, my reading pin is inverted. Two, it is set to INPUT_PULLUP mode. And three, it is dumping RAW, not ALL.

I think all of these are important for different reasons. The first two are because you need to be reading the right thing. The last is because in my case (and I was also trying to control a ceiling fan) the protocol was not being correctly identified. The only way around this is to both read and transmit raw, so you’re just blarting out what you heard.

Once I made those changes, it worked like a charm.

1 Like

@dibyadip, hang in there. This is a tricky thing, and it took me weeks to get it working (probably because, as many people will tell you, I am not clever).

First thing to figure out is if your IR transmitter is even sending anything at all. How we check this is with a mobile phone: your camera can see IR flashes, but your eye cannot.

So look at your LED through the phone camera and transmit. If you see flashes, good! Your IR LED is working. But if you do not, well, start by replacing your IR LED. It’s possible to get a bad batch, and even more possible to install them the wrong way round (this kills the LED).

1 Like

There are many howtos on led driving on the web, but this one seems to have some hopefully helpful explanation https://arduinodiy.wordpress.com/2015/12/12/driving-an-ir-led-constant-current-source-or-not/

Thank you @DeeBeeKay and @nickrout

Most high end phones have an IR filter so you may not see the IR LED flashing. I know my iPhone blocks it but a cheap Android phone I have does not.

Thank you @murtoz for your answer, it was very useful. I spent many hours playing and investigating more deeply on how IR codes works, and want to share some details that can help others.

I have two Broadlink IR remotes that works fine with these A/C. So I used the Broadlink Base64 code and decode it to HEX. So I could “read” the pulse timming and found that in my IR code has a LOW pulse (negative in RAW format) for 20ms. Reading again ESPHome Remote Receiver component docs, I’ve found the “Idle” configuration variable to set the timeout for a stable state of the signal. Default value is 10ms, setting it to 25ms give me the correct read from the IR Receiver, with only one “Received Raw” event!

My next problem was that if I send that negative value of “-20,000” microseconds (or 20ms) in the RAW format, an IR receiver read values of 4ms to 6ms of LOW pulse, not 20ms. Reading the source code I found that the ESPHome Remote Transmitter component works well with values below 16ms.

So I found a workarround replacing the original “-20,000” pulse with “-10,000, 1, -10,000”, and that works fine!

Today I’ve update HA to version 0.110, and now I can use SmartIR with ESPHome by using a custom service to send Raw IR Codes! :smiley:

2 Likes

Trying to use some nec codes not on my orginal remote, but found on “JP1 Remote” files

Here is my dump for “1”, “2”,“3” button presses:

[14:24:25][D][remote.jvc:048]: Received JVC: data=0x20DF
[14:24:25][D][remote.lg:053]: Received LG: data=0x20DF8877, nbits=32
[14:24:25][D][remote.nec:068]: Received NEC: address=0x20DF, command=0x8877
[14:24:25][D][remote.raw:041]: Received Raw: 8994, -2268, 548

[14:24:27][D][remote.jvc:048]: Received JVC: data=0x20DF
[14:24:27][D][remote.lg:053]: Received LG: data=0x20DF48B7, nbits=32
[14:24:27][D][remote.nec:068]: Received NEC: address=0x20DF, command=0x48B7
[14:24:27][D][remote.raw:041]: Received Raw: 8996, -2268, 548

[14:24:28][D][remote.jvc:048]: Received JVC: data=0x20DF
[14:24:28][D][remote.lg:053]: Received LG: data=0x20DFC837, nbits=32
[14:24:28][D][remote.nec:068]: Received NEC: address=0x20DF, command=0xC837
[14:24:28][D][remote.raw:041]: Received Raw: 8996, -2268, 548

Here is the protocol data for 1 2 3 buttons

Description=Vizio VW37L HDTV40A TV
Remote.name=ARRX15G XSight 15
Remote.signature=USB8004
SegmentFlags=255
DeviceType=TV
DeviceIndex=54
SetupCode=1758
ButtonIndependent=false
ButtonIndex=82
Protocol=00 5A
Protocol.name=NEC1
ProtocolParms=4 null 0 0 0
FixedData=00 DF 00
ExtraData=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Function.16.name=1
Function.16.index=11
Function.16.keyflags=0
Function.16.hex=77

Function.17.name=2
Function.17.index=12
Function.17.keyflags=0
Function.17.hex=B7

Function.18.name=3
Function.18.index=13
Function.18.keyflags=0
Function.18.hex=37

I can easily see that the “FIxed Data=00 DF 00” I can see that all address are “address=0x20DF” and the commands match up with the last 2 of the “hex” but I’m not sure where the previous underlined hex comes from:

ie:
Function.16.hex=77 = Received NEC: address=0x20DF, command=0x8877
Function.17.hex=B7 = Received NEC: address=0x20DF, command=0x48B7
Function.18.hex=37 = Received NEC: address=0x20DF, command=0xC837

My goal is to use these remote functions:

Function.33.name=HDMI 1
Function.33.keyflags=0
Function.33.hex=7E
Function.33.notes=Not on original remote.
Function.34.name=HDMI 2
Function.34.keyflags=0
Function.34.hex=BE
Function.34.notes=Not on original remote.
Function.35.name=Power On
Function.35.keyflags=0
Function.35.hex=AB
Function.35.notes=Not on original remote.
Function.36.name=Power Off
Function.36.hex=5B
Function.36.notes=Not on original remote.
Function.37.name=Component
Function.37.hex=A5
Function.37.notes=Not used in favor of discretes above
Function.38.name=HDMI
Function.38.keyflags=0
Function.38.hex=9C
Function.38.notes=Not used in favor of discretes above

Any help would be appreciated!

I ended up programming a Harmony remote to dump the discrete codes.
But a answer may help someone else.

Thanks for the examples I missed the 38kHz in the docs. I’d like to know it it’s possible to create a generic function like:

switch:
  - platform: template
    name: "38kHz template with variable"
    turn_on_action:
      remote_transmitter.transmit_raw:
        code: {{ $REMOTE_CODE }}
        carrier_frequency: 38kHz

And than pass that variable via HomeAssistant or Node Red so you don’t have to specify it over and over in the ESPHome yaml.