Thursday, September 03, 2009

Homemade Muon Detector, Arduino and Max/MSP


I am fortunate enough to be borrowing a homemade muon detector from my friend Robert Hart of Hardhack.org.au, co-founder of Adelaide Dorkbot and all-round electronics and mechatronics guru.

You can find out more about the particular version of the muon detector that I have been experimenting with here: http://hardhack.org.au/geiger_muller_detector.

The basic concept is to use coincidence detection to filter out terrestrial radiation and leave only data that indicates cosmic radiation.

Today I got around to hooking the device up to my computer via an Arduino board. The model that I am borrowing has three Geiger-Müller tubes, and as such there are two main signals that I would be interested in, namely a coincidence detection for the top and middle tubes, and a coincidence detection for the middle and bottom tubes.

In terms of reading this data via the Arduino, it is actually quite a simple affair. I have connected the three coincidence outputs (top && middle, middle && bottom and ((top && middle) || (middle && bottom))) to Arduino pins 8, 9 and 10. These pins are equavalent to PORTB bits 0, 1 and 2.

Since the output from the detector is a 5V logic signal with a positive signal indicated a coincidence detection, it is then simply a matter of reading the output from PORTB via the PINB command, comparing this reading to the previously-sampled reading, and if the newer reading is different, then printing it via the serial port to the main computer.

The Arduino code is as follows:

byte previous;
byte data;

void setup() {
Serial.begin(57600);
DDRB = B00000000;
PORTB = B11111111;
}

void loop() {
if(PINB != previous) {
previous = PINB;
Serial.print(previous, BYTE);
}
}


It is then simply a matter of using software such as Max/MSP to read the byte and react accordingly. The simplest Max/MSP patch that will decipher the signals into bang triggers is this:

To explain the patch briefly, the metro 3 object is consistently querying the serial a 57600 object whether new data is in the serial input buffer. If there is, the serial a 57600 sends the incoming byte out of its left outlet.

Since the interest lies in bits 0 and 2 (the top && middle and middle && bottom signals), those bits need to be isolated. By first shifting the byte an appropriate amount, and then taking the modulo 2, the specific bits can be easily isolated and dealt with.

The change objects prevent false triggers. The sel 1 objects simply make it so that every transition in the logical signal from a 0 to a 1 will trigger a bang.

3 comments:

Unknown said...

sonification great potential. could you vary pitch for muons of discrete energy levels. That would make great music!!!

Unknown said...

Sonification great. Could you vary pitch with muons collection at discrete energy levels. That would be true space music !!!

outsidein said...

This is really neat,Thanks for sharing. How do you filter out the cosmic radiation from background radiation signal?