Geiger Counter with Arduino MKR WIFI 1010

Hi to everyone,

I am working on Geiger Counter project with an Arduino MKR WIFI 1010. This project is very simple: I just want to count "radiation" every minute. Thus, I have just made these connections between the Arduino Board and the Geiger Board:

Arduino - Geiger board
5V - 5V
GND - GND
A1 - Vin

For this project I am using the A1 pin as an interrupt pin. Thus, if I have understood weel, everytime the event is verified the code should perform the function (i.e. just count +1). After a fixed time the count will be reset. This is the simple code that I am using:

unsigned long counts; //variable for GM Tube events
unsigned long previousMillis; //variable for measuring time

#define LOG_PERIOD 10000 // count rate
//#define LOG_PERIOD 60000
const byte interruptPin = A1;

void setup() { //setup
  counts = 0;
  Serial.begin(9600);
  pinMode(interruptPin, INPUT);
  attachInterrupt(digitalPinToInterrupt(interruptPin), impulse, FALLING);
  Serial.println("Start counter");
}

void loop() { //main cycle

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis > LOG_PERIOD) {
    previousMillis = currentMillis;
    Serial.print("Counts: ");
    Serial.println(counts);
    counts = 0;
  }  
}

void impulse() {
  counts++;
}

However, I noticed that it does not work very well: most of the times it counts always 0. Only sometimes it counts but it is not possible because the LED of the board blinks everytime that it counts. Can someone help me?

I am attaching here a picture my Geiger Counter board
Screenshot 2023-09-22 alle 23.27.22

Why do you use A1 as an interrupt pin? A designated external interrupt pin is almost always a better choice.

Check whether you need a pullup resistor on the input pin.

Variables shared with interrupts should be declared "volatile", e.g.

volatile unsigned long counts; //variable for GM Tube events

thanks a lot for your answer. I am using A1 just from this picture (as you can see there is also A1):

Do you know if some pins are better than other with this board as interrupt?

I added with "volatile" but unfortunately the issue is not solved

Add a 5K to 10K pullup resistor from A1 to Vcc.

Note that there are different types of interrupts. Not all respond to edges, like "FALLING".

You MUST check! Interrupts designated "external" are usually the most versatile.

I changed the pin from A1 to A2, I disconnected and reconnected the Arduino, I have added "volatile" and I should have solved it. It seems that it works properly. I will monitor it for some days and eventually I will close this post. Thanks for your feedback

Let's hope you didn't to this, because it implied you changed the wiring while the system was powered up. One of the best way there is for damaging any system.

What is the purpose of this measurement?
Did you know that every time you detect a detection event in a GM tube, then the tube becomes unable to detect any more events until it recovers. Therefore you will be underestimating the true count you would get if the tube did not have this "dead time" as it is called.

This underestimation increases as the count increases. It can be compensated for with a little maths.
See this link for how.
http://www.cco.caltech.edu/~derose/labs/exp2.html

An by the way, you do know that you will have about 800V across the tube so don't touch anything on that PCB.

Hi!
Thanks for your answer.

Of course I did it not in that order.

The goal of this experiment is just for teaching and explain how a Geiger Tube works.

I know about the "dead time" but since I am not using any radiation sources I haven't to perform accurate measurements. At most I am measuring the background level and by sure a dead time of "ms" does not impact on this. But anyway I don't have to do any real measurements for now.

Anyway I solved my issue: the wire "A1 - Vin" had a poor contact.

Thanks again.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.