IRLink Single Output Block Available

A new IRLink Power Functions block was recently added to the HiTechnic downloads page which uses a mode known as Single Output Mode. Unlike the other IRLink PF blocks, this block sends a command that is not subject to timeout by the PF controller. This should be useful to anyone who uses the IRLink for controlling PF motors but especially for train folks where it is desirable for the train to keep going even when it goes out of range.

Background

The HiTechnic IRLink is a general purpose two way IR receiver/transmitter. Originally designed to communicate with the LEGO RCX, for which there are NXT-G blocks available and there is also support in NXC, RobotC and other languages, the IRLink is also capable of sending commands to the LEGO PF controller 8884 IR-RX:

This makes it possible to either extend your LEGO NXT creations with LEGO PF Motors or to use your NXT to control creations that use PF motors.

Note: Even though the IRLink is a two-way IR device and can send PF commands, it can not receive them. The reason is technical and it involves the nature of the timing in the signals from LEGO PF remotes. Unlike the RCX, which has very accurate timing in the IR signal, the LEGO PF remote sends a signal that has inconsistent timing which the IRLink cannot handle.

The LEGO Power Functions IR protocol allows for several different kinds of commands, or modes, to be sent to the PF Controllers. Most of these commands have a timeout of 1.25 seconds. That means that if you send a command to the PF controller to run the A and B motors at full power and then you don’t send another command, then the motors will automatically stop. This is intended as a safety so that when a vehicle goes out of range of the remote, it will not keep going. The LEGO 8885 remote sends this kind of command and automatically repeats it faster than the timeout so if you use this remote to drive a vehice away from you it will automatically stop when it goes out of range. But the LEGO PF protocol also has commands that don’t have a timeout. For example, the LEGO 8879 remote sends a command that is not subject to timeout and the PF motors will keep running until they get another command to change power, direction, or stop.

The two previous Power Functions IRLink blocks both sent PF commands that had this timeout. That means that even if you had the IRLink block in a loop to repeat the command on a regular basis, the PF vehicle would still stop shortly after it got out of range of the IRLink.

The New PF Single IRLink Block


The solution was to create a new IRLink block that sends a command that is not subject to the timeout. Here is the configuration panel:

Most of the setting in the configuration panel are pretty obvious; you can select the port used for the IRLink; the PF channel, 1 to 4; and the output; A or B; and the power level, -7 to 7. But there is one new setting that requires some explaining, the Repeat option.

Understanding the Repeat Option

The PF message that is sent by this block has a bit that needs to be toggled every time a new message is sent. The PF controller, verifies that the bit has changed since the last message and if it hasn’t, it assumes this is just a repeat of that last message and ignores it. So in other words, in order for all messages to be received properly, the NXT and the PF controller have to remain in sync when it comes to this toggle bit.

But what if one message in a sequence gets missed, perhaps because IR interference or range, then the next message will actually get ignored even if there is no interference or range issues? This may be a problem.

To get around this situation, the new block adds the Repeat option. When checked, the block will actually send the command twice, once with each state of the toggle bit. This will ensure that as long as the PF controller is in range, it will now be in sync with the NXT. The drawback is that it will take twice as long to sent the command with the toggle bit than without. About 1 second if Repeat is checked instead of less than 1/2 a second if Repeat not checked.

So when should you use the Repeat option? Probably anytime when there is a chance that messages might get missed for one reason or another. Using the Repeat option will ensure that the PF controller will receive the message as long as it is in range.

If you are using this block in a creation where the PF controller is always near the IRLink, then probably better to leave the Repeat option off since it takes longer to send and may make things less responsive.

Already Mentioned in RailBricks magazine

Benn Coifman has written a great article in the blog for RailBricks magazine which discusses the new block.

Where to get the new block

Like all HiTechnic NXT-G blocks, this block is available for download from the NXT-G block download page. You will also find a link to to the download from the bottom of the IRLink product page.

Enjoy!

Tags:

3 Responses to “IRLink Single Output Block Available”

  1. Pau says:

    Hello. I need this block in Labview. Will it be avaliable? Thanks

  2. Gus says:

    Yes! I did this a few weeks ago but had not gotten around to putting it on the downloads page. Now it is there. Look at the downloads section at the bottom of the IRLink Products page.

  3. Pau says:

    Thanks a lot!
    I’ll try to install it at LV2010. I hope it works.

Leave a Reply