USB IR Toy – Infrared Carrier frequency review

Since introducing support into AnalysIR for the USB IR Toy we haven’t played too much with setting the different infrared carrier frequencies. After reading some mixed experiences on the Dangerous Prototypes forum we decided to put it to the test. So to start off we implemented a feature in AnalysIR to set the carrier frequency and to default to 38kHz at start up. UIRToyModulation38kHzNext we checked the mechanism described on the DP website about configuring the carrier frequency and everything seemed to work out OK.

We settled on the following common frequencies – 30kHz, 33kHz, 36kHz, 38kHz, 40kHz, 56kHz and 455kHz and the ‘Setup transmit modulation‘ commands issued to the USB IR Toy to set these frequencies are as follows:

0x06 + 0x63 + 0x00  – 30kHz  (rare)
0x06 + 0x5A + 0x00 – 33kHz   (rare)
0x06 + 0x52 + 0x00 – 36kHz   (very common)
0x06 + 0x4D + 0x00 – 38kHz   (very common)
0x06 + 0x4A + 0x00 –  40kHz  (very common)
0x06 + 0x34 + 0x00 – 56kHz   (common)
0x06 + 0x06 + 0x00 – 455kHz (rare, Bang & Olufsen)

The command is explained in more detail on the DP website. The first byte is the command for setting the carrier frequency (0x06). The second byte is the value for PR2 and varies for each frequency. The third and final byte sets the duty cycle to 50% (0x00). In some cases the carrier frequency setting does not match up exactly with the target frequency but relatively small variations will not be significant in most situations.

We then set about measuring and verifying the resulting carrier frequency generated by the IR Toy using an IR Led connected to the probes of our Oscilloscope and held right up against the IR emitter of the USB IR Toy.

Results: The results were quite good and more than adequate for use with nearly all Infrared remote control projects. The results for the 455kHz carrier frequency were the least accurate and this is because the PR2 values available for this PIC chip do not coincide exactly with 455kHz so it was a choice between 430kHz and 500kHz. However, we expect it will still provide a workable solution. (Now if anyone wants to donate some Bang & Olufsen equipment….we will test it out)

The first image above shows the results for the most common IR frequency of 38kHz and we have included all of the results for reference below.


All of the signals above were generated by AnalysIR, connected to a USB IR Toy V2 hardware & V22 firmware. The measurements are taken by the internal cursor function of the oscilloscope and have an accuracy of +/-0.5kHz at best, which is more than adequate for our purposes. Note: Using an IR LED directly connected to the oscilloscope probes means that the amplitude of the modulated signal is quite small.

3 thoughts on “USB IR Toy – Infrared Carrier frequency review

  1. Ok, Scrub what I said. I forgot that the IR TOY officially only supports a /4 prescaler. You need the “black addition” firmware for the /1 resolution. Sorry about that…


    1. Yes Jim, the prescaler is 4 for the IR Toy firmware.

      It is similar on AVRs/Arduinos running at 16MHz – not possible to get exactly 455kHz PWM, but it seems close enough is good enough. IR receivers can be quite forgiving on modulation frequency.

      Unfortunately, we were unable to test with actual B&O equipment, but we did a bench test with a 455kHz IR receiver and it all worked fine.

      FYI, we have quite a few users using the IR Toy with AnalysIR.

      So ‘you are not alone’. 🙂

  2. Hi, Really interesting blog here. Good to see that someone else is doing something with the IR TOY.

    I could not help but wonder if there were PWM frequencies closer to the B&O 455kHz. After a quick look at the data sheet I came up with 461538 Hz. Somewhat closer than 430kHz or 500kHz. The PR2 value for this is 0x19.

    12MHz / (0x19+1) = 461538.5 Hz.

    Should go better and probably will work as it is pretty much only 1% out of spec.

    Cheers, Jim