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 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.
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?
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...
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
}
}
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: