Arduino Geiger Counter

Hi there,

Need a self build geiger counter? Without complex circurit. Here it is πŸ™‚

Here my Arduino sketch:

#include "DogLcd.h"
#include "Bounce2.h"
#include "RunningAverage.h"

#define calFactor 1.0/5.8

/*
LCD SI pin to digital coupin 7
LCD CLK pin to digital pin 8
LCD RS pin to digital pin 5
LCD CSB pin to digital pin 6
LCD RESET pin is not used +5V
LCD Backlight pin is not used
*/

DogLcd lcd(7, 8, 5, 6);

const byte buttonPin = 3;
const byte displedPin = 9;
const byte buzzerPin = 10;

byte buttonState = 0;
byte lastButtonState = 0;
byte buttonCount = 0;
byte buzzerOff = 0;

volatile unsigned int count = 0;
byte runCount = 0;
unsigned int countPerRun[30];
unsigned int countPerMinute = 0;
unsigned int averageCountPerMinute = 0;
float radiationValue = 0.0;

unsigned long timePrevious = 0;

RunningAverage RunningAverageCountPerMinute(10);

Bounce debouncer = Bounce();

void setup() {
 Serial.begin(9600);
 Serial.println("CPM;AV;uSv/h");
 
 pinMode(buttonPin, INPUT_PULLUP);
 pinMode(displedPin, OUTPUT);
 pinMode(buzzerPin, OUTPUT);

 debouncer.attach(buttonPin);
 debouncer.interval(5);
 
 lcd.begin(DOG_LCD_M162);
 
 attachInterrupt(0, countPulse, RISING);
}

void loop() {
 debouncer.update();
 buttonState = debouncer.read();

 if (buttonState != lastButtonState) {
 if (buttonState == LOW) {
 if(buttonCount < 4) {
 buttonCount++;
 }
 else {
 buttonCount = 1;
 }
 }
 }
 
 lastButtonState = buttonState;
 
 switch (buttonCount) {
 case 4:
 buzzerOff = 0;
 break;
 case 3:
 buzzerOff = 1;
 break;
 case 2:
 digitalWrite(displedPin, LOW);
 break;
 case 1:
 digitalWrite(displedPin, HIGH);
 break;
 }
 
 if (millis()-timePrevious > 2000){
 timePrevious = millis();

 byte i;
 for (i=0; i<30; i++) {
 if (i == runCount) {
 countPerRun[i] = count;
 }
 countPerMinute+=countPerRun[i];
 }

 RunningAverageCountPerMinute.addValue(count);
 averageCountPerMinute = RunningAverageCountPerMinute.getFastAverage();
 
 radiationValue = (float)countPerMinute * (float)calFactor;
 
 lcd.clear(); 
 
 lcd.setCursor(0, 0);
 lcd.print("CPM=");
 lcd.print(countPerMinute);
 
 lcd.setCursor(9,0);
 lcd.print("AV=");
 lcd.print(averageCountPerMinute);
 
 lcd.setCursor(0, 1);
 lcd.print("uSv/h=");
 lcd.print(radiationValue);

 Serial.print(countPerMinute);
 Serial.print(";");
 Serial.print(averageCountPerMinute);
 Serial.print(";");
 Serial.println(radiationValue);
 
 runCount++;
 if(runCount > 29) {
 runCount = 0;
 }
 
 count = 0;
 countPerMinute = 0;
 }
 
}

void countPulse(){
 detachInterrupt(0);
 count++;
 if (buzzerOff == 0) {
 tone(buzzerPin, 2000, 15);
 }
 while(digitalRead(2)==1){
 }
 attachInterrupt(0,countPulse,RISING);
}

The diode I’m using as beta, gamma and x-ray sensor is Teviso RD2014. It is also sensitive to GSM radiation. Nice to find bugging devices. πŸ™‚

Here are some good links I worked with:
http://www.opengeiger.de/index_en.html
http://www.teviso.com/en/products/radiation-sensor-rd2014.htm

Have fun!