ESP32 IR Remote - Pronto - Inconsistent data, not sending

Got a breakthrough, so I thought I’ll post here could it somehow help somebody else :blush:
I struggled a lot going raw. Like a lot. Then I read a lot about it, and when that breakthrough happened I felt incredibly lucky compared to people I’d read. I got it pretty easy in comparison. That moment the AC turned on, I was on cloud nine.
I def recommend this extensive thread: https://community.home-assistant.io/t/esphome-raw-infrared-with-ir-led/

Here’s what I did:

  1. Switched my receiver config to raw: dump: raw instead of dump: all which only gave me pronto
  2. Captured my first raw codes. Realized straight away that my receiver was indeed inverted as suggested in my first post, and found the correct way to set it.
  3. For each remote press, kept getting 2 raw codes (“couple codes”) I could not merge together as one ended with the same polarity as the second started. So I started tryna send both, one code after the other.
  4. Started capturing around 10-20 “power on” “couple” codes, each different from the last. I tried to send each “couple” code every 2sec using - delay: 2s (I was about to go and average each in excel as some other people did). My hope there was that one of those codes was captured close enough to what the AC would like to hear. That did not work. Matter of fact, it did not even fire.
  5. Found out about mode: INPUT_PULLUP for the receiver config.
  6. Found out about parameters to transmit_raw (repeat, times, wait_time, carrier_frequency). I added values as found in other people’s yamls to give it a shot.

All in all, my receiver config now looks like this:

remote_receiver:
  pin: 
    number: GPIO32
    inverted: true
    mode: INPUT_PULLUP
  dump: raw

No change on the transmitter. Now here is the switch, with all parameters and some codes:

