1. Concept of the machine

Sorting machine is a device which purpose is to scan supplied LEGO part and then display its shape, at the end of the cycle the part is moved out of scanner which allow for repeating whole work cycle. Scanning is conducted by movable colour scanner, which measures the dimensions and colour of supplied ellement. For automatisation of the scanning process a conveyor belt is used that can supply parts to scanner as well as move them after completed operation.

2. Main components of the machine are:

  • colour scanner - used to determine the shape and colour of the scanned part.
  • conveyor belt - the belt goes along the whole length of the scanner table; supplying parts for scanning, moving them through the process of scanning and moving them away afterwards.
  • Scanning table - special table in contrasting colour allowing the sensor to distinguish the scanned pice from the background. Front and back elongations of the plate are used as entrance and exit to the working area.
  • Transmission system for the scanner - a set of reduction gears used for increasing the precision of the movement of the system as well as decreasing step (distance between one scanned point and the next one) of sensor.
  • LEGO NXT - as a control and processing unit.
  • Touch sennsor - as an end stop, for controlling the movement of the scanner.

3. Code and control

For the main control unit a LEGO NXT was used. The software was written using “ROBOTC”. The scan was done by writing the places with different colour than background table to a specified matrix which was later simplified by moving all results to upper-right corner of the matrix, removing error/misaligned pixels and smoothing edges.

4. Example of the obtained results

The obtained image is distorted due to stretching the width of the image with respect to its height.

Video of the scanner during work:

5. Advantages & Disadvantages of chosen scanning method


  • The chosen method allowed for a great precision of the scan
  • Possibility to detect the shape and the colour of the specimen
  • Scanner works regardless of initial orientation of the part


  • Scanning of a single part takes as much as 8 minutes
  • Device uses a lot of power
  • Creates lots of noise during work

6. Conclusions

Constructed scanner fulfilled the initial assumptions and is able to work reliably. However further improvement is still possible especially in the field of shape recognition or better shape proportion during display. Unfortunately the major disadvantage of this type of scanning is speed which is hard to overcome as increasing speed decreases precision of the measurement, in such a case it might be impossible to obtain satisfying results of both parameters. Efficiency of the machine could be increased by scanning few parts at once, however that would require some software adjustments.