Go Down

Topic: Geiger counter/Scaler program questions. (Read 5 times) previous topic - next topic

Radioactive

I need to count pulses from a Geiger counter as square waves to produce a scaler/ratemeter for the Geiger counter.

A Geiger counter creates pulses but does not actually count them a Scaler would actually count the number of pulses each Minuit and store the values then average them.

I have some rather dreamy aspirations about a fully programmable program in the future that allows the operator to program in calibration constants and dead times of various probes including my Lucas cell for measuring radon gas up to about 20,000 pulses a second.

But for now I must learn how to walk so my goal for the moment is to be able to record my normal background radiation of around 17 counts per minuet once every minuet to a terminal emulator on a laptop I have a couple Unos and the experimental board now with the SD shield board in the mail. The Graph program is up and running on the 1st Uno with a pot that can change the numbers on realterm.

The GM-10 geiger counter will be used in my first experiments as it only needs a 5 volt source and its output is square waves.

My background is electronics engineering with a specialization towards GM counters and Scintillation counting with photomultiplier tubes, I have some basic programing knowledge in Basic and PLCs.

TIA.

Tracy, AKA Radioactive.
 
A human being should be able to change a diaper, Plan an invasion, Butcher a hog, Con a ship, Design a building, Write a sonnet, Balance acc

Grumpy_Mike

I am not sure about getting a square wave from a GM tube it is more like a pulse.
I would recommend that you get one edge of this signal to trigger an interrupt and let the ISR do the counting. Then use the millis() timer to see how many counts you get in a second to give you the rate.

http://www.arduino.cc/playground/Code/Interrupts


Are you going to incorporate dead time correction or do you want just the raw rate you read?

Radioactive

Mike I already have signal conditioning circuitry in place to convert the pulses into square waves with the GM-10.

http://www.blackcatsystems.com/GM/products/GM10GeigerCounter.html

For the moment I would be happy to just count pulses to the terminal emulator as I learn my way around the programing.

Thanks.

Tracy
A human being should be able to change a diaper, Plan an invasion, Butcher a hog, Con a ship, Design a building, Write a sonnet, Balance acc

retrolefty

#3
Feb 26, 2011, 07:54 am Last Edit: Feb 26, 2011, 07:56 am by retrolefty Reason: 1

Mike I already have signal conditioning circuitry in place to convert the pulses into square waves with the GM-10.

http://www.blackcatsystems.com/GM/products/GM10GeigerCounter.html

For the moment I would be happy to just count pulses to the terminal emulator as I learn my way around the programing.

Thanks.

Tracy


Then basically you just need to look at the various frequency counter sketches that people have developed to see which best meets your present and future needs. It's the same task with just different timebase being used, pulses per min Vs cycles per second. just do a "arduino frequency counter" search and I'm sure lots of sketches will show up.

Lefty


Lefty

Radioactive

You only need pins 2,3 and 4 from the GM-10, 2 = Signal or pin 5 on the digital i/o, 3 = gnd and 4 = +5 volts.

I have this sketch up and running it creates a text file on the sd memory that it stores the readings to.

Code: [Select]
// Geiger Counter Lib example

/* Adapted by Tracy Albert from programing for a frequecy counter by,
  Martin Nawrath KHM LAB3
  Kunsthochschule f¸r Medien Kˆln
  Academy of Media Arts
  http://www.khm.de
  http://interface.khm.de/index.php/labor/experimente/
*/
#include <FreqCounter.h>
#include <SdFat.h>
#include <SdFatUtil.h>

Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;
void setup (void);
unsigned long frq;
int cnt;
int pinLed=13

// store error strings in flash to save RAM
#define error(s) error_P(PSTR(s))
void error_P(const char *str)
{
  PgmPrint("error: ");
  SerialPrintln_P(str);
  if (card.errorCode()) {
    PgmPrint("SD error: ");
    Serial.print(card.errorCode(), HEX);
    Serial.print(',');
    Serial.println(card.errorData(), HEX);
  }
  while(1);
}

void writeCRLF(SdFile &f)
{
  f.write((uint8_t *)"\r\n", 2);
}
/*
* Write an unsigned number to a file
*/
void writeNumber(SdFile &f, uint32_t n)
{
  uint8_t buf[10];
  uint8_t i = 0;
  do {
    i++;
    buf[sizeof(buf) - i] = n%10 + '0';
    n /= 10;
  } while (n);
  f.write(&buf[sizeof(buf) - i], i);
}
/*
* Write a string to a file
*/
void writeString(SdFile &f, char *str)
{
  uint8_t n;
  for (n = 0; str[n]; n++);
  f.write((uint8_t *)str, n);
}
void setup(void){
  pinMode(pinLed, OUTPUT);

  Serial.begin(9600);        // connect to the serial port
  Serial.println("Geiger Counter");

  // initialize the SD card
  if (!card.init()) error("card.init");
 
  // initialize a FAT volume
  if (!volume.init(card)) error("volume.init");
 
  // open the root directory
  if (!root.openRoot(volume)) error("openRoot");

 
}
  void loop(){
// create a new file
  char name[] = "WRITE00.TXT";
  // wait if any serial is going on
  FreqCounter::f_comp=10;   // Cal Value / Calibrate with professional Freq Counter
  FreqCounter::start(60000);  // 1 minuit Gate Time
  while (FreqCounter::f_ready == 0)
   frq=FreqCounter::f_freq;
  Serial.print(cnt++);
  Serial.print("  cpm: ");
  Serial.println(frq);
    delay(100);
  digitalWrite(pinLed,!digitalRead(pinLed));  // blink Led
  //cntc=cnt

//----------------------------------------------------------------------------------------------- 

  for (uint8_t i = 0; i< 1000; cnt++){
   name[5] = i/10 + '0';
   name[6] = i%10 + '0';
   if (file.open(root, name, O_CREAT | O_APPEND | O_WRITE)) break;
   
  if (!file.isOpen()) error ("file.create");}
  // write 100 line to file
  for (uint8_t i = 0; i < 100; i++){
    writeNumber(file, cnt);
    writeString(file, " cpm ");
    writeNumber(file, frq);
    writeCRLF(file);
 
  // close file and force write of all data to the SD card
  file.close();}

}


I am still working on the cvs file version.
A human being should be able to change a diaper, Plan an invasion, Butcher a hog, Con a ship, Design a building, Write a sonnet, Balance acc

Doomy

Hi Radioactive.

Maybe you can find interesting the new board launched this week by Libelium: Radiation Sensor Board for Arduino. With your experience in the program code you can help us to improve this board.

Thanks!

Go Up