I was interested if the T4 is able to count 10ns pulses. According to the measurements shown here: https://forum.pjrc.com/threads/57185...l=1#post212248 a simple

Code:

digitalWriteFast(pin, HIGH);
digitalWriteFast(pin, LOW);

should generate a < 10ns pulse. I connected pin0 with pin1, generated 50000 randomly spaced pulses and had an interrupt on pin1 count the incoming pulses.

Code:

uint32_t count = 0;
void setup()
{
while (!Serial) {}
pinMode(0, OUTPUT);
attachInterrupt(1, [] { count++; }, RISING); // attach interrupt to pin1, increment counter in ISR (connect pin 0 and pin 1 with a cable)
for (int i = 0; i < 50'000; i++) // generate 50k pulses
{
digitalWriteFast(0, HIGH);
digitalWriteFast(0, LOW);
delayMicroseconds(random(1, 100));
}
Serial.println(count);
}
void loop()
{
}

It prints exactly 50'000. So, I assume that the T4 should be fast enough to count the pulses.

The biggest hurdle is probably signal conditioning.

Yes, 10ns pulses might be difficult. On the other hand, if you have access to the detector, why not simply give it a try :-). As mentioned above, I'd go for a 74LVCXX (or another fast) buffer to protect the Teensy and bring the signal to 3.3V but this is probably not necessary.

will it be possible to measure upto 100,000 Hz, with high precision?

The photons will arrive at the detector statistically. So, the maximal possible precision depends on the number of counted photons. If you count N pulses you'll get a standard deviation of sqrt(N) which gives a precision (cv) of sqrt(N)/N = 1/sqrt(N). Thus, for an ideal detector you'd expect a cv of 1/sqrt(100000) = 0.3%. For 100 pulses you'd get a cv of 10%. So, as usual, precision depends on measurement time.

Real detectors always have a dead time which will lead to non linear count rates (if pulses arrive during the dead time they can't be counted). You can estimate this by the following formula:

N=M/(1-M x td) (see https://www.hamamatsu.com/resources/...dbook_v3aE.pdf chapter 6)

where N is the real count rate, M is the measured count rate and td is the dead time. The data sheet states 50ns dead time for the sensor. Thus, if you see 100'000 cts/s you'll have a real count rate of N = 100'000/(1-100'000 x 50E-9) = 100'500. Which is 0.5% off. However, the teensy also introduces some dead time since it can not detect another interrupt while it handles the first. I __estimate__ that the total dead time will be more like 500ns you get 100000/(1-100'000 x 500E-9) which corresponds to about 5% error. Still very good. In case you want/need to use the formula to linearize your measurement you should make some test to find out the correct dead time.

Hope that helps