Go Down

Topic: Infrared interface (Read 10308 times) previous topic - next topic

TjeerdBer

Hi all,

A question: Does anyone know how to interface my just bought IR interface to the Arduino?
There are some letters on the board: YS-IRTM.
The discription is: 5V Infrared IR Remote Decoder Encoding Transmitter & Receiver Wireless Module.
I bought it at ebay link: http://www.ebay.com/itm/252029695340?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Thanks for any reply, Tjeerd (NL)

jremington

How is your Chinese? Manual here.

jbike

I bought several of them myself. And thanks for the link to the datasheet! They work at 9600 baud default, but you have to conform to their 3 character at a time plus 2 character prefix of 0xA1 0xF1. So if you want to send ABC, then send 0xA1 0xF1 0x41 0x42 0x43

Garwel

I was wondering if anyone has got one of these working. I have tried without success. I have wired it to a FT232RL FTDI USB To TTL Serial Converter and monitored the com port and no data comes through.


ys-irtm              ftdi
5v    ------------  5v
tx    ------------  rx
rx    ------------  tx
gnd  ------------  gnd

jbike

It might be that your terminal program can't send hex values? I used Realterm, set up for 9600 baud, set the port to the FTDI port, set the display tab to hex+ascii, put 0xA1 0xF1 0x41 0x42 0x43 in the send window then clicked on send numbers. I set up a second instance of Realterm for the other module, and set up a second FTDI converter port. Verify you can send and receive between the two FTDI converters on the two Realterm monitors before using the modules to verify the setup is correct.

yura-007

Hi, i connect YS-IRTM to USR-WIFI232-604, and cant do great work.
Work only receiver (https://www.youtube.com/watch?v=KtKk9DX1_DA) sniffer show me receive data, but transmitter not work. I try send hex: A1, F1, 1C, 2F, 33 and A1, F2, A5, 00,00 and A1, F3, 01,00,00 but all this not work. Diod not blink on camera.
A1, F2, A5, 00,00 - A5 its mean address in documentation. I not understand, address com port?
Help me pls!
Sorry for my english.

LeifOlav

So to use this with uart you have to install RealTerm Serial Capture. And set it up like this:



Select the COM port of your uart, and set the baudrate to 9600. Make sure your uart is set to the same baudrate in the device manager. Should be 9600 by default, but just in case. They need to operate on the same baudrate.



Connect the uart and YS-irtm like this:



Now, assign the right baudrate for the YS-IRTM(should be 9600 from default)




So now we are ready to receive the code from the remote. LG remote in this case:




So the code we received was 04 FB 12. But to output code from the YS-IRTM we have to send the "start" bits A1, F1 first. So the code will look like; A1 F1 04 FB 12



Or you could send it as numbers using; 0xA1 0xF1 0x04 0xFB 0x12




And for the arduino:

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

Receiving code from remote. In this case LG remote controller.

(Yes, it will flash the LED every time it's receiving something)



Code: [Select]
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);
        }
}


Sending code from the arduino to YS-IRTM every 5 seconds, as an example:

(Yes, the YS-IRTM will blink every time a successfull code is sent)


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

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(5000);        // delay 5sec
               
       
}



So the code you receive will always be without A1, F1 because these are only used for the YS-IRTM to "start" sending the next bits.

Baudrates:
01 - 4800
02 - 9600
03 - 19200
04 - 57600

A1 F3 02 00 00 = set baudrate to 9600
A1 F3 04 00 00 = set baudrate to 57600
and so on..


Sending:

A1 F1 xx xx xx = Send xx xx xx
ex. A1 F1 04 FB 12


mikekgr

Dear LeifOlav,

using your fine instructions I was able to check my ys-irtm. THANKS a lot for your informative how to.
Please if you found any other command that the firmware of ys-irtm can accept, please share with us !!!
Also, is it possible to change/update the firmware? Do you know anything about?

Again, Thanks and Best Regards,
Mike Kranidis

Gogatrone

I tried this over and over again but I couldn't make it work.

I used the Arduino codes with the connections given. Even tough I receive code I cannot send it. Realterm is updated and there is no hex button on the send section.

On the other hand I want to receive and send air conditioner remote data. I am not sure if I can do it with Arduino.

My uart is: https://www.aliexpress.com/item/Smart-Electronics-PL2303-PL2303HX-USB-to-UART-TTL-Cable-Module-4p-4-pin-RS232-Converter-Serial/32328101959.html?spm=2114.13010608.0.0.rTj61j

What should I do?

lcrr

Quote from: Gogatrone
I used the Arduino codes with the connections given. Even tough I receive code I cannot send it. Realterm is updated and there is no hex button on the send section.
Try sending it as numbers, as suggested by LeifOlav:
Quote from: LeifOlav
Or you could send it as numbers using; 0xA1 0xF1 0x04 0xFB 0x12
I used my Arduino Due TX and RX pins as UART interface, so the module presumably should work with it. I just didn't have the time to test a send/receive program yet, but I was able to send a turn on/off signal to my TV using Realterm.

TYTAHXAMOH

#10
Dec 22, 2017, 04:30 am Last Edit: Dec 22, 2017, 05:13 am by TYTAHXAMOH
Hi where! Can anyone advice me how to make "repeat code" on YS-IRTM as in picture?
I need it to simulate long pressed button

vkanth

How is your Chinese? Manual here.
Based on this Chinese Simplified language manual shared by jremington, I recreated an English language manual with like for like instructions. There are some statements I had to amend to correct the grammar. All thanks to Google Translate and onlineocr.net for the help needed with translation and text extraction. There are other comments in this thread (LeifOlav) which pretty much sum up the instructions. I'm new to the serial communications topic myself so exploring <A HREF="https://www.cnx-software.com/2017/04/20/karls-home-automation-project-part-4-mqtt-bridge-updated-to-use-ys-irtm-ir-receiver-transmitter-with-nodemcu/">this</A> thread helped me get to this forum.
<br>You may post this document in other forums as you see suitable.

Manbearpig73

#12
Oct 26, 2018, 04:33 pm Last Edit: Oct 26, 2018, 04:35 pm by Manbearpig73 Reason: more details given
Realterm is updated and there is no hex button on the send section.

You need to search google for version 3, you probably have version 2. I found a version 3.0.1.44

Go Up