Hi all,
I present you my Geiger counter project, now that it is done thanks to your help. (I use this lib and I wonder why it's not included in Energia)
I could reach over 350000 CPM (Counts Per Minute) with a rather hot Americium-241 source and the very alpha sensitive SBT-11A pancake probe (I checked, it's not light sensitive) (the displayed µSv value for that is not correct because not calibrated for Am-241), and in a theoretical test over 1.5mio CPM, so it is good to know the chip is fast enough, but I'm not sure what limits it (don't have oscilloscope).
There's a limit how many CPM can come out from a tube, called "dead time". For this pancake probe, which has a dead time of 25µs, it's 1s/0.0000025s = 40000 impulses per second = 2400000CPM, which is much higher than for a SBM-20 probe: 1s/0,000190µs*60 = 315789CPM. 2.4mio sounds a lot however and I'm not sure if it still could be reached, other limit factors aside.
Formula: (xCPM/60)/((xCPM/60)/(1-((xCPM/60)*0.000190))) = factor on how many impulses are registered.
Let's say we have 150000CPM:
for SBM-20: (150000/60)/((150000/60)/(1-((150000/60)*0,000190))) = 0,525 -> only 52,5% are registered.
for SBT-11A: (150000/60)/((150000/60)/(1-((150000/60)*0,000025))) = 0,9375 -> 93,75% are registered, so this is much better.
The last step is to put the chip on a breadboard and in a case.
#include "LCD_5110.h"
LCD_5110 myScreen(P2_4, // Chip Select * #3 on sparkfun breakout SCE
P2_3, // Serial Clock * #7 on sparkfun breakout SCLK
P2_2, // Serial Data * #6 on sparkfun breakout DN(MOSI)
P2_1, // Data/Command * #5 on sparkfun breakout D/C
P2_0, // Reset * #4 on sparkfun breakout RST
P2_5, // Backlight #8 on sparkfun breakout LED
PUSH2); // Push Button 2
#define LOG_PERIOD 10000
#define MAX_PERIOD 60000
long unsigned counts, cpm, cumulative;
unsigned int multiplier;
unsigned long previousMillis;
char string[10];
void count(){ counts++; cumulative++; }
long unsigned maxCounts=0;
float usv=0.0;
void setup() {
//=== LCD ===
myScreen.begin();
myScreen.setFont(1);
myScreen.text(0,0,"DeepBlueSky");
myScreen.text(0,2,"v1.0");
//=== geiger counter ===
counts = 0;
cpm = 0;
multiplier = MAX_PERIOD / LOG_PERIOD;
attachInterrupt(P1_2, count, FALLING);
}
char uSv[12];
int unsigned times; //this doesn't need to be long unsigned (in theoretical test it goes up to ~ 9000 [µSv/h] (= 9mSv/h))
void loop() {
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > LOG_PERIOD){
previousMillis = currentMillis;
cpm = counts * multiplier;
if(cpm > maxCounts)
maxCounts = cpm;
//CPM
sprintf(string,"%lu",cpm);
myScreen.text(0,0,string);
//CPM to µSv/h
unsigned long long count57 = 57 * cpm; // factor 0.0057 für SBM-20 tube
sprintf(string,"%u", (unsigned) (count57 % 10000));
times=cpm/176; //µSv number before . //this mysterious 176 comes out if you do 1/0.0057, and so when you divide cpm/176 you get the number before the dot, e.g. 1000CPM/176=5 (no rest)
sprintf(uSv,"%d", times); //start concatenating the number -- add number before . (dot)
strcat(uSv,"."); //add .
strcat(uSv,string); //add number after .
myScreen.text(0,2,uSv);
memset(uSv,0,sizeof(uSv)); //clear µSv array
//maximum CPM
sprintf(string,"%lu",maxCounts);
myScreen.text(0,4,string);
//cumulative -- dosismeter //with setFont(1) we can only fit three rows on the LCD, use setFont(0) if you want
//sprintf(string,"%lu", cumulative);
//myScreen.text(0,4,string);
counts = 0;
}
delay(LOG_PERIOD);
myScreen.clear();
}