Thursday, January 29, 2009

PF IR Receiver as Wireless Touch Sensor


Here are the details on the trick that I used in my Battle Tank project to get the NXT to read sensor input from the Power Functions remote control. See the "Method 1". This allows the NXT to see the IR receiver as a single touch sensor, which is actually quite easy to do if you have the two wires needed (PF Extension Wire and RCX Conversion Cable). The "Method 2" was an earlier and much more complex way to get full control from both levers (9 states).

You only get one touch sensor out of this, but with a little timing trick in the NXT program, I made the single PF lever control two NXT-triggered functions on the Battle Tank. A quick press and release of one lever triggers the scissor stabber with one NXT motor, and a press and hold of the same lever triggers the dart gun with another NXT motor. This leaves the other lever on the same channel open to run a PF M-motor in both directions to implement the unfolding saw blade (same M-motor folds/unfolds via a worm gear while also spinning the blade by up-gearing). Then the other IR receiver is attached to the two PF XL-motors to do the driving on another channel.

It looks like you could extend this trick to get two touch sensors by connecting the other half of the IR receiver to a second sensor port on the NXT, but this doesn't work. Pressing either lever ends up triggering both touch sensors. Wondering what was going on here, I consulted Philo, who kindly explained that the whole setup is electrically questionable to begin with because the PF and NXT sides don't share a common ground, but it ends up working and being safe with one sensor, but attaching two creates a strange current flow and also results in a short circuit condition if the levers are pushed in opposite directions. So don't bother trying that...

No comments:

Post a Comment