Jan 30, 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...

8 comments:

Geoffrey said...

Nice Setup !

To avoid short circuit and be able to use two levers,do you think it is possible to use a second IR receiver set on the same IR channel but connected via PF port B to the NXT sensor port 2 ?

Regards
Geofffrey

Parax said...

Optical Isolation...

Got PF LEDs?
Got Light Sensors?

I made a differential motor Drive along time back (before the LED's) to feed both PF inputs into one input, I never utilised it as it was just far too bulky & inefficient

Dave Parker said...

On using a 2nd IR Receiver. I verified this just now, and it still doesn't work (one lever triggers both). However, it does work with a second PF battery box so that the two IR receivers are isolated. But that's getting just silly with weight and bulk...

Actually, the longer story is that you can get two sensors to work, even with just the one IR receiver, but not when viewed as a touch sensor. If you view them as a light or sound sensor and view the "Raw" value, you will see that you can distunguish the difference between one and the other. Pressing one lever takes one raw value from 1023 down to 0 and the other from 1023 down to only about 110, so with some compares you could read this, and I did have this working at one point. However the risk of a short circuit is always there if you push the levers in opposite directions, which of course will happen in practice.

Parax, PF LED and light sensors is a great idea if you have some of those (I don't, maybe I need some now...). That's way better than my crazy "Method 2" using motors and rotation sensors.

Hey LEGO/HiTechnic/Mindsensors, can you tell that we are desperate here? Can you give us a IR Receiver sensor for the NXT that is powered by the NXT sensor port, reads the PF IR Remote, and returns all 9 states to the NXT? This can't be that hard, I have seen a homebrew one on nxtasy, and it seems like it would be a big hit.

Parax said...

IMO the best solution is to get all pf outputs into one NXT input, My differential drive achieved this by measuring the differing speeds (9 states - four speeds in each direction and stopped - see link above)

Using the LED & sensor approach gives one PF output to one NXT input, (and it cant do Bi-Directional!) Which is just not enough! I had thought about how to multiplex this approach, ie using colour red filtered led & blue filtered led and using the colour sensor, but I dont think the colour sensor works that way (I believe it just detects light and the source colour changes)

Yes we really need a PF reciever sensor. That does not need a seperate reciever and power pack. Ideally new software for the IR Link Sensor - I did request this from Steve at HT when the brick came out - but he said it was impractically difficult. Probably due to the PF protocol, which is quiet complicated, and in reality there are many modes including PWM speed control, far more than the 9 states that the current remote produces. although the reciever can recieve them.
I think the best solution available at the moment is to dismantle a reciever and attach it to an NXT hombrew sensor board in such a way that it is NXT powered, and can pass the PWM output data to the NXT. This is not a small task!

Pe-ads said...

Veeery cool!
I'm hopefully getting some extension cables soon, and may get an RCX-NXT cable at the same time, just for this.
Also, if anybody makes a custom circuit-board for it, using the HiTechnic Prototype board, could they post a diagram for it?
An alternative way would be to have the NXT controlled by a different device, e.g. NXT, PC, PS Remote, and have the NXT controlling the motors, either by BTKiwi's method, or by using the IRLink. I know that defeats the entire point, but it is an alternative.

Pe-ads

Pe-ads said...

Hmmm...
Been looking at options for i, and saw the HiTechnic IRSeeker. This is used in RoboCup Jr. in the football area for detecting how far away the ball is, and which direction it is in. The signals are given by the ball, which emits the signals.
If the IR remote is on the same channel as the IRSeeker, the Seeker could pick up the direction of the remote signals and come towards it.
I know that is limited in its application, but it could be used.

Pe-ads

Dave Parker said...

The homebrew one I saw on nxtasy is here.

sib said...

where do you buy it???

Related Posts Plugin for WordPress, Blogger...