nxtprograms.com

Fun Projects for your LEGO MINDSTORMS NXT!

Home     Projects     Help     Contacts

Peg Sorter
Building: Expert
Program: Advanced

Building Instructions


1


2


3


4


5


6


7


8


9


10


11


12


13


14


15


16


17


18


19


20


21


22


23

Connect the light sensor wire to port 3 on the NXT.  Insert the pegs into the correct holes as shown below, then adjust the axles until the light sensor sits flat against the beams on the sides of the channel. 


24

This step builds the conveyer pusher and the calibration stick, which are loose parts that are not attached to the sorter machine.
 

The conveyor pusher will be placed behind the pegs on the conveyor, as shown below. 

The calibration stick is used to calibrate the light sensor.  See "Using the Peg Sorter" below. 
 

Peg Sorter Programming

Use the Peg_Sorter program for the Peg Sorter.  You will also need the Calibrate_L3 program to calibrate the light sensor beforehand. 

Important: See the instructions below to calibrate and properly set up the Peg Sorter.

 

Using the Peg Sorter
  1. Before using the Peg Sorter, the light sensor must be calibrated.  You can use the Calibrate_L3 program to calibrate the light sensor, which has two steps as shown below.  You only need to calibrate the light sensor once after building the model.  The calibration will be remembered after that.

When the calibration program tells you to center the sensor over the black color, insert the calibration stick so that the black axle is completely under the light sensor and centered and flat on the bottom of the channel. When the calibration program tells you to put the sensor over white, remove the calibration stick so that the sensor sees the white beam at the bottom of the channel.
  1. Use the knob on the side of the conveyor motor to move the conveyor stick back to make room for the conveyor pusher and the pegs, and load the pegs into the conveyor, as shown below.  The pegs will push better if you alternate the pegs with the long and short side first down, then up, then down, etc.  Also, to get good sorting results, do not put two black pegs in a row anywhere in the sequence.

Important: As currently designed, the Peg Sorter works best if there are not two black pegs in a row anywhere in the sequence.  This is because the mechanical hitter cannot recover fast enough after hitting one black peg to get the next one right afterwards.
  1. Make sure the hitter bar (which has two small black gears on either side) starts out horizontal, as shown below.  Turn it with your hand as necessary before starting the program.

Make sure the hitter bar starts out horizontal.

  1. Run the Peg_Sorter program.  If the black pegs are not being hit at the right time (if you think the hitter is swinging slightly too early or too late), you can try adjusting the hitting delay by using the left and right arrow buttons on the NXT.
     

    The delay time between when the light sensor sees a black peg to when the hitter starts its motion is displayed on the NXT screen and can be adjusted with the left and right arrow buttons on the NXT.

 

Challenges
  • A goal for real mechanical sorters in factories is to sort items as quickly as possible.  See if you can make any improvements to the sorter to allow it to sort faster.  To get the program to run the conveyor faster, you just need to increase the power level on the Motor block that is controlling the conveyor (Motor C), but if you run it faster it might start to miss black pegs.  At the designed speed, it can sort well as long as the black pegs don't come any faster than every other peg.  If the black pegs are spaced even farther apart, it could sort even faster without any other changes, but a challenge would be to get it to sort faster while still allowing more black pegs.  One idea for an improvement would be to redesign the hitting arm to start closer to the pegs and not need to swing as far.  This would allow it to recover faster.  For example, perhaps make a hitter with four arms instead of two, and don't gear the hitting motor up as much. 

  • Try modifying the conveyor to allow for more pegs to fit into it.

  • Of course this Peg Sorter is not really a practical way to actually sort your NXT pegs.  Aside from using most of the parts in your NXT set, it takes way too long to load the pegs into the conveyer.  Could you design a way to just dump the pegs into a bin and then have the machine feed them into the channel somehow?

  • The sorter could be fairly easily modified to sort normal sized pegs instead of the long pegs, so you could try that.  This would also open up a possibility for an advanced challenge: try to sort three different colors of pegs.  For example, gray pegs fall straight through, black pegs are hit to the left, and blue pegs are hit to the right.  This will require changing the program to sense three levels of brightness, so it will get more complex then just "wait for dark enough, then hit" in the program.

Get nxtprograms.com on CD!
Click here for info

Home     Projects     Help     Contacts

 

Copyright 2007-2011 by Dave Parker.  All rights reserved. 
All project designs, images, and programs are protected by copyright.  Please see the usage policy.