View Full Version : HOW TO: USB-UIRT - Learning/Testing IR codes

07-02-2008, 09:41 PM
Learning /Testing IR Codes

Once you have enabled your USB-UIRT, you are ready to learn IR commands – which is what we’ll discuss in this post. Our subsequent post will discuss how to trigger macros using IR commands and send IR commands.

This post will contain:

A) Managing IR commands

B) Learning IR commands

C) Copying/pasting IR commands

D) Validating IR commands

E) Testing learned IR commands

F) General Notes
A) Managing IR commands

In mControl Editor, select the commands tab. The commands tab will show all the IR codes you have saved to date. From here, you can add new codes, and change or delete existing ones.

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - EditorCommands.jpg

Now you will want to choose “New IR Code”. Choose USB-UIRT for “learn from” and for test output, choose UUIRT_IRB : 0.

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - AddCode.jpgB) Learning IR commands

To start learning a command, select “USB-UIRT” as the Learn from device and press the “Learn” button. For best results, we have done the following:

Different remote controllers learn best at different distances, but the controller should usually be a few inches away from the USB-UIRT when learning. You will know if the distance is adequate if the LED on the front of the USB-UIRT lights up when you send an IR signal through a controller.
Keep pressing the button we are learning until a code appears in the “Code:” area. (If you press the button for a short period, the USB-UIRT may not have time to learn the complete code.)
You may need to repeat this step a few times.

To confirm the learning operation, you can view the mControl log file, and you should see that the USB-UIRT has entered learning mode, learned 100% of the code, and has exited learning mode. The frequency of the signal and its quality can also be seen in the log file. If any of the frequencies at any stage in the learning process read 0, or the learning process did not get to 100% completion before you released the button, your code may not work.

Here is a sample of log file output from a successful learning process.

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - LogOutput.jpg
C) Copying/pasting IR commands

An alternate method of learning a code is through a .ccf file. Some .ccf files can be found at http://www.remotecentral.com .

1. Find your TV, DVD or other IR controllable device and download the appropriate .ccf file.

2. Download a .ccf to .xml converter. It is available for free at http://ccftools.free.fr/downloads.html . Download the circled version as shown below.

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - CCFtoolsinstall.jpg

After installation, open CCFDecompiler.exe (located in Program Files) and add the .ccf file you downloaded. Then select XML format and decompile the file.

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - CCFdecompiler.jpg

The resulting file is created in the same directory as the original. Now open the .xml file using your web browser and scroll through the file to find the CCF format codes for different operations.

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - CCFcode.jpg

The CCF on code for a Sharp TV obtained from the XML format is shown above. Copy and paste the code you want into the code section of the Edit IR Code window in mControl editor.

07-02-2008, 09:42 PM
D) Validating IR commands

OK, now that we have a code in the Code window, how do we know if itís good or bad? We can get a good idea of the validity of the code, if we analyze the format.

For mControl each IR command is stored as a CCF (Component Configuration File) code. So before going further, letís understand a bit about CCF code formats Ė this will help distinguish good IR commands from bad ones.

Each CCF code consists of a series of hex-based words. A CCF code comprises a header and then a body which consists of a series of on/off pairs.

The first four words are the header. The first number, 0000, shows that the code is learned. The second number is the frequency, and the sum of the third and fourth numbers is how many on/off pairs there should be in the signal. In the signal below, there are 22 hex, or 34 on/off pairs.

Within the body, each number in an on/off pair can be converted into a time value for which the IR transmitter is active or inactive.

The first pair in the body is used to for synchronization and is typically of bigger value than the main pairs.

Finally, the last word in the body decides the minimum time there should be in between this IR command and the next Ė so it will be typically be a larger number than all other words in the body.

Here is an example of what a good CCF code should look like.

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - CCFcodelearned.jpg

Depending on how the IR message is received, mControl may learn a slightly modified CCF code. If the code follows the rules for a well-structured CCF code, this will not create any issues. For example, when we compare the longer CCF code (below) and the original (above), they are nearly identical. In this case, the body section is essentially the same, just repeated. Take note that the pair count in the header reflects this change (0x22 or 34 pairs in the above sample vs. 0x44 or 68 pairs in the sample below):

For example, mControl might change the code above to:

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - CCFcodelearned2.jpg

It is important to note that some remote controls do not use the same IR code each time a button is pressed on the remote. An example is the Xbox 360 power control. Here, a toggle system is used in which the first, third, fifth, etc. button presses have the same IR code and the second, fourth, etc. have the same IR code. If you plan on controlling the Xbox 360 power from a USB-UIRT or a GC-100, you would need to find and distinguish between these two codes by testing them. For the other commands on the Xbox 360 remote, they only require one good IR code.

