Skip to the content
2 layers85 × 69 mmPhotogate, the printed circuit board in 3D

STEM project: Arduino photogate pcb & scripts

Size
85 × 69 mm
Copper layers
2
Thickness
1.6 mm
Parts
9
Nets
4
Pads
13
Tracks, vias
30, 0
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
2 Apr 2025
Updated
7 Apr 2026

Overview

Photogate is an open-source printed circuit board by repsej-h, from the repsej-h/photogate repository on GitHub. It is a 2-layer board of 85 × 69 mm with 9 parts on 4 nets, routed with 30 tracks and 0 vias.

Its parts include 2 resistors, 1 diode, 1 transistor and 1 connector.

README

README.md

Watch the video

Photogate

Project description

The photogate project is an Arduino compatible PCB, designed to take precise measurements of for example a pendulum's period or the speed of a miniature car in a test rig. Since the photogate project is driven by a school project, some screenshots and component workings will be included in this repository.

The PCB

The U-shaped PCB most importantly features a 3 pin connector. From left to right the pins need to be connected to GND, digital interrupt & +5V on your Arduino. There are two mounting holes in the PCB, which could be used to attach the photogate to a 3d printed mounting piece (which is not yet developed). Last every PCB features a unique QR-code, for easy identification of the PCB's

A screenshot of the schematics can by found in the references folder

Components

Only 5 components are placed on the PCB. Starting off with R1 and R2, these are 220 $\Omega$ and 2000 $\Omega$ resistors respectively. These are placed on the board as 0805 SMD resistors. Next is a 3 pin connector with a 90 degree bend, making the photogate easily compatible with a breadboard. Alternatively, when mounting the PCB, female to male Arduino jumper wires can be used. Next we have the more vital components. The first one is the 940 nm LED, which constantly emits light when connected to a power source. Finally a 940 nm insert typephototransistor either blocks or allows electricity to flow through the circuit. This flow triggers an interrupt request (IRQ)

Sponsership

Special thanks to PCBWay for providing me with quick and easy pcb prototyping! 

Working with them has been nothing but smooth. Their boards are top-notch, their turnaround times are fast, and the entire process is incredibly easy from start to finish. Whether you're prototyping something new or scaling up for production, they make sure you get exactly what you need — quickly and reliably.

If you are interested in ordering some photogates, I highly recommend checking them out via this link. PCBway logo

Scripts

Currently the photogate project features 3 scripts:

photogate.ino

This script uses a single photogate pcb to measure the time between two triggers. For demonstration purposes, the internal arduino led is turned on in between the start and stop trigger. A picture of the hardware setup is presented below. In order for the interrupt to work, the SensorPin has to be wired to the digital 2 / 3 pin on an Arduino Uno. (cfr interrupts)

photogate_pendulum.ino

This script is used to measure the period of a pendulum using a single photogate. It calculates the high-precision average of 10 measured periods to ensure experimental accuracy.

Key Features

  • Automatic Data Reset: The script features an sanity check. If the interval between triggers exceeds 5 seconds (5000 ms), the script assumes the experiment has been paused or adjusted. It will automatically discard previous partial measurements and restart the count from zero.

  • Smooth Table Output: Data is printed to the Serial Monitor in a strictly aligned table format. This includes:

    • Time: Padded numerical values to prevent column shifting.

    • Progress Bar: A visual representation of how many readings are left before the average is calculated.

Hardware Setup

In order for the timing interrupt to work correctly, the SensorPin must be wired to a pin capable of handeling interrupts.

  • Arduino Uno: Connect to Digital Pin 2 or Digital Pin 3.

How to Use

  1. Connect the hardware as described above.

  2. Upload the script and open the Serial Monitor (set to 9600 Baud).

  3. Release the pendulum. The first pass will initialize the timer.

  4. The table will populate automatically. If you stop the pendulum for more than 5 seconds, the table will reset itself for your next trial.

  5. After 10 periods, the final average (T×2) will be displayed in a result block.

SlingerPeriode.ino

This script has the same functionality as the photogate_pendulum.ino script, but has been modified to be used on a college information day. Most important changes are reformatting the script's output and adding instructions for the demo in de code documentation. Also, this script is based on a older version of the pendulum script and still uses analog readings. Theirfore connect the SensorPin to pin A0!

speed_measurement.ino

This script is designed to calculate the speed of an object traveling through multiple photogates. Unlike previous projects, an array of photogates is used to collect timestamps along the path of the object. This data is used to calculate the speed of the object for each interval.

[!NOTE] Since old Arduino Uno's only feature 2 interupt pins, only 2 photogates can be used. Please consult Arduino docs to check if your Arduino model can support more than 2 interrupts.

Configure the script

By default the script is configured to work with two photogates, connected to digital pins 2 & 3. In this case, simply input the distance in cm between the 2 gates right here: unsigned int distances[pinsLength - 1] = {100};

When adding more photogates, first add your pins into the int pins[] seperatedby comma's. Next plug in the distances between the gates, also separated by comma's into unsigned int distances[pinsLength - 1] and you are good to go.

Until now the script has been tested with up to 3 photogates. Also note that the script doesn't bother in which order gates get triggered. This means that a set up can be used in both directions. The end user needs to interpret which is gate one, two, etc based on the object's trajectory.

Parts

9
QtyValueFootprintReferences
2MountingHoleMountingHole:MountingHole_5.5mmMountingHole 1, MountingHole 2
1220Resistor_SMD:R_0805_2012MetricR1
12kResistor_SMD:R_0805_2012MetricR2
1Conn_01x03_PinConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_HorizontalJ1
1G***kibuzzard-67ED3B28kibuzzard-67ED3B28
1IR26-21C_L110_TR8LED_THT:LED_D5.0mm_Horizontal_O3.81mm_Z3.0mmD1
1LOGOLOGOG***
1Q1LED_THT:LED_D5.0mm_Horizontal_O3.81mm_Z3.0mmQ1

Similar boards

  • 2 layers103 × 30.5 mmTS Back Endcap, the printed circuit board in 3D

    TS Back Endcap

    EEVengers/ThunderScope

    ThunderScope GitHub Repo

    9 parts1.3kMIT
  • 2 layers31.8 × 47.6 mmNGC 38 connector, the printed circuit board in 3D

    NGC 38 connector

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    9 parts1.2k
  • 2 layers24 × 27.3 mmExpansion Card Retrofit, the printed circuit board in 3D

    Expansion Card Retrofit

    FrameworkComputer/ExpansionCards

    Reference designs and documentation to create Expansion Cards for the Framework Laptop

    9 parts1.1kCC-BY-4.0
  • 2 layers15.6 × 17.3 mmSKR Mini TFT Thermistor Board, the printed circuit board in 3D

    SKR Mini TFT Thermistor Board

    VoronDesign/Voron-Hardware

    Cool Hardware designed by the Voron Design group

    9 parts1.1kGPL-3.0
  • 2 layers39.1 × 49.5 mmLearnoliver, the printed circuit board in 3D

    Learnoliver

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    9 parts915
  • 2 layers17.4 × 16.9 mmToolhead, the printed circuit board in 3D

    Toolhead

    tanaes/whopping_Voron_mods

    9 parts787GPL-3.0
  • 2 layers9.8 × 108 mmExpander, the printed circuit board in 3D

    Expander

    wntrblm/Castor_and_Pollux

    A Juno-inspired dual oscillator

    9 parts587
  • 2 layersKeyboard after, the printed circuit board in 3D

    Keyboard after

    adamws/kicad-kbplacer

    KiCad plugin for automatic keyboard's key placement and routing

    9 parts547GPL-3.0

Questions

How big is the Photogate PCB?

It measures 85 × 69 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Photogate use?

9 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Photogate KiCad files?

From the repsej-h/photogate repository on GitHub, at the commit this page was made from: the board is KiCAD-files/photogate.kicad_pcb and its schematic KiCAD-files/photogate.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Photogate design in my own project?

Its repository states no licence, so its author keeps all rights: ask repsej-h before reusing the design.