I want to create a system to separate between an aluminum can and a plastic bottle.

Both are lightweight, so I'm thinking of using the transparency property, meaning that the can is not transparent, but the plastic bottle is.

Will the light sensor work out?

Or would you suggest me another type of sensor I should use?


A light sensor should work. Another option would be an inductive Sensor to detect the Aluminium Can. And if you need to know if there is a Can in your sensor area you can combine it with an IR (or capacitive) Sensor, which should detect both Can types.

So it would be something like this:

if(IRdetect == true){
  if(inductive == true){
    type = alu;
    type = plastic;
  // no Can

Some cheap sensors as Example:

  • It's better never to use == true or == false, omit the true or use !. This code can be replaced by type = IRdetect && inductive; – Michel Keijzers Sep 29 '17 at 8:44

A light sensor should work. If the aluminium can reflect much light, you can consider putting the light and light sensor on the same side, close together.

If not, put the light and light sensor of opposite sides so the light beam goes through the bottle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.