Page 130 -
P. 130
243_MasterPieces_02b.qxd 4/18/03 6:59 PM Page 102
102 Masterpiece 2 • The Learning Brick Sorter
Brick Sorter, after several sorting cycles, you will notice the arm and hand moving slowly,
and you will need to pump again to restore a good pressure level.
Take some 2x2 bricks in three different colors. White, gray and black are a perfect
choice, but the Learning Brick Sorter will work with many other combinations of colors.
You can test the readings of the light sensor for each color simply using the console
mode of the RCX. Press the View button until the arrow in the display points toward
Input Port 1; now the display shows the reading of the light sensor.Any choice of colors
whose average reading are separated by at least the value of RANGE_WIDTH will work.
Switch the RCX on, place a brick on the yellow tile of the pickup stand, just next
the light sensor, and press any lever on the switchbox.The Learning Brick Sorter will
take the brick and will drop it in one of the bins. Now provide a Positive (green lever) or
Negative (red lever) feedback using the switchbox, and the arm will come back in its rest
position above the pickup stand, ready for a new cycle.
When you are finished and want to switch the RCX off, remember to do it only
after you provided the last feedback.This ensures the arm is in its rest position and you
don’t have to reset it manually when you want to use the Learning Brick Sorter again.
Further Suggestions
My simple Learning Brick Sorter leaves the door open for many possible additions and
improvements. On the hardware side, you can improve the management of the air supply
providing an external compressor controlled by an automatic pressure switch. On the
same theme, another option is replacing one of the valve switches with a version able to
drive also the pump, as described later in this book in Masterpiece 4 “PneumADDic II”
by Kevin Clague.
A nice addition is an automatic feeder for the bricks. Something as simple as an
inclined plane can do the trick. If you need some further inspiration, I suggest you search
the Internet: there’s plenty of well-designed brick sortering robots, and many of them
feature automatic feeding mechanisms of some kind.
You can try to add an additional bin to make the Learning Brick Sorter able to sort four
different colors.You can move the valve switches to a different location on the baseplate
to get some space for the fourth bin after the third one.The software needs very small
changes: just set the BINS and RANGES constants to 4 instead of 2. Colors need to be
chosen very carefully: white, light gray, dark gray and black are a good set. Reduce
RANGE_WIDTH to 1 if necessary.
On the software side, there are many possible variations as well. For example, you can
modify your Learning Brick Sorter able to recognize when the training phase is finished
and the knowledge base is complete, so as not to ask for any feedback anymore. Or, in
the opposite direction, you can make re-training more efficient: my program is already
able to handle the situation where the Learning Brick Sorter is completely trained but
the user wants to change the destination bin of each color. However, it’s not particularly

