How to convert IR raw data into an array to be sent as IR

I am new to both Arduino and this forum. I have some background in hardware and programming in other environments. I am using the Elegoo Super Starter Kit.
My first project is to try and simulate some of the IR commands generated by an xfinity XR11 remote control. The remote control is set to send IR commands, instead of RF, and is also set to control the power and volume of a Samsung TV.
My breadboard has an IR receiver and transmitter. I have been using the SimpleReceiver example program to collect the IR codes for a few of the remote control buttons that I would like to simulate. The power, and volume keys on the remote control send standard Samsung commands and I have made them work using the IrSender.sendSamsung method. However, the other buttons are more of a challenge. Those buttons all come back as either noise or an unknown protocol. I'm sure that they are not noise. The raw data looks like this.

Received noise or an unknown (or not yet enabled) protocol
rawIRTimings[18]:
-13650

  • 250,- 850
  • 250,-1000 + 250,- 700 + 250,- 700 + 250,-2600
  • 250,-2750 + 200,- 750 + 200,- 750 + 250
    Duration=12250us

I found a few posts that talk about just putting this data into an unsigned int array and then using the IrSender.sendRaw method with the array as a parameter. However, I'm still confused about what I'm being told to do.

I would like to come up with a IrSender.sendRaw that will result in the IrReceiver generating the exact same output shown above.

Any help or a link to an article or post that I have not yet found would be appreciated.

Thanks in advance.

Welcome to the forums.

Look at the SendRawDemo example sketch that comes with the library.

Thanks for your prompt reply.
I looked at this example and saw the syntax for passing the array to the sendRaw.
However, I still don't know how to use the values shown in my post to build the values in the raw[] array. uint16 will only take positive numbers but the first value, and others, in the array in my post are negative numbers. The first value in the array that I posted is -13650. I have several printRaw outputs where the first value is -3276750. Even if I drop the minus sign this number is too big for an uint16. In my post the [18] lads me to believe that the array has 18 elements. However, the commas are only shown between ever other number.

I hope that I did not spew out too much stuff.

So what are those other buttons supposed to control?

So many quick responses.
The right arrow button, which is the one in my post, puts the DVR into fast forward mode. The EXIT button removes an annoying display on the screen. The play button takes the DVR out of fast forward mode and back to normal play mode. These are the only three buttons that I want to simulate and can make a raw data array for each of them if I can only figure out what those arrays need to look like.

To understand, controlling another device, not samsung tv? If yes, what device?

An xfinity DVR. Not sure of the model number. Every other key on the remote is shown in the serial window as unknown protocol followed by a dump as shown in my post.

I have no idea about the device itself.
Can it be possible that only Samsung tv signals are sent via IR and others are RF?

By default the remote control does use RF but I have changed that to IR. I have captured each of the keys that I'm interested in, and there are only three of them, using the example IRreceive program. What I need to figure out is how to take the data that I have and convert it into a raw array that when sent will produce the same results as the remote control itself.

That raw you posted doesn't look like normal/good/valid IR-signal. That's why I'm asking...
It could be 00001100, one byte without header, but it would be weird.

Press the same button three times and post the output here.

Use signed long, the simple declare is

long rawIR_data[100] = {0}; 

change 100 to whatever the maximum number of numbers is.

I will try that. I have to leave for a couple of days but I will be back.
Thanks to you all.

The compiler is having an issue with the array being long It looks like the array has to be unsigned int.

Print the received data as hexadecimal and binary.

Serial.print(received,HEX);
Serial.print("\t");
Serial.println(received,BIN);

Please post your full code and the error message, so we can better underestand what's going on...

I have been out of town for a few days and upon return spent some time looking at the SendRaw sample. My initial goal was to create some standard NEC commands using raw data and I think that I am now good with that.
My next big issue is to understand the format of the IR commands sent from a Comcast xfinity XR11 remote control. I only need to understand the format generated from three of the keys.
Am I better off continuing with this thread or starting a new thread with a more descriptive title to maybe draw more attention?
Again, thanks for the responses so far.

You can stay with your original question/topic. "Attention" depends on your presence and on information you provide..

Valid raw data is same independently how / with what you send it. But you have to receive it correctly first.

Why? If a signal is NEC coded, just send it as NEC, there's no reason to work with raw signals if you have an already known code.

If IRremote doesn't recognize it as a known protocol, you don't need to "understand" anything: just capture the keys in raw format and send them in raw format, and that's all you need.

I think you can continue here, but the decision is yours, nothing stopping you from doing so if you prefer.

I will keep the thread going here. I will try not to get too long winded but, for me, that is hard to do.
As previously mentioned, I have a board with an IR receiver module and an IR transmitter module.
I am trying to duplicate the IR codes sent by three buttons on a Comcast xfinity XR11 remote control. After capturing the IR sent by those three buttons it was pretty clear that I was going to have to send raw codes instead of something easy like sendNEC or something of the sort.
I tried to use the sendRAW to simulate a standard NEC command and after some fooling around I have that working and now feel comfortable sending raw data.
However, my current dilemma is what I'm suppose to send. The format of the xfinity commands are very different than a standard NEC format. That is not my only problem.
Here are the codes captured by my IR receiver for the fast forward button on the remote.

and here are the codes captured when I press the play button on the remote.


Granted, it took me quite a few clicks of the play button to get an exact match of everything
except the first large number. I'm still not sure what the -3276750 and -1054700 are.
So, how can this be? My IR receiver may not be sensitive enough to accurately detect the actual signal that is transmitted by the remote. The IRremote library may not be able to interpret the pattern that is being given to it by the receiver. Or, everything is as it is shown and I just don't know what I'm doing.
So that is where I am at and would appreciate any help or suggestions.

If the receiver isn't the right one, due to poor sensitivity or the wrong carrier frequency, the received code won't be the same when pressing the same key (that is, the raw values ​​will be slightly different). If, in your case, the code appears to have essentially the same values, the decoding is correct.

To learn how to send a raw sequence, you simply need to create an "unsigned int" array with the raw sequence values. I don't have a circuit handy right now to test the IRremote and give you exact information, but I remember there was also an example sketch showing how to compose the array of raw values ​​and then send them using irsend.sendRaw(); with the parameters being the array, the array length, and the carrier frequency (which you need to know, obviously). I think it was "ReceiveDump", showing a "pronto" array (I see it'd be the "compensateAndPrintIRResultAsPronto()" function) over serial, just below the output you reported here.

To give you an example, this was the "raw" encoding of the first buttons of the old SkyHD decoder:

unsigned int Signal1[KEYS][VALS] = {
  {240,1016,244,1152,236,748,244,2788,240,1288,244,1288,244,1148,244,880,240,12956,240,1016,244,2652,236,748,244,740,236,748,240,744,244,740,240,744,244}, // "0"
  {236,1020,240,1156,300,684,236,2796,248,1280,240,1292,236,1156,248,872,244,12956,236,1020,240,2520,240,744,244,740,236,748,240,880,240,744,244,740,236}, // "1"
...etc...

so to send the "k" key code:

  irsend.sendRaw(Signal1[k], codeLen, KHZ);

(here VALS is 35, the numebr of values from the array, and KHZ is 36 because the remote has 36 kHz carrier frequency).

In my opinion, the first high value can be ignored (it represents a rather long "pause" signal), and the other values ​​have alternating signs, i.e., "+" indicates the presence of carrier and "-" its absence. Therefore, the array should be composed by taking the unsigned values, starting from the first with the "+".
For example (but since you only posted an image of the output—which shouldn't be done—I can't copy them directly) the FF key should be something like:

unsigned int SignalFF[17] = {
  {250,850,250,1650,250,700,250,2750,250,1250,250,1200,250,1150,250,2600,250}, // "FF"

Try running the "ReceiveDump" example code now, and check the serial output when you press the FF key. And if you'll post here the serial output please do it using the same "CODE" tags you use for the sketch source.