I am trying to get data from a Giger sensor (https://www.aliexpress.com/item/Good-Quality-Assembled-DIY-Geiger-Counter-Kit-Nuclear-Radiation-Detector-GM-Tube/32595354504.html) to a NodeMCU ESP8266 board (https://www.amazon.com/HiLetgo-Internet-Development-Wireless-Micropython/dp/B010N1SPRK/).
The sensor generates low pulse interrupt of 200 micro seconds and the processor has to count no. of interrupt in a minute.
The esp isn't able to detect the interrupt pulse but I can get the interrupt fired in an Arduino Uno. I checked manually that interrupts of esp works.
Is there any way to make the interrupt faster in esp?
Here's the code,
const byte interruptPin = D1;
volatile unsigned int interruptCounter = 0;
void setup() {
Serial.begin(115200);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), handleInterrupt, FALLING);
}
void handleInterrupt() {
++interruptCounter;
}
void loop() {
unsigned long init_time = millis();
Serial.println("Counting");
while(millis()-init_time <= 15000){
delay(1000);
Serial.print('.');
}
Serial.print("Count/min is:");
Serial.println((unsigned int)(interruptCounter<<2));
interruptCounter = 0;
}