For our Project we are making a rocket, I'm in charge of the payload part of it. So we got Arduino uno and the NGMC-V1 Geiger counter and realized we didn't know what we were getting into too. we need a code to work with our project but we don't have any luck trying to find one anywhere.
We don't much about Arduino or the codes and need help.
Does anyone know where we can find one?
The Geiger counter outputs pulses on the INT pin, so you need to count those pulses for a period of time, usually for 1 minute, to get counts per minute.
This forum thread had code in reply #1, which had a couple of errors that I tried to fix and some junk that I removed. I don't have a way to test it.
Connect INT on the Geiger counter to D2 on the Arduino.
Connect the grounds. Power the Geiger counter with 5V as described on eBay.
#define LOG_PERIOD 60000UL //unsigned long logging period in milliseconds, recommended 15000-60000.
volatile unsigned long counts=0; //variable to count GM Tube events *** don't forget "volatile" ***
unsigned long previousMillis=0; //variable for time measurement
void tube_impulse() { //procedure for capturing events from Geiger Kit
counts++;
}
void setup() { //setup procedure
Serial.begin(9600); // start serial monitor
Serial.println("Geiger counter");
pinMode(2, INPUT_PULLUP); // set pin INT0 input for capturing GM Tube events
attachInterrupt(0, tube_impulse, FALLING); //define external interrupts
}
void loop() { //main cycle
unsigned long currentMillis;
currentMillis = millis();
if (currentMillis - previousMillis > LOG_PERIOD) {
previousMillis = currentMillis;
Serial.println(counts); // send counts data to serial monitor every LOG_PERIOD milliseconds
counts = 0;
}
}
Note: if this is going into a rocket, and you want it to actually WORK in that rocket, you will need to solder all connections. NO jumpers or breadboards.
That program prints out counts accumulated every 60 seconds. To see the data you have to connect the Arduino to a computer running a terminal program, or Arduino Serial Monitor.
Try using the same computer as you did for uploading.
If all this is unfamiliar to you, start with the simple examples that come with the Arduino IDE (the software development package) and learn how Arduino works.