Digital interrupt of analog photo cell receptor input

Hi all,

I'm trying to measure the obstruction of a light sensor (i.e: the instant when something physical is blocking it from receiving any light), and need to be able to signal the moment the light sensor is obstructed with high temporal frequency. The best way to do this is probably by using digital interrupts; however, a photo cell receptor can only be read by analog input. Does anyone have suggestions how to tackle this one? I've read somewhere the best way is to use an analog comparator, but I do not quite understand how to use and set up its register. Using an Arduino Uno.

Thanks a million :slight_smile: !

BSwift: Hi all,

I'm trying to measure the obstruction of a light sensor (i.e: the instant when something physical is blocking it from receiving any light), and need to be able to signal the moment the light sensor is obstructed with high temporal frequency. The best way to do this is probably by using digital interrupts; however, a photo cell receptor can only be read by analog input. Does anyone have suggestions how to tackle this one? I've read somewhere the best way is to use an analog comparator, but I do not quite understand how to use and set up its register. Using an Arduino Uno.

Thanks a million :slight_smile: !

Please supply some actual time values to what you refer to as "the moment the light sensor is obstructed". How do you determine the obstruction? Do you know the obstruction is complete when the sensor begins to be uncovered? How do you handle "fringing", when shadows begin to appear from the edge of the object?

How fast is the object moving?

When you have some real life time values, then you can decide how much time you have to allow for sensor reading and how often. And then you can pick an appropriate sensor.

Paul

Most photo transistors can be wired up to trigger one of the external interrupts. I am using a QRE1113 like that to measure the speed of a small DC motor. I have also done it with a few slotted optical switches recovered from old printers. Sparkfun make a breakout board for the QRE1113 and their analog circuit (yes, how ironical) is ideal for connecting to an external interrupt.

...R

Paul_KD7HB: Please supply some actual time values to what you refer to as "the moment the light sensor is obstructed". How do you determine the obstruction? Do you know the obstruction is complete when the sensor begins to be uncovered? How do you handle "fringing", when shadows begin to appear from the edge of the object?

How fast is the object moving?

When you have some real life time values, then you can decide how much time you have to allow for sensor reading and how often. And then you can pick an appropriate sensor.

Paul

Thanks for the response, Paul In analogy, I'm interested in counting coins that are put into a coin slot using a light shining unto a light receptor both embedded inside the slid, counting the amount of times the receptor is being obstructed. However, in my project, there'd be about 8 "coins" shooting by per second on average, each taking an average of 75 ms from start to end of obstruction, with an interval of about 50 ms between two coins coming through. As I want to be able to pinpoint both start and end of each coin's obstruction with high temporal frequency, I figured I needed to use digital interrupt.

BSwift: Thanks for the response, Paul In analogy, I'm interested in counting coins that are put into a coin slot using a light shining unto a light receptor both embedded inside the slid, counting the amount of times the receptor is being obstructed. However, in my project, there'd be about 8 "coins" shooting by per second on average, each taking an average of 75 ms from start to end of obstruction, with an interval of about 50 ms between two coins coming through. As I want to be able to pinpoint both start and end of each coin's obstruction with high temporal frequency, I figured I needed to use digital interrupt.

Looking for photocell got you off on the wrong track! They are voltage generators and take time and then you need to measure the voltage to find when it goes away and then reappears.

Look for optocouplers. At least that is what I searched Ebay for. Found this: http://www.ebay.com/itm/OptoCoupler-Optical-Sensor-Speed-Sensor-Counter-For-Arduino-/121129138352?hash=item1c33dbf8b0:g:RWcAAOxy9X5TajG9. There are other possibilities there for your project and will make a straight forward solution.

And with those items, you can trigger an interrupt on change in the digital pin to get the starting edge of the coin and then the trailing edge. You may not even need an interrupt, but just polling the digital pin. You will always know when a coin breaks the light, to expect a corresponding reappearance of the light.

Paul