How to optimize the debouncing for a photocell (0-24 V) on Arduino Due

Hi everyone,
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
C

You can use a voltage divider to scale the voltage from 24 to 3.3 (or anything you wish). You might wish to add a 3.3V Zener diode to assure the voltage can never get above 3.3.

Depending on the nature of the sensor output, you may not need to debounce at all. Is it a switched output, or a variable voltage?

If it's switched, you can debounce in the software rather than adding additional circuitry. If it i a variable voltage, then some hysteresis may be needed. That too can be accomplished in the software.

As for internet access, there are examples in the Ethernet library. Look at those as some of them sound similar to what I think you want to do.

carmo:
Hi everyone,
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
C

Two resistors in series will divide a voltage easily and cheaply (measure at the point between the two resistors).

See: Voltage divider - Wikipedia

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.