My Cart

How to Measure and Display Radiation Levels and Temperature Using Radiation Geiger Kit

Difficulty Level: Beginner -

1. Introduction

This tutorial allows the user to know radiation levels, amount of light and temperature showing them on the LCD.

Ingredients:

    - 1 x Radiation Geiger Kit:
    • 1x Platform
    • 1x Geiger Counter - Radiation Sensor Board
    • 1x Temperature sensor (MCP97004)
    • 1x LDR
    • 1x 220Ω resistors
    • 1x Breadboard
    • 1x External power supply
    • 1x Programming cable
    • Jumper Wires

Preparation Time: 30 minutes

Buy now
NOTE: Depending on the platform chosen to develop the project, the ingredients and the schematics shown in this tutorial can vary.

This project can be developed with Arduino or Intel Galileo. It is also compatible with Raspberry Pi using the Raspberry Pi to Arduino shields connection bridge.

For further information about the Geiger Counter - Radiation Sensor Board, consult the main tutorial.

Step 1: Connection

Connect the Geiger tube to the Radiation Sensor Board and then, connect the shield to the Arduino or to Raspberry Pi connection bridge. Connect the LDR with the resistor and the temperature sensor in the breadboard as you can see in the next diagram.

Connect two wires, red and black, to the two long rows on the side of the breadboard to provide access to the 5 volt supply and ground. Place the temperature sensor with the flat part looking down like the diagram. Connect the right leg of the sensor to GND and the left to 5 volt. Connect the central leg to the first pin at bottom left of the shield (Analog 0). Finally connect the LDR to 5 volt and the other LDR leg to a resistor, connect also this point to Analog 1 in the Radiation Sensor Board. The other resistor leg has to be connected to GND.

Step 2: The Code

Arduino:

Code:
/*  
 *  Geiger Counter - Radiation Sensor Board
 *  
 *  Copyright (C) Libelium Comunicaciones Distribuidas S.L. 
 *  http://www.libelium.com 
 *  
 *  This program is free software: you can redistribute it and/or modify 
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or 
 *  (at your option) any later version. 
 *  
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License 
 *  along with this program.  If not, see http://www.gnu.org/licenses/. 
 *  
 *  Version:           1.0
 *  Design:            David GascĂłn 
 *  Implementation:    Luis Miguel MartĂ­
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(3,4,5,6,7,8);


// Threshold values for the led bar
#define TH1 45
#define TH2 95
#define TH3 200
#define TH4 400
#define TH5 600

// Conversion factor - CPM to uSV/h
#define CONV_FACTOR 0.00812

// Variables
int ledArray [] = {10,11,12,13,9};
int geiger_input = 2;
long count = 0;
long countPerMinute = 0;
long timePrevious = 0;
long timePreviousMeassure = 0;
long time = 0;
long countPrevious = 0;
float radiationValue = 0.0;


float tdegrees; //
int sensorPin = A0; // input for the MCP9700
int sensorValue = 0; // voltage value from voltage divider
boolean alert = false;

void setup(){
  pinMode(geiger_input, INPUT);
  digitalWrite(geiger_input,HIGH);
  for (int i=0;i<5;i++){
    pinMode(ledArray[i],OUTPUT);
  }

  Serial.begin(19200);

  //set up the LCD\'s number of columns and rows:
  lcd.begin(16, 2);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Radiation Sensor");
  lcd.setCursor(0,1);
  lcd.print("Board - Arduino");  
  delay(1000);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(" Cooking Hacks");
  delay(1000);

  lcd.clear();
  lcd.setCursor(0,1);  
  lcd.print("www.cooking-hacks.com");
  delay(500);
  for (int i=0;i<5;i++){
    delay(200);  
    lcd.scrollDisplayLeft();
  }
  delay(500);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("  - Libelium -");
  lcd.setCursor(0,1);
  lcd.print("www.libelium.com");    
  delay(1000);

  lcd.clear();  
  lcd.setCursor(0, 0);
  lcd.print("CPM=");
  lcd.setCursor(4,0);
  lcd.print(6*count);
  lcd.setCursor(7,0);
  lcd.print("Tc=");
  lcd.print(tdegrees);
  lcd.setCursor(0,1);
  lcd.print(radiationValue);

  attachInterrupt(0,countPulse,FALLING);

}

void loop(){
  
  if (millis()-timePreviousMeassure > 10000){
    if (alert){
      timePreviousMeassure = millis();
      lcd.clear();    
      lcd.setCursor(0, 0);
      lcd.print("Temperature alert");
      lcd.setCursor(0, 1);
      lcd.print("Core fussion");
      get_temp();
      
    } else {
    countPerMinute = 6*count;
    radiationValue = countPerMinute * CONV_FACTOR;
    get_temp();
    timePreviousMeassure = millis();
    Serial.print("cpm = "); 
    Serial.print(countPerMinute,DEC);
    Serial.print(" - ");
    Serial.print("uSv/h = ");
    Serial.println(radiationValue,4);      
    lcd.clear();    
    lcd.setCursor(0, 0);
    lcd.print("CPM=");
    lcd.setCursor(4,0);
    lcd.print(countPerMinute);
    lcd.setCursor(7,0);
    lcd.print("Tc=");
    lcd.print(tdegrees);
    lcd.print((char)223);
    lcd.print("C");
    lcd.setCursor(0,1);
    lcd.print(radiationValue,4);
    lcd.setCursor(6,1);
    lcd.print(" uSv/h");
    
    //led var setting  
    if(countPerMinute <= TH1) ledVar(0);
    if((countPerMinute <= TH2)&&(countPerMinute>TH1)) ledVar(1);
    if((countPerMinute <= TH3)&&(countPerMinute>TH2)) ledVar(2);
    if((countPerMinute <= TH4)&&(countPerMinute>TH3)) ledVar(3);
    if((countPerMinute <= TH5)&&(countPerMinute>TH4)) ledVar(4);
    if(countPerMinute>TH5) ledVar(5);

    count = 0;
    }
  }

}

void countPulse(){
  detachInterrupt(0);
  count++;
  while(digitalRead(2)==0){
  }
  attachInterrupt(0,countPulse,FALLING);
}

void ledVar(int value){
  if (value > 0){
    for(int i=0;i<=value;i++){
      digitalWrite(ledArray[i],HIGH);
    }
    for(int i=5;i>value;i--){
      digitalWrite(ledArray[i],LOW);
    }
    
  }
  else {
    for(int i=5;i>=0;i--){
      digitalWrite(ledArray[i],LOW);
    }
  }
}

void get_temp() {
  tdegrees = analogRead(A0)*5/1024.0;
  tdegrees = tdegrees-0.5;
  tdegrees = tdegrees/0.01;
  //print all through serial
  Serial.println("Temperature: ");
  Serial.print(tdegrees);
}
        

Raspberry Pi:

Code:
/*  
 *  Geiger Counter - Radiation Sensor Board
 *  
 *  Copyright (C) Libelium Comunicaciones Distribuidas S.L. 
 *  http://www.libelium.com 
 *  
 *  This program is free software: you can redistribute it and/or modify 
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or 
 *  (at your option) any later version. 
 *  
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License 
 *  along with this program.  If not, see http://www.gnu.org/licenses/. 
 *  
 *  Version:           1.0
 *  Design:            David GascĂłn 
 *  Implementation:    Jorge Casanova, Luis MartĂ­n
 */
 
#include "arduPi.h"

// Threshold values for the led bar
#define TH1 45
#define TH2 95
#define TH3 200
#define TH4 400
#define TH5 600

// Conversion factor - CPM to uSV/h
#define CONV_FACTOR 0.00812

// Variables
int ledArray [] = {10,11,12,13,9};
int geiger_input = 2;
long count = 0;
long countPerMinute = 0;
long timePrevious = 0;
long timePreviousMeassure = 0;
long countPrevious = 0;
float radiationValue = 0.0;


float tdegrees; //
int sensorPin = 0; // input for the MCP9700
int sensorValue = 0; // voltage value from voltage divider
boolean alert = false;

void countPulse();
void ledVar(int value);
void get_temp();

void setup(){
  pinMode(sensorPin, INPUT);
  pinMode(geiger_input, INPUT);
  digitalWrite(geiger_input,HIGH);
  for (int i=0;i<5;i++){
    pinMode(ledArray[i],OUTPUT);
  }

  

  printf("Radiation Sensor\n");
  printf("Board - Arduino\n");  
  delay(1000);

  printf(" Cooking Hacks\n");
  delay(1000);

  printf("www.cooking-hacks.com\n");
  delay(1000);

  printf("  - Libelium -\n");
  printf("www.libelium.com\n");    
  delay(1000);

  printf("CPM = %i\n",12*count);
  printf("Tc = %f\n",tdegrees);
  printf("%f\n",radiationValue);
  

  attachInterrupt(2,countPulse,FALLING);

}

void loop(){
  
  if (millis()-timePreviousMeassure > 5000){
    if (alert){
      timePreviousMeassure = millis();
      printf("Temperature alert\n");
      printf("Core fussion\n");
      get_temp();
      
    } else {
    countPerMinute = 12*count;
    radiationValue = countPerMinute * CONV_FACTOR;
    get_temp();
    timePreviousMeassure = millis();
    printf("CPM = %i\n",countPerMinute);
    printf("Tc = %f ÂşC\n",tdegrees);
    printf("%f uSv/h\n",radiationValue);
    
    
    //led var setting  
    if(countPerMinute <= TH1) ledVar(0);
    if((countPerMinute <= TH2)&&(countPerMinute>TH1)) ledVar(1);
    if((countPerMinute <= TH3)&&(countPerMinute>TH2)) ledVar(2);
    if((countPerMinute <= TH4)&&(countPerMinute>TH3)) ledVar(3);
    if((countPerMinute <= TH5)&&(countPerMinute>TH4)) ledVar(4);
    if(countPerMinute>TH5) ledVar(5);

    count = 0;
    }
  }

}

void countPulse(){
	
  count++;
  
}

void ledVar(int value){
  if (value > 0){
    for(int i=0;i<=value;i++){
      digitalWrite(ledArray[i],HIGH);
    }
    for(int i=5;i>value;i--){
      digitalWrite(ledArray[i],LOW);
    }
    
  }
  else {
    for(int i=5;i>=0;i--){
      digitalWrite(ledArray[i],LOW);
    }
  }
}

void get_temp() {
  tdegrees = analogRead(0)*5/1024.0;
  tdegrees = tdegrees-0.5;
  tdegrees = tdegrees/0.01;
}

int main (){
	setup();
	while(1){
		loop();
	}
	return (0);
}

        

Intel Galileo:

Code:
/*  
 *  Geiger Counter - Radiation Sensor Board
 *  
 *  Copyright (C) Libelium Comunicaciones Distribuidas S.L. 
 *  http://www.libelium.com 
 *  
 *  This program is free software: you can redistribute it and/or modify 
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation, either version 3 of the License, or 
 *  (at your option) any later version. 
 *  
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License 
 *  along with this program.  If not, see http://www.gnu.org/licenses/. 
 *  
 *  Version:           1.0
 *  Design:            David GascĂłn 
 *  Implementation:    Jorge Casanova, Luis MartĂ­n
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(3,4,5,6,7,8);


// Threshold values for the led bar
#define TH1 45
#define TH2 95
#define TH3 200
#define TH4 400
#define TH5 600

// Conversion factor - CPM to uSV/h
#define CONV_FACTOR 0.00812

// Variables
int ledArray [] = {10,11,12,13,9};
int geiger_input = 2;
long count = 0;
long countPerMinute = 0;
long timePrevious = 0;
long timePreviousMeassure = 0;

long countPrevious = 0;
float radiationValue = 0.0;


float tdegrees; //
int sensorPin = A0; // input for the MCP9700
int sensorValue = 0; // voltage value from voltage divider
boolean alert = false;

void setup(){
  pinMode(geiger_input, INPUT);
  digitalWrite(geiger_input,HIGH);
  for (int i=0;i<5;i++){
    pinMode(ledArray[i],OUTPUT);
  }

  Serial.begin(19200);

  //set up the LCD\'s number of columns and rows:
  lcd.begin(16, 2);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Radiation Sensor");
  lcd.setCursor(0,1);
  lcd.print("Board - Arduino");  
  delay(1000);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(" Cooking Hacks");
  delay(1000);

  lcd.clear();
  lcd.setCursor(0,1);  
  lcd.print("www.cooking-hacks.com");
  delay(500);
  for (int i=0;i<5;i++){
    delay(200);  
    lcd.scrollDisplayLeft();
  }
  delay(500);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("  - Libelium -");
  lcd.setCursor(0,1);
  lcd.print("www.libelium.com");    
  delay(1000);

  lcd.clear();  
  lcd.setCursor(0, 0);
  lcd.print("CPM=");
  lcd.setCursor(4,0);
  lcd.print(6*count);
  lcd.setCursor(7,0);
  lcd.print("Tc=");
  lcd.print(tdegrees);
  lcd.setCursor(0,1);
  lcd.print(radiationValue);

attachInterrupt(2,countPulse,FALLING);
}

void loop(){
  
  if (millis()-timePreviousMeassure > 10000){
    if (alert){
      timePreviousMeassure = millis();
      lcd.clear();    
      lcd.setCursor(0, 0);
      lcd.print("Temperature alert");
      lcd.setCursor(0, 1);
      lcd.print("Core fussion");
      get_temp();
      
    } else {
      
      
      
    countPerMinute = 6*count;
    radiationValue = countPerMinute * CONV_FACTOR;
    get_temp();
    timePreviousMeassure = millis();
    Serial.print("cpm = "); 
    Serial.print(countPerMinute,DEC);
    Serial.print(" - ");
    Serial.print("uSv/h = ");
    Serial.println(radiationValue,4);      
    lcd.clear();    
    lcd.setCursor(0, 0);
    lcd.print("CPM=");
    lcd.setCursor(4,0);
    lcd.print(countPerMinute);
    lcd.setCursor(7,0);
    lcd.print("Tc=");
    lcd.print(tdegrees);
    lcd.print((char)223);
    lcd.print("C");
    lcd.setCursor(0,1);
    lcd.print(radiationValue,4);
    lcd.setCursor(6,1);
    lcd.print(" uSv/h");
    
    //led var setting  
    if(countPerMinute <= TH1) ledVar(0);
    if((countPerMinute <= TH2)&&(countPerMinute>TH1)) ledVar(1);
    if((countPerMinute <= TH3)&&(countPerMinute>TH2)) ledVar(2);
    if((countPerMinute <= TH4)&&(countPerMinute>TH3)) ledVar(3);
    if((countPerMinute <= TH5)&&(countPerMinute>TH4)) ledVar(4);
    if(countPerMinute>TH5) ledVar(5);

    count = 0;
    }
  }

}


void countPulse(){
      count = 0;
  timePreviousMeassure = millis();
  while (millis()-timePreviousMeassure < 10000)
  {
    if(digitalRead(geiger_input) == 0)
    {
      count++;
      while(digitalRead(geiger_input) == 0); // do nothing until pin goes back to HIGH
    }
  }
  
  
}


void ledVar(int value){
  if (value > 0){
    for(int i=0;i<=value;i++){
      digitalWrite(ledArray[i],HIGH);
    }
    for(int i=5;i>value;i--){
      digitalWrite(ledArray[i],LOW);
    }
    
  }
  else {
    for(int i=5;i>=0;i--){
      digitalWrite(ledArray[i],LOW);
    }
  }
}




void get_temp() {
  tdegrees = analogRead(A0)*5/1024.0;
  tdegrees = tdegrees-0.5;
  tdegrees = tdegrees/0.01;
  //print all through serial
  Serial.println("Temperature: ");
  Serial.print(tdegrees);
}