Loginskip to content

More on HiTechnic IRLink and PF

news/
software/
NXT Repository/Hardware/
NXT Repository/Tutorials/

As I posted a few days ago, the new HiTechnic IRLink (which should be available from HiTechnic in about a week) opens up new opportunities for controlling extra motors with the NXT. The IRLink sensor (i.e. it connects in a sensor port) allows the NXT to control the new RC LEGO trains, control the RCX (like the RCX IR Tower did) and control the new Power Function motors. The new PF motors, which are available in 2007 kits like the LEGO Creator Dinosaur (1 medium and 1 large motor) and the 8275 Technic Bulldozer (2 medium motors, 2 large motors) have their own battery box (a conversion cable for directly connecting to the NXT is supposed to be released soon) and can connect either directly to the battery box or via a special IR receiver. The IR receiver allow controlling the PF motors via a special remote control, also available from LEGO in the above mentioned kits.
So, back to the IRLink from HiTechnic. Since each IR receiver control 2 motors (let’s call them motor 1 and motor 2) and can have 1 of 4 ‘channels’, you can operate up to 8 PF motors using one IRLink. Notice, however, that the current needed will probably require more then 1 battery box for 8 motors running in parallel…. HiTechnic will release 3 special NXT-G blocks for the IRLink - one for RC Train system, one for RCX communication and one for controlling PF motors. In the rest of this post I am going to discuss the later block.
Before we go off - a short reminder. When you wire one of the regular NXT servo motors, the simplest program I can think of is ‘run motor until I press orange button’. Below is an NXT-G program that does just that:

Quite simple, isn’t it? So, when I first got my IRLink connected to my NXT (after importing the NXT-G block from HiTechnic) I dropped the block on my diagram and made this program:

the control panel for the PF block is shown below

As you can see, I asked Motor 1 to move ‘Forward’ and then had a ‘Wait for Button Press’. Eagerly I ran the program and to my great disappointment the motor rotated for a short moment and then stopped. The program, however, was still running until I pressed the orange button.

What happened? Well, here’s the catch. The IRLink acts just as the Remote Control does. When you want a PF motor to move forward you move one of the RC joysticks up and hold it until you want it to stop. If you press forward for a short period and then release the knob, the motor would rotate for a short period - just like what happened in my first program.

What should be done? If you want a persistent motion, you should put the PF block in a loop. You must also make sure that executing the rest of the loop does not take too much time, else the motion will be jerky. My second program is shown below:

now the motor rotated continuously as I expected. As this block’s behavior is quite different then the concept of ‘Move Unlimited’ block, this may be a cause for some confusion at first.

Remember - when in doubt about how to use IRLink for controlling PF motors, think in terms of how you would have done the same with the manual PF Remote Control. I am having great fun with these motors….

Guy Ziv