I have a presence sensor (i. e. a photocell) that provides an output signal 0-24 V. I would like to trace all the state changes, for instance on the leading edge through my Arduino Due board interrupt input.
I need to design a small circuit the brings the signal from 0-24 to 0-3.3 V. I thought to use an optocoupler, but I can't find the right model. I'm a beginner. And then I'm not so good in dimensioning the other compenents like resistors and so on.
After that, I need to optimeze the debouncing and reading every where over the Internet, I understood to add a Schimitt trigger. Also in this case I don't know if and which kind of capacitor has to be added.
Please for both cases, could you suggested me the model as well?
My target is to have the interrupt as fast as possible.
Thank you very much
Two resistors in series will divide a voltage easily and cheaply (measure at the point between the two resistors).
A capacitor connected between ground and the output of the photocell will debounce it. The size will depend on how fast you want the cell to respond. Play around with some different sizes (make sure they're rated for 24V). Or...you can just set a minimum time interval between changes in your software. eg. Ignore events that happen within 1ms of the previous one.