The HiTechnic IR Link Sensor allows you to use IR signals to communicate with the Power Functions IR receivers, the remote controllable Lego trains and the venerable RCX.
I bought myself one a few weeks ago and have been busy tinkering with it ever since. I contacted the HiTechnic company to ask for some documentation on how this sensor worked but for various business reasons (NDAs, etc) they were unable to give me *all* the details. However, one of their engineers, Steve, was very helpful explaining how the Power Functions part worked. The sensor has a few modes, one for each device you can control with it (NXC, PF or Train). The idea is that the sensor’s functionality is kept as generic as possible, putting all the intelligence in the software controlling it, RobotC in my case. Using the Lego Power Functions RC document and the detailed description of the encoding mechanism given to me by HiTechnic, I was able to cobble together a nice implementation of the Combo PWM Mode. Once I had that completed, I also implemented the Combo Direct Mode based loosely on the NXC example code Steve had provided. For details on the encoding scheme, I suggest you read through the code attached to the end of this post. I have added plenty of comments throughout the code.
That is a picture of what Steve used to test my driver. That’s a pretty sweet setup if you ask me. How it must suck to make a living working with Lego and sensors all day! My test setup is a little less impressive looking. I only have the PF stuff that came with the Bulldozer. With this RobotC driver, I can control not only the direction of the motors but also the speed at which they rotate. This is not possible with the standard PF remote which implements only the Combo Direct Mode. Using the Combo PWM Mode I have a lot more control over the motors. The driver can handle all 4 channels, allowing you to control up to 8 motors simultaneously.
Without further ado, here is the driver: LINK. Future additions might include routines to control the RCX and those remote controlled trains. I will keep you posted.
Edit: Version 1.1 is out and available here. The main task is no longer enabled by default.
hi
I’m programming a remote control for PF motors with Hitechnic IRLink and Hitechnic accelerometer. The program with the accelerometer works fine but when I included IRLink library for RobotC, I have a lot of problems with variable values, they became wrong. The programs and images are here (http:// lrobotikas.net/files/problem.zip) and in these images you can see where the problem is.
And when I compiled the program there are this warning messages:
*Warning*:Invalid ‘=’ operation for types ‘eCPMMotorCommand’ and ‘short’
*Warning*:Invalid ‘=’ operation for types ‘eCPMMotorCommand’ and ‘short’
*Warning*:Invalid ‘=’ operation for types ‘eCPMMotorCommand’ and ‘short’
Hey there,
First let me ask, are you using RobotC 1.40 Public RC2 or higher? I have only tested it with that.
Also, you will need to remove the main task from the IRLink library. It is included for example purposes only.
If only I could read Spanish so I could understand your comments, haha. Io no hablo Espagnol 🙂
You could try changing your multidimensional array from a byte type to eCPMMotorCommand, that seems to reduce the number of warnings quite drastically when I compiled it on my system.
Please try these things and let me know how it went!
Koldo,
You can pick up a newer version of this driver via the link provided at the bottom of the post. It fixes the double main task if the file was included as a library. You now need to explicitly enable the main task through a define.
Regards,
Xander
With the new driver the pgrogram runs fine, without change the program. Thanks
Koldo,
Any chance you could tell me what you’re making? I’d love to know how you are using the IR Link software!
Regards,
Xander
HI Xander, next week I’ll publish the project in my website, is a omni-directional robot with six PF motors. I’ll write a basic description in English.
Hi Xander,
Great drivers, they work really well and easy to implement. Thanks for sharing your work. Also do you know what the part number or description for the 120 degree “propellor” attached to the end of all the power functions motors in the picture above?
Thanks
JamesD,
Thanks for the compliment! I am working on converging all the drivers I’ve made so far into a set of header files with common functions (of which there are quite a few) in deeper header files. This avoids code duplication and makes debugging easier too.
As for the 120 degree propeller, I don’t know. This picture was sent to me by one of the engineers from HiTechnic. He just used it to show the motor was turning, no more.
Xander
Hi there, Brill doc, did you have any luck on how you would control an rcx or multiple ones. I dont have any spare pf stuff but tons of rcx’s etc
Thanks Simon
I have not yet had the time to implement the RCX control code. Other obligations, unfortunately, have kept me from writing the code for it.
Regards,
Xander
Hello,
Thank’s for the driver, i have the same problem than Koldo :
And when I compiled the program there are this warning messages:
*Warning*:Invalid ‘=’ operation for types ‘eCPMMotorCommand’ and ’short’
*Warning*:Invalid ‘=’ operation for types ‘eCPMMotorCommand’ and ’short’
*Warning*:Invalid ‘=’ operation for types ‘eCPMMotorCommand’ and ’short’
But the driver is OK.
I want to received with NXT the IR Command of Remote Control (Power Function). Is it possible?
Thank’s a lot.
Christophe
Hi Xander,
could you help me, my name is Rio from Jakarta, Indonesia,
recently I bought IR Link from a friend of mine in US,
but until now is not working, don’t know why,
I only use NXT-G, and I already email to Steve,
but still not working, I already upgrade my NXT firmware to 1.05,
still not working, any suggestion?
my last change is send back to US for a replacement.
but that the last thing to do, because a need time and money.
any suggestion?
Best Regards
Hi Rio,
I’m sorry to hear your sensor is not working. Unfortunately, I have no experience using this sensor with NXT-G. What were some of the suggestions of Steve for you to test? Did you try them all? You are sure it’s not a problem on the PF side of it? Perhaps the receiver channel and the channel you are sending on do not match. Are the batteries in your NXT and PF battery holder fresh?
Xander
Xander
Steve also suggest me to check the PF receiver, but their match, I always play my PF, and not got any problem, and always check the batteries, but when I try the IR Link, it’s seems not working, I try different channel, or different port, still not working.
Hello,
Thank’s for drivers.
I have a question, is it possible to receive with the IR Link Sensor a signal from Power Functions IR Remote Control.
I wand to command the NXT with Power Functions IR Remote Control.
Thank’s.
Christophe,
As far as I know, you can’t.
Regards,
Xander
Hi,
I am trying to use the IRLink sensor to command a railway automated switch.
I successfully used and appreciated the functions you created for 3rd party sensors. I used the IRLink sensor from Hitechnick, and everythink worked fine, but I have an issue on operating the motor in reverse mode. I setup the speed to maximum in reverse = 15, but apparently there is less power provided to the motor while running in reverse mode. I compared with the forward mode with speed set to 4 or 5. For this reason, the mechanical part is moving ok on switching using forward direction, but failed to switch when using reverse direction. Could you help me pls ? I’ve been tried all functions for single pin and combo with the same result.
Thank you,
Vladimir
Hello Vladimir,
Do you see this problem also when you are using the standard remote control?
This is what I missed to mention. Using the NXT G blocks downloaded from Hitechnik website, the motor’s power is consistent while driving forward and backward, so my switch is operating properly. The disadvantage there is that the command is maintained for minimum 1 sec, and I’ll need to keep it moving less, what I can do from ROBOTC.
Ah ok, that is good to know. At least we know your sensor is not broken! Are you using ROBOTC 3.55B2 and the driver suite 3.2.1? If not, could you update and tell me if the problem persists?
I’m using ROBOTC 3.54 FW.9.55 and driver suite 3.1 .
I’m a ROBOTC distributor but I didn’t got any newsletter about 3.55B for now.
You state that driver suite 3.2 will work only with 3.55B, so that I’ll need to search for 3.55B first. Did you encounter the issue I mentioned before ?
Here are the functions I used for testing:
doPFcomboPwmModeTest(15);
PFcomboPwmMode(HTIRL, 0, 15, 0);
doPFsinglePinOutputModeTest(15);
Ah, you should definitely upgrade, there are so many issues with ROBOTC 3.54 and my driver suite. It has to do with the ubyte to int conversion by the compiler. It really messes with the drivers’ internals. You can download ROBOTC 3.55B2 right here: http://www.robotc.net/forums/viewtopic.php?f=52&t=5122
I’ve never seen the issue you’re having before, but that does not mean my drivers are without bugs! 🙂