Build a sorting robot

You will program a robot to sort LEGO bricks according to color.  

Automated systems like this sorting robot are common everywhere in the manufacturing industry. Monotonous tasks such as sorting of waste or discarding of burnt cookies can advantageously be performed by robots, which never get tired or demand higher wages.

Note that several groups can take turns programming the same robot.


  • Dongle
  • 1 Fable joint module
  • 3 passive modules
  • 2 lids
  • 1 webcam
  • LEGO to build the “arm” and bricks in different colors to be “sorted”

Task 1:

Construct the robot as shown in the image. Connect the USB camera to the computer. The other groups can test their program using the computer’s integrated camera. The camera can be selected under “settings” and “camera source” in the interface.

Task 2:

Program the robot to sort LEGO bricks to the right if you press the right arrow key and to the left if you press the left arrow key. Thoroughly test the program.

Expand the program with the camera so that the robot can detect the workpiece’s color and sort it to the left or right accordingly.

Task 3:

Experiment with the program and the robot – try to make it more general.

For example, you can program it to only sort workpieces of a certain size and color to the left and the rest to the right.

Recent Entries