Photogate V2
ESP32 optical timer documented from electronics to firmware and 3D modeling
Project Overview
Photogate V2 measures time intervals produced by an infrared optical barrier. The analog sensor response is conditioned by an LM393 comparator, converted into 3V3 digital pulses, counted by the ESP32, and interpreted by firmware routines for physics experiments.
Documentation Sections
Hardware
KiCad schematic, PCB layout, prototype board, power system, sensor interface, display, encoder, and manufacturing files.
Software and Pulses
ESP-IDF firmware architecture, how pulses are read, menu flow, experiment state machine, and pulse timing diagrams.
3D Modeling
FreeCAD assembly, printable parts, mechanical design decisions, and the interactive 3D viewer for the board and case.
Open Development Toolchain
The project was developed with open and widely available tools so the electronics, firmware, and mechanical parts can be studied, modified, reproduced, and maintained without depending on closed design files.
ESP-IDF
Official Espressif framework used to build, flash, monitor, and configure the ESP32 firmware.
FreeRTOS
Provides the task, queue, and timing structure used by the menu and measurement routines.
KiCad
Used for schematic capture, PCB layout, board documentation, and manufacturing outputs.
FreeCAD
Used to model the enclosure and mechanical assembly as editable parametric parts.
Linux Workflow
Development was organized around a reproducible terminal workflow for building and documenting the project.
Open Hardware
Design files are kept in the repository so the device can be inspected, adapted, and reproduced.
Build and Run
Requirements
- ESP-IDF v5.4
- A configured ESP32 development environment installed with Espressif's official tools
- Required cables and hardware to flash the firmware
Install and configure ESP-IDF from Espressif's official installation site: ESP-IDF Installation Manager
Quick Start
1. Clone the repository
git clone https://github.com/MarcioBulla/PhotogateV2.git
cd PhotogateV2
2. Open an ESP-IDF terminal/session
After installing ESP-IDF, use the terminal or shell configured by the official installer so that idf.py and the ESP-IDF environment variables are available.
3. Build, flash, and monitor
cd firmware
idf.py build flash monitor
Repository Structure
- firmware/C source code for the ESP32 firmware
- boards/KiCad schematic, PCB layout, packages, and JLCPCB files
- 3DModels/FreeCAD mechanical model files
- docs/Website, IBOM, 3D preview, and curated image assets