The hardware is simple, a 100nF dc blocking cap to block the ~2.4V DC bias on the output and a 10K:10K voltage divider to step down the ~9.6V to <5V suitable for TTL/USB communication. Corrected output is fed into the Arduino's pin3 and a ground/return wire is run between the arduino and GM detector for continuity.
The software was relatively straight forward for the counter. It simply increments a variable each time a pulse is detected and sends the total to the serial monitor at a set interval. Note that no delay command was used since it needs to count pulses while timing. I also programmed in an indicator LED to pin13 which had a built in led on the Uno. I had to code in hysteresis, which took me several hours, for this LED as the ~<10mS pulses are too short for our eyes to see well. This involved an entirely separate timer routine and some creative coding to toggle states efficiently.
Here's the links to download the .txt files with the arduino code.
General Purpose Pulse Counter
General Purpose Pulse Counter
Note that the LED will appear continuous above about 30Hz. You can set the time period and make adjustments to better suit your needs, but remember that I'm only transmitting data from the arduino via the serial port, not to it, so you'll need to push new code for each change.
As well as this works I may look into picking up a cheap USB-RS232 converter and DC-DC converter to step up the 5V from USB to 12V so that I have a more compact all in one, always on radiation monitor. I don't want to tie up my only arduino, and as is this is taking my best breadboard and bench supply to power!
7/20/14 UPDATE: I noticed that when used for a geiger counter scaler that the readings were a bit high. When I was writing the program I was concerned that the entire loop might be executed so fast as to have multiple triggers for the same pulse. This was confirmed with single pulse testing. I revised the code to include a delay line that prevents multiple triggering. There is now a user changeable variable that sets a dead time before the arduino will count an additional pulse. This is set to 100uS by default but easily changed to suit your needs. For non square pulses keep in mind that the arduino's digitalRead triggers on about 2.0V, so just have it for as long as the waveform is above 2V. I've also revised the serial output code for better visuals when used as a geiger counter and added in the function of dose rate conversion. Simply put in the counts per microRem into the GMsensitivity variable and it will do the math for you. To not clutter things there are now two .txt files, one for generic counter, and one for geiger counter. Enjoy!
No comments:
Post a Comment