Photo-gate timer
Contents
Specifications
- Connect up to 5 gates for four times (first gate zeros timer).
- Include a display with enough characters to show the time past each connected gate, 8x2 or 16x2.
- Include a power switch to save the battery, and/or a reset switch.
- Use a breadboard so it can be built by students, or modified.
- Allow timing of periods up to at least 10s, accurate to 0.01s.
Circuit
This circuit is built in sections, the micro-controller and display on one breadboard and each gate on their own separate ones, with three lines (V+, ground, and signal) going between. The three-volt supply may involve a voltage-regulator circuit, which optionally would include a diode to protect from backwards-connected supplies.
For a printable diagram of the Atmega 328P-version of this circuit, see Photo-gate-timer-Arduino.pdf.
For a less-accurate PICAXE version of this circuit, see PICAXE-Photo-gate-timer-i2c-LCD-2014.png .
Photo-gate
The higher the resistance of the resistor feeding the photo-transistor, the higher its sensitivity, but the slower its response will be. For an extremely sensitive receiver, calibrate an op-amp as a comparator—It would have to be re-calibrated every time the environment changes.
Often the micro-controller features an internal pull-up resistor on its inputs. If activated, the circuit will use less power if the photo-gates are designed to be active-low instead of active-high, since most of the time they'll be inactive and thus not drawing current through the pull-up resistors.
Components
- Photogates
- LED, infrared (~$0.15). I use a Lite-On LTE-302-M, which has a black or gold dot to identify itself as an emitter; it also allows up to 50mA of constant current, or even 1A if pulsed 300 10µs pulses per second, so it can be used at a greater distance than 20mA emitters. The cathode is the short lead, on the left as you're facing the lens.
- Phototransistor, infrared (~$0.15). I use a Lite-On LTR-301, which has a red dot to identify itself as a receiver. The collector is the long lead, on the right as you're facing the lens, the short lead being the emitter of the transistor.
- Switching transistor, 2N2222 or equivalent NPN (~$0.10). I use an R3309, whose leads are emitter, collector, and base, left to right, as seen leading down when looking at the flat face.
- Resistors
- LED limiting resistor (4V/40mA=100Ω; 4V/20mA=200Ω; 2V/40mA=50Ω) (~$0.02)
- Phototransistor resistor (~5kΩ) (~$0.02)
- NPN base resistor (~50kΩ) (~$0.02)
- NPN emitter resistor (~1kΩ) (~$0.02)
- Breadboard (~$5)
- Micro-controller. I use a PICAXE 20M2 (software timing) or a 20X2 (dedicated hardware timing for better accuracy); both have plenty of inputs and outputs for multiple gates and any type of display. ($4-$6)
- Resonator circuit if necessary. Not available for PICAXE 20M2. (~$1)
- Display
- LCD Display, serial capable. I use Newhaven's NHD-C0216CiZ-FSW-FBW-3V3 LCD with I2C ($10)
- Two 1µF capacitors to aid voltage booster circuit.
- Two 5kΩ resistors to pull up serial clock and data lines while idle.
- One 50kΩ resistor to pull up reset.
- Alternatively, a TTL-to-USB or TTL-to-serial circuit for sharing data with computer ($18)
- LCD Display, serial capable. I use Newhaven's NHD-C0216CiZ-FSW-FBW-3V3 LCD with I2C ($10)
- Hook-up wires ($2)
- Power supply
- 9V or a quartet of AAA with a 3V voltage regulator, capacitor(s), resistor(s), or
- 3V AC adapter, or
- Two alkaline AAA or AA batteries.
Saving power
The LCD and micro-controller use little power compared to the infrared emitters, which are constantly on in this circuit as initially designed. So, one way to significantly reduce power would be to power only the next-expected-to-close gate. Another way to reduce power would be to pulse the emitters, which would also allow for very bright IR light—This way would require periodic pulses of narrow width accompanied by polling of the receiving circuit, or a more elaborate circuit involving a missing-pulse detector, a timer at each photogate that is reset by pulses from the emitter. Pulses and delays in timing would limit the precision of the system.
Program
For an explicit example, see Photo-gate timer with an Arduino or the less-accurate Photo-gate timer with a PICAXE 20M2.
- Initiate the display
- Write "waiting for 1st gate" to the display
- Set an interrupt on the pin attached to the first gate. Will interrupt the program wherever execution is and go to Interrupt.
- Loop.
- Increment time counter.
- Go back to Loop.
- Interrupt
- If first gate:
- Reset counter.
- Display "1st gate tripped".
- Set interrupt to second gate, or all the rest of the gates to allow four independent channels of timing.
- If other gate:
- Save counter as time for that gate.
- Display that value in the place corresponding to that gate.
- Set interrupt to next gate unless this is the last one or running interrupt on all gates.
- Return to wherever program was before interrupt.
- If first gate:
Datasheets
- Newhaven Display liquid crystal display module, with side white backlight and transflective display.
- http://www.newhavendisplay.com/specs/NHD-C0216CiZ-FSW-FBW-3V3.pdf
- Atmel 328P 8-bit microcontroller
- http://www.atmel.com/devices/ATMEGA328P.aspx
- PICAXE micro-controller system for education
- http://picaxe.com
- Lite-on LTE-302 side-look IR emitter
- http://optoelectronics.liteon.com/upload/download/DS-50-92-0009/P_100_E302.pdf
- Lite-on LTR-301 side-look IR photo-transistor
- http://optoelectronics.liteon.com/upload/download/DS-50-93-0013/P_100_LTR-301.pdf
See also
See more discussion and other circuits at Circuits for teaching physics.
For a discussion of the circuit around the photo-transistor, read An Arduino-Controlled Photogate by Calin Galeriu of Becker College, Worcester, Massachusetts, in The Physics Teacher, v51:n3:pp156-158. http://dx.doi.org/10.1119/1.4792011