Adding a New Code Definition File

The image above is the remote control for my new roommate's RCA TV. We are going to capture the IR codes for all of the buttons on that remote and then design a new page of commands so that we can control that device with our Ultimate Remote.

Also open the ultimate_remote sketch and do a File -> Save as with a new name something like ultimate_remote_with_rca. Take a look across the top of the Arduino IDE and you will see a number of tabs for multiple files that are part of this program. The files that are named (whatever)_codes.h contain the codes for all of the commands that are used by the device. We are going to create a new tab called rca_tv_codes.h that will contain the codes for the RCA TV.

In the upper right corner of the Arduino IDE is a small downward pointing triangle. Click on that triangle and there will be a drop-down menu with a variety of options. You can use that triangle to navigate to existing tabs. We want to use the "New Tab" option.

At the bottom of the IDE a dialog will open where you can enter the name of the new tab page that you want to create. We will call it rca_tv_codes.h. Obviously you will want to pick a filename that makes sense for your device. Click on the "OK" and a blank tab will appear.

In the blank page that you just created start typing a define command for every button on your remote. Give it a unique name that identifies the device and the function. For example our begins with the following few lines and continues with descriptions for all of the buttons.

#define RCA_UP
#define RCA_LEFT
#define RCA_OKAY
#define RCA_RIGHT
#define RCA_DOWN

We recommend that you make an entry for all of the buttons whether or not you think you might use them or not. It makes it easier to capture all of the codes while you have everything set up to do so. Later you might want to edit your command page and add or remove some codes and you don't want to have to set everything up again to capture more codes.

Note: You will probably not be able to enter number keys using the Ultimate Remote software as currently written. That is because when entering numbers on a TV or DVR you typically have to enter them quickly after one another. You would not be able to navigate the Ultimate Remote Screen in time. We suggest you still capture the codes because future versions of the software will be able to queue up several digits and then send them in sequence.

Capturing IR Codes

You should load the sketch titled dongle_dump in the Arduino IDE and upload it to the Trinket dongle. (Or if you did not make a dongle, upload the sketch remote_dump to the Ultimate Remote itself.) Compile and upload the sketch and open the serial monitor.

Point the remote control for your TV or other device at the receiver dongle or the receiver on your Ultimate Remote. After we pressed the "Up Arrow" button on our remote we saw the following on the serial monitor:

Ready to receive IR signals
Decoded NEC(1): Value:C738B847 Adrs:0 (32 bits)

This says that we were able to successfully decode NEC protocol which is protocol number 1. The value received was "C783B847" and the Address was 0. "Address" is an additional bit of data used by some protocols. In this case it is unused. Finally, we are told this is a 32-bit protocol. In fact, all NEC protocols are 32 bits, but some protocols such as SONY have a variable number of bits.

Can we now go back to the page rca_tv_codes.h and enter that information into the define statement for the Up Arrow. Note that because this is a hexadecimal number you must precede it with 0x. We repeated this process for all of the buttons on the remote. Here is what the entire set of entries will look like after we have edited in the codes.

Download: file
#define RCA_UP 0xc738b847
#define RCA_LEFT 0xc7387887
#define RCA_OKAY 0xc738d02f
#define RCA_RIGHT 0xc73838c7
#define RCA_DOWN 0xc738C837

#define RCA_POWER 0xc73840bf
#define RCA_HOME 0xc738da25
#define RCA_EXIT 0xc738a758
#define RCA_BACK 0xc73828d7
#define RCA_APPS 0xc738ea15
#define RCA_NETFLIX 0xc73842bd
#define RCA_VUDU 0xc738c738
#define RCA_BLANK_LEFT 0xc73847b8
#define RCA_BLANK_CENTER 0xc73827d8
#define RCA_INPUT 0xc73858a7

#define RCA_VOLUP 0xc73832cd
#define RCA_MENU 0xc7389a65
#define RCA_CH_UP 0xc738aa55
#define RCA_VOLDN 0xc7382ad5
#define RCA_MUTE 0xc7386a95
#define RCA_CH_DN 0xc738728d

#define RCA_1 0xc73850af
#define RCA_2 0xc738906f
#define RCA_3 0xc73810ef
#define RCA_4 0xc73848b7
#define RCA_5 0xc7388877
#define RCA_6 0xc738087f
#define RCA_7 0xc738708f
#define RCA_8 0xc738b04f
#define RCA_9 0xc73830cf
#define RCA_MINUS 0xc7385aa5
#define RCA_0 0xc738a857
#define RCA_EPG_I 0xc7389867

#define RCA_REWIND 0xc738b24d
#define RCA_PLAY_PAUSE 0xc73812ed
#define RCA_STOP 0xc738f00f
#define RCA_FF 0xc7380af5
#define RCA_RED 0xc738c03f
#define RCA_GREEN 0xc738a05f
#define RCA_YELLOW 0xc73800ff
#define RCA_BLUE 0xc738807f

When you have completed capturing all of the codes, you should save that file by pressing "Ctrl-S" on your keyboard. See the section on Troubleshooting in this tutorial if you are not able to successfully decode the signal from your remote.

Now that we have captured all of the IR signals and recorded them, we will show you how to create a new page of commands using the signals.

This guide was first published on Sep 23, 2019. It was last updated on Sep 23, 2019.
This page (Recording Your IR Signals) was last updated on Oct 24, 2020.