

Opto counter
Universal infrared proximity sensor/counter of events
- Size
- 27.9 × 27.9 mm
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 13
- Nets
- 16
- Pads
- 42
- Tracks, vias
- 88, 3
- Pours
- 2
- Routed
- Yes
- KiCad
- KiCad 7 (file 20221018)
- Created
- 22 Oct 2023
- Updated
- 9 Jun 2026
Overview
Opto counter is an open-source printed circuit board by ppetr, from the ppetr/hw-opto-counter repository on GitHub, published under the Apache-2.0 licence. It is a 2-layer board of 27.9 × 27.9 mm with 13 parts on 16 nets, routed with 88 tracks and 3 vias.
It is built around the ATTINY3224-SSU, TSSP6038TR and TSAL4400. Its parts include 3 resistors, 3 connectors, 2 ICs, 2 diodes and 1 capacitor. It belongs with the AVR (ATmega, ATtiny) boards of this library.
Main components
3ATTINY3224-SSU
SOIC-14-40℃~+85℃ 1.8V~5.5V 12 12bit 20MHz 256Byte 32KB 3KB 8 Bit AVR Built-in FLASH SOIC-14 Microcontrollers (MCU/MPU/SOC) ROHSMicrochip TechnologyMicrocontrollers (MCU/MPU/SOC)TSSP6038TR
SMD-25℃~+85℃ 2.5V~5.5V 38kHz 50° 5mA 8m SMD Infrared Remote Receiver (IRM) ROHSVishay IntertechnologyInfrared Remote Receiver (IRM)TSAL4400
插件,D=2.9mm-40℃~+85℃ 1.35V、2.6V 100mA 160mW 16mW/sr@IF=100mA 25° 5V 940nm 插件,D=2.9mm Infrared LED Emitters ROHSVishay IntertechnologyInfrared LED Emitters
README
README.mdUniversal IR optical, directional proximity detector/counter with TWI (I²C) interface
Disclaimer: This is not an officially supported Google product.
The board uses two IR LEDs with a modulated signal (both either 38KHz or 56KHz, depending on the receiver type) whose light reflects off objects in front of the device into an IR receiver.
Using two LEDs allows to determine an approximate position (or direction of movement) of an object in one dimension. Modulating the signal significantly reduces interference from natural IR light sources.
The microcontroller (ATtiny3224) varies the signal strength to compute the strength of the reflected signal using the binary search algorithm.
The measured values are made available through I²C (subordinate).
Event counter
In addition to reporting current values of reflections from both LEDs, the microcontroller also counts the number of times the reflection quickly changes (which we call "events"). These events are defined using two parameters:
- Exponential moving average smoothing factor ("half-life"), which computes the baseline signal to compare against. The default value is half-life of 10s.
- Delta factor [0..1]. An event is triggered when the signal differs more than the delta factor from its exponential moving average.
There are the following event types that are counted independently:
- Signal reflected from LED1 crosses the delta boundary and returns while
LED2's signal remained within.
text LED1: ___|‾‾‾|___ LED2: ___________ - Similarly the other way around.
- LED1's signal crossed outside the delta boundary followed by LED2's signal
crossing outside. This captures the situation when an object is moving in
the direction LED1->LED2.
text LED1: __|‾‾‾|____ LED2: ____|‾‾‾|__ - Similarly the other way around.
Status
Development of a prototype.
Contributions
Please see Code of Conduct and Contributing.
Parts
13| Qty | Value | Footprint | References |
|---|---|---|---|
| 2 | 4k7 | Resistor_SMD:R_1206_3216Metric_Pad1.30x1.75mm_HandSolder | R1, R3 |
| 2 | MountingHole | MountingHole:MountingHole_2.2mm_M2 | H1, H2 |
| 2 | TSAL4400 | LED_THT:LED_D3.0mm_IRBlack | D1, D2 |
| 1 | 100nF | Capacitor_SMD:C_1206_3216Metric_Pad1.33x1.80mm_HandSolder | C1 |
| 1 | 220 | Resistor_SMD:R_1206_3216Metric_Pad1.30x1.75mm_HandSolder | R2 |
| 1 | ATtiny3224-SS | Package_SO:SOIC-14_3.9x8.7mm_P1.27mm | U1 |
| 1 | IR-REC | Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical | J1 |
| 1 | TSSP6038 | opto-counter:TSS60xx | U2 |
| 1 | UPDI | Connector_JST:JST_XH_S3B-XH-A_1x03_P2.50mm_Horizontal | J3 |
| 1 | qwiic | Connector_JST:JST_XH_S4B-XH-A_1x04_P2.50mm_Horizontal | J2 |
Similar boards
- 2 layers47 × 20.6 mm

- 2 layers56.7 × 25.4 mm

BatteryMonitorATTiny3224
ieb/BatterySensor
A Modbus RTU Battery Current and Voltage sensor board based Attiny3224, MAX485, MAX9918 chips.
24 parts1 - 2 layers64.6 × 47.9 mm

- 2 layers21.1 × 19.6 mm

Soic14-bb
jaco-pixeldump/attiny-soic-14-barebone-breakout-board
A compact, breadboard-friendly breakout adapter PCB for 14-pin SOIC Microchip ATtiny microcontrollers (such as ATtiny3224, ATtiny1624, ATtiny824, ATtiny424, as well as 1-series and 0-series parts like ATtiny1614…
5 parts1MIT - 2 layers79 × 80 mm

- 2 layers93 × 93 mm

- 2 layers62.5 × 48.5 mm

VacSensor
hschack/ZB3245TSS_OPENPNP
More to come Link Mellow Fly Super8Pro https://teamgloomy.github.io/flysuper8proh723general35.html
25 parts - 2 layers64 × 78 mm

Actuator board
ieb/autopilot
An ML Autopilot designed and written almost entirely by Google AntiGravity.
37 parts
Questions
How big is the Opto counter PCB?
It measures 27.9 × 27.9 mm and has 2 copper layers, 1.6 mm thick.
What parts does the Opto counter use?
13 parts, built around the ATTINY3224-SSU, TSSP6038TR and TSAL4400. 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 Opto counter KiCad files?
From the ppetr/hw-opto-counter repository on GitHub, at the commit this page was made from: the board is hw/opto-counter.kicad_pcb and its schematic hw/opto-counter.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the Opto counter design in my own project?
Its repository publishes it under the Apache-2.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).