Expand one RCX input into six digital inputs

circuit diagram

I chose low power components so that the entire circuit draws less than 5 milliamps when all switches are on.
The output only gets turned on during the read phase of the sensor, so it does not use any extra power

The inputs are pulled up with 47K ohm resistors. They are cleaned up with a schmidt trigger buffer, and then fed into analog switches. Any passive sensor up to about 5K ohms on resistance will work, and one up to 15K will usually work. The off resistance should be at least 220K, although 100K will usually work.

The analog switches connect a series of resistors that double in value each step. This adds a voltage to the output which is proportional to the ratio of that resistor value and the feedback resistor value. The output is pulled up to a positive voltage by a seventh resistor.

It is then buffered and switched on to the output by a seventh analog switch which is controlled by a transistor. The transistor detects when the supply voltage is turned off and the input period occurs.

The output varies from 2.50 volt to 3.75 volts (adjustable with the trim pots on the opamps.)

To calibrate the expander, set the RCX into Raw Light mode:

  

int a;
task main()
{
  a = 0;
  SetSensor(SENSOR_2, SENSOR_LIGHT);
  SetSensorMode(SENSOR_2, SENSOR_MODE_RAW);
  SelectDisplay(DISPLAY_SENSOR_2);
  while (a < 1) { }
}

The two potentiometers are adjusted until the display reads 765-766 with all inputs shorted, and 513-514 with all inputs open. I have found this range to have the lowest noise.

Each input will turn on one of the bits in the analog input. Bits 2 through 7 correspond to the input switches, bits 0 and 1 absorb the noise

The programming needed to use the expander is very simple. Since each input turns on one bit in the sensor input, a simple AND for each bit is used.

int a;
task main()
{
  a = SENSOR_2;
  if (a &   4) { stuff for sensor 1 }
  if (a &   8) { stuff for sensor 2 }
  if (a &  16) { stuff for sensor 3 }
  if (a &  32) { stuff for sensor 4 }
  if (a &  64) { stuff for sensor 5 }
  if (a & 128) { stuff for sensor 6 }
}

I have built a prototype and designed a printed circuit board RCX Input PCB that fits within an eight by four brick (1.125" x 2.375".)
This is the size of two 2 x 8 electrical plates (4 pieces available in part #5037 from Lego Shop at Home for US$6.75.)
The parts for the circuit are on this Bill of Material. The board is in stock. I have assembled and tested the first unit. Other than a couple of embarrassing errors, it works fine.

I will sell it for cost (US$10 Bare or US$35 A&T). If anyone is interested in purchasing, contact me.


LEGO MindStorms WebRing
LEGO MindStorms WebRing
Site Owned By: Rob Duff

Control Panel
[ Skip Prev | Prev | Next | Skip Next ]
[ Prev 5 | Random | Next 5 ]

Last updated 2000-Dec-10