To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 92
91  |  93
Subject: 
Automated brick sorter
Newsgroups: 
lugnet.robotics
Date: 
Thu, 8 Oct 1998 21:39:20 GMT
Viewed: 
1467 times
  
Automated LEGO brick sorter

I have built a Mindstorms version of the 8094 mechanical arm that lifts 2x4
bricks and puts them in bins. Of course with Mindstorms, it can actually see
what color the brick is and take it to the appropriate bin.

It uses 2 touch switches: one to tell when the arm has rotated to the 'brick
loading bay', and one to tell when the arm has lowered into position ready
to grip the brick. The light sensor sits below the brick to be picked up to
determine its color.

Here's how it works:

The arm positions itself around the brick. The brick is picked up and the
arm rotated an amount dependent on the color until it is over the appropiate
bin whereupon it is dropped. The arm returns to position and picks up
another. This continues until all bricks have been picked up.

There are 3 bins: One for light colour bricks, one for dark, and one for
imbetween. The ambient lighting conditions tend to determine which colour
goes where. White and black always go in the right bins, though.  The
numbers in the source below tend to vary by +/- 3 so it is difficult to tell
exactly what color brick it is with 100% accuracy. Perhaps a future version
will have another light sensor to measure ambient light and make the
appropriate adjustment.

I'll have images on my web page tommorrow as soon as I have borrowed a
digital camera!

Many thanks to David Baum for NQCC - an excellent tool that make Mindstorms
development so much easier, quicker and fun.

Has anyone else made one of these?


// arm.nqc by Huw Millington
// Written in NQCC 0.5b1

#define EYE  IN_1
#define ANGLE  IN_2
#define HEIGHT  IN_3

#define JAWS  OUT_A
#define ARM  OUT_B
#define ROTATE  OUT_C

// Colors of bricks measured in my dimmed computer room

#define WHITE  54
#define YELLOW 54
#define RED     51
#define GREY    49
#define BLUE    40
#define BLACK   38
#define AMBIENT 32


#define RaiseArm  Fwd(ARM,4)
#define LowerArm  Rev(ARM,4)
#define StopArm  Off(ARM)
#define OpenJaws  Fwd(JAWS,OUT_FULL); Sleep(150); Off(JAWS)
#define CloseJaws  Rev(JAWS,OUT_FULL); Sleep(400); Off(JAWS)


#define ArmClockwise   Fwd(ROTATE,OUT_FULL)
#define ArmAntiClockwise Rev(ROTATE,OUT_FULL)
#define StopRotate  Off(ROTATE)


int Color;

task main
{
// Set up ports

Sensor(EYE,IN_LIGHT);
Sensor(ANGLE, IN_SWITCH);
Sensor(HEIGHT, IN_SWITCH);


while (1 == 1)  {

  // Rotate to position if not already there

  ArmAntiClockwise;
  wait((ANGLE == 1));
  StopRotate;

  //Lower arm ready to lift brick if not already there

  LowerArm;
  wait(HEIGHT == 1);
  StopArm;

  // Get color of brick

  Color = EYE;

  // If there's no brick there, exit

  if (Color <= AMBIENT+1)
   break;

  // Grip brick

  CloseJaws;

  // Raise the arm a bit

  RaiseArm;
  Sleep(50);
  StopArm;

  // Rotate arm towards bins

  ArmClockwise;

  // Rotation angle dependent on color of brick

  if (Color >= RED-1)
   Sleep(300);
  else if (Color >= GREY-1)
   Sleep(650);
  else
   Sleep(850);

  // Stop rotating, lower arm, drop brick

  StopRotate;

  LowerArm;
  Sleep(50);
  StopArm;

  OpenJaws;

  // Raise arm ready for next time

  RaiseArm;
Sleep(50);
StopArm;
}
}



Message has 2 Replies:
  Re: Automated brick sorter
 
(...) <snip> (...) I built a different type of sorter that separated red and blue 2x2 bricks. It is not as elaborate as yours, but it was a nice, quick Mindstorms project. Pictures are at: (URL) reply to: dbaum at enteract dot com (26 years ago, 9-Oct-98, to lugnet.robotics)
  Re: Automated brick sorter
 
Huw Millington wrote in message ... (...) Pictures now available at: (URL) (26 years ago, 11-Oct-98, to lugnet.robotics)

9 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR