The Bonse Hart USAXS instrument is coming along nicely, and the expectation is that we can start using X-rays pretty soon. One missing element in my detector electronics chain, however, is a counter and rate-meter. Normally, one would buy these as NIM modules, in which case they are very nice, reliable and expensive (for example the Canberra 512 one which will cost on the order of 5 kEuro, and a similarly priced ratemeter module would be required as well). Alas, such money is not available in my budget at this time, so an alternative solution had to be found.
Those of you who are following my Twitter stream (user @drheaddamage) will have seen the occasional tweet on the solution: letting the counting and ratemeting be done by an Arduino (or rather, a Ruggeduino variant, which is an Arduino for stupid people like me who like to make many mistakes in electronics engineering). I am happy to say that the project is now pretty much complete, with only the actual integration in the detection chain left to do (edit: this has now been done, and it works if the 100kOhm resistor connected to the BNC is replaced by a 120 Ohm resistor. Otherwise it will not detect the short pulses emanating from the Single Channel Analyser (SCA) module.).
The concept is straightforward: Sense the rising edge of a pulse coming in on one pin and count it. Simultaneously, keep track of the time spent actually counting (i.e. not the time spent on other administrative tasks) and be ready to export this information through the serial port to the controlling computer.
As it turns out, this is easy to do with an Arduino Uno, as it has two pins that can do event-based operations. Simple wiring, with the occasional resistor thrown in to help keep things under control (though this is not strictly required in the Ruggeduino) and a lot of crossed fingers when it is actually put into action may just do the trick.
The attached picture (Figure 1) shows the Arduino in its semi-permanent state, mounted in a NIM module. This module used to be an Ortec high voltage power supply, but turned out to be broken. The potentiometer, LEDs, switches and NIM and BNC connector have been reused. Testing with a signal generator showed a counting capability up to about 100000 counts per second, which is also pretty much the limit of my scintillation counter. Serial overhead seems to be very small so intermediate readout of the counter is no problem. I, for one, am quite excited to see if this all will work!
If anyone is interested in the code, it can be downloaded here: Counter_and_ratemeter_v0p2. It is not neat code, but I tried to keep it organised and legible. The connection diagram is hand-drawn and shown in Figure 2.
I have to agree with Pete Jemian, who noted that “the prospect of low-cost control systems involving Linux, EPICS, and the Raspberry Pi with Arduino or BeagleBone I/O boards has begun a new generation in value automation systems”. Let’s see what other (ab-)uses we can find for these things in the X-ray sciences! As always, questions and comments are very welcome below.