E) Testing learned IR commands

Regardless of whether you used the copy/paste method, the USB-UIRT, or the GC-100 for learning, the IR command can be tested using a GC-100 or a USB-UIRT. Here, we will explain how to test using the USB-UIRT.

There are two options for testing codes using the USB-UIRT. You can use the USB-UIRTís internal IR emitter to communicate with your device, or you can use an external IR emitter. The advantage of the external IR emitter is that the line of sight of the USB-UIRT with respect to the IR receiver on your device will not be an issue, since the emitter carries a wired signal from the USB-UIRT. If you are using the separate emitter, plug it into the back of the USB-UIRT and place the IR emitter bud onto the IR receiver for the device you want to control.

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - USB-UIRTdiagram.jpg


http://www.embeddedautomation.com/images/appnotes/USB-UIRT - ExternalEmittter.jpg

Smarthome 8160s External IR emitter

If you are using the internal emitter, point the side with the LED at the device for which you want to test a code. Your USB-UIRT should be within a few meters of the device for best results. Now press the test button. The LED on the USB-UIRT should flash. Similarly, an LED on the external IR transmitter should flash if you are using one.

Several external IR emitters have been tested for the GC-100 and the USB-UIRT, as well as the built-in emitter for the USB-UIRT. All emitters tested have worked successfully. Among the transmitters used were :

(1) Smarthome single stick-on IR emitter (product #8160s),
(2) IR emitter included with Windows Media Center
If the test does not yield the result you wanted, try learning the IR command again. If you are using an external transmitter, make sure the bud is directly over the IR receiver on the device. If it still does not work, the remote you are trying to get the IR code from may be more complicated and would make the use of a USB-UIRT difficult to implement.

F) General Notes

We have tested a few devices with the USB-UIRT (and GC-100) and have been able to consistently control all of them that responded to signals through the learned codes. We have tried learning the CCF codes through GC-100 and USB-UIRT, and there is no problem learning on one and transmitting on the other.

Here are the results:

http://www.embeddedautomation.com/images/appnotes/USB-UIRT - TestResults.jpg

Happy Automation!

07-04-2008, 12:26 AM
Since I've never been able to learn with my USB-UIRT using mControl I've been waiting for this to be posted, but I'm afraid even after trying it again, this is exactly what I'm doing and the results are I end up with a short string. like "3F2C47C36FF1."

Here is the relevant part of the log

2008-07-03 20:12:46.875 00:01:03.3108090 (014) I0 UUIRT: learning 0% done, freq=0, quality=0
2008-07-03 20:12:47.656 00:01:04.0876597 (014) I0 UUIRT: learning 12% done, freq=36203, quality=97
2008-07-03 20:12:47.687 00:01:04.1157356 (014) I0 UUIRT: learning 24% done, freq=36240, quality=97
2008-07-03 20:12:47.796 00:01:04.2258398 (014) I0 UUIRT: learning 36% done, freq=36193, quality=96
2008-07-03 20:12:47.906 00:01:04.3357714 (014) I0 UUIRT: learning 48% done, freq=36156, quality=97
2008-07-03 20:12:48.000 00:01:04.4357989 (014) I0 UUIRT: learning 60% done, freq=36140, quality=98
2008-07-03 20:12:48.187 00:01:04.6108245 (014) I0 UUIRT: learning 72% done, freq=36204, quality=96
2008-07-03 20:12:48.218 00:01:04.6559406 (014) I0 UUIRT: learning 84% done, freq=36177, quality=97
2008-07-03 20:12:48.328 00:01:04.7559055 (014) I0 UUIRT: learning 96% done, freq=36240, quality=97
2008-07-03 20:12:48.328 00:01:04.7559309 (014) I0 UUIRT: learning 100% done, freq=36240, quality=97
2008-07-03 20:12:48.343 00:01:04.7717366 (005) D0 UUIRT: exited learning mode.
2008-07-03 20:12:48.453 00:01:04.8791486 (011) D0 USB-UIRT Received: 3F2C47C36FF1
2008-07-03 20:12:48.453 00:01:04.8791879 (011) D0 Device [UUIRT_IRB:0] received command [IRCODE=3F2C47C36FF1]
2008-07-03 20:12:48.546 00:01:04.9678447 (011) D0 USB-UIRT Received: 3F2C47C36FF1

As you pointed out, it gets to 100% with similar quality to your logs. I've tried this on two different computers with the same results. I'd say I have a bad USB-UIRT, but I am able to learn with Mainlobby's USB-UIRT plug-in and if I copy the CCF over it works in mControl.

