Maker Pro
Maker Pro

Trouble with Infrared Communications (Custom Transmission)

I have been trying for a while to get a basic system working in which I can communicate infrared signals from one arduino to another to control it

However, the only infrared help I've been able to find online regarding transmitters has been to make your own TV remotes. But what I want to do is to use one arduino to send IR messages with an IR transmitter to another arduino with an IR receiver (I would just use if statements for the values of whatever signal is being sent to activate whatever code I so desire).
 
According to the datasheet your Arduino must transmit signal like this:

The data signal should fulfill the following condition:

Carrier frequency should be close to center frequency of the band-pass (e.g. 38kHz).

Burst length should be 6 cycles/burst or longer.

After each burst a gap time of at least 9 cycles is necessary.

The data format should not make a continuous signal transmission. There must be a Signal Gap Time (longer than 15ms) at least each 90ms (see Figure A).

Site http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html, it has very good information which could possibly help you. In the code for IR led they use sony protocol for sending the signals.
 
o the datasheet your Arduino must transmit signal like this:

The data signal should fulfill the following condition:

According to the datasheet your Arduino must transmit signal like this:

The data signal should fulfill the following condition:

Carrier frequency should be close to center frequency of the band-pass (e.g. 38kHz).

Burst length should be 6 cycles/burst or longer.

After each burst a gap time of at least 9 cycles is necessary.

The data format should not make a continuous signal transmission. There must be a Signal Gap Time (longer than 15ms) at least each 90ms (see Figure A).

Site http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html, it has very good information which could possibly help you. In the code for IR led they use sony protocol for sending the signals.
Ok, what I'm most confused about is this line:

irsend.sendSony(0xa90, 12); // Sony TV power code

Since I'm not using a sony receiver, what should this line of code be instead?
 
I think you could send the signal using those protocols and then in the other Arduino you just read the code. If you want to use your own protocol you must use send.raw.

int khz = 38; // 38kHz carrier frequency for the NEC protocol

unsigned int irSignal[] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560}; //example raw nec protocol

irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array.

delay(5000); //In this example, the signal will be repeated every 5 seconds, approximately.
}
void loop() {
 
I think you could send the signal using those protocols and then in the other Arduino you just read the code. If you want to use your own protocol you must use send.raw.

int khz = 38; // 38kHz carrier frequency for the NEC protocol

unsigned int irSignal[] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560}; //example raw nec protocol

irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array.

delay(5000); //In this example, the signal will be repeated every 5 seconds, approximately.
}
void loop() {
I'm confused again since this is in setup? and there is nothing in the loop?
 
I think the easy way would be to use one of the protocols for the transmission, or you could create one yourself, look at the files in the ir_NEC.cpp for how its done.

https://www.sbprojects.net/knowledge/ir/nec.php

Some examples for suitable data format are: NEC Code (repetitive pulse), NEC Code (repetitive
data), Toshiba Micom Format, Sharp Code, RC5 Code, RECS–80 Code, R–2000 Code.
 
I think the easy way would be to use one of the protocols for the transmission, or you could create one yourself, look at the files in the ir_NEC.cpp for how its done.

https://www.sbprojects.net/knowledge/ir/nec.php

Some examples for suitable data format are: NEC Code (repetitive pulse), NEC Code (repetitive
data), Toshiba Micom Format, Sharp Code, RC5 Code, RECS–80 Code, R–2000 Code.
Alright I now understand the 0's and 1's in the protocol but clarify something for me: The first two indexes in the array are defining a block of 9000ms and 4500ms, whereas ever two sets of 560 is a 0 and 560 followed by 1690 is a 1? And this binary but what is the default bit size?
 
Last edited:
Yeah, as far as I know that's right. I'm not expert on this subject, just interested about it also, since I have some projects where this can be useful.

You can just use the (irsend.sendNEC(//hex value here, //bit count here) like in the demo, I cant test it since I don't have any receivers like this available. I think NEC protocol was 8 bit address and 8bit command.
 
Yeah, as far as I know that's right. I'm not expert on this subject, just interested about it also, since I have some projects where this can be useful.

You can just use the (irsend.sendNEC(//hex value here, //bit count here) like in the demo, I cant test it since I don't have any receivers like this available. I think NEC protocol was 8 bit address and 8bit command.
Alright, so I used a new code for receiving IR values, decoding them, and telling what type of transmitter (sony, nec, etc.)
So I used my Roku remote and it told me it was NEC, so I used this code:

irsend.sendNEC(0X57E3E817,128);

Originally. the numeral after the code was a 32. I assumed that this is so because a 6 digit code can represent 32 different numbers. I also assumed, since the code given to me from the remote was 8 digits, that I needed to change the 32 to a 128. Is this correct?
 
No, maximum bit length is 32bits when NEC is used. 16bits for address and 16 for command.

0x20DF10EF = 0000 0000 0010 0000 1101 1111 0001 0000 1110 1111
address 0010 0000
inverted address 1101 1111
command 0001 0000
inverted command 1110 1111
 
No, maximum bit length is 32bits when NEC is used. 16bits for address and 16 for command.

0x20DF10EF = 0000 0000 0010 0000 1101 1111 0001 0000 1110 1111
address 0010 0000
inverted address 1101 1111
command 0001 0000
inverted command 1110 1111
OK, so I have fixed that but the signal that is outputted refuses to work with the TV still. I am using this:

irsend.sendNEC(0X20DF10EF,32);
delay(100);

Edit: WE HAVE CONTACT. Turns out the range is just crap. I heard that using 2 180ohm resistors in parallel works well at increasing range?
 
Use your own code what you got from reading the tx not my example, did you try to send it using 32bits?
I want to thank you for all of your help with this. Thanks to you, I have a deeper understanding in IR and have been able to make great use of this knowledge. You rock!
 
Top