|
|
Using Power Functions (PF) remote handset to control a NXT is a rather old idea, see for example Dave Parker's Power Functions Remote Control Sensor or Mike Brandl's Power Functions, or ... how can I remotely control my NXT? I went a bit further, allowing the NXT to receive all nine different combinations of the PF handset, using only one NXT sensor port. This comes with a price, it needs some soldering inside the PF receiver to transform it into a NXT sensor (after modification it will be no longer possible to use it as regular PF receiver - see note at bottom of this page). Also note that HiTechnic makes a NXT IRReceiver Sensor, more powerful since it can work also with the PF speed controller (my hack works only with the on/off controller) and is able to receive orders from different remote channels. The idea is simple: combine the outputs of the PF receiver with well chosen resistor values to obtain a different voltage for each combination of controls and measure this voltage with the NXT. Here is the schematics: The PF receiver is powered from NXT 4.3V sensor supply. This is far below expected 9V supply but it seems to work fine. Getting the resistors values right was not so easy because there is an internal 10k pull-up in the NXT, and because the output of the receiver can have 3 states (0V, +V or floating). Here is the Excel spreadsheet I used. The resistor values chosen maximize the separation between the different states, but the optimum thresholds are not evenly spaced, so lots of comparisons in software are to be expected... Building the sensor
Programs The program below is a simple NXC test program that displays on NXT screen the position of PF remote switches. This program is easy to adapt to other uses: after the thresholding tests, you get two variables (Switch1 and Switch2) that contain the PF remote levers positions (-1, 0 or +1), and a third variable, PFremote, that contains a integer [0..9] encoding the 9 possible different combinations of levers positions. I let you adapt this program to NXT-G, it should be very simple... but laying down all these embedded switch blocks is simply too much for me!
|
|||||||||||||||||||||