More details
% [UUIRT] adapter driver version 1.3.0 is loaded and initializing (debug level=5)
USB-UIRT: controller found, Protocol Version=257, Firmware PluginVersion=1289, Firmware Date=3/26/2004
mControl build 3057.

07-04-2008, 09:18 PM

We are currently looking into this issue, as we have experienced similar problems. We believe that the USB-UIRT is not exiting learning mode properly, and when this happens, we may receive another IR signal, resulting in a hash code, like the one that you received. This will then be displayed in the mControl IR code window.

The following message will display in the log file twice if the learning was successful and only once if it failed:

UUIRT: exited learning mode.

For the time being, try learning at different distances, and holding the button on the remote you are learning from for various lengths of time. We have always been able to learn good codes from remotes using the USB-UIRT and mControl, but sometimes it has taken several tries.

07-06-2008, 02:31 PM
Thanks for the tips, and believe me, I've tried every remote in the house at every distance.

The oddest thing is that I can load up my other software and learn any code I want with the first try. Also, I installed my USB-UIRT on another machine, did a fresh install of mControl and it did the exact same thing .

10-25-2008, 02:50 PM
Did you ever get a resolution to this? I am also not able to learn codes with mControl and my new USB-UIRT. One thing that I find strange is that the LED on the USB-UIRT comes on when I send it an IR signal but this does not happen when I am in the process of learning a code from within mControl.

10-27-2008, 01:58 AM
Does anyone have any suggestions on how to get the learning function to work? I have uninstalled and reinstalled the device several times with still no luck.

Can someone that has a USB-UIRT confirm that the LED lights up when a code is sent to it when in learning mode? As I stated above, the device just seems to go dead when mControl initiates learning. As soon as the learning count down finished the device starts to respond to IR signals and lights up.

10-27-2008, 07:01 PM
First, there was a bug in learning which is fixed in the latest beta build (found in this forum). Second, check other posts in this forum relaed to various issues of UUIRT specifically the learning distace.

Ted Singh
10-27-2008, 07:23 PM

Here are the key steps:
1. Press "Learn" in mControl Editor
2. Hold the remote close (between 2-6" away)
3. Keep holding the button until the command is learned

If you continue to have issues, send your log files to support at embeddedautomation dot com. Make a note of the date/time that you were learning the command.


10-29-2008, 12:55 AM
I was able to learn a few IR codes today but all of them were invalid. For example it learned the ok button from a xbox/windows MCE remote as "412E5DF340F1" but an exclamation was displayed and I was not able to save the code.

At this point all I am trying to do is learn a few codes to trigger a macro to turn on or off some lights. Any compatible code should work as long as I know what device an button it is for (I can program my Home theater master remote the same code).

Ted Singh
10-29-2008, 05:51 AM

Which version of mControl were you using? We made some bug fixes - you should try the beta version here: http://www.embeddedautomation.com/forum/showthread.php?t=1325


10-29-2008, 11:07 PM
Thanks!!!! Upgrading from build 3057 to build 3217 solved my problem!!!

12-19-2008, 09:50 PM
I wanted to share my experiences with this as to perhaps help others. I had quite a lot of trouble with learning IR codes as well but worked through them. Here are the tips I have from my struggles.

1. Don't try to learn with the RF-IR receiver from the Harmony remotes; I could never get this to work.
2. Learning from the harmony remote itself was quite finicky, I ended up using a device I own and learning from the original remote.
3. Some of my remotes (for instance the Xbox 360 one), didn't seem to learn at all. I ended up using my BDP-S350 remote and managed to learn a bunch of codes.
4. Not all buttons worked. For whatever reason, "8" and "0" on the remote I could not get to learn. Just keep trying with other buttons.
5. It won't learn if the remote is too far OR too close. You need to play around with it and get it just right.
6. I could never get the CCF download mechanism to work right.

Hope this helps someone save some time and frustration.

01-23-2010, 03:22 PM
I tried really hard to get the learn function to work properly to no avail on Windows 7 Ultimate 32.

However, I WAS able to get the CCF file decompiler instructions to work with zero issues.

08-11-2010, 09:00 AM

I am running the latest Beta and got myself a brand new USB-UIRT.

In mControl the learning of a code is fine and what I then do is trigger a macro for when mControl receives the IR code.

Only problem is that when I am a few metres away and press a button on the remote, the light flashes on the USB-UIRT and in mControl it shows receiving IR code but macro not running.

As soon as I point the remote at the same distance as when it was learning the IR code it then executes my macro's.

any help will be much appreciated!