# How to make/duplicate a NEC Infrared Transmission Protocol

what i am trying to achieve to be able to duplicate/recreate the infrared signal of my remote control using my arduino.

The arduino has a already a library for this, unfortunately it doesn't seem to support the board that i am going to use the arduino mkr1000. The library has a recieve that makes me able to see the data, but the function for transmitting it back is not working.

So this makes me resort to creating a function for sending myself. I know that the remote i am using uses and NEC infrared transmission protocol. So i looked at its specs.

according to it:

• a 9ms leading pulse burst (16 times the pulse burst length used for a logical data bit)
• a 4.5ms space
• the 8-bit address for the receiving device
• the 8-bit logical inverse of the address
• the 8-bit command
• the 8-bit logical inverse of the command
• a final 562.5µs pulse burst to signify the end of message transmission.

What i dont understand is, what is this address and command.

unfortunaly i do not have an oscilloscope inorder to probe my remote to confirm some hypothesis. What i have though is the output of the serial monitor the arduino upon recieving the signal.

Encoding  : NEC
Code      : 2FD807F (32 bits)
Timing[67]:
+9200, -4500     + 600, - 550     + 600, - 550     + 600, - 550
+ 600, - 550     + 550, - 600     + 550, - 550     + 600, -1700
+ 600, - 550     + 600, -1700     + 550, -1700     + 600, -1700
+ 600, -1700     + 550, -1700     + 600, -1700     + 550, - 600
+ 550, -1700     + 600, -1700     + 550, - 550     + 600, - 550
+ 600, - 550     + 600, - 550     + 600, - 550     + 550, - 600
+ 550, - 550     + 600, - 550     + 600, -1700     + 600, -1700
+ 550, -1700     + 600, -1700     + 600, -1700     + 550, -1700
+ 600, -1700     + 600

unsigned int  rawData[67] = {9200,4500, 600,550, 600,550, 600,550, 600,550, 550,600, 550,550, 600,1700, 600,550, 600,1700, 550,1700, 600,1700, 600,1700, 550,1700, 600,1700, 550,600, 550,1700, 600,1700, 550,550, 600,550, 600,550, 600,550, 600,550, 550,600, 550,550, 600,550, 600,1700, 600,1700, 550,1700, 600,1700, 600,1700, 550,1700, 600,1700, 600};  // NEC 2FD807F
unsigned int  data = 0x2FD807F;


From the output can we point out which is the address and which is the command? so that i will be able to create a code for it

In the sample capture you have the data right there => 0x02FD807F. The address is 0x02. The logical inverse of the address is the 0xFD. The command is the 0x80. And the logical inverse of the command is the 0x7F value.

• A follow up question. in the specification it is saying "pulse burst" does this have to be followed? can i just turn the led on for 9us or does it have to be bursted at 38khz Commented Jul 17, 2019 at 14:17
• @Jack - Bursted at 38kHz. Commented Jul 17, 2019 at 14:26
• Now that will add some challenges in the coding. Thank you very much i will try to tackle the challenge now. Commented Jul 17, 2019 at 14:31
• I deleted my first comment because it contains error that might confuse someone else, I will say my thank you again here , I was not critical enough to notice that there are inverse pair in the data. Commented Jul 17, 2019 at 15:06
• @Jack - Really glad it worked out for you. Commented Jul 17, 2019 at 22:31