Trash Sorter

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.


Yes intriguing . I wonder how u would tell if it was glass or plastic ? Here it is on dimensions but in reallity that won't be of use. Both materials dont conduct electricity.

Anyone got any ideas?

Anyone got any ideas?

I think I would approach it with a multi-stage process, with some "fuzzy" logic:

1) How "squishy" is it (likely a glass bottle won't "squish")? 2) How well does ultrasound pass through it? 3) How well does IR light pass through it? 4) How well does UV light pass through it?

For each of these measurements, you would assign a percentage decision value; take the average, perhaps apply a bias if needed, and use that for the decision.


We actually considered using a few of your suggestions for glass/plastic. We just didn't have the time needed to implement those and due to the sizing rules, checking the length was much easier (of course as pointed out, not practical in the real world).

A few problems we thought of is that some plastic bottles are not clear. That would kind of throw off the light testing. Also most bottles have labels which would block the light.

Ive been thinking myself between posts .Maybe an oven set 50Cbelow the melting point of glass . Smash or shred both and pass through oven with a sieve bottom and revolving drum .

Plastics should melt out and be reclaimable by shredding again. Then there is the problem that both glass and plastics have different sub groups . But then so do tin and metals.

Weight should be a decent indicator. You allready know the height, shouldn't be too hard to measure the width. You can probably assume the bottle is round (if its square, it is VERY likely to be glass anyways, and heavier). Find the plastic bottle with the thickest wall you can possibly find, and a glass bottle with the thinnest wall you can find. I'm putting my money on that the glass bottle is still relatively heavier, probably by a decent margin of error for your machine.

You could get tricky and use a solonoid or a servo as a striker and a microphone to pick up the resultant sound.. glass will make a notably different sound than plastic I would think. The other way would be density, but you have no way of knowing the wall thickness, which could make a thick-wall plastic bottle seem by weight to be a glass bottle instead.

Pull out a 'scope and a microphone and see if there's a usable difference in the sounds generated by a striker. I'd think that glass is going to make that characteristic short-duration "tink", while plastic would be more deadened (tapping my coffee cup and a plastic Iced Tea bottle here) sound. If so, a little creative coding can probably differentiate the two. Come to think of it, metal would have it's own particular "clunk" too...

I'm just thinking about how we as humans tell whether it's glass or plastic or whatever.. and one of the first things any of us would do is to tap it, and listen to the sound it makes. It works for us, so maybe there's a solution in there that Arduino can use too..

Very nice, could you make a video? Would love to see it working :).

Unfortunately I can't. Since the project was funded form the college, I had to leave it there. I have since graduated and do not have access to it anymore. I can give you the results of the competition.

The competition did not go well for us. Most schools in this competition used it as their senior project. At my college, we didn't so we only were able to work on it in our free time. We had our separate senior project, many other projects, and tests. These had a higher priority than this project. Due to this, we didn't have much time to work on it, so we kind of just had to work with stuff that was laying around as we didn't have time to try different things and order stuff. We also weren't able to go back and perfect everything we had.

The problem all teams had in the competition was with the hopper. (read instructions for clarity on hopper) The hopper was not included in the machine dimensions, and it couldn't have any motor or anything like that. When it came time to start, all 12 bottle/cans were to be poured into the hopper and then you start the machine. The hard part was getting the machine to get only one bottle/can out of the hopper at a time.

Since we didn't have much time, we left the hopper to the last thing to work on (big mistake). The only thing we had time to come up with was a ramp that sloped down to the conveyor tracks. The bottle/cans were to be poured on the incline and stack up behind the tracks. When the machine was turned on, the tracks would grab the first bottle/can and the others would slid down the ramp.

As I was pouring them on the incline, the weight of the bottle/cans began to add up on the first bottle/can resting on the edge of the track. The first bottle/can slipped and about 5 of the 12 slid down into the machine.

Due to the rules, we weren't allowed to touch anything after I started pouring. We tried turning the machine on and it ran through one sequence and here is how that went.

There were still about 6-7 bottles/cans on the incline, so when the tracks began to turn, one fell in with the others and hit the switch. The metal plate moved in and squeezed in all the bottles/cans that fell in and actually activated the switch behind the hinged plate. Now since there are a mix of bottles/cans, the switch that determined if it was metal did not close, so the Arduino says it is not Metal. Also the bottles/cans were sitting in front of the ultrasonic sensor, so the Arduino thought short and then ruling it was Glass. The ramp on the bottom actually then turned to the glass bin. When the trap door tried to open, the weight of the bottles/cans maxed out the motor and it couldn't turn the door. When it started over again and ran the conveyor tracks, another bottle fell in and the metal plate began to move, but never could put enough pressure on the bottles/cans to activate the switch behind the hinged plate. We had to turn it off.

The team that won used the same tests that we did (magnet, metal, length), but they made their machine horizontal instead of vertical like we did. Then there hopper was a square area that funneled into a pipe that fed into their machine. It had a very gradual slope. Ours probably dropped 2-3ft over a 2-3ft horizontal distance. Theirs probably dropped 2-3in over a 2-3ft horizontal distance. The pipe actually went into the machine a few inches so they put a vibrator on the end. The vibrator would vibrate the bottles/cans down the pipe very slowly but effectively. I think they ended up sorting 6 or 12 correctly. Every other team underestimated the hopper like we did and had similar results as we did.

I actually do have a video of the competition, but the lighting was very poor and all you can really see is the bottles sliding into the machine.

Here ya go.

I should also add that they didn't really want us taking our time and pouring them one by one like that. That is the reason I am trying to hurry.