Problem with IR Transmitter/Emitter

Hello

My Infrared transmitter has a range of about 20 cm and it works on my TV, but when I try it on my AC it won't work.
It seems like my transmitter is not strong enough (even if I put it on the AC, it will still not work).
I know that my AC does use infrared and does work with my transmitter (it only works once every hundred times)

I'm using an eps32

This is the module I'm using:
Screenshot 2024-06-24 at 18.20.49

here's my code:

#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>

const uint16_t kIrLed = 4;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).

IRsend irsend(kIrLed);  // Set the GPIO to be used to sending the message.

uint16_t tvTURN[68]={
4535, 4502, 567, 1675, 570, 1678, 566, 1678, 
568, 556, 565, 556, 568, 557, 564, 558, 
565, 560, 560, 1682, 572, 1674, 566, 1679, 
569, 555, 531, 592, 531, 590, 544, 581, 
542, 580, 539, 585, 536, 1709, 536, 586, 
534, 588, 535, 590, 533, 589, 560, 564, 
557, 567, 557, 1687, 557, 566, 557, 1687, 
560, 1685, 557, 1688, 526, 1719, 525, 1719, 
525, 1720, 526, 1000};

uint16_t acTURN[100]={
9083, 4574, 592, 1682, 617, 1663, 594, 552, 
618, 532, 617, 537, 618, 540, 617, 543, 
620, 1666, 619, 520, 619, 1660, 620, 1660, 
617, 533, 618, 534, 644, 511, 645, 516, 
644, 505, 646, 494, 646, 498, 644, 1635, 
646, 504, 644, 510, 643, 513, 646, 515, 
643, 508, 642, 496, 642, 1637, 642, 505, 
640, 509, 639, 514, 638, 1654, 640, 520, 
638, 1649, 614, 524, 641, 501, 638, 507, 
638, 512, 635, 515, 633, 523, 632, 527, 
606, 543, 604, 536, 601, 543, 595, 549, 
595, 556, 591, 564, 589, 568, 586, 598, 
561, 572, 536, 1000};

void setup() {
  irsend.begin();
#if ESP8266
  Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
#else  // ESP8266
  Serial.begin(115200, SERIAL_8N1);
#endif  // ESP8266
}

void loop() {
  if (Serial.read() != -1) {
    irsend.sendRaw(acTURN, 100, 38);
  }
}

Please can someone tell me what can I do?
use a different module (what module?)
use more current/voltage (and how?)

Thank you

The code for the AC may be wrong, or the IR modulation frequency may be wrong.

Where did the posted code come from? Which AC unit do you have?

For longer range, use a higher power IR LED, with a transistor switch.

I know the code is correct, it works for my TV but only sometimes for my AC.
what I'm saying is that I'm sure that everything works but the transmitter is just weak.
How can I use a transistor switch and make it longer range?

Using an ESP32? Then VCC for the LED is only 3.3V; the LED has a 220 ohm resistor in series(see board image). That may have been selected with 5V systems in mind. You can try reducing the 220 ohm(put another 220 ohm in parallel). That !should! increase the output intensity. There is a risk - reducing that resistance increases the current drawn from the ESP32 output pin, and I can't tell you where you'll run the risk of output burnout - but I suspect 220//220 won't be a problem, as long as the output isn't on continuously; AFAIK, the default state(in between transmissions) is off when you use the IR libraries, so you should be good.
Does it work with the AC if you hold the LED close to the receiver window on the AC unit, presuming you know where that is?
By the way, the codes for an AC unit and a TV unit are markedly different; you may be getting successful transmission for the TV, but poor transmission for the AC, simply because the implementations are different in the library you're using.

1 Like

How did you get your AC codes?

In addition to the numeric code for the IR library, you need to match the IR wavelength and the IR modulation frequency, which can be very different for different devices.

An internet search for "arduino high power IR LED" turned up this module as the very first hit.

1 Like

Thank you for the response.

I will try to put another 220ohm resistor in parallel and when I'm holding the LED close to the receiver (I know where it is), it will still work rarely

Then "weak" IR LED power is not the problem.

Then this points to something other than raw intensity. I'd be more suspicious of the codes you're using for the AC unit in that case.

I used IRLib2 (ESP32 support) library

That is to ask where did

uint16_t acTURN[100] = {

come from?


An alternative to the approach you are taking is to hijack the A/C remote, or a copy of it, and program the Arduino to, in essence, press any buttons you need to automatic press.

There are a variety of ways to do that, hardest part is opening up the remote and daring.

a7

This is a dangerous position to have. I've found when things are working "sometimes" no assumptions should be made as to where the issue is.

If your remote doesn't work when at the AC (i.e. almost touching the IR receiver cover) then it could well be the signal being generated. Perhaps the ESP32 clock is on the low or high side of expected. This could cause a problem as well.

That module can not give you reasonable range. It's kind of "fake" in the sense that it doesn't have any transistor circuit to drive the led at sufficient power. That Vcc pin is meaningless.
AC signals are very much different from TV. You have to have of course right frequency, but they are 99.9% 38kHz.
But AC signals are very long and complex, they can be for example 35 bytes compared to few bytes of TV. Also tolerances for pulse timing are generally tighter than TVs and other common electronics, so if your received "raw" is little bit off and sent "raw" has it's tolerances as well, so the final output for long signal can be not recognized anymore by receiver.