tirsdag den 9. december 2008

Resistors in RCX touch sensor

Group members participating:
Lars, Morten and Thomas.


Duration of activity:

In total; 6 hours. The actual practical testing took about 2 hours, while the remaining 4 hours was used on finding relevant references and documenting the process.


Goal:
For future work of our project we want to investigate the possibility of using several touch sensors. In order not to consume all input ports of the NXT, we want to understand how the old RCX touch sensor functions, and to see whether it is possible to connect sensors in parallel using only one NXT input port.

Plan:
  1. Investigate the physical construction of the RCX touch sensor.
  2. Determine the measured limit integer value corresponding to a return value true from a call to readBooleanValue on the SensorPort.
  3. Create a graph of the working range of the input port, ie. measured integer value versus resistor load over pin1 and pin2 of the input port.


Activities and Results:
  1. We borrowed 9 defect RCX touch sensors and 1 working see-through RCX touch sensor to experiment with.
    • A working sensor; Looking inside the see-through sensor showed that it has a fixed resistor mounted between the two wires. Using a multi tester gave resistance reading of around 15k ohm when the the touch sensor was not pressed, and a reading of 1.4k when the sensor was pressed. The explanation is that the rubber elastic (its function is to push the plastic button out) is actually also conductive. This means that if the touch sensor is pressed current will flow through both the rubber elastic and the fixed resistor, lessening the total resistance through the sensor (see figure2).

      Figure1; a picture of an open RCX touch sensor

      Figure2 shows resistor diagram of an original working RCX touch sensor

      Measuring the resistance of several touch sensor blocks in their different states gave the results presented in the table below:
      num\state
      unpressedlight press
      hard press
      comments
      015.0 k Ω14.6 k Ω
      1.4 k Ωworks | with pull-up
      1 Ω199.0 k Ω17.0 k Ω≥ 14.26k Ω| never true
      2Ω70.0 k Ω3.9 k Ωworks | no pull-up
      3Ω10.0 M Ω160.0 k Ω≥ 14.26k Ω| never true
      4Ω5.0 M Ω2.6 k Ωworks | no pull-up
      5Ω12.0 M Ω4.0 k Ωworks | no pull-up
      6Ω8.0 M Ω0.7 M Ω≥ 14.26k Ω | never true
      7Ω15.0 M Ω7.0 M Ω≥ 14.26k Ω | never true
      From the table it can be seen that the touch sensors does not only work as switches, ie. they are not strictly on/off, it can potentially work on a variable proportional input / output. - If the sensor is pressed hard, it will give a different readout then if the sensor is only pressed lightly, ie. the rubber elastic acts as a variable resistor.


    • Tampered sensors: 2 of the touch sensors had already been 'tampered' with. The back side of the two is labeled 222 and 119, disassembling one of them showed that a small SMD resistor had been glued on the rubber elastic spring, while the original fixed resistor had been removed.
      The two tampered sensors function by letting pin1 of the input port float in mid air (well actually, internally in the NXT, it is connected to 10k ohm pull up resistor) when not pressed, meaning the value measured by the NXT ADC is the max value (in this case 1023).
      When the sensor is pressed, pin1 is pulled to ground via the SMD resistor, inside the sensor, giving us a voltage divider to let the ADC measure on (see page 6 in HDK).


    • Defect sensors: Opening one of the 9 defect sensors given to us gave an explanation to the dysfunction. The fixed resistor had been removed, no SMD resistor had been attached and some of the rubber elastics had lost most of their liveness properties, meaning that when pressed only a minimal current (close to zero) went through the rubber elastic, ie. the output of the voltage divider inside the touch sensor, is still close to 5V.
      Using a multi tester on the rubber elastic which had lost some liveness showed a reading of about 7M ohm. This means even if the sensor button is fully pressed, the total resistor value is still larger than the 600 integer limit of the corresponding 'isPressed' true/false limit.


  2. Using a test program and bridging pin1 and pin2 with different resistor values, it was possible to establish the true/false limit similar to the integer values 600 = false, and 599 = true. The corresponding ohm value looks to be between 14.16k ohm and 14.26k ohm.


  3. Investigation shows the ADC has a resolution of 10 bit, with a pull-up resistor of 10k ohm, giving the SensorPort a integer range from 0 to 1023.
    The measured integer values from point (2) above, and their corresponding resistor loads was logged, and a graph of the logging can be seen in the figures below.

    Figure3: a plot of measured input of the SensorPort / input-load, with only the resistor axis in logarithmic scale.

    Figure4: a plot of measured SensorPort input / input load, with both axis' in logarithmic scale.

Conclusion:

From the graphs (figure 3 and 4) and the measurement of resistor values, we saw that for a RCX touch sensor to function in a proper fashion (maybe also backward compatible), it should have a fixed pull down resistor (Rfix) of 15k ohm or above. The 15k value gives the NXT a possibility of knowing that something is connected. The measured value on the analog input port of the NXT pin1 is lowered from floating 1023, to a value around 615 for the 15k example.
Given the of the rubber elastic (Rrub) is within the range 1.4k - 12M, and that the 599 integer limit has a similar ohm value of approximately 14.16k ohm, the two resistors inside the sensor housing (Rtot = Rfix || Rrub) should be in the range:

Unfortunately this approach is not applicable for several reasons:
  • Some sensors have lost conductive properties. In the case of (Rfix = 15k) and a defect rubber elastic (Rrubmin = 0.7M), the parallel resistor value of the two will not be below the 600 limit: 14.26k ohm:

  • If we want to connect N sensors with fixed 15k ohm resistors in parallel to the same input port, the parallel resistors will lower the collected resistance to around (15k / N), which for (N=2) already is below the 14.16k-limit, ie. the measured value is less then the 600 integer pressed/un-pressed limit.
  • Further more the nature of the variable elastic rubber resistor makes it impossible to distinguish the different sensors apart.


The final solution should enable the sensor to work in the usual way, ie. that calling SensorPort.S1.readBooleanValue() will still return respectively true/false if an equivalent call to SensorPort.S1.readRawValue() returns a integer value less then 600/greater then 600.

A way to do this is by cheating; as mentioned in point [Tampered sensors] above, gluing a SMD resistor directly on the back of the elastic rubber spring, and letting the input pin float when not pressed, - when pressed - the SMD resistor will act as a pull down resistor. Then from the graphs above (figure3 and 4) it can be seen that, the SMD resistor value then should simply be less then 14.16k ohm and above 50 ohm. This yields a working resistor range, where the individual touch sensors are distinguishable.

Using the aquired results we see, that it is possible to connect several RCX touch sensors in parallel to just one SensorPort.


References:
Page 527 at91sam7s series datasheet http://www.atmel.com/dyn/resources/prod_documents/doc6175.pdf

Page 6 in HDK http://cache.lego.com/upload/contentTemplating/MindstormsOverview/otherfiles/2057/LEGO%20MINDSTORMS%20NXT%20Hardware%20Developer%20Kit(3)_7A0CF630-CCE5-4AAF-91FA-D1E7C911817C.zip

Ingen kommentarer:

tagtagtag