Geiger Counter to Excel in Real Time

Got the enclosed Sketch from “thegeekgroup”. It will gather the data that I need.

How do I send this data from one Arduino Uno/Xbee (series 1) hooked to the Geiger Counter to another Arduino Uno/Xbee (series 1) hooked to the computer.

I know how to hook things up and put the data in a .txt file but am not smart enough to write the additional code for either Arduino/Xbee.

Any help would be very much appreciated.

//CPS Sketch int count = 0; void setup() { Serial.begin(9600); pinMode(2, INPUT); digitalWrite(2, HIGH); attachInterrupt(0, count_isr, FALLING); } void loop(){ int i; delay(1000); i = count; count= 0; Serial.println(i);

}

void count_isr(){ count++; }

Please use the # icon when posting code.

It will gather the data that I need.

Are you sure. This bit can potentially miss counts:- i = count; count= 0; Serial.println(i); If a count occurs between the first and second lines you will miss it. Why not just keep on sending the accumulation of counts and subtract the previous sample from it at the other end or even at the arduino.

and put the data in a .txt file

Just change the file type to .csv for a spread sheet.

Why are you using a second arduino you can connect the xbee direct to the PC through a USB / serial bridge.

Do not want to miss any counts. Want to enter counts per second in an Excel spread sheet. Not sure how to make the code changes you suggest.

Will now use a .csv file.

Was using the second Arduino because I didn't know any better. I have a Sparkfun USB/serial bridge, will use that.

Thanks!

int last_count;

Not sure how to make the code changes you suggest.

long int last_count
void loop(){
long int i;
delay(1000);
i = count;
Serial.println(i-last_count);
last_count = i;
}

also make the count variable a long int instead of an int.

Do not want to miss any counts

You will that's physics, it is caused by the dead time of the GM tube. Are you going to apply a dead time correction in the spread sheet?

Only getting about 4 CPS background out of the GM tube and it has a fairly short dead time. So missed counts due to dead time won’t be much of a problem.

Hope the counts on the spread sheet are close to the digital meter on the counter. I do not plan to apply a dead time correction.

Will let you know how the code changes you suggested work. Might be tomorrow.

Very much appreciate your help!

Found PLX-DAQ and it works great with Excel over Xbee with the test Sketch below. //Arduino PLX Test


int val = 0; int val1 = 0; void setup() { Serial.begin(9600); // opens serial port, sets data rate to 9600 bps //int val = 0; Serial.println("CLEARDATA"); }

void loop() { Serial.print("DATA,TIME,"); Serial.println(val1); val1 = random(0, 100); delay(3000);

}

When I upload the CPS Sketch below nothing shows up in Excel. What am I doing wrong?


//CPS Sketch int count = 0;

void setup() { Serial.begin(9600); pinMode(2, INPUT); digitalWrite(2, HIGH); attachInterrupt(0, count_isr, FALLING); }

void loop(){ int i; delay(1000); i = count; count= 0; Serial.println(i);

}

void count_isr(){ count++; }

The trick in posting code on this forum is that the code has to be between the brackets that pop up when you click the # icon.

You are not printing any comers in the second sketch.