I had a project last year at college that I used an Arduino for and thought I would share what I did. The rules for the competition are linked above. We had to sort 4 different types of bottles/cans: Aluminum, Glass, Plastic, and Tin. Each type of bottle/can had dimensions they had to be within. Also the machine had to be within certain dimensions.
To start off, there were two tracks that acted as a conveyor belt. In between the tracks, there was a lever with a magnet attached to it. The only bottle/can that was magnetic was the tin can. When the can rolled over the magnet, it pulled the lever up. The lever acted like a switch, when it was pulled it, it opened the switch and told the Arduino it was Tin.
When the bottle/can reached the end of the track, it fell off into the area with the blue bottom. As it fell, it hit a limit switch that told the Arduino to stop the tracks and move on to the next step. (You can kind of see the switch on the right side of the first picture and in the middle of the second and third.)
The bottle/can is now laying on the blue plate. It is laying between two metal plates; one that is stationary and the other moves. The moving plate has a nut attached. There is a motor attached to a threaded rod that moves it back and forth (shown below on left).
When the bottle falls in this area, the moving plate moves until each plate is touching an end of the bottle/can. At this point, the moving plate is pushing the bottle/can into the stationary plate. The stationary plate is actually attached by hinges (seen in the second picture on the right). When the bottle pushes up against it, it hits a switch behind the plate and tells the Arduino to stop moving the plate. The switch is at the bottom of the picture below (green circuit board).
Now the Arduino will test if the bottle/can is metal. There is a electrical lead that is attached to each plate (green wire in above picture). The plates are touching each end of the bottle/can. If the bottle/can is metal, it will close the circuit. If the bottle/can is plastic or glass, the circuit remains open. From this the Arduino knows if the bottle/can is metal (Aluminum or Tin) and then knows the difference between those because of the magnetic switch.
Next, the Arduino needs to figure out how to tell if it is plastic or glass. In the rules, the given lengths of the glass and plastic bottle do not overlap. The biggest glass bottle is smaller than the smallest plastic bottle. There is an ultrasonic sensor on the stationary plate (2 circles in picture below) and it reads the distance between the plates, telling the Arduino the bottle/can's length. If the bottle/can wasn't metal, the Arduino knows if it is wither plastic or glass because of its length. Now the Arduino knows exactly what the bottle/can that is being tested is made of now: Aluminum, Glass, Plastic, or Tin.
There is a basket on each side of the machine (one material per side) for the bottle/cans to fall into (not shown). Under the blue area, there is a ramp that is attached to a motor (shown below). The ramp rotates to the correct side. After the ramp rotates, the blue plate (which is attached to motor shown on the right of the forth picture), pivots around and allows the bottle/can to fall and hit the ramp, making it roll into the correct bin.
The next few pictures show the wiring, Arduino, and the whole machine.