switch:
  - platform: template
    name: Raw Code Power Button
    turn_on_action:
      - remote_transmitter.transmit_raw:
         code: [410, -466, 393, -413, 444, -2124, 448, -437, 421, -1269, 446, -1269, 448, -410, 447, -1268, 446, -412, 445, -410, 448, -1272, 443, -1273, 444, -410, 446, -1270, 445, -1268, 447, -412, 446, -441, 418, -1264, 449, -411, 448, -436, 421, -1294, 421, -413, 445, -436, 421, -410, 448, -411, 446, -413, 446, -412, 446, -411, 445, -437, 421, -411, 446, -412, 446, -411, 446, -413, 447, -412, 445, -411, 447, -435, 421, -412, 447, -435, 421, -411, 447, -412, 445, -414, 446, -1266, 447, -411, 447, -410, 447, -411, 447, -437, 421, -409, 448, -1269, 446, -1266, 450, -436, 421, -411, 447, -410, 447, -1294, 422, -1270, 446, -1266, 448, -1269, 446, -411, 446, -437, 421, -410, 448, -411, 446, -438, 421, -1267, 447, -1268, 448, -436, 421, -1271, 445, -1267, 447, -412, 446, -410, 448, -1269, 446, -436, 421, -411, 447, -1267, 448, -410, 447, -437, 421, -1269, 446, -412, 447, -410, 447, -412, 446, -437, 421, -410, 446, -410, 448, -411, 446, -413, 446, -409, 447, -412, 448, -410, 447, -411, 447, -409, 447, -410, 448, -410, 447, -411, 446, -437, 421, -412, 447, -410, 448, -435, 421, -412, 445, -437, 421, -437, 421, -436, 421, -411, 447, -412, 446, -411, 446, -412, 446, -411, 446, -437, 421, -437, 421, -410, 447, -413, 446, -410, 447, -410, 447, -411, 446, -413, 445, -411, 447, -410, 447, -412, 446, -413, 446, -409, 447, -411, 447, -411, 446, -410, 448, -411, 446, -412, 446, -411, 447, -412, 447, -435, 421, -412, 447, -411, 446, -412, 444, -413, 445, -437, 421, -438, 421, -435, 421, -1268, 447, -1268, 447, -411, 447, -1269, 447, -1268, 446, -412, 445, -1268, 448, -1270, 446]
         repeat:
            times: 5
            wait_time: 16ms
         carrier_frequency: 38kHz
      - remote_transmitter.transmit_raw:
         code: [3426, -1696, 445, -1268, 446, -1269, 446, -437, 421, -410, 447, -415, 445, -1266, 447, -437, 421, -437, 421, -1268, 447, -1268, 447, -411, 446, -1295, 420, -413, 445, -412, 446, -1270, 445, -1270, 447, -411, 446, -1268, 445, -1297, 421, 
                -409, 447, -436, 421, -1295, 421, -410, 447, -411, 446, -1295, 421, -412, 445, -437, 421, -412, 445, -412, 446, -411, 446, -412, 446, -411, 447, -411, 446, -414, 446, -411, 446, -411, 445, -412, 446, -410, 447, -438, 420, -412, 447, -437, 421, -412, 
                445, -411, 447, -409, 447, -412, 445, -1270, 446, -412, 445, -411, 447, -410, 447, -415, 444, -409, 448, -1270, 444, -1271, 446, -409, 447, -412, 446, -412, 446, -1270, 445, -1270, 445, -1270, 445, -1269, 446, -412, 446, -411, 447, -412, 447, -410, 
                446, -411, 446, -1272, 445, -1269, 444, -413, 445, -1270, 445, -1268, 448, -437, 421, -411, 446, -1269, 446, -413, 444, -412, 446, -1296, 421, -412, 445, -412, 446, -1268, 446, -412, 445, -412, 448, -411, 446, -437, 421, -409, 446, -412, 446, -437, 
                421, -412, 445, -413, 445, -415, 443, -414, 445, -411, 445, -413, 445, -412, 445, -412, 445, -413, 445, -413, 445, -414, 445, -435, 421, -412, 446, -412, 446, -413, 444, -412, 445, -413, 445, -411, 446, -412, 446, -411, 446, -413, 445, -413, 446, -411, 
                445, -413, 445, -412, 445, -411, 447, -412, 446, -413, 444, -412, 446, -412, 445, -412, 446, -412, 445, -413, 445, -413, 445, -413, 444, -439, 420, -413, 445, -411, 445, -412, 445, -413, 445, -414, 444, -412, 445, -414, 445, -413, 445, -412, 446, -435, 
                421, -437, 420, -413, 445, -412, 445, -438, 420, -1270, 445, -1273, 444, -414, 444, -1267, 446, -1269, 446, -413, 445, -1270, 445, -1271, 446]
         repeat:
            times: 5
            wait_time: 16ms
         carrier_frequency: 38kHz

And it started firing. We are shooting raw. Not only that, the AC turned on. :exploding_head:

Now why did it work? I haven’t looked in detail yet, I think I might be actually firing twice each time as I get double the beeps. I’ll have to look into it more but it is very promising as I was able to reuse the power off code I first captured and it worked on first try.

Couple of thoughts regarding hardware quality, as I had not reach that point yet (to look into swapping cables, using a separate power source for LEDs, etc… I will not claim to have top of the line equipment, I just started tinkering in the realm of ESP32 and those boards in general. This is my very first project.
In other threads, many seem to struggle with their IR LEDs especially with constant current as well as power. They would add diodes, resistors and a transistor to deal with those issues(Constant current infrared LED emitter circuit - AnalysIR Blog). @DeeBeeKay deals with those in the aforementioned post.
I also read about ESP not working as well as weemos boards for this application.

In my case, I am using an IT transmitter that’s comprised of one tiny led (which is useful to let you know if you’re firing without having to take out your phone camera every time) and more importantly of what I assume to be two diodes which should provide current stability. I could be dead wrong. Truth of the matter is, I can fire these from almost a meter away from the AC. Not huge some may say, but that’s well enough for now. The accept both 3.3v and 5v from the ESP32.

That really deviated from the original title & topic, but we got there :partying_face:

Now I guess it’s just a matter of registering all the power on cmbinations with modes and with temperatures… and don’t get me started with vane positions :laughing: but really glad I got it working!!

Thanks all yall!