Arduino and photogates

Photogates are optical sensors that are are routinely used in physics labs to measure speed of objects passing through them. Arduino can sense photogates fairly easily. The following is an example of how to use arduino to sense photogates.

What is a photogate made off?

It has an infrared LED that emits IR light. It also has an IR phototransistor to sense the IR light. There are two ways to make a photogate: one way is to build an interruptive gate. One will have an IR LED emit light and an IR transistor on the opposite side of the gate to receive the light. If no object obstruct the light, the transistor reports low. When an object passes through the gate, it blocks the IR light and the transistor reports high. This way reduces false triggers since the transistor only looks at the IR LED and is not easily disturbed by nearby IR sources, like a lamp. Another way is to construct a reflective photogate. This gate has IR LED and transistor on the same side but a reflective surface needs to be brought near the assembly so enough IR light is reflected by the surface back and hits the transistor to product a signal. This way larger objects can be detected but the sensor is more subject to external noise.

There are pre-manufactured photogates for a few bucks so I will use one made by Sharp.

Here I have connected two photogates to arduino.

Here is a detailed hookup picture:

Here is some video:

9 Responses to Arduino and photogates

  1. Nahuel says:

    Can you upload the code??

    • liudr says:

      Will do. That post was pretty old before I found a place to host my program codes. This blog can’t host zip files. So do you use photo gates for teaching?

  2. manuel says:

    I do, I would apreciate too much your help code.

  3. Justin says:

    hello, im also currently working on a photogate timer with my arduino
    i currently have it setup so that the time interval between the photogate’s blockage is displayed in the LED display,,
    btw,, can i have a look at your code please?

    • liudr says:

      I’ll dig up the code. It’s been for a while since I last looked at my code. I think I created a photogate class, basically a state machine.

  4. Alex says:

    Do you know if this works on later revisions of the arduino board? The Duemilanove doesn’t seem to be offered anywhere official. I’m planning on making small ripple tank (well, trough, really) that uses this design to measure the wave speed.

Leave a Reply