Help with IR receiver and transmitter Module (SOLVED)

Hello.

I have a "YS-IRTM" module, I have some problems using it.

It has 4 pins: 5V, GND, TX and RX

I connect TX and RX to RX and TX of my ESP8266 respectively, and I use this library, I use examples of this library, when I upload "IRrecvDemo" example to my ESP, when I hit a button of an IR remote (this remote) in front of the module, it shows some codes in the serial monitor, but some different keys show the same code.

And when I use another examples to transmit some IR signals, like "IRsendDemo" nothing happens, it doesn't transmit anything, when I use my phone camera to observe the IR diode, it doesn't turn on, and when I measure the voltage between 2pins of IR diode, there's 0.08V.

Then I connected the IR diode to GND and 3.3V pins of my ESP and observed it through my phone camera, a weak violet light was emitting, after some seconds it made a sound like a very small spark, when I touched the diode it was a bit warm, and a small brown spot inside it, again I connected the diode to 3.3V for a seconds to see if still I can see that weak violet light :smiley: and still it was there!

I don't know how I should use it but my guess is that this library or the examples I use, aren't made for serial communication, but I have no idea what I should do!

The library you refer to is designed to connect directly to IR receivers/transmitters (with relevant support components) but the module you show is using some unknown IC to decode/encode the IR signals.

Something like this is what you need though you can get cheaper by buying the IR receiver/transmitter separately and connecting them with relevant resistors.

Riva:
The library you refer to is designed to connect directly to IR receivers/transmitters (with relevant support components) but the module you show is using some unknown IC to decode/encode the IR signals.

Something like this is what you need though you can get cheaper by buying the IR receiver/transmitter separately and connecting them with relevant resistors.

Here is the datasheet, I was uploading it.

Hi,
Have you googled;

ys-irtm esp8266

and looked at this library.

Tom... :slight_smile:

TomGeorge:
Hi,
Have you googled;

ys-irtm esp8266

and looked at this library.
GitHub - balucio/Remote: ESP8266 - Universalremote

Tom... :slight_smile:

Hi, Thank you so much for this greate library! Unfortunately I had googled so much since yesterday but not this one -_- :smiley:

I installed it but I get some errors can you help me with it?

I get the following error when I try to compile the codes:

no matching function for call to 'SoftwareSerial::SoftwareSerial(const int&, const int&, bool, int)'

Hi,
Can you post your code please?
Do you need software serial, ESP2866 has two UART ports?

Thanks.. Tom.. :slight_smile:

TomGeorge:
Hi,
Can you post your code please?
Do you need software serial, ESP2866 has two UART ports?

Thanks.. Tom.. :slight_smile:

Well, I'm just trying to compile the example of this library, and it uses softwareserial, see here

Its example is so complicated for me it has many *.h and *.cpp tabs in it.

TomGeorge:
Hi,
Can you post your code please?
Do you need software serial, ESP2866 has two UART ports?

Thanks.. Tom.. :slight_smile:

Could you find any solution to it?

Finally I could get it work by getting help from this post

Hi,
Good you had success.
Now can you tell us what you did and post your code so anyone else with a similar problem can learn from this thread like you did with thread you liked?

Thanks.. Tom... :slight_smile:

TomGeorge:
Hi,
Good you had success.
Now can you tell us what you did and post your code so anyone else with a similar problem can learn from this thread like you did with thread you liked?

Thanks.. Tom... :slight_smile:

Of Course.

The wiring:

Connect the arduino TX (pin 1 on UNO) to RX on the YS-IRTM
Connect the arduino RX (pin 0 on UNO) to TX on the YS-IRTM
and ofcourse:
5v -> 5v
gnd -> gnd

Code for receiving and decoding:

int incomingByte = 0;   // for incoming serial data

void setup() {
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}

void loop() {

        // send data only when you receive data:
        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

                // say what you got:
                Serial.print("I received: ");
                Serial.println(incomingByte, HEX);
        }
}

Code for transmitting:

uint8_t my_serial_bytes[5]={0xA1, 0xF1, 0x00, 0xEF, 0x11};
int incomingByte = 0;   // for incoming serial data

void setup() {
        Serial.begin(9600);     // opens serial port, sets data rate to 9600 bps
}

void loop() {
 
 
Serial.write(my_serial_bytes,sizeof(my_serial_bytes));

delay(50);


               
               if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

                // say what you got:
                Serial.print("I received: ");
                Serial.println(incomingByte, HEX);
                delay(5000);        // delay 5sec
               }
}

This line:

uint8_t my_serial_bytes[5]={0xA1, 0xF1, 0x00, 0xEF, 0x11};

declares the code you want to send. A1 F1 tells the module to send the code and you shouldn't change it, so for example if you want to send: 04 FB 12, you should change that line to this:

uint8_t my_serial_bytes[5]={0xA1, 0xF1, 0x04, 0xFB, 0x12};

1 Like