Questions on programming/using Photoelectric sensor

Hello all! I am making a automated can crusher and am using a "atc" photoelectric sensor it is a 10-30v dc sensor so i am using a 12v power supply to power both the sensor and the arduino. My question is does anybody have any advice to make this program work properly? Basically i want the sensor to tell when a can is present and activate my program. I have to program setup already but without the sensor or any switch period. I was just curious on the best way to go about using it to start my program? I have already searched through the forum to see how to go about doing this and couldn't quite find what would suit my application. I figured this was the best forum for help considering the amount of experienced users with arduinos. Thanks for any advice or ideas it is greatly appreciated! :slight_smile:

Hello,
the Project Sound pretty Basic to me. All you Need to do is periodically turn the light beam on, test if it being received at the sensor. If it is, there is no can and nothing Needs to be done. If the light beam is not detected, there is a can so start the crushing. You probably just Need to step X times in one direction and then X times in the other direction.

When done, simply use a delay and wait a second or two before testing again for a can...

Once you get it this far, consider removing the delay and using a sleep mode instead.

First of all thank you very much for your reply i have looked through the forum and couldnt find the help i needed that i needed. I am having trouble on how to program the switch to activate the program everything else is done. Im using a prox switch i just want to start my program. Im still new to this and it seems simple but for me just starting its not lol. Do you have any ideas on how to go about writing the program to activate it?

Hi,
Can you post a link to the spec/data of your sensor please?

Thanks.. Tom... :slight_smile: