Pages: [1]   Go Down
Author Topic: How to optimize the debouncing for a photocell (0-24 V) on Arduino Due  (Read 784 times)
0 Members and 1 Guest are viewing this topic.
Bologna, Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
0
Offline Offline
Newbie
*****
Karma: 0
Posts: 40
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Canada
Offline Offline
God Member
*****
Karma: 7
Posts: 602
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Facts just don't care if you ignore them.

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 146
Posts: 5522
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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: https://en.wikipedia.org/wiki/Voltage_divider

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.

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Pages: [1]   Go Up
Jump to: