S28ITR9608 slot

Photo Gate

Senses anything passing through its slot.

Loading 3D Drag to orbit · scroll to zoom · double-click to reset

Try it

Pass a card through the slot

0 clear1 blocked0 clearRPM = 1200

5 mm slot opto: OUT goes HIGH when something blocks the slot. Great for encoder wheels and RPM.

/*
  BuiltByTyler Sensor Kit - S28 PHOTO GATE (ITR9608 slot)
  Board: ESP32-WROOM-32 DevKit V1 (30-pin), Arduino-ESP32 core 3.x, "ESP32 Dev Module"

  Counts things passing through the slot. OUT goes HIGH when the slot is
  blocked. Prints the count each second, and RPM for a wheel with 1 slot/flag.

  Wiring (module pin -> ESP32 pin):
    GND  -> GND
    VCC  -> 3V3
    OUT  -> GPIO 4

  Library: none needed
  Serial Monitor: 115200 baud
*/

#define OUT_PIN  4

volatile unsigned long blocks = 0;    // changed inside the interrupt

void IRAM_ATTR onBlock() {             // runs every time OUT goes LOW -> HIGH
  blocks = blocks + 1;
}

void setup() {
  Serial.begin(115200);
  pinMode(OUT_PIN, INPUT);
  attachInterrupt(digitalPinToInterrupt(OUT_PIN), onBlock, RISING);
}

void loop() {
  delay(1000);
  unsigned long n = blocks;   // grab and reset the count
  blocks = 0;
  const char *state = digitalRead(OUT_PIN) == HIGH ? "blocked" : "clear";
  Serial.printf("%s  %lu per second  RPM = %lu\n", state, n, n * 60);
}

Not for sale yet. Planned price $79, shipping included. Join the waitlist and we'll email you once when the kit is ready. Nothing else.