Gamma spectroscopy using an MCU and the Arduino IDE

Hi there,

this is a nuclear physics project I've been working on for quite some time.
As you might know there are multiple different kinds of ionizing radiation, the most well-known being alpha, beta and gamma radiation.

All of these can be detected using different methods of measurement, an example would be Geiger counters that use a special Geiger-Müller tube to count the number of ionization events. The special thing about gamma radiation is that the energy of the resulting photons is specific to the nucleus it originated from meaning if you measure the gamma-ray energy you can tell exactly which atom (nucleus) it came from. This way you cannot only tell how much radiation is "produced" by a sample - you can also properly define the unstable elements in your sample.

Now the problem with gamma-rays is that they cannot be detected easily by your average camera and they also penetrate most materials with ease. Using a special crystal called a "scintillator" you can convert some of the high-energy photons to visible light with the amount of photons being directly proportional to the gamma energy. This way, with a sensitive enough detector, you can measure this light and determine the element of origin by looking at the number of photons.

I have designed a so-called scintillation counter which uses this exact effect. All of it is open-source so you can download the repository from GitHub and get started immediately. All of the hardware and software, as well as production-ready files can be found there:

The heart of this detector is a Raspberry Pi Pico microcontroller which I chose because of the outstanding cost/performance ratio. Before that I used an Adafruit Itsy Bitsy M4 which cost 3x as much and had essentially the same ADC performance (most important for this project obviously). Programming is done using the Arduino IDE and Earle Philhower's great Arduino-Pico core, you can check it out here:

This way you have full control over the Pico's features while still utilizing the easy-to-use Arduino IDE instead of the much more complex pico-sdk.

More info about this project is on the GitHub repo I've linked above. There you can find a much more in-depth description of the detector and further reading like datasheets and so on.

1 Like

Looks interesting! Would you mind telling us where you purchased the LYSO crystal and posting pictures and construction details of the actual crystal/APD detector setup?

Sure! I got all of my scintillators from eBay. The LYSO crystal was from a US seller, the NaI(Tl) one that I'm using right now from a russian seller. Just search for them, you'll definitely find some although it might be quite a bit more difficult now depending on your region. Most of the used scintillators that you can get cheaply in Europe are from Russia and Ukraine, so yeah...

About the crystal setup: The finished SiPM carrier board is there to allow for easier packaging with the scintillator as well as to be reusable for different detectors as that's by far the most expensive part. You'll want to apply some optical coupling compound between the SiPM and the crystal window to reduce reflections as good as possible. There are also sellings on ebay for special materials but you can use some standard silicone grease - works great for me. After you applied some, you press both parts together and wrap everything with light-tight tape, again, I'm just using some black electrical tape here. That's it essentially, now you plug the board in and you're ready.

I cannot show you the exact buildup as I've already assembled everything, but I made some pictures of the end result. The PCB is a bit too large for the small scintillator (18x30 mm) so I just wrapped everything even more ;). And please ignore the ugly pin headers on the detector, these are only there for debugging. I can only upload one image (new user restriction) so here you go, hope it helps.

Thanks, but I meant that the details should be posted on your Github site.

True, good idea. Totally forgot about that.

I found the Theremino site to be a pretty good example of information content for DIY projects like gamma ray spectroscopy, although it could be better organized.

https://www.theremino.com/en/blog/gamma-spectrometry

I made some additional changes to the software (i.e. the Arduino sketch) to include some serial commands for settings and also a much faster Geiger mode where you only get the counts per second readings without the energy information. It's all in the repo's README, which should be a bit more clear about what to do too.

In addition to the detector itself, I specifically made a web-app/multi-channel analyzer front-end for this project to visualize the realtime spectra, do energy calibrations and so on... Of course it's also all open-source software and can be used with any serial device, but I don't want to go into much more detail here, cause it's the Arduino forum after all ^^

I completely forgot to mention that I made a hackaday project page for this and a newer version of the detector board will hopefully arrive soon (thanks global chip shortage):

I'm probably going to use this as my main channel of pushing updates further down the line! :slight_smile:

Quick update if you haven't followed all the changes on hackaday or GitHub!

I refined most of the electronics, changed the whole layout and mechanical design (small scintillators can now be strapped to the board to make it a single piece, yay!) and also added many features to the Arduino sketch, i.e. the device firmware. There are now many more serial commands you can send to the Pico to control it. Also thanks to the great arduino-pico project there is now support for the Raspberry Pi Pico W through the Arduino IDE too! There's so much potential there since it's a simple drop-in replacement :slight_smile:

For a more extensive look on what changed I think it would be best to look at the GitHub repo and all of the Hackaday logs.

In addition to that, I'm very happy to announce that the board can now be purchased here thanks to my partner makerfabs! This includes the whole main detector board with the Raspberry Pi Pico and all. You'll only need to buy the scintillator and SiPM separately to get started.

You can also build one on your own by purchasing all the parts with the help of the Kitspace page which does automatic BOM searches and all that.

Cheers!

1 Like

Really hyped for all the possibilities the Pico W offers now, thanks again to Earle Philhower and his great Arduino-Pico library APs, wireless connections, OTA updates and much more are already supported from within the Arduino IDE!

It's a drop-in replacement so the hardware footprint is indentical and much of the software also stays the same, however, the wireless capabilities really add so many new features, I'm so excited :slight_smile:

In the meantime I added support for your standard 32x64 px OLED displays. The full spectrum and some additional info is shown and refreshes periodically. Here's a photo of what this looks like:

If you have the latest firmware, the OLEDs will be used by default so you don't even have to enable anything :slight_smile:
You can also slightly modify the code to use different size OLEDs. It's important that they're SSD1306 driven, though!

I also uploaded the complete default firmware to GitHub so that you can drop all the Arduino coding and drag-and-drop the software onto the device more easily. There is a version with and without the reference in use. The rest are the default parameters.

New Update!

I did some testing with the Arduino-Pico library and all the different compiler and overclock options. The results are honestly pretty amazing, you can squeeze so much additional power out of the Pico! I've uploaded an overclocked firmare to GitHub that you can try out if you want to.

In addition to that, I've worked on a 3D-printable case with a colleague and all the design files are now also available on GitHub. There's room for up to a 5x5x5 cm scintillator and some electronic hacks, so have fun :slight_smile:


And last but not least, I've added a true random number generator to the firmware. Once you enable the function, it will output random 8-bit numbers, i.e. 0-255, to the Serial port as soon as they come in. You can expect the amount of generated random numbers per second to be your cps / 3 / 8. For 25 cps this would mean about 1 random number per second. You can use this and seed a pseudorandom generator every second to get more numbers out of it with decently improved entropy :+1:

Since the last update here I've done some changes to the Arduino firmware, especially to the serial commands. If you've not been following on Hackaday, I have listed all the big changes there. Also, I added an optional true random number generator to the serial commands, so you can generate numbers using radiation, yay! I could use some help, though, because the number 0 is quite overrepresented for now. I don't know what's causing this, but the rest looks just fine as expected.

And I also just wanted to let you know, that the Open Gamma Detector is now officially certified open hardware! :smiley:

oshw

I'm, by the way, also looking into building a new revision of the detector just now. I'm still waiting for parts to test the first changes, so expect some new updates some time after new year. Till then, merry Christmas and a happy new year! :slight_smile:

Another quick update: In order to not just copy and paste posts from my Hackaday, I have selected one from the logs for you. This is one of the posts that I feel is one of the more important ones -- I tested the energy resolution and range with my new detector prototype and it looks very good, yay! :smiley:

I made a great comparison measurement with an old Rev. 2 detector and my Rev. 3 prototype. Of course again with my obligatory Lu-176 source (aka 2 LYSO scintillators) that you've seen many times now lol.

Gain and SiPM voltage are identical here, as can be seen from the uncalibrated recording. Both detectors also have the same SiPM (MicroFC 6 mm) and scintillator (Russian 18 x 30 mm NaI(Tl)) installed. I recorded for an hour for the raw background and another hour with the Lutetium.

In principle, the two backgrounds look very similar. But you can see that the new spectrum begins further to the left, has a longer "plateau" in front of the actual curve and also ends significantly further to the right (near 4096 vs the old 3800).

The same scheme can be seen for the uncalibrated Lu-176 spectrum, only that the annoying spike of the old board at the beginning of the measuring range is not present here. I could have set the discriminator higher, but then the range would be even more limited than it already is.

Here you can also see the clear improvement in energy resolution that I have already mentioned in previous logs. The spectra are of course still a bit rough in general, this is simply due to the short measurement time.

And finally the calibrated spectrum: I did that to emphasize the new measuring range again. This is certainly not the most accurate calibration (I only took the 202 and 307 keV peaks roughly), but you can already see a clear difference.

I feel like there isn't much to test anymore, the new revision is looking great so far. Keep you updated! :wink:

Proud to announce that the newest hardware revision of the detector is now available! There are loads of improvements aimed at usability and performance as well as versatility. Listing all of them would definitely go overboard here. But I have written a complete changelog on Hackaday, so if you want to have a look here you go: Here comes 3.0! | Details | Hackaday.io

Anyways, a picture is worth a thousand words so here is a 30 minute Lu-176 spectrum done with the newest boards. You can see, the energy resolution @ 300 keV is already at <14% which is much better than before:

As always the complete, updated hardware and software can be downloaded from GitHub. Happy tinkering! :slight_smile:

1 Like

Just got some test results back using a Cs-137 source and the newest 2x2 SiPM array board (OpenGammaProject/MicroFC-SiPM-Array-Board).

<8% energy resolution with a 6.6% NaI scintillator. I'm pretty happy with the results! :smiley:


Here is another great example for a handheld device. A user called RobertD did a short project showcase of his very professional-looking spectrometer. Here is a link to the posts: https://www.gammaspectacular.com
(If linking other forums is inappropriate in any way for the moderators, I'll happily remove the link. Just wanted to let you know and didn't want to copy-paste another user's content)

I think it looks amazing!

I also just added new ticker support for the device via a standard passive buzzer! :smiley:

If you're used to commercial (mobile) devices or ever heard a Geiger counter clicking, you'll feel instantly familiar with the sound. This way, the count rate can be translated into an audible tone with which you can easily (only roughly of course) assess your surroundings.

1 Like

For newcomers, here is the essence of how to calibrate the Open Gamma Detector. If you have your complete device with a scintillator, you only need a sample that has well-known gamma-ray energies. You can use these to calibrate the bin axis and then export the calibration.

In this video I'm using two tiny LYSO scintillators as a Lu-176 source. This isotope has two very well-known gamma peaks that are ideal for a very simple linear calibration.

Since the last update, I've added SH1106 OLED display support on top of the existing SSD1306 support. I've also decreased the tick rate to only enable the buzzer on every 10th pulse. That way it's much more calm in background scenarios and you get 10x the range, yay! :slight_smile:

I've also created a new, tiny MicroFC 6mm SiPM carrier board that is only 10x10mm large and hosts an optional RC low-pass filter as always. It's also rectangular which can help when working with scintillators that are close to the size of the board.

It's all open source of course and already available on Kitspace if you want to grab one: GitHub - OpenGammaProject/Tiny-MicroFC-Carrier-Board: 🎒 Tiny carrier board for a 6 mm C-Series MicroFC-60035 silicon photomultiplier.