# Needing more than a spark test?



## graham-xrf

I have some chunks of nice steel, 31mm thick and 120mm x 60mm (about 1.2" thick and 4.7" x 2.3").
The 31mm apart faces are parallel to within a tenth thou, so they are sometimes handy as a sort of fat parallel, but the perimeters are not as in a rectangular block. They have the profile of whatever hydraulic pump kit they were originally destined for.

They don't rust - so not just some nearly tool steel.
They are magnetic, so mostly iron in there.

It seems there is not much between the "spark test" on a grinder, and some expensive kind of analysis.
I can't afford one of those FLIR things which are only cost-effective if they are identifying exotic stuff all all day long.
Trying for density once let me identify a nice chunk of titanium, but I did have some other clues.

Is there some lower cost way of figuring out what is in the alloy?


----------



## RJSakowski

A good question.  As far as I know, no there isn't.  The problem with identifying steels is that the alloying elements are usually not found in significant percentages and that many are common to an multitude of alloys so a simple qualitative test isn't sufficient.

My very first chemistry course lab in collage was qualitative analysis.  Back then, this was usually done by dissolving a sample in acid and adding various reagents to create a signature reaction.  My recollection is that the transition elements of which the major steel alloying metals are members were particularly difficult to identify.

One test that might be used is a flame test.  It consisted of dipping a  small platinum or nichrome loop into a dissolved sample and the placing the loop in a flame from a Bunsen burner.  Different elements will color the flame differently.  Unfortunately, it doesn't work with all elements.








						Metal Ion Flame Test Colours Chart
					

This graphic looks at the colour of various metal and metalloid ions that occur during flame tests. Most people probably remember doing this experiment in school chemistry lessons, if not with the …




					www.compoundchem.com
				




Once an element was identified, then you have to analyze it for the particular amount in the alloy.  My first professional job was as an analytical chemist designing analytical procedures for various materials.  Many of the elements will interfere with each other, making an analysis difficult.  A method known as polarography was used to perform some of these analyses.  Another tool that we used was emission spectroscopy. that provided a relatively quick means of identifying materials.  It consisted of placing a dissolved sample in a carbon cup and firing high voltage through the sample.  The resultant light was captured and its spectrum recorded on a photographic plate.  Unfortunately, the cost of an emission spectrograph is beyond the reach of any except large laboratories.

All this testing provided job security for chemists in the past.  Which is why x ray fluorescence is the tool of choice today.








						Handheld XRF Spectrometers for Elemental Analysis
					

Handheld X-Ray Fluorescence (XRF) analyzers have the capability to quantify or qualify nearly any element - from Magnesium to Uranium.




					www.bruker.com


----------



## homebrewed

Here's a description of a "DIY" XRF setup:  DIY XRF. It uses americium capsules from smoke detectors as the X-ray source. But you'd still need to get your hands on a PMT and scintillator crystal, and be willing to spend a lot of time messing with it (getting it to the point of making quantitative measurements would be a heavy lift for a DIYer). Make sure you have some lead-lined shorts .


----------



## graham-xrf

I have only 0.9 mirocuries of Americuim 421 here on my desk, and possibly 2 microcuries down in the garage.
I have 2 photomultiplier tubes with the green flourescent back screens laying about in the cellar. Three if you count the cheap Russian night-sight. Honestly - I think there may be easier ways of making a pulse of X-Ray.

You are right about it being a DIY heavy lift attempt. Pity one needs X-Rays.

I am OK to dissolve a bit of this stuff, and try some flame test. The only platinum wire I have is a bit thin, it being from platinum-rhodium thermocouple, but it may do. I have sulphuric (OK - sulfuric) acid. It kind of pre-supposes all the alloy metals in there can end up as some sort of sulfate, no matter the valency.

Maybe if I can at least discover some of the alloy metals in there, then try a thin piece for melting, and see what happens if I heat-treat a bit to see if it self-hardens or something. It may narrow down the possibles. Given that it does not rust, there might be nickel, chromium, molybdenum maybe.


----------



## graham-xrf

@RJSakowski : The flame test looks somewhat limited when we are after the steel alloys.
Is it realistic to conduct a chemical test for these, just assuming they are there, even if they prove not to be?

A first test for iron can yield a percentage, which then immediately reveals the remainder proportion being all the alloying elements?

Would the Curie temperature of the mix be a tell-tale as to which steel it might be?
If it corresponds to a known steel mix, the thing is revealed. I have visions of heating a lump of it, with a thermocouple stuck into a drilled hole, until a magnet lets go. Hmm.. we need the magnet material coupled in a way that the magnet does not die first!

In any case, any one of the XRF hand-held fancy kits is likely to cost a whole lot more than my entire machine, and all it's bits!


----------



## ericc

I don't think that the Curie temperature will tell you that.  This is more of a decalescence thing.  You have to have a good eye and a precise temperature reading to do this.  One could possibly do it with a muffle furnace and an accurate pyrometer.


----------



## RJSakowski

graham-xrf said:


> @RJSakowski : The flame test looks somewhat limited when we are after the steel alloys.
> Is it realistic to conduct a chemical test for these, just assuming they are there, even if they prove not to be?
> 
> A first test for iron can yield a percentage, which then immediately reveals the remainder proportion being all the alloying elements?
> 
> Would the Curie temperature of the mix be a tell-tale as to which steel it might be?
> If it corresponds to a known steel mix, the thing is revealed. I have visions of heating a lump of it, with a thermocouple stuck into a drilled hole, until a magnet lets go. Hmm.. we need the magnet material coupled in a way that the magnet does not die first!
> 
> In any case, any one of the XRF hand-held fancy kits is likely to cost a whole lot more than my entire machine, and all it's bits!


Graham, Last things first,  Yes, a quick check on eBay shows xrf testers in the $6K range.  Well beyond reason for anyone not using one for major business.operations.  I think a business opportunity could be possible for someone doing testing for hire on mail-in samples.

I'm not sure that you would be able to distinguish different steel alloys by their Curie temperature.  If it were possible, a more accurate test than simply looking for the temperature of loss of ferromagnetism.  The is a tool called a differential scanning calorimeter  which I understand can be used for measuring the Curie point.  I haven't used it myself but about twenty years ago, one of our epoxy suppliers used into determine the extent of curing in an epoxy.  It looks like the eBay prices are somewhat better than xrf but it really wouldn't tell you much about the composition of the steel.

A colorimetric test could be developed for measuring the percentage of iron.  Again, I'm not sure it would be precise enough to identify an alloy.  When looking at the composition of steel alloys, all of the components have a range with iron usually listed as balance.  That said, iron forms some highly colored complexes the intensity of which can be measured with a colorimeter or by comparison to a color chart.  To do so, a sample of known weight has to be dissolved and and diluted to a known concentration.  Then the sample is compared to a color chart or, for more accurate values, the absorbance of a certain wavelength of light by the sample is measured.  That's the simple version.  In reality, checks for possible interferences need to be done, standards of known concentration have to be made and host of other possible issues have to be dealt with.

There are other means of measuring the amount of iron and other metals in an alloy.  I had developed a titration procedure for measuring manganese which could also be used to measure iron concentration.  Potentially metals like cobalt and vanadium could be measured in that way as well.  But these are better suited to an analytical laboratory than a machine shop.


----------



## hman

No joy, folks 

Way back when I was a chemist, I learned about an instrument called an Atomic Absorption spectrometer.  It was used for quantitative analysis of dissolved metals.  For any given metal, the light source was a specific "hollow cathode" arc lamp containing that metal.  Then there was a gas fueled burner, which had a long line of small holes - maybe 3" or 4" - through which the light was sent.  The dissolved sample was slurped/atomized into the gas stream to "color" the flame.  The length of the burner was necessary for sensitivity. 

Light passing through the line of flames was measured with "some kind of" photocell detector.  The amount of light passing through the flames would be reduced by whatever target metal was present in the flames, because the atoms would absorb some of the light from the source.  The difference in readings between no-sample and sample, times a suitable absorption factor, times the concentration of sample dissolved in the solution under test, would give the concentration of the target metal in the solution.

It was a very persnickerty and involved test method, to say the least!  And not that many metals could even be tested.









						Atomic absorption spectroscopy - Wikipedia
					






					en.wikipedia.org
				




As far as a DIY "eyeball" flame color test, you're more likely than not to have a small quantity of sodium in the solution.  Sodium gives a bright yellow light, which can overwhelm and mask the color(s) that might be there from other metals.


----------



## graham-xrf

Wow! Between @RJSakowski and @hman , I seem to have unearthed the experts who are steeped in a combination of chemistry, physics, and element analysis at atomic level. I have images of periodic table pinned up next to the Starrett Tap Sizes chart!

OK - I guess since the steel was free, I can use it on whatever it seems handy for. You are right that the costs of knowing are unjustified.

As it happens, I do have enough alpha emitter material, to get up about 8 uCuries, and I already posses some photomultipliers, but they unfortunately only the type used for night vision cameras. The rest of the stuff I don't have. HM folk, especially those deep into CAD, CAM, and CNC kit, would probably find this well within their capabilities.

*For those who might want to try..*
You need to raid some smoke detectors. 8 or 10 of them, old or new.

The rest of the assemblies you can vary to your taste. You might want to turn up a mounting, or adapt some metal tubing.

I see one can get various kinds of scintillation crystal, and the Cesium Iodide type is $51.50 + $14.50 postage to UK
--> CsI crystal eBay

A new Hamamatsu Photomultiplier is about $90, but then, there is the mountain to climb to build the rest of the instrument, physical mountings etc. The information for the photomultiplier electronics is all there for some little printed circuit boards You can use other photomultipliers.

--> Hamamatsu Photomultiplier

--> PmTAdapter This appears to be a little opto-isolated highvoltage, low current supply for the photomultiplier.

and the little PIC microcontroller board --> ThereminoMCA

The software appears to be free.
The data for XRF measurements for almost every element is attached.



Thanks guys, for your response.


----------



## RJSakowski

It would be an interesting project.   

 For an x-ray source, you need a gamma emitter.  Apparently Americium 241 is the emitter of choice in ionizing smoke detectors and it is also used for XRF sources.  It emits an 59.5 Kev gamma ray along with the alpha radiation.  

There is some danger associated with amassing quantities of Americium 241 so caution should be exercised. If it were me, I would store the sources in a lead container and make sure that the XRF sources were well collimated in use.

This is all stretching my knowledge bank.  I last dealt with anything like this over fifty years ago.  What is the technology used in an x-ray spectrometer?  Bruker, one of the leading manufacturers of XRF equipment, has a manufacturing operation in Madison, WI and a former colleague used to work there.  I may have to have a talk with him.


----------



## Ulma Doctor

in my best Forrest Gump  voice....
"mama says, unknownium is like a box of chocolates- you never know what you're gonna get."

i found magnetic bronze once


----------



## graham-xrf

OK - it appears that the "X" in "XRF" on the name does refer to X-Rays,a and many detectors do use a small X-Ray tube to make a pulse of X-Rays, very confined, and not going through the user.

ALSO - it seems, the thing works with stuff other than X-Rays, like Alpha particle emitters, and electron beams.
We discount electron beams, because you have to do the trick in a vacuum.

Here is where the smoke detectors come in. Americium 241 is an Alpha-particle emitter with a half-life of 432.2 years. The helium nuclei being emitted are at a level far below the background level, which is presumably why the levels measured when folk try going at smoke detectors with radiation detectors get much the same count no matter how far they strip it down.
--> LIKE THIS

The stuff is feeble, failing to penetrate a piece of paper.  It shows on radiograph film from up against after 2 hours exposure. You can handle it. Just don't eat it!

We live on a naturally radioactive planet. The potassium in bananas is radioactive, and the sand from Chesil Beach in Dorset, as --> THIS Radioactive Beach  in Brazil. Maybe nearly every shingle beach anywhere, but we are talking lots more than from a smoke detector.

Can you amass something harmful? Yes - but you have to try hard. Mixed with Am241 from about 100 smoke alarms + radium from old clocks + thorium from gas lamp mantles, purified with lithium from batteries, and a block of lead with a hole drilled part-way through.. sure, it becomes a breeder reactor which will make a mess.
ref --> David Hahn (no longer with us)
     -->  David Hahn Wiki
     --> The Radioactive Boy Scout

Eight or ten or a hundred  smoke alarms are not going to do anything nasty. There are a good deal more in most public buildings. You can expect there will be a portion of the population for whom anything beginning with "nucl" will rub on their beliefs kinda hard, but I try always to stay informed by the science.

The PhysicsOpenLab LINK DIY XRF provided by @homebrewed was really useful. (My thanks for that)

This is the sort of thing one can apply (say) a Raspberry Pi or Arduino to, and turn into a relatively affordable project, and I am sure there is enough expertise in HM to draw on. In a nice practical form, it could require some parts made in the shop, and at the end of it, you can_ know_ with some certainty which heat treat regime to use for the thing in the making. Know how hard will be the knife edge, of the gun barrel.  Know from the get-go whether the steel you are using for whatever will resist corrosion. Know whether the bronze for the bearing is something other than a boat ornament.

Now that I look at it harder, it seems a safe an viable project that need not strain the finances and looks to be something that an HM member can do - and then post exactly how with plans and instructions in 3-part harmony!

It seems the "Theremino" part is a generalized USB interface to a PIC microcontroller.







Perhaps this board could be side-stepped for not many dollars by using a $50 Raspberry Pi, and that is like an Arduino on steroids.! A full-blown computer (Pi-4) with all the operating system, USB, video, and GPIO connect pins one could want. You can even watch YT while you analyze steel.

I admit, I am tempted, but there is too much to get right on my house, my workshop man-cave in construction, and my two machines, to go at this one just yet, though I might just keep some of the parts I have around a bit longer.

- - - - - - - - - - -
P.S. Please note that there is no "XRF" allusion to anything related to my user name graham-xrf, where the "x" denotes "ex" like in "ex-girlfriend" and similar.


----------



## RJSakowski

OK, here's my take.  The americium 241 is an x ray source.  The x-rays from the source impinge upon the sample and electrons from the inner shells of the contained elements are knocked up to a higher shell.  When they fall back to the lower shell from whence they came, they emit a photon (photoelectric effect) . The energies invoked are such that the photons are in the x-ray part of the spectrum.  This is the fluorescence part.  
Those photons hit the scintillation crystal and lower energy visible light photons are generated.  The number of secondary photons is proportional the the energy of the original x-ray photon.  Some percentage of those photons impinge upon the phoromultiplier which generates an electric current proportional to the impinging photons and thus proportional to the energy of the fluorescent x-ray.  An electronic circuit measures the current for that original photoelectric event and records an event in a particular channel according to its energy.  There are multiple channels,  each of a different energy, and those are scanned after observing a sufficient number of events to generate the x-ray spectrum.

So, required components are: x-ray source, scintillation crystal, photomultiplier, and multichannel analyzer plus computer and software to display the spectrum.

When I was in college fifty years ago, we had a newly acquired multichannel analyzerin our nuclear physics lab.  It had only about fifty channels and the readout was by columns of neon lamps.  Digital calculators were almost a decade away and computers were mainframe affairs.  I recall that we did some rudimentary analysis of gamma radiation with it. 

Fast forward to 1997, I worked for a medical device manufacturer and we made products for calibration of diagnostic x-ray machines amongst others.  Along that line, we made ionization chambers which measured x-ray energy by passing the x-rays through a chamber comprised of two parallel plates with a voltage applied to them.  An x-ray photon passing through the chamber would eject electrons fro the contained gas, some of which would drift to the positively charge plate, generating a small electric current.  This current was then amplified to generate a signal proportional to the energy of the x-ray beam.  

I don't know if the signal from the ion chamber would be sufficient to feed a multichannel analyzer but it could, in theory replace the scintillation crystal/photomultiplier.  If you think about it, a modern digital camera functions in a similar fashion arranging the "bins" spatially instead of by energy levels.


----------



## homebrewed

The other approach for doing elemental analysis is EDX, energy dispersive x-ray spectroscopy.  In this method an electron beam is accelerated to 5-30KV and focused on the sample.  This basically replaces the x-ray excitation with e-beam.   From there, a pulse height detector is used to generate the x ray spectrum, very much like the XRF system.  The equipment is (naturally) expensive, so why would you go that route instead of XRF?  Simple--spatial resolution.  Your typical EDX tool is installed on a scanning electron microscope, which has very high resolution.  Not needed to analyze a hunk of unknown alloy.

Back down to earth, I started wondering if it might be possible to update the old spark test by aiming a home-brew spectrometer at the trail of sparks and see what spectral lines show up.  Here is a web site that sells inexpensive spectrometer kits.  

Iron and carbon would burn and generate light but it's not clear to me if nickel, chrome, vanadium, molybdenum etc. would.

Again, even if the "new age spark test" scheme is able to detect the different metals in your alloy, it would be a challenge to get quantitative results.  Still, it might be good enough to aim you in the right direction -- and if augmented with other data (magnetic/nonmagnetic etc) you MIGHT be able to narrow down the field of possibles even more.

An interesting discussion!


----------



## graham-xrf

homebrewed said:


> The other approach for doing elemental analysis is EDX, energy dispersive x-ray spectroscopy.  In this method an electron beam is accelerated to 5-30KV and focused on the sample.  This basiHe
> 2+
> cally replaces the x-ray excitation with e-beam.   From there, a pulse height detector is used to generate the x ray spectrum, very much like the XRF system.  The equipment is (naturally) expensive, so why would you go that route instead of XRF?  Simple--spatial resolution.  Your typical EDX tool is installed on a scanning electron microscope, which has very high resolution.  Not needed to analyze a hunk of unknown alloy.
> 
> Back down to earth, I started wondering if it might be possible to update the old spark test by aiming a home-brew spectrometer at the trail of sparks and see what spectral lines show up.  Here is a web site that sells inexpensive spectrometer kits.
> 
> Iron and carbon would burn and generate light but it's not clear to me if nickel, chrome, vanadium, molybdenum etc. would.
> 
> Again, even if the "new age spark test" scheme is able to detect the different metals in your alloy, it would be a challenge to get quantitative results.  Still, it might be good enough to aim you in the right direction -- and if augmented with other data (magnetic/nonmagnetic etc) you MIGHT be able to narrow down the field of possibles even more.
> 
> An interesting discussion!


*A spark is a short-duration plasma*
Suggesting one does it with a plasma instead of a spark- almost the equivalent of the Bunsen burner flame test, but much hotter, and with a wavelength detector (usually diffraction grating) to let you see more "colours".
OK - let us pick out the possibles.

To resolve first the X-Ray thing. Yes indeed, you can excite the metal atoms with X-Rays, but you can also use other primary excitation sources.

1) β- radiation is, as I understand it, *an electron beam*. It will do.  β+ is positrons. We won't do that!

2) *Protons*. The stuff left over when we ionize hydrogen to get electrons. Hmm.. That is the stuff they use in the LHC. The hydrogen they use for many weeks supply is the size of a in-car fire extinguisher.

3) *α Alpha particles*. These are helium nuclei. 2 protons + 2 neutrons. Among other things, they come from smoke detectors.  Written as     He2+ or He2+  with energy 5MeV, and they move fast - like about 15,000 km/sec.

I can do, and have done X-Rays. Expensive, awkward to use, risky, needing high energy evacuated kit.

I once used a hospital X-Ray machine to put a beam through a 1mm thick little square of copper which I used as a neutral density filter to cut down the brightness of the beam, so I could develop an auto-focus video device for the photomultiplier display to allow continuous X-Ray diagnosis. The only way I could get my face close enough to the eyepiece was to sit on the machine, and let the beam go down onto the copper quite close to where I was ..er. sitting. I had the heavy white apron and all, but the beam was to the side of me, and I had it switched on for 20 seconds and longer at a time. X-Rays is not what we (OK - I) would want to use.

Electron beam guns is also something I have got to grips with. The up to 40kW kind where the beam is focused onto the top of the (titanium) being vaporized, using scan coil magnets to move it around. Huge vacuum pumps, and 35kV power supplies (variable), running up to near 1Amp. All is OK unless you lose control of the beam. If it ever hit the side of the chamber and broke through, that would be a huge dose of X-Ray.

I came to dislike electron beams. I still have two of the old Leybold Hereaus electron guns intact with cooling jackets and a high-isolation filament transformer. They are nice big chunks of beautifully shaped stainless steel that can be re-purposed. Alternatively, if any HM member wants them, even for a door stop or boat anchor, they are there for the taking, but you have to fund the shipping - and remember, I am in the UK!  We can throw in the safety isolation filament transformer and a length of molybdenum filament wire. This stuff is a bit heavy.

*We don't need X-rays, nor electron beams.*
Americium is an Alpha (α) source, and a weak gamma (γ) source that is unknown in nature, the only artificially produced element, made by neutron bombardment of plutonium or uranium, so it is, in fact, a component of reactor waste. The tiny amount needed for a steel analyzer can come from a few smoke detectors.

*Can we use the light as @homebrewed suggests?*
Perhaps one can, though I think this is still the stuff of a small vacuum chamber.  Perhaps of stainless pipe about 50mm diameter, and having quartz windows. A cheap plastic diffraction grating, and one of those "line array", or matrix photodiodes. The carbon arc can be started with a spark, stabilize the light, and the sample being tested is in fact one of the electrodes, or is placed on a piece of carbon. We only need a brief flare - perhaps 400mS.
The photodiodes can be sampled much faster, perhaps at 20 - 100kHz, and the outputs put through a calibration scaling before display. A Raspberry Pi fitted with an e-Bay A-D converter add-on board (about $10 to$40) might do.

So far, for me, this version is just a mad, free thinking, possibly stupid speculation. Like designing on the back of a napkin while the food is arriving! I have no idea whether this high speed, high tech, version of a Bunsen flame test will work. Feel free to trash the musings if you like.

*The radioactive way - a proven design exists!*
That is why I like it. None of the bits are outrageously expensive. Much of the design outline is already in this thread. It has some nice science in it.

How we get the spectrum plot out of it is something I did not quite understand. I (think) the energy that excites the metal atom is released as the electrons return to their un-hyped-up quantum state, and the wavelength of what is released is related to the wavelength by Planck's Constant, which is extremely er.. constant. So measuring the relative brightness of the scintillation leads to a place on the plot.

We surely do not need a build as clunky as this!




The smoke detector set looks like this. Again, I am thinking it need not be like this.







OK - not fully checked out yet, but this last option looks so very feasible that it is surely worth a scrutinize by HM Forum crowd critique.


----------



## hman

Hmmmmm ... high voltage power supply for the photomultiplier ....  Maybe this one?








						12VDC Power Supply?
					

Before I even plug this in - what is it? At first glance I thought 'DC Power Supply', now I'm not so sure. I saw 'D-C' on the meter, then realized that the meter is 'milliamperes' and then I studied the read of the unit. Then I decided it was best to take some picts and post asking those of you...




					www.hobby-machinist.com
				




-or-

use one of the Rooshin night vision scopes!  They include photomultipliers (though an imaging type).

(2) One thing I think I missed in your description of a DIY XRF rig was a monochromator - something to separate the frequencies of the detected radiation, so you get a spectrum, as shown in your illustration.  Your most recent post touches on that, but I don't think brightness and wavelength/frequency are interchangeable.  RJ's explanation helped a little, but I still don't "get it."  My studies in chemistry did not include XRF or EDX.  The closest I came was in grad school, where I did ESCA spectroscopy.  That entailed analyzing the energy spectrum of electrons emitted when a sample was bombarded by Xrays.  Electrons aree a WHOLE lot easier to manipulate than photons!

(3)  Good thing you mentioned "P.S. Please note that there is no 'XRF' allusion to anything related to my user name graham-xrf, where the 'x' denotes "ex" like in "ex-girlfriend" and similar."  I was really starting to wonder!


----------



## graham-xrf

hman said:


> (2) One thing I think I missed in your description of a DIY XRF rig was a monochromator - something to separate the frequencies of the detected radiation, so you get a spectrum, as shown in your illustration.  Your most recent post touches on that, but I don't think brightness and wavelength/frequency are interchangeable.  RJ's explanation helped a little, but I still don't "get it."  My studies in chemistry did not include XRF or EDX.  The closest I came was in grad school, where I did ESCA spectroscopy.  That entailed analyzing the energy spectrum of electrons emitted when a sample was bombarded by Xrays.  Electrons aree a WHOLE lot easier to manipulate than photons!
> 
> (3)  Good thing you mentioned "P.S. Please note that there is no 'XRF' allusion to anything related to my user name graham-xrf, where the 'x' denotes "ex" like in "ex-girlfriend" and similar."  I was really starting to wonder!


OK - we step carefully here - why we don't need a monochromator. All spectrum analysis of the various frequencies light kind do need it.  Diffraction gratings, Fresnel things, anything to bend the light varying amounts depending on the color.

We are finding out the unique wavelength - or frequency if you like, of the light emitted from an element. We are hitting it with radiation energy, albeit not from a Bunsen flame, nor a spark. We use a radioactive energy.

Now here is where we get right into the murky waters of "is it a particle, or is it a wave"? There are now lots of good explanations on the equivalence of matter and energy, and the "Quantum Standard Model". The quantum model is an elaborate scientific fairy story which does not care that the concepts are arbitrary and non-intuitive. What is known is that it allows exact calculation and prediction to better than 10 digits of extraordinary, repeatable precision.

When that "energy", whether thought of as a helium atom with momentum, or simply as a bunch of energy, slams into the metal, the electrons in the atom will only accept strictly discrete amounts - i.e."quanta", and after a short time, from nanoseconds to hours, depending on material, the electrons drop back to their previous state, releasing back exactly that amount of energy.

Now we get to the nice bit. That energy comes out as radiation - photons - it is light. It zips away at the speed of light. And best of all, it has to be a unique color. At this point, you can say "ahh - we can figure what element that came from is we use a monochromator grating, and make it sit at it's place in a spectrum. This could be done if one was madly energising it, like the phosphors in a flourescent tube.

As I understand it, this method is different. The photon that is released hits a scintillator material where the whole excitation thing happens all over again, but this time in a constant, known, material. So the now second-hand light from the scintillator crystal excites a photomultiplier tube, or photodiode, or maybe solid-state photomultiplier. It results in an electric pulse which can reveal meaningful information. The nature of the pulse, the timing, the slopes, and the magnitude of it, are a signature of the metal that started it all.

I am not an expert. I am still reading up on exactly how this trick works. A whole bunch of metals in the mix can apparently produce a whole bunch of little slopes in the response, unique to each, and the magnitude of the departures can indicate relative proportions. The math, and science in this is not trivial, and is completely contrary to the reasonable simple, low cost kit that is involved.

The XRFSpec_ENG.pfd file posted earlier in this thread has the pulse data signatures for nearly every element.

OK on the "xrf" in my username. It was pure coincidence!


----------



## graham-xrf

Maybe a silly question, but if you dissolved the metal in acid, and shine a wideband filament type light through it, and then spread the light with a grating or prism, would you see a "dark line" corresponding to the absorption of light wavelength specific to the stuff in the solution?

Yeah - I know, if it was that easy, it would be widely done already!


----------



## RJSakowski

Alpha particles have to be accelerated to a very high velocity in order to generate x-ray fluorescence in a target.  This would require a linear accelerator.  In addition, the beam would have used in a high vacuum.  The Americium 241 source emits a relatively low energy alpha particles, easily stopped by a few sheets of paper.  It is the 59.7Kev gamma ray that is responsible for the fluorescence in target materials.  The fluorescence photons re not light.   They are much higher in frequency , above UV and in the x-ray region where their "frequency" is measured in terms of energy( e =hf).

To detect these x-rays, they are passed through the scintillation crystal where again the photoelectric process takes place and visible light photons are generated.  The sum of the energies of the photons generated is equal to the energy of the x-ray photon.


----------



## RJSakowski

graham-xrf said:


> Maybe a silly question, but if you dissolved the metal in acid, and shine a wideband filament type light through it, and then spread the light with a grating or prism, would you see a "dark line" corresponding to the absorption of light wavelength specific to the stuff in the solution?
> 
> Yeah - I know, if it was that easy, it would be widely done already!


Actually, you do not see a single line.  If you run a spectrum of the light passeing through the solution it is a rather broad absorbance band.  Offhand, I can't give you the physics of it but I have run enough of them to know it for a fact.  Additionally, the colored solution resulting from absorbance is not dependent on an interaction with the nucleus.  Copper chloride is a different color than copper nitrate.  Add ammonia, and the solution turns a very intense blue.

It is possible to see absorbance lines  (Fraunhofer lines) if the matter is in a gaseous state.  This is how the atomic absorption spectrometer works.


----------



## graham-xrf

RJSakowski said:


> Alpha particles have to be accelerated to a very high velocity in order to generate x-ray fluorescence in a target.  This would require a linear accelerator.  In addition, the beam would have used in a high vacuum.  The Americium 241 source emits a relatively low energy alpha particles, easily stopped by a few sheets of paper.  It is the 59.7Kev gamma ray that is responsible for the fluorescence in target materials.  The fluorescence photons re not light.   They are much higher in frequency , above UV and in the x-ray region where their "frequency" is measured in terms of energy( e =hf).
> 
> To detect these x-rays, they are passed through the scintillation crystal where again the photoelectric process takes place and visible light photons are generated.  The sum of the energies of the photons generated is equal to the energy of the x-ray photon.


Yes - and I should have seen it earlier. The spectrum for AM241 in post #15 shows it has the 59.7keV emission line on the right, which is enough to excite the K and L lines of all the elements.

I am guessing it it is the role of the scintillator crystal material to capture these beyond-visible wavelengths, and re-emit light photons into a photo-multiplier or other technology detector. It must be a special effect, and not just from excitation of it's own elements.

Thanks also for the explanation of experience with solutions. I did think that route would have some downsides.


----------



## RJSakowski

graham-xrf said:


> Yes - and I should have seen it earlier. The spectrum for AM241 in post #15 shows it has the 59.7keV emission line on the right, which is enough to excite the K and L lines of all the elements.
> 
> I am guessing it it is the role of the scintillator crystal material to capture these beyond-visible wavelengths, and re-emit light photons into a photo-multiplier or other technology detector. It must be a special effect, and not just from excitation of it's own elements.
> 
> Thanks also for the explanation of experience with solutions. I did think that route would have some downsides.


Here is a fairly thorough explanation of the  scintillation process.https://en.wikipedia.org/wiki/Scintillator


----------



## rwm

RJ- I thought you were just a fisherman!? But wow! You guys are very impressive. However, I am not at all shocked that we have this kind of talent on HM! This is a very interesting project that I would like to hear more about. I have always wanted an XRF since I got into casting (metal, not trout.)
I am staring at a photomultiplier tube from a scrapped gamma camera. I think I have some Americium in the basement. Is this really possible? Talk about a quarantine project!
Robert
Edit: I believe all the current gamma cameras are solid state detectors. Is that an option? 
Robert


----------



## hman

Graham - 

Thanks for your explanation.  I really goofed when I said "monochromator" ... actually meant to ask about way to distinguish the wavelength/energy of the fluorescence (Xray)  photons.  Your mention of a spectrum analyzer did set me straight.  Bottom line, though, is that I'm an old geezer and sometimes kinda dinosaurian in my thinking.  Ah, well ...


----------



## graham-xrf

hman said:


> Graham -
> 
> Thanks for your explanation.  I really goofed when I said "monochromator" ... actually meant to ask about way to distinguish the wavelength/energy of the fluorescence (Xray)  photons.  Your mention of a spectrum analyzer did set me straight.  Bottom line, though, is that I'm an old geezer and sometimes kinda dinosaurian in my thinking.  Ah, well ...


Old geezer me too, but I nevertheless am still surprised and irritated when the stuff that reminds us of it gets in the way of a bit of "growing old disgracefully".

As I understand it so far..

1. You start with some of these smoke detector sensors. Here is one I extracted from an old smoke detector.
    (Yeah - nearly live. On the desk in front of me. Making a mess!)

Not that I expect any Brownie points from HM for doing this in their cause, but I am very aware that I am handling a by-product of plutonium decay that is a fissile material with a large neutron absorption cross section 5700 barns (yes - as in "big as a barn door"), which gives it a critical mass of around 9kg to 14kg. This is not quite what I mean when I say "growing old disgracefully, but you get the idea.

That said, the amount in there is around 2.62E-7g or 262 nano-grams. It is in the little pressed metal setting "button", which comes out and bounces on the desk, and makes it to the floor, and ..yeah!




Of course, the great YT resource shows it much better than I can, and one in particular comes with fun sparks and zap stuff..
--> How Radiation Works using Americium 241, Alpha Particles and Gamma Rays

and another where at about 3:05, we actually see the radioactivity measured (no gloves)
-->  Extraction of Americium 241 from Smoke Detector

It occurs to me that one might get up an effective source from grinding up a Coleman lamp gas mantle. You can get the thorium version, which work better than the yttrium type as lamps, from eBay.

2. We arrange the Am241 buttons in a circle, around a shield tube end. The radiation from the buttons strikes the metal under test, and out comes photons you can't see, back at the detector in the middle of the tube. Yes - the energy that exits the metal atom does have a wavelength, and it might not be at some convenient visible (wavelength).

3. It hits the material of a scintillator material. A crystal of cesium iodide.
They come at all sorts of crazy prices asked, from USA to Ukraine, from 20 bucks to a couple of hundred $$.
Like this --> eBay CsI

Now we discover there are various scintillation materials, like Na(TI), and every kind of combination fitted up with detector photomultipliers, etc. I have not explored this enough, but know that the electron tube type is the only sort that can get down to the lowest energy detection without generating a lot of competing electrical noise.
The flash given off by the scintillator material is proportional to the photon energy arriving.
I like the Hamamatsu tube with the cesium iodide scintillator already bonded to the tube.

4. The light pulse triggers electrons from a photo-sensitive cathode in a photomultiplier tube. The nature of the thing is to produce in proportion, perhaps up to a hundred million more. An electrical pulse, which can be measured. Clever gadget, but the circuits are simple.







This is, so far, the most expensive part. It is also the place where we get the most variety in DIY approaches. You don't have to get this particular one. The majority of enthusiasts out there are looking to make radiation detectors of various kinds. They want the clicks, and the meter showing the counts per second rate.

What we are after is more subtle.  We want to measure the pulse height, duration, and shape.
That is - I think so. Everything I read looks to be about that.




5. If you are still with me so far, this amounts to some fairly simple, and not too expensive kit, given that we are trying to make a nondestructive point-and-shoot general materials detection and analysis gadget.

According to the link from @RJSakowski , the Wikipedia on Scintillators, you get a pulse. The stuff is very much hard sums about scintillation science, but it is worth scanning even the indigestible , just for perspective.

6. *Measuring the pulse(s).*
   This is where we need not get all entangled with old project stuff like the "Therimino" thing. I have not yet untangled it all, but it seems they were using the audio input microphone channel on a computer to sample the signal as a 192kHz A-to-D converter, in the same manner as ham radio enthusiasts would contrive to make spectrum and waterfall displays  of signals. They also had a PIC micro-controller USB adapter.

I think it is a series of pulses from each scintillation, triggered, sampled, and averaged.

I have not yet figured it all out, but I am thinking that yes - one could use the audio channel as a signal waveform sampler, though my preference would be something more made for the purpose, such as a dedicated A/D converter instrumentation card. Or use the Audio channel. Either way, all you need for final hardware is £35 or so of Raspberry Pi, or Arduino. It could even be a smartphone app.

I freely admit I have not got it all figured out yet, but a steels alloys analysis without breaking the bank seems kind of possible


----------



## graham-xrf

rwm said:


> Edit: I believe all the current gamma cameras are solid state detectors. Is that an option?
> Robert


Robert: No, I don't think so. What the detector can do depends on the scintillation material. You can get gamma detectors in several technologies.

The ranges of energies, and wavelengths that solid state (Si) detectors can do seems to have a lower end that is electrical noise limited - that the thermal noise from molecules wiggling about as in any semiconductor material. The electron tube types can apparently work at low noise to much lower levels.

Again - I am in the "soak-up" phase of learning much of this science. When I know enough to give a better answer, I will say what has been shown to be so, and who says, and so on.

I am less into fully getting to all the theory expounded , and more into wringing out the practical stuff one needs to make something like this work. I am not at all sure I am up do doing something like this all by myself. I may need some help. You can be sure that if I get to the point of getting up a working, proven verified, demonstrable build, then it will be posted here, with all the instructions.


----------



## RJSakowski

It looks like you are getting the hang of it.    In bullet 1., I wouldn't mess with the Th 232  It has a much longer half life, 1.39e10 yrs. compared to 275 yrs for Am 241 which it will be a much weaker emitter/gram of material.  Also, the largest danger with alpha emitters is from ingestion. Although they are extremely short range, alpha particles are extremely active.  Any process that would have the potential of creating small particulates should be avoided.  In contrast, the AM 241 is in the form of a pellet and and can be used that way which minimizes any potential ingestion risk.  As I see it, the form found in smoke detectors is ideal for this application.  Think of the array light a camera light, illuminating the target.  If mounted on a lead backing plate, all of the beam will be directed forward toward the target with almost no radiation from the source interfering with the desired signal.

The combination of scintillation crystal and photomultiplier make up a radiation detector. As I recall, radiation detectors operate in three distinct modes, the Geiger region, a proportional region,and the avalanche region.  Which region of operation you're in is determined by the mukltiplication rate of the individual dynodes in the multiplier which is controlled by the potential difference between the dynodes.  

For a pulse height analyzer, we want to operate in the proportional region.  In this region, the output current generated by each event will be proportional to the energy of the x-ray photon.

From there, we need to sort out the energy, as represented by the output current.  I expect that this could be done by converting the current signal to a voltage and using an A/D converter to create a digital value.  A gate would activate the A/D converter and lock out any additional input while the pulse information was being processed.  The processing could be done by a series of conditional cases in the program sorting the event into an appropriate accumulator array and the array would be scanned to provide the count vs. energy display.  The processing part would need to fairly fast to minimize dead time and loss of events.  From my experience, the events aren't to closely timed, at least with fairly weak sources.  The energy spectrum would be built up, pulse by pulse until it was reset and displayed on some suitable output device.

A simpler scheme would be look at a single energy, knowing that a particular element would be emitting x-rays at that energy.   A fairly simple pair of comparators could define the voltage box, V1< Vsample< V2, and if the sample voltage is in the box, a counter is incremented.  Ideally, You would compare the signal to a background signal and calculate the ratio.  The ratio would be compared to the ratio from a known sample to give a thumbs up or down to the identity. 

It would seem that we have existing devices that could be hacked.  I have an app on my Android phone called Physics Toolbox Suite which has, among other interesting tools, an audio spectrum analyzer.  It is sorting a real time audio signal into a frequency spectrum which can be frozen.


----------



## graham-xrf

@RJSakowski :
Entirely agreed. I did say we should not eat the stuff! The bits of fragile (used) thorium mantle sticks to fingers, and floats about in the air, and generally much harder to control until one gets it held down somehow.

That said, the smoke detector little "button" did it's best to become inaccessible. I had to crawl around on the floor, looking all over the place to retrieve it. After all - it might eventually become 1/8 of my steel alloy sensor!

Now that we are beginning to figure this out, even to the extent of a design of our own, it is maybe time to look at the wish list of features. Can we aspire to know more than which elements are present? Might it deliver approximate percentage proportions? Is it, or need it be battery powered?  Is it a gadget with a USB lead to a smartphone app? Are there any low cost Silicon photodiodes that might do the job?

This needs a pause for HM contributions. Feel free - no matter how critical, or crazy. If it is just clouded by wishful thinking, I am happy to blame the lockdown effect!


----------



## homebrewed

Scintillators and PMTs aren't used in commercial EDX tools these days.  Instead, they use large-area silicon detectors, basically high voltage diodes.  As in the case of a scintillator/PMT, the pulse height is proportional to the x-ray photon energy.  That, by the way, is what "EDX" stands for -- energy dispersive x-ray spectroscopy.  There is another approach that uses a crystal as a kind of diffraction grating, where the grating is the crystal lattice itself.  As the crystal is rotated the incident x-rays are diffracted at different angles toward a fixed detector.  Very much like a visible-light monochromator.  This type of system offers much higher resolution but, because it acquires one wavelength at a time, it is much slower.  Also, you STILL need some kind of detector.  This type of system is called a WDX, or wavelength-dispersive x-ray spectrometer.  Our old WDX used an ionization detector, a lot like a Geiger tube -- but IIRC the active gas was either a mixture of methane or carbon monoxide (!).

Also check these links out:  http://www.noah.org/science/x-ray/detector/ https://benkrasnow.blogspot.com/2012/11/large-area-detector-for-x-rays.html ; and you might be able to acquire some of the hardware here.  I haven't gone so far as to check prices from the latter so it still could be out of the range of what hobbyists would be willing to pay.


----------



## RJSakowski

graham-xrf said:


> @RJSakowski :
> Entirely agreed. I did say we should not eat the stuff! The bits of fragile (used) thorium mantle sticks to fingers, and floats about in the air, and generally much harder to control until one gets it held down somehow.
> 
> That said, the smoke detector little "button" did it's best to become inaccessible. I had to crawl around on the floor, looking all over the place to retrieve it. After all - it might eventually become 1/8 of my steel alloy sensor!
> 
> Now that we are beginning to figure this out, even to the extent of a design of our own, it is maybe time to look at the wish list of features. Can we aspire to know more than which elements are present? Might it deliver approximate percentage proportions? Is it, or need it be battery powered?  Is it a gadget with a USB lead to a smartphone app? Are there any low cost Silicon photodiodes that might do the job?
> 
> This needs a pause for HM contributions. Feel free - no matter how critical, or crazy. If it is just clouded by wishful thinking, I am happy to blame the lockdown effect!


You need a scintillation detector to find those wayward buttons.  

The PHA we have been discussing are capable of measuring quantity provided there is a means of calibration.  The easiest way would be to have a known sample.


----------



## graham-xrf

homebrewed said:


> Scintillators and PMTs aren't used in commercial EDX tools these days.  Instead, they use large-area silicon detectors, basically high voltage diodes.  As in the case of a scintillator/PMT, the pulse height is proportional to the x-ray photon energy.  That, by the way, is what "EDX" stands for -- energy dispersive x-ray spectroscopy.  There is another approach that uses a crystal as a kind of diffraction grating, where the grating is the crystal lattice itself.  As the crystal is rotated the incident x-rays are diffracted at different angles toward a fixed detector.  Very much like a visible-light monochromator.  This type of system offers much higher resolution but, because it acquires one wavelength at a time, it is much slower.  Also, you STILL need some kind of detector.  This type of system is called a WDX, or wavelength-dispersive x-ray spectrometer.  Our old WDX used an ionization detector, a lot like a Geiger tube -- but IIRC the active gas was either a mixture of methane or carbon monoxide (!).
> 
> Also check these links out:  http://www.noah.org/science/x-ray/detector/ https://benkrasnow.blogspot.com/2012/11/large-area-detector-for-x-rays.html ; and you might be able to acquire some of the hardware here.  I haven't gone so far as to check prices from the latter so it still could be out of the range of what hobbyists would be willing to pay.


Addressing whether or not to use large area silicon photodiode sensors. The best of these have similar gain to PMT electron tube, but inherently have the noise floor all solid state semiconductors have. Revese biased avalanche diodes operating at or beyond breakdown along with current limiting, quenching and damping circuitry, have been around for a some time, wheras the large area diode types devoted to X-Ray and other detection are newer speciality products.

I am used to going after the ultimate low noise floor short of cryogenics using pHEMT (PseudoMorphic High Electron Mobility Transistors) in microwave satellite kit.  Getting the signal captured with a good signal-to-noise ratio is key. To this add the front-end noise of the gain system. The signal is amplified, and from then on, it is safe, because the noise is amplified as well. The signal-to-noise ratio becomes locked in, because any subsequent processing has to be grossly noisy before that noise can compete with the racket already amplified.

What drives my first choice is taken from a Hamamatsu webinar [1], promoting SiPM (Silicon Photomultiplier) is this chart.



And a table




Notice the region 1 to 10000 covered well by the electron tubes. The noise limit for SiPM diodes is actually around 2000. In the table, the Hamamatsu propaganda stressed only the highlighted stuff in column 3. I put value on the dark output. I would not set the need for temperature compensation against high voltage.

Temperature compensation is a pain, and since the highest voltage I have ever dealt with in really high energy kit was 35kV, or in discharge kit, about 160kV, I don't think high voltage is such a disadvantage, especially since this kind is so high impedance, you can touch it, and it collapses. The last reason is much more prosaic. The tubes seem affordable, and at the level I would play, simple, and were used in an existing, albeit dated, design.

The system considered here is not the WDX wavelength dispersive method, which would be the conventional way of splitting wavelength components into spectrum - like a prism. This is the "other" sort, but the name escapes me. Would it be "Energy Transient Integral Dispersion" or something like that.  Even so, I would live to know if the photons scattered from the metal could be deflected into a sensor array by some scintillator.

A basic question to ask is.. are the wavelengths coming back at the sensor X-Ray wavelengths? I have not yet checked the energies for the alloy metals yet. There is just too much to read in a short time. I am still at the somewhat skeptical stage, just thinking through the first recipe. For this to be something we attempt, it had better not cost more than about $200 + some fun project build time.

You did, after all, provide the first DIY link. That leads on to a lot of stuff, mostly in Italian!
If we can cook up something that almost any HM member can replicate, that does only one thing well, with minimum cost, that would be something to aim for. Right now, I am still all too aware of how much I don't know!

[1] Hamamatsu Silicon Photomultipliers Webinar


----------



## homebrewed

Depending on how much of a DIY approach you want to take with this, it appears it might be possible to make your own proportional gas ionization detector.  Ambient-pressure detectors typically use an argon-methane or argon-CO2 blend.  They need an electric field around 100,000 volts/cm to bias them into their proportional-detector region of operation, typically achieved by using a metal tube with a thin wire down the middle.  The electric field intensity is inversely related to the diameter of the electrode, so thinner wires are better, so don't freak out just yet!  By running them at reduced pressure, the ideal gas is isobutane, also known as R600A refrigerant (welly-well now! ).  This also drops the voltage necessary to bias the detector into its proportional-detector mode.

Someone who repairs automotive AC systems would have a lot of the necessary equipment/materials to make one of these, although, of course, some machining and electronics skills would be highly desirable as well.  The vacuum pump would need to be a 2-stage version that can get down into the 50 millitorr range so the tube could be back-filled with pure isobutane.

One thing that is not often mentioned is that the choice of metal for the outer tube/electrode is important.  Making it out of thick, high-atomic-weight metal like steel is bad, because it absorbs x-rays.  The ideal material is thin-walled berillium, but thin-walled aluminum might suffice.  Obviously, if going with a reduced-pressure detector the tube will have to withstand the pressure differential.  Tradeoffs abound, eh?


----------



## homebrewed

Regarding your question about the fluorescence wavelength(s), the choice of scintillator give you the answer:  CsI is used to detect X-rays....so a visible-light spectrometer won't work.

When gas detectors are operated in their proportional mode they are operating in an avalanche-multiplication mode so they do have gain, similar to solid state APD's.  Their electronics have a challenging set of requirements because they have to be fast enough to accurately capture the pulse, but quiet enough to get a decent signal out of them.  Your experience with HEMT circuits could be an asset here.  As you say, the first gain stage is the crucial one in this regard.  I've played around with some of the HBT-based DC-GHz amplifiers from mini-circuits, they are inexpensive and not too difficult to work with.  You probably would have to go with a resistive output load rather than an inductor, in order to get the flat frequency response you'd need.


----------



## RJSakowski

homebrewed said:


> ....... The vacuum pump would need to be a 2-stage version that can get down into the 50 millitorr range so the tube could be back-filled with pure isobutane.


A way of eliminating the need for a high vacuum to obtain a pure fill is to evacuate the tube and fill the evacuated tube with the fill gas and then pumping it down again.  This process will reduce the amount of residual air by the dilution factor Pfinal/Pinitial to the same effect as pumping to a much lower pressure. This process can be repeated to obtain whatever degree of purity is required.


----------



## graham-xrf

A question (for the DIY design) : What should the tube around the PMT sensor be made of?
Implied in the sketch is that the photomultiplier tube has a CsI scintillator attached to it's front window.




The question arises because I am unsure. Often, electron tubes need metal shields, sometimes of mu-metal to block out magnetic fields.  Plastic would block alpha particles, but we are interested only in the florescence emissions from the steel, provoked by the other radiation. The typical result data is like this example for nickel..




Notice the backscatter stuff on the right. We would want to minimize the unwanted stuff, by using collimation, and having any surface other than the target and the sensor the radiation might hit, stop it dead, absorb it, make it disappear and die.

Do we need _two_ tubes, one inside the other?
Is lead, or aluminum, or polythene a good choice?


----------



## graham-xrf

Still thinking about the low pressure tube filled with lighter fluid..


----------



## graham-xrf

homebrewed said:


> Regarding your question about the fluorescence wavelength(s), the choice of scintillator give you the answer:  CsI is used to detect X-rays....so a visible-light spectrometer won't work.


OK - so when the radiation hits the metal(s), the energy photons that come back from the K and L electron states returning, with the help of Planck's  Constant, are at X-Ray wavelengths, which is why CsI scintillator is needed to yield light that a photo-detector can see. Have I got that right?


----------



## RJSakowski

graham-xrf said:


> A question (for the DIY design) : What should the tube around the PMT sensor be made of?
> Implied in the sketch is that the photomultiplier tube has a CsI scintillator attached to it's front window.
> 
> View attachment 320679
> 
> 
> The question arises because I am unsure. Often, electron tubes need metal shields, sometimes of mu-metal to block out magnetic fields.  Plastic would block alpha particles, but we are interested only in the florescence emissions from the steel, provoked by the other radiation. The typical result data is like this example for nickel..
> 
> View attachment 320682
> 
> 
> Notice the backscatter stuff on the right. We would want to minimize the unwanted stuff, by using collimation, and having any surface other than the target and the sensor the radiation might hit, stop it dead, absorb it, make it disappear and die.
> 
> Do we need _two_ tubes, one inside the other?
> Is lead, or aluminum, or polythene a good choice?


I would use lead to stop the x-rays from the source.  I would also mount the buttons on a lead disk at the front of the shield tube.  I would expect some backscatter from the surface of the target.


----------



## graham-xrf

Is a thin glass wall transparent enough?
Alumina?

I am imagining a glass test tube shape, thin only on the hemispherical end. The electrode coming in from the "bung end glued on with epoxy, along with the evacuation tube.

It is possible to use bicycle pump dragged sharply in reverse to make pressures low enough for those toy arc discharge globes to work. It may be possible to fill up the tube entirely with the lighter fluid/car air conditioning stuff, then simply pump down until most of it is extracted, and the remainder low pressure vaporized.

Getting the signal off it requires the discharge pulse current to go through a resistor, as low value as possible (noise), and across it, voltage limiting circuit, and amplifier (low noise). Similar circuits were once used to get the signal off the front electrode of Vidicon, Chalnicon and other types TV camera tubes (from previous century - and millennium).

So we still start with a ring of smoke detector innards, and we put a homebrew (forgive!) gadget up the middle, with some cheap electronics to make high voltage, + low noise amplifier from Mini-Circuits, and offer it up the mic input jack of a cheap credit-card sized computer, + a display app?

Alternatively, the signal goes to a small PIC microcontroller circuit that does the A/D conversion, and sends a serial stream of numbers to a smartphone or PC app via a USB cable?

Am I imagining this wrong?


----------



## rwm

"Robert: No, I don't think so. What the detector can do depends on the scintillation material.  "
You seem to be correct. In medical imaging, apparently it is just the CT and fluoro imaging that has gone to flat panel solid state receptors. Looks like Gamma cameras are still Anger design with PMTs.
This is a great thread!
Robert


----------



## rwm

graham-xrf said:


> Is a thin glass wall transparent enough?
> Alumina?



X ray tubes use a Beryllium window for what it worth.
Like this:



Robert


----------



## RJSakowski

No to the bicycle pump. There are low cost pumps that will get down to around 50mm of Hg.  Better yet, a compressor from a refrigeration unit will make a decent vacuum pump.  I would prefer getting to 1 mm of Hg and then using the procedure that I described above.   I use a 5 micron pump myself.


----------



## rwm

There are some really cheap photomultiplier tubes on eBay. How hard would it be to make the support electronics if you knew the specs from the manufacturer? BTW the one you posted earlier is now half price!
Robert


----------



## graham-xrf

@rwm : Wow - Wow - WOW !
Who knew we had a HM member who can just point at his own X-Ray tube?
Then again - I am the nutball hoarding 2 electron beam guns!

More seriously - I am still thinking we can do better. I still don't quite get how the X-Axis is defined with EDX, unless it is something related to the higher energy (shorter wavelengths) taking longer to drop out of the excited state.
I see some plots where the different materials make a pulse in a definite new place, but I don't understand how EDX (energy dispersive x-ray) stretches out a spectrum.

The WDX way more immediately is understood.
Start with smoke detector sources.
Settle for a nice low cost photomultiplier tube.
A scintillation material - maybe ready attached, maybe separated, but coupled with lens oil.

Then  a (something). A diffraction grating maybe? Mounted on the end of a shaft turned by a little stepper motor. It need be nothing more than one of those little things salvaged from an old floppy disc drive, or an adapted RC servo from the model plane flying fraternity. It rotates in steps, and aims the separated photons belonging to each material at the scintillator. A spectrum analyzer - except we don't have an array of photo-multipliers around it, so we rotate the grating instead.

This stuff must have been well researched already. Are we just scratching in the trails of already developed expensive machines?


----------



## graham-xrf

RJSakowski said:


> No to the bicycle pump. There are low cost pumps that will get down to around 50mm of Hg.  Better yet, a compressor from a refrigeration unit will make a decent vacuum pump.  I would prefer getting to 1 mm of Hg and then using the procedure that I described above.   I use a 5 micron pump myself.


I know that some of the newer diaphragm pumps can make a respectable, if not hard vacuum. 10E-2 to 10E-3 millibars. Going any further requires vane pumps stacked with oil diffusion pumps, or a turbo-molecular pump on the end of it.
So suppose I salvage a fridge compressor. How does it come to work "backwards"?

[Edit: There are some cultural downsides into simply typing "vacuum pump" into the eBay search box.]


----------



## RJSakowski

graham-xrf said:


> I know that some of the newer diaphragm pumps can make a respectable, if not hard vacuum. 10E-2 to 10E-3 millibars. Going any further requires vane pumps stacked with oil diffusion pumps, or a turbo-molecular pump on the end of it.
> So suppose I salvage a fridge compressor. How does it come to work "backwards"?
> 
> [Edit: There are some cultural downsides into simply typing "vacuum pump" into the eBay search box.]


I am not aware of any diaphragm pumps that can get down to much less than 3-5" of Hg.  10E-2 mbar =7.5microns Hg which is getting into the range of rotary vane pumps.

The compressor is in a closed loop system.  The function of compression side is to convert the gas back to a liquid but equally important is the suction side of the pump which lowers the pressure  to cause the lowering of temperature as the refrigerant evaporates.

On an online search there are mixed messages as to the amount of vacuum a refrigeration compressor can pull ranging from 1mm to several inches of Hg so not as good as I had thought.  In addition, small compressors typically require recirculation of the oil to keep them lubricated.  It can be done but it adds to the complexity.Finally, responsible repurposing of a refrigeration compressor requires a provision for capturing the refrigerant.  This can be done by a refrigeration repair shop or possibly, they have a compressor already pulled from a defunct unit they could give.  Loss of refrigerant due to leaks is a common failure mode.

I noticed the "cultural downside" when I went to eBay UK.  We tend to be a bit more prudish this side of the pond.


----------



## rwm

The xray tube is a cool decoration. It was given to me by a medical repair tech. Pain in the ass to get it out of the housing!
But I think I misunderstood your question about transparency. I now believe you meant to visible light not xray.  Sorry. 
I am having a hard time understanding how you plan to separate the energies. Is it a quantitative effect on the number of photons hitting the face of the PMT?
Robert


----------



## graham-xrf

I am still trawling everything there is about material identification, learning about Raman handheld spectrometers, finding out about Compton scattering, and what is an Auger electron, and why that produces a special little piece of spectrum.

In the most practical way, I am still only seeking to winkle out some scheme to cook up a materials identification gadget, simple, and very cheap, and can be made by most HM members, perhaps with some help between them.

I was thinking shining an IR laser diode salvaged from outdated CD/DVD units, and using a $1 avalanche photo-diode from Mouser.com, or DigiKey might have possibilities, but I am not plugging for anything definite yet, until I know more of the physics, and what property we are trying to exploit.

If it has to be bombarding the steel with ex smoke detector radiation, then fine. Now what wavelengths come back, and how do we use them?  If we use some other energy, IR, whatever, that is a new game.
- - - - - - - - - - - -
Re: The diaphragm vacuum pumps, I have actually used a dual-diaphragm type at a place I worked, but now I forget the brand name.

My usual fare was industrial sized tandem vane pumps, with very large diameter valve openings to oil diffusion pumps, or sometimes turbo-molecular pumps. With all the Edwards vacuum gauge kit, and pump-down sequence logic instrumentation, they come expensive! The change-over from hot-wire Pirani bridge gauges to Penning ion gauges comes at about 10E-3mbar, where there is not enough gas to keep the hot wire working. There was one type which could "bridge the gap", getting to part way to 10E-4mbar.

Then I found the small dual-diaphragm non-oil pump, and it really could make low-grade vacuum, certainly up to 10E-2mbar. If I find it again, I will post it.


----------



## graham-xrf

Hmm - How come it double-posted?


----------



## graham-xrf

rwm said:


> The xray tube is a cool decoration. It was given to me by a medical repair tech. Pain in the ass to get it out of the housing!
> But I think I misunderstood your question about transparency. I now believe you meant to visible light not xray.  Sorry.
> I am having a hard time understanding how you plan to separate the energies. Is it a quantitative effect on the number of photons hitting the face of the PMT?
> Robert


Not at all. You did not misunderstand. For me, transparency is not restricted to visible wavelengths.
Also - I am not yet sold on any single method.

The type we are discussing is if you hit a material hard enough with radiant energy, you can get it to glow  by florescence, and the color is characteristic. . This might be too feeble a glow to see - only a few photons. The radiant energy might be infra-red light, or visible light, or UV, or electrons (i.e.beta radiation), or even X-Rays.

The radiation from Americium 241 in quantities as small as 200 nanograms is not considered harmful unless you eat it, but can provoke glow photons from elements, and these can be detected. They also arrive over a time, and the characteristics are related to the elements - a signature. A built-up plot of many arriving to make a trace. It can take seconds or minutes to gather enough.

The "other" way is to have some gadget to disperse the response glows by color - for that read "wavelength". This is not as straightforward as prisms. Diffraction gratings made by capturing laser holographic interference onto photographic resist are unlikely to be an "easy thing".

There are characteristic responses that can identify materials from shining infra-red at them, A totally different method, but with maybe easier routes to a cheap DIY getup.

I do love your X-Ray tube!


----------



## rwm

Thanks! I do understand x-ray fluorescence as excited by a gamma source. I was wondering how the detector crystal and the PMT would work to separate out the characteristic xrays of each material. The detector crystal is monochromatic (right?) so I assume the higher energies make more photons available to the PMT? I also don't understand how to account for temporal spacing (or lack of) for emission events.
Robert


----------



## homebrewed

graham-xrf said:


> OK - so when the radiation hits the metal(s), the energy photons that come back from the K and L electron states returning, with the help of Planck's  Constant, are at X-Ray wavelengths, which is why CsI scintillator is needed to yield light that a photo-detector can see. Have I got that right?


Yep, you got it.  Sounds like an indirect way to do things, but it's surprisingly common.  A similar approach is used to detect electrons scattered from a surface being imaged by a scanning electron microscope (of course in that case the electrons strike a phosphor, much like the kind you'd find in the old CRT displays).  One advantage is that the combination is very robust, as long as the PMT is protected from stray light. That's easy to do inside the SEM vacuum chamber.


----------



## homebrewed

I see there still some confusion on how a scintillator can produce an X-Ray spectrum.  Both RJ and I have mentioned it in previous postings to this thread, but just to repeat..... in essence, the detector system outputs a pulse whose total energy is proportional to the energy of an x-ray photon that hits the scintillator.  For a given detector system that generates the same-width pulses per photon, this boils down to pulse height.  Higher = shorter X-Ray wavelength, thank you Mr. Planck.  You could use the primary gamma ray photons from your Americium to calibrate the system.

In order for this to work right, the incoming X-Ray flux must be low enough so individual photons can be detected.  And of course the acquisition system must be fast enough to capture the peak, and sophisticated enough to reset quickly so it is ready for the next photon to come in.

You can buy relatively cheap vacuum pumps for A/C work -- both Amazon and ebay offer many (probably most come from the same Chinese factory).  Or you could wait for a 25% coupon from Harbor Freight and buy their 2-stage pump.  Getting the instrumentation needed to properly measure the gas pressure when you backfill with your detector gas might cost more than the pump, though.


----------



## RJSakowski

The source beam has to be more energetic than the resultant photons in order to have an interaction.  A visible beam will not yield any useful information.  The 59.7 Kev photons interact on a nuclear level to generate lower energy photons.  These will be in the 5 -50 Kev area of the spectrum for the materials in question. These photons impinging on a scintillation crystal will release a shower of low energy visible light photons with the sum of their energies equal to the energy of the x-ray photon.  The energy of a visible photon is in the ev region.  E = hf , hence hundreds or thousands of visible light photons foe each x-ray photon.

I expect that there could be two simultaneous x-ray photons but it would be rare.  If you recall ever listening to the audio output from a Geiger counter, you can hear the distinct events.  The process in XRF is one of sorting each event according to its energy and summing up the events over time to build the spectrum.

Normally, it isn't possible to excite electrons in a target to emit photons of higher energy than the source photons.


----------



## homebrewed

If DIYing your own gas-based detector (which does not require a scintillator), a sub-problem is getting the right operating pressure.  Off-the-shelf pressure sensors that are suitable for this can run you about $600 for the controller and sensor (Kurt Lesker model KJLC-205 + KJLS6000SS).  However, if you're willing to roll your own controller circuit as shown here you can get by with just the sensor for about $55 + electronics (2020 price).  The circuit uses a  single 741 op-amp (!!) so how tricky can it be?

An alternative would be to buy a MEMS based pressure sensor chip like the MS5540C from TE Connectivity, which DigiKey currently has for $22.99.  Its low pressure range isn't as good as the thermocouple sensor, bottoming out at 10mbar; and it would require some sort of vacuum-tight electrical pass-thru.  For a bit more money I'd go for the thermocouple gauge, which already has a gas fitting on it.  I've used them at work and they are very rugged.  Throw in an Arduino for the ADC and conversion to pressure and wallah, as an old friend has been known to say.


----------



## rwm

Thanks for reviewing that. That makes a lot more sense now. I was thinking about a much higher xray flux. The Geiger counter example is very illustrative.
So if you use an Americium source, a stock PMT with a scintillation crystal in front of it, it seems like the rest is just electronics and processing? I say "just" although I see that could get real complex.
Following with interest.
Robert









						Scintillation crystal Pure Cesium iodide CsI radiation detector 1" dia cylinder  | eBay
					

Cesium Iodide crystal scintillator, perfect to couple to standard 1" photo-multiplier tube as super sensitive radiation detector. It has excellent energy resolution (unlike typical plastic scintillator).



					www.ebay.com
				




$50


----------



## RJSakowski

rwm said:


> Thanks for reviewing that. That makes a lot more sense now. I was thinking about a much higher xray flux. The Geiger counter example is very illustrative.
> So if you use an Americium source, a stock PMT with a scintillation crystal in front of it, it seems like the rest is just electronics and processing?
> Following with interest.
> Robert


That would be a pretty hot source.  I would definitely want some shielding between it and me.  

re: the rest of the stuff, I think it can be. As I envision it, there would be a gate on the output of the pmt which would pass the voltage through a gate to hold for sampling .  The voltage would be presented to a comparitor circuit and computer controlled variable voltage would sweep from zero to some maximum value.  When the swept voltage matched to sample voltage a count would be added to the appropriate accumulator.  The number of accumulators will determine the resolution of the spectrum.  more for higher resolution and longer processing time.  The spectrum could be scanned it real time, watching it grow or sample acquisition could be performed for a set time and the spectrum scanned afterwards.


----------



## graham-xrf

rwm said:


> Thanks for reviewing that. That makes a lot more sense now. I was thinking about a much higher xray flux. The Geiger counter example is very illustrative.
> So if you use an Americium source, a stock PMT with a scintillation crystal in front of it, it seems like the rest is just electronics and processing? I say "just" although I see that could get real complex.
> Following with interest.
> Robert
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Scintillation crystal Pure Cesium iodide CsI radiation detector 1" dia cylinder  | eBay
> 
> 
> Cesium Iodide crystal scintillator, perfect to couple to standard 1" photo-multiplier tube as super sensitive radiation detector. It has excellent energy resolution (unlike typical plastic scintillator).
> 
> 
> 
> www.ebay.com
> 
> 
> 
> 
> 
> $50


I saw that one, but I think you can get a photomultiplier tube with a CsI scintillator material already bonded to the front window. Also, other scintillators like NaI(Tl) Thallium-doped Sodium Iodide, though I don't know which suits the aim better. To couple the scintillator to the photomultiplier, you need a drop of lens-coupling immersion oil. That stuff is non-drying so I suppose it would be enough to tape the ensemble together, or use some glue perhaps. Epoxy around the rim might be OK. I am not sure I would shock the edge of a PMT window with hot melt glue.


----------



## hman

graham-xrf said:


> I am still trawling everything there is about material identification, learning about Raman handheld spectrometers, finding out about Compton scattering, and what is an Auger electron, and why that produces a special little piece of spectrum.


Part of my graduate study in chemistry was doing Auger and ESCA analysis of catalyst surfaces.  I'll offer a general summary of the techniques here.  

Both techniques depend on a very precise way to measure electron energies.  The analyzer was a tubular structure ~6" in diameter and ~18" long.  It consisted of two very precise hollow cylindrical "lenses," which curved the path of scattered electrons.  Only one energy would survive the circuitous trip.  I don't recall exactly, but I think it had a Channeltron electron multiplier for a detector.  An electron gun for the Auger analysis was located coaxially and centered inside the front of the analyzer.

Auger analysis starts with bombarding the sample with an electron beam.  These electrons knock electrons from various inner shell orbitals in the sample.  This process involves a random exchange of energy, so the scattered electrons are ignored.  But after a core electron has been ejected, other electrons, from higher orbitals, "fall down" to replace it.  Because orbital energies are precise, and depend entirely on the atom in question, the energies of the transitions are also precise.  Additional (Auger) electrons, carrying this excess (kinetic) energy, are sometimes ejected in this process.  These electrons "carry" the precise packets of energies as velocities (elecron mss being constant).  By analyzing the velocities of ejected Auger electrons (ie, by adjusting the potentials of the electron lenses in the analyzer), you can identify the types and concentrations of atoms in the sample.  Each particular element will have a set of well defined Auger electron energies.  Back in the day (1970s), we would manually compare a plot of the electron energy spectrum with a table of energies to do the analysis.  Nowadays, all the info is in a computer, making elemental and proportional analysis a lot easier.  https://en.wikipedia.org/wiki/Auger_effect 

ESCA analysis uses x-rays to bombard the sample.  But here, the originally ejected electrons' energies are well defined.  Photon energy minus orbital energy equals ejected electron energy.  The advantage of ESCA is that the electron energies would shift very slightly due to the oxidation state (charge) of the atom, and this could be measured.  ESCA is short for "Electron Spectroscopy for Chemical Analysis).  The disadvantage was that the number of electrons was a lot less than Auger, so yu had to crank up the electron multiplier and accept a higher level of noise.  By and large, ESCA is not that useful for metallurgical analysis.  More useful to chemists.

By the way, EDX/WDX are the opposite of ESCA.  In an electron microscope, the electrons in the electron beam used for imaging collide with and eject (scatter) electrons from the sample.  These ejected electrons are used to form the image.  As with Auger and ESCA, the ejected electron leaves behind a "hole" in the orbital structure and outer electrons falling inward do so with precise energies.  Some Auger electrons are formed.  But most of the transitions dump the energy in the form of photons (x-rays) of precise energies.  It's these x-rays that are analyzed for energy levels.

I've made use of Channeltron electron multipliers in other graduate work.  And as I understand it, the electron multiplier plate in night vision devices is basically an array of Channeltron-type devices.  The way they work - very small diameter curved channels are coated internally with what amounts to a continuous thin film resistor.  High voltage is placed across the ends and there is a continuous potential difference along the length of the channel.  An electron entering the channel in a straight line intersects the wall somewhere - attracted by the potential - and knocks off several secondary electrons.  These are accelerated inward by the potential field, again in a straight line.  So they hit somewhere further along the curved wall, eject more electrons, etc. etc.  Advantages - No need for a voltage divider, as in a regular PMT.  Disadvantage - The thin film resistor can only handle a limited amount of current before it's burned out.  So you have to be careful about "how much you feed it."  I seem to recall that image intensifiers have some pretty sophisticated circuitry to prevent burnout from bright lights.

Now a specific question for graham-xrf:  Looking at post #31, I did not see this type of electron multiplier listed in the table.  Was I simply missing the nomenclature?  Or was it not included?????  And could you use either a night vision image intensifier (which I think you said you had on hand) or a Channeltron instead of a PMT?


----------



## graham-xrf

I suppose this idea deserves at least a lash-up experiment. I have two Americium sources, and I can expect to posses another six soon. I will get hold of a PMT tube + scintillator, either as separates, or as a unit.

I am assuming the PMT tubes used for night vision goggles are unsuitable because they don't let you collect the electron output to an amplifier, instead expending the energy onto a green (zinc sulphide) screen. The other has a fibre-optic bundle intended to couple to aCCD chip. A pity, because that one could see down to 1/12 starlight, and the image of a person in a field would be as speckles of arriving photons, becoming more high resolution as the light level increased.

*It would help if I get a little walk-through.*
I tried to check out NIST Atomic Spectra Database
I went for "Lines", and typed in "Fe" and pressed return. After about 10 seconds pause, we get the first page of 29609 lines, and I can hear the PC fan revving up as all 4 cores go from 44C to around 60C.

On the way, I see "Levels" and more, and my eye is drawn to "ASD Interface for Laser Induced Breakdown Spectroscopy" (LIBS), but we leave that for now.

I try "Na", hoping to see something of the two bright yellow lines at 589nm and 589.6nm. They are there, but you search a long way down through 7383 lines. I am guessing the numbers are about every possible energy transition between every energy "shell" and all its electron quantum spin states, and only a few would be provoked from a shot of Americium-origin energy.

So start with the energy from one of the smoke detector best shots..

1) It hits the iron, and electrons energy states get yanked about, and settle down, giving back the energy as a photon of a new discrete quantized amount, or amounts, depending on how many electrons got jangled, and by how far.
Let us gloss over what happened to the remainder that did not make the cut (among quanta).
Perhaps we get back a whole bunch of quantized energies.

2) So find out one of these, and divide by Planck's Constant, and also the speed of light, to get at the wavelength.
   This wavelength is the characteristic of the iron - it's fingerprint. Also, the amount of energy in it is also such a fingerprint, locked together by the constant-ness of Planck's Constant.

3) This exit photon (might even be X-Ray) hits the scintillator material.
   Let us gloss over what happens there, other than to say that the scintillator responds with a feeble flash of (visible light, or not?), but it's own photons anyway. The flash intensity is proportional to the Fe spectrum photon, so we still have a grip on it being iron.

4) These iron-sized photons have to make it through the (thin) glass window of the PMT, and hit a new material, which exhibits the photoelectric effect. Let us here not explore wave-particle duality, nor stay with the photons. It's OK to say we end up with electrons, because that is what photoelectric material does.
These electrons are hopefully proportional to the arrived photon, though possibly only a few because of low efficiency.

5) The PMT multiplier multiplies - by several hundred thousand to a million, but still proportional.
We end up with a pulse of current - the size still related to the fact it came from a smoke-detector -abused iron atom. There are more, thousands of them, all the same strength that labels them as iron.

6) In between, there are thousands more, but they are of different strengths. They would be the nickel, or cobaly, or magnesium sized flashes, They arrive at various times, sometimes right on top of the iron flashes, or each other, but in general, they have drop-out delays characteristic of their electron energy states.

7) In the end, if you display the strength of the pulses that arrive, and display them positioned on a X-Axis such that the higher the energy, the smaller the value, related by Plancks Constant, and the speed of light, you get a signature spectrum for the material. On this last point, I took it from @homebrewed post#15 that this is how the height of the pulse, and the wavelength are related, and so therefore may be displayed.

Posts have happened while I have been writing - apologies if I missed something . Having struck out on the NIST site, I have resorted to Kaye & Laby 14th edition, which I _know_ RJ has likely cussed at at some stage of his life. I just wanted to figure the wavelengths of what the scintillator was supposed to be responding to.

Remembering that we want cheap + cheerful here. We only need to be able to see enough of the elements content, and rough proportions to be able to zero in on the steel. Come to that - the app can do that for us.


----------



## rwm

That sounds about right to me, although I don't understand this statement:
"they have drop-out delays characteristic of their electron energy states."
Any time delay would not be relevant and only due to chance. It is the amplitude of an individual signal that equates to energy and would be characteristic for a specific element's electron shell. Or do I misunderstand the statement?
Robert


----------



## graham-xrf

hman said:


> Now a specific question for graham-xrf:  Looking at post #31, I did not see this type of electron multiplier listed in the table.  Was I simply missing the nomenclature?  Or was it not included?????  And could you use either a night vision image intensifier (which I think you said you had on hand) or a Channeltron instead of a PMT?


Firstly - thanks for the Auger electron explanation. The lines of spectra that can happen from where some electron energy states impinge a bit on lower levels, or are variously shielded depending on whether an electron was knocked out of a lower shell, gets a bit complicated, to say the least.

Regarding the intensifier types in the table post #31. The tables were from the Hamamatsu webinar, which would have been all about Hamamatsu products. These might not include image intensifiers incorporating micro-channel plate structures. The old salvaged example I have of was a (I think) a Generation 3, and may by now be poisoned by helium ingress (can helium go through glass)?

The type you describe are now very developed, very efficient things, devoted to night vision, so probably optimized for visible and infra-red wavelengths, and generally output to a green screen - so not for directly providing the multiplied electron collection to an amplifier.


----------



## graham-xrf

rwm said:


> That sounds about right to me, although I don't understand this statement:
> "they have drop-out delays characteristic of their electron energy states."
> Any time delay would not be relevant and only due to chance. It is the amplitude of an individual signal that equates to energy and would be characteristic for a specific element's electron shell. Or do I misunderstand the statement?
> Robert


From what I read, when an electron in an atom structure is driven into a higher energy state, the time it takes to return, and deliver up the photon at a quantum defined wavelength is not random. It can drop out in nanoseconds, or up to hours, depending on the element, and depending on which states the transit was between. Was I wrong about that? It is possible. I am taking in much of this stuff really fast (for me).

This think it now begins to look like it has a chance, enough for me to risk getting hold of enough stuff for the first experiment, gathering up some circuits stuff, and giving it a try. It may get somewhere, or it may strike out sadly, but we will never know unless we get up something to beat up on alloy steel, and see if we can figure out what it gives up.


----------



## RJSakowski

Some information about CsI(Tl) scintillation crystals.  Also, a lot of other info.





						CsI(Tl) - Cesium Iodide (Tl) Scintillator Crystal
					

Cesium Iodide, activated with Thallium - CsI(Tl) - is one of the brightest available scintillators, with a  broad emission peaking at 550nm. CsI(Tl) has good stopping power, physically rugged and and well suited to a broad range of applications.



					www.advatech-uk.co.uk


----------



## graham-xrf

RJSakowski said:


> Some information about CsI(Tl) scintillation crystals.  Also, a lot of other info.
> 
> 
> 
> 
> 
> CsI(Tl) - Cesium Iodide (Tl) Scintillator Crystal
> 
> 
> Cesium Iodide, activated with Thallium - CsI(Tl) - is one of the brightest available scintillators, with a  broad emission peaking at 550nm. CsI(Tl) has good stopping power, physically rugged and and well suited to a broad range of applications.
> 
> 
> 
> www.advatech-uk.co.uk


Thanks RJ.
What we now need to get to is the range of wavelengths to expect from the steels, after being hit by Americium energies, so to decide which scintillator material best suits it. Must not forget to include carbon, and cobalt, and silicon.


----------



## RJSakowski

I think carbon will be difficult.  It has a very low cross section for x-rays.  Page 6 of the document in post #9 gives the wavelengths of all the elements.   The upper energy will be the 59.7 Kev of the Americium source.


----------



## homebrewed

Auger (pronounced oh-jhay since the effect is named after a French physicist) electrons only come from the surface.  Just throwing a sample into the machine and hitting it with electrons won't actually reveal what the bulk material is -- it will show what's absorbed on the surface.  Typically carbon from organics that were absorbed from the environment.  A real auger system includes an ion gun to erode/mill the surface away at a known rate so it can be used to generate a profile of all the elements vs depth. 

The vacuum system for Auger analysis also has to be _extremely_ clean, or stuff from the chamber or pumps will deposit on the sample and lie to you about what's really there.  An LN2 cold finger + turbo pump + scroll pump for backing the TMP are needed, none of which are within a hobbyist's  price range.  The pump system alone would be upwards of $10K unless you can score some good deals on ebay.  Then there's the ion gun....

EDX and WDX use high energy electrons that penetrate deeper into the sample so they're better at telling you what the bulk material is without requiring an ion mll.


----------



## homebrewed

After browsing around ebay for PMTs and scintillators it looks to me like the scintillator-PMT approach is the way to go.  Buy 'em and proceed with the project, rather than getting yourself into the position of needing to buy/make tools to make what you want.  In addition, that approach has already been shown to work.  Why re-invent the wheel if you don't need to??

Scintillators also should be better suited for detecting lower-energy x-rays.  When you start getting down into the 5kev range, the window material for ionization detectors becomes crucial -- that's why beryllium is the material of choice.  A scintillator doesn't have that problem.


----------



## rwm

I may build one of these if someone figures out the electronics. It would be so cool to have. Are the support electronics for a commercial PMT complex?
Robert


----------



## homebrewed

The main thing a PMT needs is a stable high voltage power supply (they actually are very simple devices).  The dynodes are biased with a resistor-divider string, and the raw output is a current pulse, needing either a passive element (i.e., another resistor) or relatively fast current-to-voltage converter.   The PMT's gain is determined by the high voltage so that's why the HV needs to be stable.


----------



## graham-xrf

I know myself well enough to recognize when I have invested enough thought, and poked in enough speculative holes, that I must be really interested. Even though it will have to come behind more important things, like the building changes at my place, and have to get along in parallel with my machine stuff, I will try to progress this. I want to check this idea out.

So now I have put in some real money for stuff that could just end up as a cool experiment. There will be something come out of it, even if we discover the scheme has flaws. I expect I will likely have some interesting fun on the way. The best outcome is that between us, we figure out an affordable gadget that many HM members would want to have, and can reasonably put together.

Any tested circuits and proper knowledge can be posted here. Nobody else need embark on any part of it until we know something works - unless they really want to, which I welcome. I am happy to have anyone help me figure out bits of this, because for sure, there is stuff you will know better. If you make something that it works a bit better, or even just looks a bit cooler without compromising function, I am all for it.

*Sensors - let's check them out*
I agree that when it comes to uncompromising performance, the PMT tubes seem hard to beat. Scoring cheap PMT tubes from eBay could easily result in some great bargains, but could also lead to disappointment. I would not advise a "pre-owned" PMT. By their nature, the photo-voltaic material, especially from older tubes, can be life-limited from a range of causes. "New other" might be OK, but still a risk. I notice many of them come from Ukraine, or Poland.

New PMTs and also a huge variety of solid state X-Ray and other sensors are out there. There are other manufacturers, including some USA firms Start with Hamamatsu.
--> *Hamamatsu HERE*
Then get closer and check out PMTs
--> *Hamamatsu PMTs HERE*
--> *Avalanche Photodiodes (like solid state PMTs)*
--> *Spectrometers, FTIR modules, Raman*
--> *X-Ray sensors*
I am sure HM folk can trawl the website and data sheets as well as I can. Move on from Hamamatsu, and at least have a look at other manufacturers. It's OK to use any PMT one can get hold of. The circuits are all similar, and can be designed to be adaptable. Do not fear the high voltage. It is a tiny feeble low current thing. Last time I did one, I made it jump little 6kV sparks to the end of my clutch pencil.

*The  sensor area - go for bigger*
Try for something large - maybe 19mm (3/4") or more. The bigger the front face, the more of the radiation hitting the steel gets used.

I don't know how much it costs, but one can get the whole thing, high voltage and all, in a module.
(See attachment)

*Look for the best scintillator*
I understand some are hygroscopic. I read that CsI is "slightly hygroscopic". OK, so it takes up water. What does that mean? Does it still work? Will it end up in a pile of dissolved mess (or was that "deliquescent")?
I see there are scintillator materials made of plastics. What?

So far, the first part I am sure of is using the smoke detector innards. That is the easiest, cheapest, most convenient, long lived excitation source I have come across - unless someone knows different.

- - - - - - - - -
Note:  I have to hide out from this COVID-19 thing for longer than most. It may limit my options a bit.


----------



## homebrewed

graham-xrf said:


> I know myself well enough to recognize when I have invested enough thought, and poked in enough speculative holes, that I must be really interested. Even though it will have to come behind more important things, like the building changes at my place, and have to get along in parallel with my machine stuff, I will try to progress this. I want to check this idea out.
> 
> So now I have put in some real money for stuff that could just end up as a cool experiment. There will be something come out of it, even if we discover the scheme has flaws. I expect I will likely have some interesting fun on the way. The best outcome is that between us, we figure out an affordable gadget that many HM members would want to have, and can reasonably put together.
> 
> Any tested circuits and proper knowledge can be posted here. Nobody else need embark on any part of it until we know something works - unless they really want to, which I welcome. I am happy to have anyone help me figure out bits of this, because for sure, there is stuff you will know better. If you make something that it works a bit better, or even just looks a bit cooler without compromising function, I am all for it.
> 
> *Sensors - let's check them out*
> I agree that when it comes to uncompromising performance, the PMT tubes seem hard to beat. Scoring cheap PMT tubes from eBay could easily result in some great bargains, but could also lead to disappointment. I would not advise a "pre-owned" PMT. By their nature, the photo-voltaic material, especially from older tubes, can be life-limited from a range of causes. "New other" might be OK, but still a risk. I notice many of them come from Ukraine, or Poland.
> 
> New PMTs and also a huge variety of solid state X-Ray and other sensors are out there. There are other manufacturers, including some USA firms Start with Hamamatsu.
> --> *Hamamatsu HERE*
> Then get closer and check out PMTs
> --> *Hamamatsu PMTs HERE*
> --> *Avalanche Photodiodes (like solid state PMTs)*
> --> *Spectrometers, FTIR modules, Raman*
> --> *X-Ray sensors*
> I am sure HM folk can trawl the website and data sheets as well as I can. Move on from Hamamatsu, and at least have a look at other manufacturers. It's OK to use any PMT one can get hold of. The circuits are all similar, and can be designed to be adaptable. Do not fear the high voltage. It is a tiny feeble low current thing. Last time I did one, I made it jump little 6kV sparks to the end of my clutch pencil.
> 
> *The  sensor area - go for bigger*
> Try for something large - maybe 19mm (3/4") or more. The bigger the front face, the more of the radiation hitting the steel gets used.
> 
> I don't know how much it costs, but one can get the whole thing, high voltage and all, in a module.
> (See attachment)
> 
> *Look for the best scintillator*
> I understand some are hygroscopic. I read that CsI is "slightly hygroscopic". OK, so it takes up water. What does that mean? Does it still work? Will it end up in a pile of dissolved mess (or was that "deliquescent")?
> I see there are scintillator materials made of plastics. What?
> 
> So far, the first part I am sure of is using the smoke detector innards. That is the easiest, cheapest, most convenient, long lived excitation source I have come across - unless someone knows different.
> 
> - - - - - - - - -
> Note:  I have to hide out from this COVID-19 thing for longer than most. It may limit my options a bit.


Seems like you found the Wikipedia article about CsI.  Yes it's disappointing to find it's somewhat hygrosopic.  It might be possible to seal it in something like a vacuum-sealed "food saver" bag to get around that.  Plastic film are pretty transparent to X-rays so vacuum-sealing the scintillator probably won't incur much of a performance hit.  As a side-note, the wizard who ran our WDX system made his own replacement detector windows out of stretched/thinned polypropylene plastic bags.  If carefully stretched, the plastic became both thin enough and strong enough to produce very good low-energy X-ray analysis results AND resist the pressure differential between the low-vacuum SEM chamber and detector gas, which was around atmospheric.  Must've looked like a balloon, but he got the goods.  Like I said, a wizard...too bad he's mentally gone now....


----------



## graham-xrf

Sometimes, with cheap bits, you can make something great.
I consider Dan Berard's achievement outstanding,. He built a homebrew STM (Scanning Tunnelling Microscope) from a piezo noise buzzer - which is one ot the "other" parts found in discarded smoke detector alarms. He managed to image atoms using John Alexander's micro version of a milling machine table.

Cut across the top electrode to divide it into quadrants, then get the tiny X-Y scan motion by flexing the piezo noise-maker using op-amp ramp waveforms. How he manages to make atomically sharp STM tips by cutting stressed wire at a slant, or sharpened by electro-etching it dipped in  hydroxide.
--> Home Built STM

Like these graphite atoms, or the 600nm wide bit of gold (that's about 24 millionths inch)





This is something like the tiniest equivalent of of moving a mill table under a dial indicator.


----------



## graham-xrf

*Calculation Anomaly?*
I need an arithmetic check... and yes - feeling stupid and embarrassed.
I was calculating the wavelengths of what the alloy metals emissions might be, and it messed up.

Example: Sodium
Sodium has the characteristic yellow emission, the two well-known lines at 589nm and 589.6nm



OK - we won't be trying to identify sodium, but this test is just to make my calculation work.
We get the energies from the document in posting #9.
They agree with the values in my old chemistry book (Kaye & Laby).



They are in KeV, so multiply by 1000 to get *1040.98eV* and *1071.1eV*

We need also:
h    = 6.626070E-34        (Planck's Constant)
c    = 299792458            (Speed of Light m/sec)
eV = 1.602176634E-19  ( Electronvolt in Joules from electron charge moved through 1 volt)

Wavelength λ = (h * c)/E metres    (The Planck-Einstein relation - our main equation)

So I tried h * c = 1.9864458121E-25
Also, get the energy E1 = 1040.98 * eV = 1.66783383246e-16 Joules
and                            E2 = 1072.10 * eV = 1.71609139268e-16 Joules
Now go for the wavelengths..
            h * c = 1.98644581218e-25

  λ1 = (h * c)/E1 = 1.19103343E-09 m
and
λ2 = (h * c)/E2 = 1.15754083E-09 m

This is not what I expected! Multiply 1E9 is nanometres. I wanted to see 589nm.

So am I doing something really silly? How does this work? I have to get it right if I want to figure what comes from (say) vanadium, or nickel.
[Edit - OK, we got there. End of post#77]


----------



## rwm

I may be misunderstanding this but I thought spectral lines were related to the outer shell electrons (like chemistry) while characteristic x-rays are related to the K shell electrons. They are therefore completely different energies and properties. Sodium emission lines are visible light wavelength while characteristic x-rays are, well x-rays. The characteristic x-rays of Na would not be the 589nm spectral lines.
Robert


----------



## RJSakowski

Robert has it right; different shells.  This may help to clear things up.





						Electromagnetic spectrum - Wikipedia
					






					en.wikipedia.org


----------



## graham-xrf

Me too (misunderstanding).
I know that if you toss some salt into the blue propane flame, you  get that colour, and that may_ not_ be the kind of wavelengths we are talking about when we hit metal (even sodium) with some smoke-detector specials.

I just took the document of shell energies for all those elements (from posting #9) and tried out some, looking for any match-up to any spectra at all. I can only suppose that the calculation is correct, and that the real "colours" coming out are 1.19nm and 1.15nm

Take c    = 299792458  (Speed of Light m/sec) and divide by one of those wavelengths - and cringe.
They would be X-Rays - 251petaHertz. X-Rays is considered 0.1nm to 10nm

One transition is an L --> K transition (Kα )
The other is a M --> K transition (Kβ), that is, from M shell right past L, all the way to K
The configuration is 1s22s22p63s1.

The thing is, with only 11 electrons, there are a limited number of ways you can beat the thing up (with smoke detector shots). There are only two close-space strong lines in the spectrum. There are only two energies given. They are close together. That might be confusing me.

*Try this:*
The bright yellow lines that are seen, even in light from the Sun, are _not_ what we have to deal with. They are visible light, not X-Rays!
If you do enough to knock out a K electron, then one from M will drop in there and take it's place, OR, maybe one from L region will drop in and take it's place. Each transition will deliver some X-Rays.

*The yellow light*
I think the change in energy involved might correspond to just the energies in the K region, the "outer shell" if you like. The transition between the ground state and one of the spin states 3p3/2 and 3p1/2.

@RJSakowski  has replied while I was typing - so I press reply now.

[Edit - I think I got it. 589nm is good for transition from -5.14eV to -3.04eV, corresponding to 3s, and 589.6nm is good for transit to 3p spin state.  Who knew I would ever get this deep into quantum mechanics?]


----------



## graham-xrf

Moving swiftly on - we need to be detecting X-Rays. That, I suppose, is what the scintillator material is all about. A frequency down-conversion to tiny flashes that we detect with the photo-electric goodies.

Re: Hygroscopic
The joint to the detector can be sealed up. The outside of the CsI (T) or whatever can be blocked with grease, water-glass, paint, whatever. The front surface has to be exposed, so store it between outings with a cover with dessicant, like the silica gel bags that come with your new micrometer. Maybe there is a "dry it out" procedure. What if one takes the butane torch to it? Bake it in the oven along with the cookies?

Seriously - which X-ray scintillator material do we adopt?


----------



## RJSakowski

graham-xrf said:


> Moving swiftly on - we need to be detecting X-Rays. That, I suppose, is what the scintillator material is all about. A frequency down-conversion to tiny flashes that we detect with the photo-electric goodies.
> 
> Re: Hygroscopic
> The joint to the detector can be sealed up. The outside of the CsI (T) or whatever can be blocked with grease, water-glass, paint, whatever. The front surface has to be exposed, so store it between outings with a cover with dessicant, like the silica gel bags that come with your new micrometer. Maybe there is a "dry it out" procedure. What if one takes the butane torch to it? Bake it in the oven along with the cookies?
> 
> Seriously - which X-ray scintillator material do we adopt?



The link I posted in post #64 has a good rundown on various scintillator crystals, pick on Radiation Detectors-Scintillator, scroll down to your selection and pick a scintillator from the menu at the right.


----------



## rwm

I think CsI may be the most widely available. It is used for slightly higher energies in medical imaging. Typically the 140KeV photon of Tc 99m however it will detect lower energies well.
Robert


----------



## graham-xrf

RJSakowski said:


> Robert has it right; different shells.  This may help to clear things up.
> 
> 
> 
> 
> 
> Electromagnetic spectrum - Wikipedia
> 
> 
> 
> 
> 
> 
> 
> en.wikipedia.org


At least for the sodium yellow visible lines, they are both from ground state to outer orbital 3 (or M).
You get two lines because the energy to get to 3p3/2 is slightly different to get to 3p1/2
The real stuff we are after has X-Ray wavelengths.
Sorry it took a while for me to find that one out.


----------



## graham-xrf

Detection range:
For the lowest energy in the materials we might put this thing against is from  Lithium putting out 22nm.
Beryllium does 11.4nm
Carbon would deliver 4.4nm
Magnesium gets shorter at 989pm
Good old Iron does 193pm
Moving along to the highest value on that page is Silver Ag with Kβ1 at 24.9424 KeV, which causes 48.7pm.
Beyond that, like up to Gold (Au) 77.98KeV, the numbers get silly.
The above numbers come from energies in the XRFSpec_ENG.pdf in posts #9 and #77
The little spreadsheet did it (blame anything)!

These wavelengths cover a range well past what the scintillators we have been mentioning apparently can do.



OR - I have messed up again!
Sorry folks, but when I do try for something that cost more than about $2, it will be a bit hardball.
All the wavelengths I get so far are too short for this kit. Something must be wrong!
Other guys have got a glow out of this stuff.
The numbers have to make sense at least once.
Maybe someone can spot the fumble


----------



## homebrewed

Still a bit more than what I'd want to pay, but check this out:  cheap gamma spectrometer.  And there are various modules for less that you probably could assemble into an XRF system.

If folks still want to roll their own detector, you also may want to look into so-called SiPM's, solid-state photomultipliers that look to be much easier to operate than traditional PMTs.  For example, the microfc-30050 from ON Semiconductor, $55.70 at Digikey.  Or for $68.75 you can get an evaluation board at Mouser.  Wow!  There actually may be a path toward making a reasonable DIY XRF after all...


----------



## graham-xrf

$600 is out of court. I,m sorry - but a flat no.
My internal evaluation reasoning is a bit phsychologically complicated, but the product loses my trust from the beginning.

If I had a product even with with most excellent high tech stuff inside, and was asking that much for it, I would not feel the need to package it in a crappy plastic box with USB lead that would not do justice to a bargain basement phone backup battery.

Pricing at $599 introduces a second element of presentation manipulation covering arbitrary speculative price pitching. The other thing I note is that it is oriented to pulse counting, not pulse sample capture. Many of these radiation detectors use high gain threshold trigger logic transitions, losing all the analogue information it the cause of counting a clear click.

I dunno. I am the type who might go to a shop three times to peruse and mull over the merits of something, and still walk away!

While PMT tubes are very cool in their own way - I like this  SiPM idea.
I am OK to try one after checking out the data sheet.

BUT - if I am going to get into the datasheets, choosing something that best suits, I need first to resolve the "wavelengths too short" question. I did not think it would be so tough to wring this one out. All the products data are about the wavelengths responses they are good for. All the data we have is about the energy of the photons that might land on them. The equations are simple, to get at the conversion factor. Still not making sense!

How do we get at the wavelengths that are going to happen coming back out of a steel alloy we have hit with radiation?


----------



## RJSakowski

The wavelength is given by the equation wavelength (nm) = h*c/E where h*c is 1.23984 KeV nm and E is the photon energy in KeV.  The lightest element of interest , Mg,  has an fluorescence x-ray energy of  1.253 KeV which would have a wavelength of .798 nm.  We would not be able to excite fluorescence above the source energy which is 59.7 KeV or .0208 nm.  If you wish to see carbon, its emission is .277KeV or 4.476nm.  I expect that the carbon will be fairly transparent to the source photons though.


----------



## homebrewed

The wavelengths you are calculating are correct.  The graphs you show in message #82 are the EMISSION spectra of the scintillators, NOT the wavelengths the materials will detect.  The graphs can help you choose the right PMT -- obviously, if the scintillator is emitting light that the PMT can't "see", you've got a problem.

The parameter of interest in scintillators is the number of photons generated for a 1Kev photon, which for Ti-doped CsI, is 54/photon.  This is the one that sets the amplitude vs x-ray wavelength.


----------



## homebrewed

Here's an Instructable describing a DIY gamma spectrometer that uses an arduino and a few other components to implement the pulse height analyzer.  I think more of the functionality could be implemented in S/W (like the "mono flop" -- also called a 1-shot multivibrator), but if not it's still a pretty simple circuit.  I don't like the 12V signals being routed into the Arduino's logic pins though.  I'd clamp them to whatever the Arduino's Vcc is (some are 5V, some are 3.3 depending on the flavor you have).

I just bought a CsI scintillator to play with.  I wonder if the americium sources in the old smoke detectors I've got lying around are active enough...


----------



## graham-xrf

RJSakowski said:


> The wavelength is given by the equation wavelength (nm) = h*c/E where h*c is 1.23984 KeV nm and E is the photon energy in KeV.  The lightest element of interest , Mg,  has an fluorescence x-ray energy of  1.253 KeV which would have a wavelength of .798 nm.  We would not be able to excite fluorescence above the source energy which is 59.7 KeV or .0208 nm.  If you wish to see carbon, its emission is .277KeV or 4.476nm.  I expect that the carbon will be fairly transparent to the source photons though.


Thanks RJ - it gets us closer.
I got h * c = 1.9864458121E-25 J.m , which is exactly the value found in Wikipedia "Planck Constant"
That Planck constant h    = 6.626070E-34 is an exact value, defined, the basis for fixing the kilogram.

To use your value for h * c, and divide by c
1.23984/c = 4.1356610779e-09  which is the number I see in the Wiki.
The given usual value is 4.135667696E-15 eV.s, but that's OK. there were 5 decimals to start with.
The value is also exact, but not expressible as a finite decimal, so approximated to 9 decimal place

The e-9 instead of e-15 is because we go direct to nanometres, and use KeV to begin with.
I get it that the value you used has the eV = 1.602176634E-19 built in.
- - - - - - - - - - -
Looking at some of the solid state sensors suggested by @homebrewed is interesting. Unfortunately, the areas are really small compared to common PMT tubes. Generally multiples of 6mm square.

MICROFC-60035-SMT-TR1  6mm x 6mm, tileable    $72,92
MICROFJ-30035-TSV-TR     3mm x 3mm  tileable    $ 23.59
.. and so on
The selection is here --> *Mouser.com ON Semiconductor Photodiodes*
There is also a range of TO3 size windowed package avalanche photodiodes. Generally expensive .

The other things I have learned about scintillators is CsI is much more rugged, and a good bit less hygroscopic than NaI. The sensitivity of CsI is much lower. PMT tubes need magnetic shielding, mu-metal as well as lead at the front. Finally, they have to use a holder that excludes all light when put over, or up against, the test sample.


----------



## graham-xrf

homebrewed said:


> Here's an Instructable describing a DIY gamma spectrometer that uses an arduino and a few other components to implement the pulse height analyzer.  I think more of the functionality could be implemented in S/W (like the "mono flop" -- also called a 1-shot multivibrator), but if not it's still a pretty simple circuit.  I don't like the 12V signals being routed into the Arduino's logic pins though.  I'd clamp them to whatever the Arduino's Vcc is (some are 5V, some are 3.3 depending on the flavor you have).
> 
> I just bought a CsI scintillator to play with.  I wonder if the americium sources in the old smoke detectors I've got lying around are active enough...


Um.. lookin for the Instructable?
The Am241 sources will be blasting away much like the day they were made. The half-life is something like 432 years, slowly making Neptunium I think.

After using Arduinos for a while, I went for Raspberry Pi. Even if the Pi gets given over to a project for which it is overkill, it is affordable enough, and is easily OK to use for compiling software, while it is on the internet, browsing data sheets, downloading software, and driving screen and mouse and keyboard. If after you get the project going, you can use a Pi-zero, stripped down card without video etc.

I just got used to high speed USB3, WiFi, Bluetooth, Audio, 2 x HDMI for fifty bucks or so.
The Pi-4 in the picture had the operating system on the 500GB Samsung SSD. The little microSD card only does a trivial boot-up to launch the OS on the Samsung. This little PI-4 has a hardened mailserver and web server on it, and has stayed on for months except for bad weather power fails, but it just puts itself back to working when it restarts.
I have unplugged the mouse and keyboard and screen.

The older Raspberry Pis are given over to projects - like the one we are considering.




I had the Pi-4 playing on YT while I was figuring out the software




The Pi-3B in the acrylic case got to work with this little A/D converter. it was OK - but multichannel 16-bit with MHz sampling rates are more to my taste.

--> A/D converter sampler


----------



## RJSakowski

The value for h *c that I gave was from wikipedia.  https://en.wikipedia.org/wiki/Planck_constant
There many different ways of of expressing h* c but since we are interested in converting KeV to wavelength, it made sense to use that one.
From the table on the right, you will see the value expressed as 1.23984193 eV-um which is the same as KeV-nm.


----------



## homebrewed

Apologies for the omission.  Here's the link:  DIY multichannel analyzer. 

Any of the Pi's would be a good candidate.  Lots of free S/W development stuff, just pick your favorite language.  I like SciPy because it has nice graphing utilities.  I used it for a homebrew visible-light spectrometer using a webcam (and a real diffraction grating, not a DVD).


----------



## homebrewed

I did a quick analysis of the hardware design for the Arduino-based implementation of that DIY MCA.  While I believe it's unlikely anyone here will take this exact approach, the analysis may be helpful when it comes to writing a S/W-based version.  So my analysis is attached.  I'm an old-school analog electronics guy so I may well have glossed over some things that are obvious to me, so feel free to ask questions.


----------



## rwm

So this has already been done?!
R


----------



## homebrewed

rwm said:


> So this has already been done?!
> R


So it would seem .  However, I haven't seen any results that might suggest this kind of DIY approach is actually useful.  I have to think it's possible because there are lots of XRF vendors using very similar technology.  Here's the thing, though.  In the world of X-ray spectroscopy, it's not just a matter of finding the energy peaks, parsing out the relative intensities for the percentage of content and calling it good.  An element emitting higher-energy X-rays will, in turn, excite X-rays from other materials present.  So there are complex interactions.  A lot of this has been modelled based on the analysis of  EDX/WDX data, but, just to make things even more complicated, each element can have a number of different energy levels that, in a number of cases, produce energy peaks that overlap.  

I know this may seem an unlikely coincidence, but the mousepad I'm currently using is one I got from ThermoScientific as a freebie:  and it's a periodic table that has information about EDX/WDX elemental analysis.  A cool thing about this chart shows the "overlaps", where the emission from one element can overlap the other -- making it more difficult to distinguish the two.  Case in point:  the K-alpha line for iron at 6.4KeV is close to manganese at 5.89Kev.  Definitely problematic, because manganese is used in many alloys.  The L-alpha lines are .636 and .704Kev for Mn/Fe respectively so no joy there.  Vanadium's K-alpha is close to Chromium, and Manganese  is close to Chromium.  Ugh!  To resolve this, commercial tools use sophisticated data-extraction programs to produce a least-errors fit  to all the data (not just the peaks).  The situation for iron and manganese is problematic, but cobalt isn't much better because it is on the other side of iron in the periodic table.  Nickel is better (some) because its K-alpha line is about 1Kev higher than iron.  

A work-around might be a kind of fingerprint analysis, where different alloys are characterized and then used as a comparison to the unknown alloy.  That would be my best-case approach.  It's limited by the "dictionary" of alloys you have characterized but that could rapidly grow in the context of an open-source effort.  Of course, a reliable open-source approach would include a rigorous method of calibrating the tools so DIY'er A can depend on the results produced by DIY'er B...and so on.

On a slightly different note, I am thinking that the "5V switch" control line in the Arduino MCA circuit is likely being used to implement a type of sample-and-hold circuit.  Once a pulse enters the measurement system, it sends a signal to the Arduino which then turns the peak-hold detector off so a particular photon event can be accurately captured.  If not, suppose in the meantime an even-higher-energy photon strikes the scintillator.  The higher pulse peak is captured by the peak detector.  This will result in a skew of the data, favoring higher-energy x-rays.


----------



## graham-xrf

rwm said:


> So this has already been done?!
> R


Only "in a way", or "sort of". @homebrewed software expertise with Python-based programming is going to tell.


----------



## graham-xrf

homebrewed said:


> I did a quick analysis of the hardware design for the Arduino-based implementation of that DIY MCA.  While I believe it's unlikely anyone here will take this exact approach, the analysis may be helpful when it comes to writing a S/W-based version.  So my analysis is attached.  I'm an old-school analog electronics guy so I may well have glossed over some things that are obvious to me, so feel free to ask questions.


This is OK. For a retriggerable multivibrator, it is a sad thing that I can still remember exploiting 74LS123 for all manner of pulse-making.


----------



## graham-xrf

Regarding analysis of the outputs. It could be digitally filtered somewhat.
Imagine a photon hits the iron, and provokes a clear single response. The same photon does not hit the manganese. That is the job of a new photon. Suppose it generates it's own clear pulse, at a different time. Now suppose they do their thing so that the response duration somewhat overlaps. We get a summing of the intensity, with two very small hikes at the top. If the pulses overlap enough, they will smear each other to the point you don't know which is which.

You do know that the height of the sum pulse is high enough that there must be response from more than one.
If the FIFO or boxcar storage of the intensity waveform is long enough, say a whole minute, then there will be some lower pulses that can be captured as having a higher probability of being a valid one, especially if they repeat.
If a sample finds (say) 10, or 200, whatever, all the same height, it is an indicator.

When you have 5 or 8 alloy elements in there, it will get to be a noisy mess, with some peaks here and there. This is where the only recourse is to characterize the noisy mess as a signature mess corresponding to a stored profile of that alloy. Once we get to display the output, we may be able to get smarter about how to analyze it.
This is the sort of thing where a human could look at a display, or mix the waveform with a tone and listen, and be able to tell differences.

There is also what might be revealed if the waveform were given the FFT (Fast Fourier Transform" treatment.

I know some will want a weekend project style little board with a USB connection, and a probe they can point. I am not sure. If it was that easy, we would be able to get them from eBay ready made. The world is full of "detectors", many totally bogus, but with "circuitry" in them. We are exploring this to discover if something truthful and usable can be made to work. Sure - we can trawl other projects to progress things if they are useful, but in the end, we verify.
Given the lack of (affordable) kit, we must be prepared that we discover it might take lots of money to do it well.


----------



## graham-xrf

My pack of thorium-loaded gas lamp mantles has arrived.
I take it one should not stash them in the same little plastic box as the Americium buttons from the smoke detectors.


----------



## homebrewed

I have examined the Arduino code that was written for the MCA.  It's interesting that, while the project web page is in Italian,  all the comments in the Arduino code are in German.   Thank goodness there are some good online translation sites!  The code actually is fairly simple, although it has a lot of commented-out code that most likely was put in for debugging purposes.

The main reason I wanted to examine the code was to verify my hypothesis that the "5V in switch" is used to implement a track-hold circuit; and I was correct.  An overview of the code shows that the program waits for a pulse to come in from the 1-shot.  It waits a short time to make sure that the voltage on the sampling capacitor rises to its peak value, then shuts the transistor buffer (the BC327 PNP transistor) off.  The circuit now is in its "hold" state.  The voltage is then digitized and the value is used to create an index into an array.  The array contents at that address are incremented by 1.  Then there's some code to update the display, which appears to be a realtime plot of the spectrum as it's acquired.  Finally, the storage capacitor is reset, re-enabled (after a short delay so the cap can fully discharge), and the "5V in switch" signal is set HIGH, which turns the buffer transistor back on.  This loop is repeated until the reset button is pushed (not shown on the schematic, by the way).  The reset clears the spectrum array and the whole thing starts over again.  The reset command also causes the program to output the spectrum data to a host computer, if one is connected to the Arduino.

While the display routine includes an "auto-scaling" function so no data clipping occurs, the code doesn't seem to take care of overflow in the integer array that stores the raw spectrum data.  This might be a moot point though -- there are 128 slots for the data so it might take a long time for one of them to overflow.  OTOH it wouldn't take much more code to check for that and stop the acquisition at that point.....or run a scaling operation on the data.

By using the Arduino's interrupt capabilities, it might be possible to get rid of the 1-shot.  If you want a visual or audible indication of pulse activity, you could use an Arduino output pin to generate a short tone or light up an LED.  It may not be possible to move the track-hold circuit into S/W, but a faster controller like a Teensy might be able to do it in S/W -- continuously digitize the input and look for a pulse event to occur.

I don't see anything really special about the MOS transistors used in the track-hold circuit.  They all are fairly high-current devices, but the IRL510 is the only one that needs to be that hefty (due to the discharge current of the 4.7nF capacitor).  I get the feeling these particular devices were used because they happened to be in the developer's parts drawer.


----------



## graham-xrf

There are high speed op-amp circuits that can ride up a pulse, and stay stuck at it's peak until discharged. I will agree the scheme has the merit of low cost simplicity. It has been a while since I used LTC6244. They are now part of Analog Devices.
--> PEAK DETECTION

I think the nature of the pulse - how sharp, or broad is it, or is it two pulses partly overlapping, is better to know than to just seek it's peak. We now have low cost high bandwidth A/D conversion chips available that can capture a pulse with enough samples through it's duration to get it's shape, including it's peak. Should we consider a pulse trigger circuit which starts a sampling, capturing (say) a gated 1second's worth at some sample rate like 250KHz?

If the pulse is faster, we increase the sample rate, and maybe reduce the sample interval.


----------



## homebrewed

graham-xrf said:


> There are high speed op-amp circuits that can ride up a pulse, and stay stuck at it's peak until discharged. I will agree the scheme has the merit of low cost simplicity. It has been a while since I used LTC6244. They are now part of Analog Devices.
> --> PEAK DETECTION
> 
> I think the nature of the pulse - how sharp, or broad is it, or is it two pulses partly overlapping, is better to know than to just seek it's peak. We now have low cost high bandwidth A/D conversion chips available that can capture a pulse with enough samples through it's duration to get it's shape, including it's peak. Should we consider a pulse trigger circuit which starts a sampling, capturing (say) a gated 1second's worth at some sample rate like 250KHz?
> 
> If the pulse is faster, we increase the sample rate, and maybe reduce the sample interval.


We won't know until we have some hardware and time to play with it.  I doubt the Theremino/MCA implementation uses a track/hold, possibly it's doing something similar to what you're suggesting.  If so a sample rate of ~40KHz might be sufficient.

The case of two overlapping but different-energy photons could be a difficult nut to crack.  If you have a quantity C = A + B but you don't know A and B, the possible solutions are infinite.  This is worst-case though,  because you know, in general, what set of elements could be present.  The algorithm would have to be informed by the set of possible photon energies.  This is not an unusual approach to take -- the EDX S/W I've used gives you the option of selecting an element and telling the S/W that it HAS to be present; or tell it that its guess at an element is totally wrong.  I've seen the S/W think that something like Europium or Hafnium is present and that just wasn't possible.


----------



## RJSakowski

You need to consider the decay times for the scintillators.  This will determine how much acquisition time is required. The CsI(Tl) has a decay time of 900 nsec.  CsI has a decay time of 16 nsec.,  NaI(Tl), 230 nsec.


----------



## graham-xrf

It occurs to me that if there were several (say 3) repeats of a single pulse that were similar height, one could subtract the sample values from a more smeared muddle of more overlapping pulses, and expose some other peaks.
Maybe not realistic - just thinking out loud.

I have ordered a cheap eBay "new other" PMT, and I am giving consideration to a new Hamamatsu part. The PMTs do not need to have a responsive bandwidth beyond what the scintillator material can provide.

The inorganic scintillator materials produce a much slower pulse , I read microseconds to tens of microseconds and more. The plastics produce very fast pulse flashes, in tens of nanoseconds. Easy enough to count, but not so easy to capture and measure. The information from @RJSakowski suggests the measurement is a much more high speed thing - unless the photomultiplier provides a lag of it's own.

At first, I plan to use my scope. It is a digital storage type good to 500MHz. I want to see these things.

The eBay CsI Scintillator in post #56 seems kind of tall.
https://www.ebay.com/itm/Scintillat...636979?hash=item2620f44673:g:QS8AAOSw8b1Z56ok

Does the cylinder of scintillator have to be that thick? It looks as if one could cut several discs out of it.

I haven't yet bought any scintillator. Still thinking on that.


----------



## homebrewed

RJSakowski said:


> You need to consider the decay times for the scintillators.  This will determine how much acquisition time is required. The CsI(Tl) has a decay time of 900 nsec.  CsI has a decay time of 16 nsec.,  NaI(Tl), 230 nsec.


Ouch!  Sounds like a peak-hold circuit would be a more cost-effective approach.  Thanks for the reality check!


----------



## homebrewed

graham-xrf said:


> It occurs to me that if there were several (say 3) repeats of a single pulse that were similar height, one could subtract the sample values from a more smeared muddle of more overlapping pulses, and expose some other peaks.
> Maybe not realistic - just thinking out loud.
> 
> I have ordered a cheap eBay "new other" PMT, and I am giving consideration to a new Hamamatsu part. The PMTs do not need to have a responsive bandwidth beyond what the scintillator material can provide.
> 
> The inorganic scintillator materials produce a much slower pulse , I read microseconds to tens of microseconds and more. The plastics produce very fast pulse flashes, in tens of nanoseconds. Easy enough to count, but not so easy to capture and measure. The information from @RJSakowski suggests the measurement is a much more high speed thing - unless the photomultiplier provides a lag of it's own.
> 
> At first, I plan to use my scope. It is a digital storage type good to 500MHz. I want to see these things.
> 
> The eBay CsI Scintillator in post #56 seems kind of tall.
> https://www.ebay.com/itm/Scintillat...636979?hash=item2620f44673:g:QS8AAOSw8b1Z56ok
> 
> Does the cylinder of scintillator have to be that thick? It looks as if one could cut several discs out of it.
> 
> I haven't yet bought any scintillator. Still thinking on that.


I found that particular scintillator on eBay, too.  I was put off by the claim that it's "pure" CsI, no indication that it's thallium-doped.  You could contact the seller to see if they know any more, but often eBay vendors are pretty ignorant about what they are selling.  I found some CsI scintillators that were removed from a PET scanner for less money and bought some to try.  I'll need to buy an eval board for a SiPM though.  That will be a little more money compared to an NOS PMT, but, since I already have some lab power supplies I can save some money there, compared to getting a PMT + HV supply.

I had a sudden thought that the scintillator material itself would exhibit an XRF spectrum that might cause problems w/regard to analyzing steel alloys, but a quick consultation with my Thermo-Scientific mousepad showed that cesium, iodine and thallium all have vastly different X-ray lines.  Their K-alpha lines are right up there (Thallium's is 72.176Kev), and their L-alpha lines are significantly lower in energy compared to vanadium through nickel.  Dodged a bullet there....


----------



## rwm

I agree that eBay scintillator crystal seems a little too thick. I wonder what the optimal thickness for x-ray interaction would be? Thinner than a gamma camera or PET detector I suppose since the energies are lower. Although there may not be a disadvantage to a thick crystal? What to encase this in to prevent light leak? 
Robert


----------



## RJSakowski

homebrewed said:


> Ouch!  Sounds like a peak-hold circuit would be a more cost-effective approach.  Thanks for the reality check!


Since you have no control over the timing of the next event I would think you would want to use a fixed window for scintillator photon collection.  The timing for the open window would start at the first photons to hit the detector, as seen by a rise in the output voltage from the detector.  Photons would be collected raising the output voltage until the window closed.  The captured voltage would then be analyzed and a count added to the appropriate register, and reset and the window opened again for the next event.  A simple circuit to capture the peak voltage would be a diode-capacitor with provision for discharging.  An operational amplifier circuit would be more complicated but probably faster.

It seems to me that this is very similar to the way a solid state camera works.


----------



## graham-xrf

rwm said:


> I agree that eBay scintillator crystal seems a little too thick. I wonder what the optimal thickness for x-ray interaction would be? Thinner than a gamma camera or PET detector I suppose since the energies are lower. Although there may not be a disadvantage to a thick crystal? What to encase this in to prevent light leak?
> Robert


We need to read up on NaI(Tl) (I think) and CsI (also doped) and others. I have to agree with @homebrewed  that in the case of the eBay crystal, the stress on "pure CsI" in the description is perhaps disingenuous. We need a rather _impure_ CsI, in the right way.  I think if the correct scintillation doping is not present, the eBay crystal ends up as a fifty bucks desk ornament that will absorb water. Natively, it will scintillate, and is apparently "efficient" for extreme UV wavelengths.
--> Applied Optic Abstract CsI

There should not be a problem shielding the measurement from light. The end of the PMT is put hard up against the CsI, with a drop of optical immersion oil between, and then sealed up around the periphery. Then a mu-metal sleeve is slid over. All sorts of sources exist for that, but about $14 from eBay buys a sheet that can be (carefully) rolled around something circular to shape it, and secure with a couple of cable ties. A piece of black or grey PVC bathroom drain pipe fitting might do, with the mu-metal either inside it or over it.

Probably something soft between the glass PMT and the tube is a good idea. Over that lot, (or inside with the mu-metal) goes a sheet of lead, I guess 2mm or 3mm thick, that extends forward far enough to pick up the scatter from the alloy under test, but not so far as to block the illuminating radiation from the Americium buttons. (best ask @RJSakowski about that).

The turned fitting around it can be plastic or metal. It too can be conveniently fashioned from plastic pipe, but the fitting that mounts the Americium buttons will need a lead disc behind the sources, and a lead ring shroud. Some sort of soft, compliant, cleanable ring on the end to allow a light-tight seal when put up against a alloy. Alternatively, a box that mounts the probe, and a sample of the alloy put in it - light tight.

Photomultiplier tubes are probably not OK to have the high voltage turned on unless already dark. I think there needs to be a light sensor diode in there to use as an interlock, and perhaps a fast-acting inherent protection limit against overload currents. We have to pick through the existing radiation detector examples. They must have got to the point of switch-on without busting the thing!

I am committed. I have purchased a cheap "new other" photomultiplier to mess with, develop circuits, etc. but I think I will end up with a new Hamamatsu PMT, or try out a silicon avalanche photodiode array, or both. If each  element of an 4 x 4 array has it's own connection, we get to capture some separate events that might otherwise have just shared the same PMT photocathode.

I know - I get it. That last thought comes with 2 x 8-channel Analog Devices A/D converters. Don't worry. It only gets to play if it is large enough area, very affordable, and widely available.


----------



## graham-xrf

I like RJ's suggestion.
Even though it picks out a single scintillation, locking out others until the the window content is grabbed, it does limit the probability of a separate photon contribution being so coincidentally timed as to "join in" the scintillation. Triggering a gate with a sample run-out a tad shorter than the decay time of the crystal, say 1uS, and then storing it in the buffer while the next pulse is collected may work. The false positives would get locked out if a pulse was unreasonably too large, and coincidental smaller ones also lose statistically if their average does not correspond to a valid element. A kind of "smart digital filter ", if you like.

If the pulse magnitude is within some limit tolerance, it's samples can be averaged with and stored as a sorted capture likely to belong to one element. A bunch of other sized shots, with such similarities, can be put in another bin as likely to belong to a different element. These "bins" are an array, with another dimension enumerating the number of pulses deemed to have contributed.

You get a set of averaged pulse samples, and a count likely to be proportional to the percentage % content of that element. The other array number represents the count (popularity) of that set. The plot could be Y-Axis scaled to suit whichever was the winner.

 I expect that would most times be iron, but you never know. @RJSakowski  might hold it up against one of his fish to check for mercury or something!


----------



## RJSakowski

If you look at the photon yield and decay time of the various scintillation crystals there seems to be a trade off between the two.  A lower photon yield means more noise and a longer collection time but a longer decay time increases the probability of having two events occur in the same collection window.

We actually used the atomic absorption spectrometer for analyzing for ppb mercury in effluent.  At the time, the company made mercury hearing aid batteries and mercury was added to zinc carbon cells so our Dept. of Natural Resources became very interested in our waste water.


----------



## homebrewed

I have some additional information to share.  I found a source for new scintillator crystals here.  The price seems "reasonable" for non-eBay stuff, and you don't have to ask for a quote to get the price! The link shows listings for a different scintillator, but that's because of stuff I learned while browsing the Theremino web site.  They have a document showing the use of a SiPM coupled to a LYSO(Ce) scintillator  The nice thing about LYSO is that it isn't hygroscopic at all.

And, speaking of Theremino, they have a fairly detailed explanation of their approach to squeezing as much resolution out of their system as possible.  If you believe them, you want to get the detector pulse into the digital domain as soon as you can.  Their comments discouraging the use of analog pulse-capturing H/W are pretty compelling.  They use an interpolation scheme to find the signal peak, and also algorithms to detect "bad" pulses coming out of the detector.  They use a 2-pole passive RC lowpass filter to slow down the pulses coming from the detector, and some other signal conditioning circuitry as well.  This also improves the SNR, which, according to them, is a Good Thing.

Unfortunately, their English documents leave a lot to be desired as far as clarity goes.  Mostly because either they used some sort of translation program, or the writer (clearly) is not a native English speaker/writer.  For instance, I think they are using "pictures" in some cases where we would use "pixels".  But I could be wrong....


----------



## graham-xrf

I guess the prices are sort of reasonable for what it is. If put with a PMT tube, before any other kit is added, we already have two higher-priced items.

 If the SiPM detector is cheaper than a PMT, that can help. What is the approximate cost of a suitable SiPM, and is the front window a limited capture area?  We have a ring of Americium sources firing away. If the sensor is too tiny, most reflections might miss.


----------



## homebrewed

An evaluation board for a MICRO-SMTPA-30035 3mmx3mm SiPm is $68.75 in unit quantities from DigiKey.  You also would need a ~25V power supply, but of course you'd need a PSU for a PMT as well.  The Theremino document on using a SiPM describes the use of a 3x3.  A 6x6 mm SiPM is about $40 more.  Buying the detector chip and putting it on your own board really won't save you much, so I wouldn't take that approach unless I was going to integrate it with other components.

The crystals that are most compatible with the SiPM's are sold in multiples of either 10 or 20.  Looking at (say) the BGO 3x3x15 crystals, that comes to $2.30 each, if one were to find 19 other interested folks.  The LYSO crystals in the same form factor would be a hair under $10 apiece, not counting shipping/handling.  Unfortunately, none of their CsI(Tl) crystals are a good size for these photodetectors.  I think one could buy the 10x10x30 crystals and cut them in half, but there's more money up-front for that and the added risk of damaging the crystal.....plus, CsI is slightly hygroscopic.

The Theremino article does have some words on making a crystal+detector assembly.  That could be used as a starting point.  Just keep in mind that wrapping it in light-shielding material (like aluminum foil) will absorb lower-energy X-Rays.  Putting the whole thing in a light-tight box is the best way to go, as far as not limiting what the scintillator can "see".


----------



## RJSakowski

I think it would be possible to focus the light from the scintillator on a small are detector.  You need a large area on the crystal in order to capture the x ray photon efficiently but you also need to direct the scintillation photons to the detector.  I'm thinking some sort of light pipe will improve efficiency.  If the index of refraction of the light pipe is large enough and the wall angles are right you will get total internal reflection.


----------



## homebrewed

The scintillator crystal I bought on eBay came in today.  The vendor wasn't sure if it was CsI or BGO, but I was able to figure that out pretty easily.  The crystal measured 1.22 x .585 x 2.99 cm and weighed 16 grams. That means the density of the crystal is 7.498g/cm^3, very close to BGO's published density of 7.13g/cm^3.  I didn't remove the crystal from the plastic bag so the actual density would be even closer to the published value.  CsI's density is 4.51g/cm^3 so there's no chance the crystal I got is CsI.

Fortunately the ends are polished, so it won't be too difficult to couple it to a SiPM.  I'm not crazy about the idea of gluing the crystal to the detector, because I want to leave the option of using a different type of scintillator on the table as long as possible.  I'm thinking the oil used for oil-immersion microscope lenses might work.  It is chosen for its transparency (of course), and a good match to the index of refraction of the front glass lens.  I'll need to make some sort of mount to hold the crystal and detector together, though, while ensuring it doesn't block x-rays.


----------



## graham-xrf

homebrewed said:


> Fortunately the ends are polished, so it won't be too difficult to couple it to a SiPM.  I'm not crazy about the idea of gluing the crystal to the detector, because I want to leave the option of using a different type of scintillator on the table as long as possible.  I'm thinking the oil used for oil-immersion microscope lenses might work.  It is chosen for its transparency (of course), and a good match to the index of refraction of the front glass lens.  I'll need to make some sort of mount to hold the crystal and detector together, though, while ensuring it doesn't block x-rays.


Use a drop of this stuff. That bottle is about 20 years old. You don't need much. It goes a long way.




From your dimensions, you have a rectangular slab of crystal, and I think you only need some of it.
It is not hygroscopic, and can apparently "be machined". It does not cleave, so it may be a bit like glass. It may have some radioactivity of it's own. Does it then "self-scintillate"? The Silicon diode saw a high temperature in it's manufacture. It is not likely to come to harm if glued up with the type of hot-melt used for paper. It peels up and can be removed if you pull on it.

I speculate a procedure here, but based on experience of coupling coherent fibre-optic tapers to CCDs.

You can likely cut it slowly the same way as glass, using a mudsaw, for which read, hacksaw + abrasive grit + water + a little sink dishwasher squirt like "Fairy Liquid".  Amazingly, the hacksay will be OK for cutting metal afterward.

Any old wet-type tile cutter is also likely to work. You can use a aluminium disc fro an old hard drive. It needs to turn on an arbor with some kind of variable speed motor. Difficult to do with a hand held electric drill. You need something steady, and you can gently control the pressure with the fingers.

You can also "make it round", by cutting through with a hole saw, but using abrasive.

The taper light pipe as suggested by @RJSakowski might be made of acrylic or polycarbonate. You can polish that stuff easily, and it is very transparent. You can get it as rod, or just raid it from a cheap drawer handle.
--> Something like this LINK

You are way ahead of me on this. I have yet to read and understand all the Theremino info. My Arduino experience was only one A/D datalogger. I have more experience with Raspberry Pi, but that does not extend to deep Python programming. My EDA program for schematics and PCB design has languished for too long, and needs the update.
I have some urgencies at home but will keep following the thread. I hope my PMT will arrive soon.

[Edit: Oops - when you said the ends were polished, I think you meant the 1.22 x 0.585 small ends. I was imagining cutting a piece off, and shining through the 0.585 dimension. It need not stop you. You can polish the "sides" before you cut.]


----------



## homebrewed

I have a low-speed diamond saw setup, made from a stepper motor and home-made arbor, and a lapidary-class low concentration saw blade.  I've used it to nick HSS rods to break them into shorter lengths so I should be able to cut the crystal down more if I want.  It appears that BGO is about as hard as glass, so there should be plenty of polishing media that will work to polish it.  

I had thought it might not be necessary to polish the BGO if the immersion oil has a similar index of refraction but BGO has a pretty high index (2.15).  Immersion oil is around 1.5 so a rough surface won't completely "disappear" if it's covered by the oil.  Oh, well.

BTW, LYSO has an index of refraction of 1.8 so it might be OK for mounting up a crystal that has a less-than-perfect surface polish.


----------



## graham-xrf

When coupling two (flat) transparent materials of different refractive index n1, n2, using a drop of immersion oil with index n_oil, what should the oil index be?

The major use, to couple the space between a special oil-only microscope objective, and a cover glass to eliminate two air-glass surfaces. A tricky, close-up procedure, only possible with specimens a few microns thick.

In this case, the crystal-glass join is flat, surfaces closer than a quarter wavelength. It is much more like cementing achromatic doublets, or making nicol prisms joining glass to calcite crystal. We only have to fill the surface roughness at the join.

When n1 and n2 are different, I would hazard a guess, and seek a coupling medium sqrt(n1*n2), but that is difficult, and I am not sure it is necessary. This is qa bit like the treatment given to emeralds and rubies to "enhance" them by filling micro fractures in the polished surfaces. They get up to all sorts of procedures to get the stuff into the gems, but unless you are OK to cement the scintillator to the SiPM, I suggest just use a drop of oil, and mount the surfaces together, The oil will not dry, nor fall out.


----------



## graham-xrf

Just a passing thought..
is it OK to be sharing a desk with radioactive items where 8 button sources of Americium 241 + 2 radioactive thorium-loaded lamp mantles compete for space with the coffee mug?

OK - now I get it why the crystals have to be so thick in the direction axis the incoming photon passes.



It's all about the energy range. I guess a high enough energy incoming can pass right through a thinner crystal without getting stopped, and having to deliver it's glow. That said, the range of eV energies we need for XRF might suit thinner crystals. Also, Area matters.

I am soaking up YT. This fellow uses a little Australian made voltage supply for the PMT, and is plugging it madly.
Also - using the sound card as the signal capture mechanism.
He uses the expression "pulse shape analyze".
He mentions "pulses being accepted". There is some discrimination there.

Y-Axis is counts.
X-Axis is "energies".
But - quite instructive (I cannot bring myself to use the word "illuminating")!
--> Inexpensive Gamma Spectroscopy!!!

Take a look at the options in data acquisition menu to the right.


He may be looking more at sources for isotope detection. We want to look at scatter that souces have worked on.


----------



## homebrewed

If I' correctly understood the Theremino description of their approach using a sound card, they also are using pulse shape analysis to:  1.  Accurately determine the peak height of a pulse; 2.  Detect and reject instances of so-called pileup, where a second photon arrives before the first one decays (so the pulse height of the second one is offset by the first); and (3) reject pulses that are contaminated by system noise.

I'm not convinced that point 1 can't be achieved using a properly-designed analog track-hold circuit but the other functions would be difficult to implement using an analog-only system.

BTW, I don't think that a simple deconvolution can handle the case where pileup occurs.  There's a difference between photon energy overlap and simple pulse overlap.  The first situation can be addressed (to some extent) by assuming a particular system resolution and using that to de-convolve the data.  In the second you have a variable time relationship for two pulses that overlap in time.  Only S/W could "look" at the data and determine if any part of the pulse(s) can be used to generate a good spectrum.


----------



## graham-xrf

Agreed! A track-hold is a fast and simpler method of grabbing the count for the peak value, and of course, by setting some thresholds, you can get the count of how many pulses had that value, for the histogram - which is what the display is.

You _can_ use a fast A/D conversion, with many samples, to get what amounts to an oscilloscope  display of the pulse and afterglow waveform of the scintillation.  From that, get the peak value. Lots of computing.

I had thought that unless the shape and duration of the scintillation has informational value in helping determine the energy, I didn't see it as useful. BUT - I am reading, reading, reading. I feel like I am back in study days for exams. There is too much here that I know I just don't (yet) know.

GIven that I do not have any Windows computers at all, I have installed PyMCA, and I will probably roll my own electronics.

If I can make the outboard stuff USB/Bluetooth, then any platform can use it if the communication format is kept the same. I am very tempted to use a Raspberry Pi with a add-on hat board to work the scintillation hardware, and even that might allow any sensor type. It has the advantage that it comes with it's own little computer, but can just as easily be a USB/WiFi/BlueTooth link to a desktop PC or laptop, and OS agnostic so it can deliver to Windows computers OK.


----------



## graham-xrf

When we read ..
*Scintillation Crystal NaI(Tl) NaJ(Tl) 18x30 mm Radiation Detector Scintillator*
What exactly is Na(J)?
I have been searching for it, but nothing found yet.


----------



## homebrewed

As an indication of (one of) the primary issues regarding the use of home-brew XRF to analyze steel alloys, see pages 11-14 and 50 here.  

Doing everything you can to minimize the FWHM of the system is vitally necessary in order to distinguish the different components.  Using S/W to filter out pulses that will widen the FWHM is probably a requirement, not a nicety.  If you're going that far then finding the peak in a digital data stream is almost free; and if your data is 16 bit resolution it would be difficult to improve on that with an analog design.  Part of minimizing the FWHM  likely includes the "right" scintillator -- some have a steeper photon/Kev slope than others.

As an aside, the processor on a Teensy 4.0 board runs at 600MHz, includes DMA and DSP functions and is 32 bits.  It costs $20, and the Arduino-hosted IDE supports a number of audio processing functions .  The same company sells a 16 bit ADC kit for $2.65 (!), or you can buy a pre-assembled (and fancier) version for $13.75 (source:  pjrc.com.  I have no financial or personal relationship with the company).


----------



## graham-xrf

I like the Teensy-4, the size, the price.
I like the Pi-4 more. Cortex-A72 (ARM v8) 64-bit 1.5GHz, auto clock between 600MHz and 1.5GHz depending on load.
I hunted around prjc.com, but not managed to find the ADC yet.

I agree 16 bits is to aim for. If we allow the LSB bit is lost because of threshold uncertainty, we have 2E-15, as the smallest level increment. I don't know the dynamic range expected from the scintillations, but I did see in the post #199 video the option to give the Y-Axis a logarithmic scaling. 146dB is enough to have headroom, even if quite a lot of the lower levels are into the noise floor.

If a multi-channel ADC is used, we have the option of pipelined processing.

The rest of the Pi-4 capabilities are these. It may be overkill, but I am a bit biased because I already have one.

I do like the 4GB SDRAM. Its enough to stack the samples. The rest that comes with it includes graphics to drive 2 screens, and high speed USB3.
--------------------

Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz
1GB, 2GB or 4GB LPDDR4-3200 SDRAM (depending on model)
2.4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE
Gigabit Ethernet
2 USB 3.0 ports; 2 USB 2.0 ports.
Raspberry Pi standard 40 pin GPIO header (fully backwards compatible with previous boards)
2 × micro-HDMI ports (up to 4kp60 supported)
2-lane MIPI DSI display port
2-lane MIPI CSI camera port
4-pole stereo audio and composite video port
H.265 (4kp60 decode), H264 (1080p60 decode, 1080p30 encode)
OpenGL ES 3.0 graphics
Micro-SD card slot for loading operating system and data storage
5V DC via USB-C connector (minimum 3A*)
5V DC via GPIO header (minimum 3A*)
Power over Ethernet (PoE) enabled (requires separate PoE HAT)
Operating temperature: 0 – 50 degrees C ambient
* A good quality 2.5A power supply can be used if downstream USB peripherals consume less than 500mA in total.

One question is how fast are the scintillations going to be arriving at?
Also how long is the pulse and it's afterglow?
Then, how many samples to capture of the event (to be able to sort the valid ones)?

Would a $14  ADC 2-channel device sampling at 1MS/sec be enough? (500kS/sec each)
A 3MS/sec version is about $16.
A 5MS/sec type is $23.

I would normally be looking for 40MS/sec or more, but this is not an SDR, and we want to keep the price down.
The trouble is, any little piece that I think is ideal already costs way more than I want.

Of course - I am trawling evaluation boards, and ready-made add-ons.


----------



## graham-xrf

homebrewed said:


> As an aside, the processor on a Teensy 4.0 board runs at 600MHz, includes DMA and DSP functions and is 32 bits.  It costs $20, and the Arduino-hosted IDE supports a number of audio processing functions .  The same company sells a 16 bit ADC kit for $2.65 (!), or you can buy a pre-assembled (and fancier) version for $13.75 (source:  pjrc.com.  I have no financial or personal relationship with the company).


I tried looking through pjrc.com, but I did not spot a 16-bit ADC kit for $2.65.
Since you are easily my XRF reference guru, I would ask what capabilities the A/D converter should have that you consider "enough"?

The scintillation event has a peak, and a duration of afterglow, with two components that have time constants in the microseconds. The afterglow can be bounced by an ill-timed new scintillation, possibly from a different element, and can be higher - or lower. The peak is of interest, and can be captured by a track-hold analogue circuit. The whole event can be delivered as a "slower" event by using a low-pass filter, in effect smearing it in time.

I would expect that one needs at least 4, and ideally many more samples to catch something happening over a microsecond or two. The cost of a 16-bit converter gets above $20 rapidly if sample rates above 2Ms/sec are asked for. Analog Devices (now including Linear Technology) have 14-bit A/D devices that can work 5Ms/sec to 40Ms/sec, at prices that might be contemplated.

The most critical first function components in this are (1) the scintillator crystal, (2) the PMT or Si avalanche Photodiode, and (3) the A/D converter signal capture. That pretty much eats up most of the first $100.

In looking through the A/D converters, I am using the mouser.com site as the first pricing supply reference, and I seek, where they exist, evaluation boards and kits. I discovered that mouser supply very nearly all the kits from Analog Devices that happen to be for devices with LTC part numbers from Linear Technology.

I can keep going, and I can even try prototyping with one or two, but I am interested in what you think on the quality and speed of A/D conversion. There are some 14-bit devices that go fast, and are more affordable. I am still thinking 16 bits, and squealing at the cost. We lose the LSB anyway, but 16 bits can give more than 90dB dynamic range. It will see what looks like "noise", but quite a lot of that can be filtered away (digitally) to discover the peaks of any other elements in there.

While it could be fun to explore XRF materials analysis with this stuff, I would like it if we can find some ready-made evaluation boards and the like hung together such that many HM members who really would like to check out what is in the bit of steel they salvaged, can get one together. I can, and have, designed PCBs with A/D on, but they were for 125MHz sampling RF receiver post down-converter back-ends. In some ways, this mission is the more difficult, and if we can, we want it to be with off-the-shelf PCBs.

Let me know your thoughts on what the A/D performance needs to be.

This thread has become a kind of intense design process exchange between only 3 or 4 members, getting to be an  esoteric mix of atomic quantum physics, electronic design, and data processing computing. Are we doing it right? Have we alienated the rest of HM?


----------



## rwm

"Have we alienated the rest of HM? " I think the answer is YES, until you have a working prototype. Then you get project of the month!
Robert


----------



## graham-xrf

Yay! It's Rob. We got something from somebody! 

Most of the kit needed to even begin "messing with bits on the bench" has not arrived yet, except for a couple of gas lamp mantles, and I have some Americium here on the desk. Oh yes - I forgot the little computer arrived today from Farnell Element14.

I did have the Am241 in the same packet as the thorium loaded mantles, but it dawned on me that putting two radioactive goodies together might have them shooting stuff into each other, and breeding who-knows-what, so the mantles have been banished to the other end of the room.

@homebrewed  is definitely the expert here. I think his forum name is apt for his outlook. There will be "prototypes" , and some lash-ups that would be better described as "experiments". All fun stuff will be posted. We are feeling our way here. Until I get some of this stuff figured out, I don't really know what I am doing!


----------



## rwm

I will be following closely but I may not have much to comment on. The microprocessor and software design are foreign to me.  Hey, I can melt lead for shielding if we get that far!
Robert


----------



## RJSakowski

The A/D converter basically determines the vertical horizontal resolution .  A 14 bit A/D gives over 16K different states.  I don't believe you need even that much resolution.

And yes, I'm still following but you guys are dealing in areas where I haven't got much to offer.

edit: corrected error in 1st line.


----------



## graham-xrf

It is not as good as you might think.
14 bits would give 16384 separate little levels, if one knew the state of the least significant bit.
You don't know the threshold down there where a signal at 1/16384th of the max tips a 0 into a 1.
Effectively, you are down to 13 bits with some certainty. 

The data sheets of 14-bit devices cite +/- 0.5LSB as the DNL (Digital Noise Level)
They claim SNR (Signal to Noise Ratio) 74dB (typ)
They claim SFDR (Spurious Free Dynamic Range) 90dB (typ) - a useless spec if it is down in the noise.

16-bit devices can truly get into 90dB range, That should be enough.

The plot display on a XRF alloys display has logarithmic Y-Axis spanning orders of magnitude from the most very feeble scintillation, to max brightness. To have the best chance of extracting the wanted spikes from the noise, I go for the highest resolution I can contrive, with as many samples as possible.

I think I will be after your expertise with material properties to figure out the shapes of the hardware, the shielding. I don't think you can turn lead in a lathe, and I know mu-metal has to be fabricated carefully, and bent slowly, or it loses it's magnetic shielding properties. Using a SiPM diode does not require magnetic shielding, nor a high voltage, but I have no idea about the nature of the probe in general.

A main constraint is that it cannot be "point and shoot". It has to get close enough to take radiation from the Am241.
It has to exclude light really well. Putting a metal sample into a dark box with the probe mounted does work, but I am thinking having something that can be put up against the steel, and seal off the light might be more convenient, and it can use a dark box on a small sample anyway.

Any ideas anyone can dream up at this stage, are welcome.


----------



## RJSakowski

To add to the above, if the span of scanned energies is 80 KeV, each bucket would be .005 KeV wide.  This would be far greater resolution than required for the application.  Additionally, when sorting into bins, the smaller the bin,  the greater the number of sample required to get meaningful distribution.    I would suggest that a 10 bit A/D converter would give adequate resloution.


----------



## rwm

Lead cannot be easily machined on a lathe and don't try to drill it! I have some lead tubular enclosures that may be of use.
I may have missed the physics on this, but what is the need for Mu metal? Would that be to enclose the PMT?
Robert


----------



## RJSakowski

The lead tube can either be rolled from thinner material or cast.


----------



## graham-xrf

rwm said:


> Lead cannot be easily machined on a lathe and don't try to drill it! I have some lead tubular enclosures that may be of use.
> I may have missed the physics on this, but what is the need for Mu metal? Would that be to enclose the PMT?
> Robert


If one chooses the PMT (Photomultiplier Tube) as the sensor to see the scintillation flashes, it is an electron tube which progressively accelerates electrons into a series of  anodes each at a progressively higher voltage. The electron stream is a current. It will get pulled by magnetic fields from nearby power supply transformers, cables motors, etc. Maybe you have seen the effect of a magnet on a CRT type TV.

The gain of a PMT is around 1million. Unwanted magnetic influences disturbing the innards will mess with the performance.

Mu-Metal shielding is the thin metal cover over CRT-type oscilloscopes, and the back end of some TV tubes. It is a soft grade of nickel-iron.


----------



## RJSakowski

Any idea of what the rate of gamma disintegration events is for Am241?  .9 uCi is equivalent to 33,000 Bq or 33,000 disintegrations per second but  the vast majority of those are alpha emission.  This information would be helpful in determining the maximum number of fluorescence events per unit time.


----------



## graham-xrf

RJSakowski said:


> Any idea of what the rate of gamma disintegration events is for Am241?  .9 uCi is equivalent to 33,000 Bq or 33,000 disintegrations per second but  the vast majority of those are alpha emission.  This information would be helpful in determining the maximum number of fluorescence events per unit time.


Working on it. I have seen it somewhere in the stuff I have been reading, but failing that, I can calculate it.
8 sources of Americium 241, each 0.9 microCuries, with a half-life of 432.90 years, and we can guess that it was likely in a reactor sometime in the last 50 years. Pretty much all of it is still there.

We shield it, so what goes backwards and sideways hits the lead. What remains going forward onto the sample will be about 1/6th of the photons that started out. We scatter some of those anyway, but my loose, "wet-finger-in-the-air" estimate is about 1/8th of the x-rays hit the test sample surface. does a photon go deep before it encounters an atom - I don't know.

You deserve a better answer, so let me get back to you on that.


----------



## homebrewed

I'm a little behind in the discussion since H-M was down for a bit.  Anyway, to comment on some of the recent discussion points....

1.  A/D resolution and speed.  My comment here is based on reading through the Theremino gamma spectrometer information.  They are using the 16 bit A/D on a USB sound card, so it's limited to a maximum sampling rate of 192KSPS.  That's not nearly fast enough to capture the pulses coming out of a PMT, so they are stretching the pulses using a simple 2-pole low pass filter, then amplifying by 100 to get the pulse amplitude back high enough to get decent numbers out of the A/D.  This is a "nice" approach because it permits the use of _very_ inexpensive A/D's; and the drivers are generally included with the computer OS (the Teensy approach would use the provided audio library to accomplish the same thing).  The LP filters also improve the SNR which helps improve the resolution of the multi channel analyzer.  

The cheap A/D kit from PJRC can be found here

The Theremino group also has some information regarding the energy resolution (in FWHM) vs A/D bits.  You really do want at least 14 bits.  I believe more bits is better due to the method they use to find the pulse peak in the presence of noise and the inevitable misalignment of sample time relative to the peak -- it is highly unlikely you will actually sample the peak, so some form of curve fit or interpolation is needed.  The energy resolution is completely dependent on how accurately the peak voltage can be measured.  You'd then conclude that one of the fancier audio A/D's that can get to 24 bits would be better yet:  but in fact those A/D's really don't give you true 24 bit resolution.  From what I've read on the web about this, the lower 4 bits are basically noise.  So 16 bits is the sweet spot in terms of "real" system performance.

2.  Regarding shielding.  Ebay has 1/8" thick lead sheet for not a lot of money.  I was figuring on cutting strips and rolling them into tubes, with the ends overlapping to avoid leakage.  Another approach would be to nest a small tube inside a larger one and fill the gap with lead shot.  You'd need a thick enough layer to make sure no stray x-rays got through there, but that also could be a way to form odd-shaped shielding pieces -- make a mold, fill it with lead shot and pour in some casting resin.

3.  PMT's ARE sensitive to magnetic fields.  SiPM's are not.....although the Hall effect still is in play, apparently it doesn't affect solid state detectors to any significant degree.

On a slightly different note, I found some WAV files some folks had made, recording pulses coming from a scintillator/PMT combo.  They also can be found on the Theremino web site.  I have some ideas on improving the data processing over & above what the Theremino folks are doing, and I can play with those by using the WAV files -- no hardware needed!  In addition, there's no reason why we couldn't do the same and share the WAV files to evaluate/compare our results.  The only downside is that even a few minutes worth of recording produces large WAV files.  It probably would be best to put them on something like Google Drive or the like -- I suspect H-M wouldn't permit the attachment of files that are tens of MB in size....


----------



## homebrewed

graham-xrf said:


> Working on it. I have seen it somewhere in the stuff I have been reading, but failing that, I can calculate it.
> 8 sources of Americium 241, each 0.9 microCuries, with a half-life of 432.90 years, and we can guess that it was likely in a reactor sometime in the last 50 years. Pretty much all of it is still there.
> 
> We shield it, so what goes backwards and sideways hits the lead. What remains going forward onto the sample will be about 1/6th of the photons that started out. We scatter some of those anyway, but my loose, "wet-finger-in-the-air" estimate is about 1/8th of the x-rays hit the test sample surface. does a photon go deep before it encounters an atom - I don't know.
> 
> You deserve a better answer, so let me get back to you on that.


Regarding the implied question in your last sentence. The x-ray penetration depth depends on the atomic weight(s) of the materials in the scintillator crystal (higher Z is better).  You want ALL of the x-ray photon energy absorbed in the crystal -- if the photon passes through the crystal without being completely absorbed, the flash of light is weaker and "looks" like it was generated by a lower-energy photon.  That is one reason why you would expect larger crystals to produce higher resolution, and why it's very important to direct as much of the scintillator's light output to the detector as possible.  RJ's comment about using some sort of light pipe to capture the light is very relevant to this discussion.

Calculating the incident flux of x-rays from the Americium would require knowing the solid angle subtended by the sample, relative to the source.  Plain old illumination calculations will do that.  As far as the total x-ray flux generated by .9 uC, based on Wikipedia, it looks like the 59.5Kev gamma emission is associated with the emission of an alpha particle, so the gamma flux should be pretty close to the number of breakdowns/second .9 uC gives you.


----------



## homebrewed

BTW, one curie = 3E9 decays/second.  So .9 uC = 9E-7*3E9 = 27E2, or 2,700 alphas/gammas per second.  Multiply that by the number of Americium "buttons" you've got & there you go.

What is the emission rate of a thorium lamp mantle supposed to be?


----------



## RJSakowski

microcurie to bq - Google Search
		

According to the above, 1 uCi = 37,000 Bq or 37,000 disintegrations/sec. so your .9 uCi button will have around 33,300 events/sec or 200K events for the six buttons.  I would expect that most of those events are alpha emissions.  Otherwise, that would be a very hot source.  It is the gamma emission that you're interested in so you need to know the ratio of alpha to gamma.

I'm guessing that you will have to capture several thousand fluorescence photons to develop a meaningful spectrum.  That plus the emission rate of the sources , along with various efficiencies, will determine the sample time.  Smaller energy buckets will improve resolution but will take longer to build a spectrum.  A thousand buckets would probably provide enough resolution; something like .06 KeV per bucket.


----------



## rwm

I think Homebrew is correct that the gamma emission occurs simultaneously with with alpha? Seems like that will be a lot of flux with 6 sources. I suspect the geometry and the efficiency losses will substantially reduce the signal however. The Am 241 gamma has to hit the sample and then the xray photon from the sample has to hit the scintillator. That is a relatively small part of the spherical area. Does any one know the activity or number of sources in a Bruker?
Robert


----------



## homebrewed

Interesting difference in the decays/sec.  I guess it just illustrates the fact that you have to take info from the 'net with a grain of salt .

BTW, I just found some LYSO scintillators on Ebay for $12.  4x4x22mm, and they appear to be in decent shape.  LYSO should be better than BGO for use in a spectrometer and it isn't hygroscopic, either.  The more photons/Kev the better.


----------



## rwm

4x4x22mm ? Small square that is 22mm thick? What do we anticipate the face area of the PMT will be? 
Robert


----------



## graham-xrf

homebrewed said:


> BTW, one curie = 3E9 decays/second.  So .9 uC = 9E-7*3E9 = 27E2, or 2,700 alphas/gammas per second.  Multiply that by the number of Americium "buttons" you've got & there you go.
> 
> What is the emission rate of a thorium lamp mantle supposed to be?


Firstly - thanks so much for your replies.
Re: The Thorium Mantles. They are available on eBay from UK, sold as a source for checking Geiger counters, but you have to dig quite far to get any information at all about count rates, and one supplier says the amount of thorium "varies".

One seller does say this ..
_"Thorium coated lamp mantles up to 200 counts per second on the Mini Monitor Geiger counter with an EP15 probe that is sensitive and has a thin mica window and detects alpha beta and gamma the PDS -100G scintillation counter 123 counts per second +/-  (The PDS-100G is very sensitive,very expensive and only detects gamma that's why the cps are lower)"_.

They also say "hard to come by now", though you would hardly think so given the number of sellers.
--> Geiger Counter test Source v2, Thorium Mantle. Check source

Another eBay seller claims to have sold ..
.. "to Universities, Schools, Nuclear Medicine Research Centers, Students, Teachers, Professors, Scientists and even to at least one CERN Scientist".

He does ship to the Europe, United States, Japan, Canada, Australia. I don't know if imports radioactive at this low level are a problem.
--> Geiger Counter Check Source v2, Thorium Mantle. test

The thorium, if not for provoking X-Ray responses from metals, is useful as a calibration source.
Old radio valve tubes cathodes are also likely a source of thorium dioxide.


----------



## homebrewed

I'm looking at a 3x3mm or 6x6mm SiPM instead of a PMT.  A 3x3 demo board is about $68 from DigiKey, a bit more than some of the used PMT assemblies I've found on ebay; but the SiPM approach would make it easier for other folks to make a similar one.  I'm mulling over the idea of a little light pipe to match the 4x4 crystal to the 3x3 SiPM.  That shouldn't be too difficult to make.  So he sez in total ignorance (so far) <g>.

A PMT with an active area larger than the scintillator is better than the reverse, in terms of collecting as much light from the crystal as possible.  Clearly, you want to buy something no larger than necessary, to avoid spending more money than you need to.  But if you're shopping ebay you are limited to what's available as well.


----------



## rwm

I though we ruled out the SiPM approach earlier due to noise? This would be really cool if you built one based on the SiPM and Graham built one with a PMT.
I read about  LYSO scintillators. Sounds like a good plan. A little less sensitive than CsI but not being hygroscopic is big.
I have to say I got lost on this: "They are using the 16 bit A/D on a USB sound card, so it's limited to a maximum sampling rate of 192KSPS. That's not nearly fast enough to capture the pulses coming out of a PMT, so they are stretching the pulses using a simple 2-pole low pass filter, then amplifying by 100 to get the pulse amplitude back high enough to get decent numbers out of the A/D. " 

Robert


----------



## RJSakowski

graham-xrf said:


> Firstly - thanks so much for your replies.
> Re: The Thorium Mantles. They are available on eBay from UK, sold as a source for checking Geiger counters, but you have to dig quite far to get any information at all about count rates, and one supplier says the amount of thorium "varies".
> 
> One seller does say this ..
> _"Thorium coated lamp mantles up to 200 counts per second on the Mini Monitor Geiger counter with an EP15 probe that is sensitive and has a thin mica window and detects alpha beta and gamma the PDS -100G scintillation counter 123 counts per second +/-  (The PDS-100G is very sensitive,very expensive and only detects gamma that's why the cps are lower)"_.
> 
> They also say "hard to come by now", though you would hardly think so given the number of sellers.
> --> Geiger Counter test Source v2, Thorium Mantle. Check source
> 
> Another eBay seller claims to have sold ..
> .. "to Universities, Schools, Nuclear Medicine Research Centers, Students, Teachers, Professors, Scientists and even to at least one CERN Scientist".
> 
> He does ship to the Europe, United States, Japan, Canada, Australia. I don't know if imports radioactive at this low level are a problem.
> --> Geiger Counter Check Source v2, Thorium Mantle. test
> 
> The thorium, if not for provoking X-Ray responses from metals, is useful as a calibration source.
> Old radio valve tubes cathodes are also likely a source of thorium dioxide.


Also  some TIG electrodes are thoriated.


----------



## graham-xrf

homebrewed said:


> I'm a little behind in the discussion since H-M was down for a bit.  Anyway, to comment on some of the recent discussion points....
> 
> 1.  A/D resolution and speed.  My comment here is based on reading through the Theremino gamma spectrometer information.  They are using the 16 bit A/D on a USB sound card, so it's limited to a maximum sampling rate of 192KSPS.  That's not nearly fast enough to capture the pulses coming out of a PMT, so they are stretching the pulses using a simple 2-pole low pass filter, then amplifying by 100 to get the pulse amplitude back high enough to get decent numbers out of the A/D.  This is a "nice" approach because it permits the use of _very_ inexpensive A/D's; and the drivers are generally included with the computer OS (the Teensy approach would use the provided audio library to accomplish the same thing).  The LP filters also improve the SNR which helps improve the resolution of the multi channel analyzer.
> 
> The cheap A/D kit from PJRC can be found here
> 
> The Theremino group also has some information regarding the energy resolution (in FWHM) vs A/D bits.  You really do want at least 14 bits.  I believe more bits is better due to the method they use to find the pulse peak in the presence of noise and the inevitable misalignment of sample time relative to the peak -- it is highly unlikely you will actually sample the peak, so some form of curve fit or interpolation is needed.  The energy resolution is completely dependent on how accurately the peak voltage can be measured.  You'd then conclude that one of the fancier audio A/D's that can get to 24 bits would be better yet:  but in fact those A/D's really don't give you true 24 bit resolution.  From what I've read on the web about this, the lower 4 bits are basically noise.  So 16 bits is the sweet spot in terms of "real" system performance.


I had mentioned in post #125 using a low-pass filter to "stretch" the pulse event, and I called it "smearing". I was maybe too hasty. It could be that all it loses is mostly noise, and leaves an easier pulse to capture.

Thanks for the link to the PJRC A/D converters kit.
Forgive that I still miss on this, but the $2.65  PT8211 Audio Kit the link leads to is a *DAC* kit for turning number streams into sound waveforms. I am thinking this is not what we mean.

*16 Bits.*
I have been looking through A/D converters, considering 14-bit and 16-bit candidates at rates up to 40MSPS.
These would be Texas Instrument, Analog Devices, and Linear Technology.
I have decided it has to be 16 bits. Also, I go for the highest sample rate possible for about £20 for the device alone.

For the 16 bits, at sample rates like 2MSPS or 5MSPS or even 10MSPS or so, come in at near the cost I was aiming for. Many can be had on a evaluation board, or evaluation kit. That costs a bit more, but I see this as a part as vital as the scintillator, or PMT. Going on the information from @RJSakowski in post #140, I am thinking the response scintillations may come at perhaps some kHz.
*
Other thoughts*
Some A/D chips are 2-channel simultaneous sampling. I thought having two samples is a way to a fast first average.

If we use the known fastest rise time of the scintillator crystal, and the frequency response of the detector PMT or SiPM, then there is no harm in setting an input low-pass filter to something slightly above that, because we know what it cuts is noise. A low noise gain stage as part of the filter is  a good idea, to set the A/D count range suitably near maximum.

Dolby-style noise removal (nonlinear gain to expand the low levels, filter, then compress back is not necessary if one has the sample numbers. If the genuine peaks are bouncing up and down from noise, or living in the middle of independent scatter noise counts, then replacing some least significant bits with a single set at some threshold level strips out those not making a valid contribution to the peaks. A vicious, crude, but effective digital noise filter.

I am still deciding the line between maximizing the effectiveness if the gadget, and the cost.
I still try for something that uses a USB link to a phone app, with some tiny thing like a Teesy 4.0, Arduino, PIC, or a Raspberry Pi Compute Module (like a Teensy, but 64-bit Coretex-A53, 1.2GHz, 1GB SDRAM, and 32GB Flash).
That last one is £30.90 in UK


----------



## homebrewed

rwm said:


> I though we ruled out the SiPM approach earlier due to noise? This would be really cool if you built one based on the SiPM and Graham built one with a PMT.
> I read about  LYSO scintillators. Sounds like a good plan. A little less sensitive than CsI but not being hygroscopic is big.
> I have to say I got lost on this: "They are using the 16 bit A/D on a USB sound card, so it's limited to a maximum sampling rate of 192KSPS. That's not nearly fast enough to capture the pulses coming out of a PMT, so they are stretching the pulses using a simple 2-pole low pass filter, then amplifying by 100 to get the pulse amplitude back high enough to get decent numbers out of the A/D. "
> 
> Robert


Apparently the filter cutoff frequency attenuates the pulse by quite a bit so that's why the Theremino H/W has a gain stage after the filter.  I've been thinking about that filter some myself.  A two-stage passive filter has pretty crappy filtering characteristics compared to what's possible with active filters.  I'm thinking that it actually is acting more like a simple charge amplifier -- basically a type of integrator that outputs a signal whose peak is proportional to the total energy in the input pulse.  A low pass filter should attenuate the crap out of a fast pulse (and in the process lose important information about the pulse), but the Theremino approach seems to work.  There MIGHT be an opportunity to improve things a bit more if we understand exactly what that filter really is doing for the overall system resolution.


----------



## graham-xrf

rwm said:


> I though we ruled out the SiPM approach earlier due to noise? This would be really cool if you built one based on the SiPM and Graham built one with a PMT.
> I read about  LYSO scintillators. Sounds like a good plan. A little less sensitive than CsI but not being hygroscopic is big.
> I have to say I got lost on this: "They are using the 16 bit A/D on a USB sound card, so it's limited to a maximum sampling rate of 192KSPS. That's not nearly fast enough to capture the pulses coming out of a PMT, so they are stretching the pulses using a simple 2-pole low pass filter, then amplifying by 100 to get the pulse amplitude back high enough to get decent numbers out of the A/D. "
> 
> Robert


Re: A low-pass filter
 I was not thinking about a passive filter. Let the first stage be a very low noise high bandwidth gain stage. Something that can amplify and reproduce even the noise waveform, while adding very little noise of it's own. Then an active low-pass filter with a roll-off starting beyond the frequency that a good scintillation has much meaningful information. Capture this with a an A/D that is fast enough to reasonably capture waveform. The shape might be one pulse, or perhaps the decay of one added to the rise of another, or all lifted by other scatter noise.

Later, we all get to figure out various strategies to dig out the trace of alloy metals in the data we get. and work on in the subsequent software. One approach is to run it for long enough, rejecting all but those that have a single stand-alone characteristic, and which repeat themselves enough to be considered valid, each with a height of their own.

There may be other schemes we can dream up that uses the data more efficiently. Once we get some real kit experiments running, and hopefully showing some promise, we may get some help from HM members who are really hot with software.

I think the pulse height lets us find a place on the X-Axis to put them, because the higher the energy, the shorter the wavelength that provoked it. The number of them having that height provides is Y-Axis histogram plot.The more there are, the higher the spike. This hopefully indicates the proportion of the alloy metal in the sample.

By then, we may have enough to know the steel. The simple combination of certain metals reveals what it is, even if the proportions indicated are totally screwed. Unfortunately, I am not sure this kit will ever see carbon well, or at all.

For now, I am concentrating on capturing the scintillations as cleanly and with as high quality information as possible, with the lowest cost stuff I can find.


----------



## graham-xrf

rwm said:


> I think Homebrew is correct that the gamma emission occurs simultaneously with with alpha? Seems like that will be a lot of flux with 6 sources. I suspect the geometry and the efficiency losses will substantially reduce the signal however. The Am 241 gamma has to hit the sample and then the xray photon from the sample has to hit the scintillator. That is a relatively small part of the spherical area. Does any one know the activity or number of sources in a Bruker?
> Robert


You are correct that the Am241 output has a majority of alpha decay.
α-decay (alpha)             5.486  MeV
γ-emission (gamma)    0.0595409 MeV

As I understand it, alpha particles (helium nuclei) are stopped even by a piece of paper, and even if some hit the sample, they don't do any more than heat it up (tiny amount). I expect all of what comes back off the sample will be what was provoked by the gamma. We probably don't get but a fraction of that anyway, because the X-ray photons will head off in all sorts of directions. Some onward, deeper into the sample, some from within the sample that did not make it back out, some sideways, etc.


----------



## graham-xrf

rwm said:


> I though we ruled out the SiPM approach earlier due to noise? This would be really cool if you built one based on the SiPM and Graham built one with a PMT.
> I read about  LYSO scintillators. Sounds like a good plan. A little less sensitive than CsI but not being hygroscopic is big.
> Robert


Thinking on that - yes, there will be at least one PMT doing this. I am, however, thinking that it is only the scintillator that needs to be big. Long enough to stop the incoming photons, turning them into light, and enough area to pick up most of what comes off the sample. The acrylic polished taper tube light funnel can deliver the scintillation flashes onto a small area S-PM photodiode.

A PMT has only one signal output, no matter where some light lands on it. I think, in the end, a SiPM on the end of a perspex light guide, not needing magnetic shielding (we still need the lead), not needing a high voltage supply, is looking more convenient.
Um .. looking for the refractive index and critical angle of acrylic to get the taper dimension if we start with (say) 25mm diameter capture area scintillator, and end up on (say) 3mm x 3mm.
(Edit:   ϴc =  arcsin(1/1.48130 = 42.46°)


----------



## RJSakowski

graham-xrf said:


> You are correct that the Am241 output has a majority of alpha decay.
> α-decay (alpha)             5.486  MeV
> γ-emission (gamma)    0.0595409 MeV
> 
> As I understand it, alpha particles (helium nuclei) are stopped even by a piece of paper, and even if some hit the sample, they don't do any more than heat it up (tiny amount). I expect all of what comes back off the sample will be what was provoked by the gamma. We probably don't get but a fraction of that anyway, because the X-ray photons will head off in all sorts of directions. Some onward, deeper into the sample, some from within the sample that did not make it back out, some sideways, etc.


From what I have read, alpha decay is the primary mode.  The alpha particle is ejected from the nucleus of Am 241, resulting in a Np 237 nucleus. The alpha particle is charged to a +2 state due to the lack of the two electrons which it quickly picks up.  It's energy is by virue of the ejection speed which is around 10% of the speed of light.  The Np 237 nucleus can be in an excited state and when it returns to a lower energy state it emits a photon.  My CRC Handbook lists alpha particle energies of 5.476 and 5.433 MeV and gamma energies of 59.7, 100, and 41 KeV with 59.7 KeV being predominant.  These energies may be slightly different than current values.  The Handbook was published in 1961.

Np 237 is relatively stable with a half life of 2.2E6 yrs. and although it decays by alpha emission, I wouldn't expect to see any further contribution.

The alpha particles will make no contribution  to the fluorescence measurement.  As far as I know, they are not capable of creating gamma rays.


----------



## RJSakowski

Keep in mind that many of the scintillation crystals are intended to collect higher energy photons and therefore need to be physically larger.  From work I had done in medical physics, the MeV level photons from a linear accelerator have a much greater penetration.  Unfortunately, that was two decades ago and my memory is somewhat fuzzy.  

There was a product we made that measured total energy of an x-ray beam integrated over time.  Because of the large range, it used a "charge bucket" method.  A "charge bucket" collected charge and when filled, it added a count and dumped the bucket.  An eight decade counter was used to record the number of buckets.  This was used in conjunction with an ion chamber.  This would be another possible method for measuring charge from an event.


----------



## rwm

Here is a link I found where someone else did this basic exercise. BTW they got some very nice, discrete peaks.


			http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/29/041/29041560.pdf
		


Obviously the alpha decay is not of interest here and is easily filtered out (physically). I cannot find a reference that indicates how often Am 241 gives off a gamma during the alpha decay? Some references seem to indicate that the gamma occurs for every event (1:1.)
The paper above reports detection of peaks related to Neptunium gammas as well. It will be interesting to see if and how you can distinguish the characteristic "appearance" of each metal with all the minor peaks and noise. On a basic level, assuming the hardware is adequate, you could just record each graph for a known material and they try to figure out what it most closely matches. This could even be done outside of the detector. Perhaps the detector sends the graph to a network resource and a program there does the matching. Maybe even web based? i.e I send my graph to your server and you tell me what I have. Just thinking out loud.
Robert


----------



## graham-xrf

rwm said:


> Here is a link I found where someone else did this basic exercise. BTW they got some very nice, discrete peaks.
> 
> 
> http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/29/041/29041560.pdf
> 
> 
> Robert


Most excellent find Robert - thanks much.

What we do with the collected scintillation samples, and sort them into buckets, rejecting some, is all for later.
I plan to grab/copy/learn from available software for getting the basic plot display up first.

There is a whole lot of "it's nice to have" stuff that may not be there at first, like on-plot annotations of identified peaks, and much else.

I can see from here that it is worthwhile to shell out the £30 or so on a tiny computer with some respectable power. For me, that is the Raspberry Pi 4. I happened to go for the £44 (I think) version with all guns blazing, 64-bit 1.5GHz ARM v8 with 4GB of DRAM, and much more flash memory than most phones have. I am not sure what the limit is, but the one on the desk has 64GB of microSD plugged in. This one is for the development convenience.

I find it nice that it just so easily gets onto the internet, accepts my network cable, can be made rock-solid secure, (no permissions for any external access), and I can install and mess with the software I find, directly on it, and because the whole OS is free, and powerful.

A dedicated 7" colour screen is £16, but I am using one of the two 4K video HDMI display outputs for now, to a regular monitor.

Once we have it figured out, the final gadget can use the smallest version capable of doing the job. The cut-down version with only one USB, no video, etc. can use a smartphone for a display. Getting software apps in the form for Android apps (.apk) is a bit involved, but not beyond us.

I have no idea how to get a user app into an iPhone playstore.


----------



## RJSakowski

An interesting paper Robert.  I note that they use a 100,000 uCi source for their work and are achieving peaks in the several thousand counts.  No mention of the time to collect a sample though.
edit: I found their counting time; 2000 seconds.


----------



## graham-xrf

The cross-section of the (lead) source holder in *Fig 1* is interesting - and odd.
The directions of scatter will be at more angles than the (one) picked out to get through a small hole.

Is that collimating to exclude unwanted scatter responses?
We might expect to detect lead, even if there is none in the test sample target.

I would have had the scinillator crystral right in there slightly to the right of the source(s) , so shielded from them, gathering as much as possible. Have I missed something?


----------



## homebrewed

rwm said:


> Here is a link I found where someone else did this basic exercise. BTW they got some very nice, discrete peaks.
> 
> 
> http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/29/041/29041560.pdf
> 
> 
> 
> Obviously the alpha decay is not of interest here and is easily filtered out (physically). I cannot find a reference that indicates how often Am 241 gives off a gamma during the alpha decay? Some references seem to indicate that the gamma occurs for every event (1:1.)
> The paper above reports detection of peaks related to Neptunium gammas as well. It will be interesting to see if and how you can distinguish the characteristic "appearance" of each metal with all the minor peaks and noise. On a basic level, assuming the hardware is adequate, you could just record each graph for a known material and they try to figure out what it most closely matches. This could even be done outside of the detector. Perhaps the detector sends the graph to a network resource and a program there does the matching. Maybe even web based? i.e I send my graph to your server and you tell me what I have. Just thinking out loud.
> Robert



The paper shows a nice geometry for an XRF setup.  I think it is pretty similar to at least one of the Theremino configurations and worth stealing, er, borrowing.  The detector is a high-purity Germanium diode, cooled with LN2.  Detectors like these have a large depletion region, created by "drifting" lithium into the semiconductor, and, once the lithium is where the manufacturer wants it the detector is cooled down to 77K.  And for the rest of its useful life it MUST be kept at 77K.  Not too practical for a hobbyist-level XRF.  

At the lab where I used to work we had a lithium-drifted detector that was specified to have an energy resolution down in the low (single-digit) electron volt range.  It was in a large Dewar that held about a gallon of LN2, and had a liquid level sensor in it that would alarm when the level got too low.  We had to top it off every week.  Rain or shine, Snowmageddon or not.  That detector, more than anything else, was where the $$$ was in that system.  Maybe I didn't add enough dollar signs but you get the drift (bad pun).

There are lots of "gun" style XRF tools offered for sale that just can't be using HPGe detectors so I know it must be possible.  Unfortunately, the goal of separating all the peaks of metals that go into steel alloys, particularly manganese vs iron or iron vs chromium, is going to be challenging--IF all we are depending on is the resolution of our detector and S/W combination.  

It might be possible to enhance the system resolution by using X-Ray energy filters.  For an example, see this paper.  FYI, 1.5 Angstroms is 150nm, corresponding to about 8.6Kev.  So the paper can't be applied as such.  But....

Taking the X-ray filter notion a bit further, I made up a table that summarizes the x-ray lines and absorption edges for Vanadium through Nickel.  I got the absorption information from here, and the table is attached.  The absorption edge is the energy at which the absorption abruptly decreases, so emission lines at an energy less than that will be attenuated more than those above it, by about an order of magnitude.  So to distinguish manganese from iron we would need a filter whose ideal absorption edge lies between the emission lines of manganese and iron, 5.89Kev and 6.400Kev respectively.  From the table, Chromium fits the bill.  But if we want to tell the difference between iron and cobalt we might want to use a Manganese filter.  And so on.  Maybe I've just moved the challenge to finding thin metal foils of these metals.  Some will be easier to find than others.

BTW, I don't think we will need to worry about x-ray fluorescence from the filter materials, as long as they are not exposed to the Americium gamma rays.  The photon energy coming into the filter won't be much higher, if at all, than the filter's x-ray line so not a lot of extra energy available to excite fluorescence.  I hope....


----------



## homebrewed

Lead's K-alpha line is 74.2Kev so the Americium gamma ray can't tickle that one.  Its L-alpha is 10.549Kev and M-alpha is 2.34Kev, both different enough to easily distinguish from iron and its nearby cousins.


----------



## RJSakowski

A one for one emission would seem to be a lot of gamma radiation with 37,000 disintegrations per uCi.

I have to relocate some reference that I found earlier but exposure from gamma radiation from smoke detectors was considered minimal.



			Will smoke detectors cause radiation poisoning?
		










						Calculate Your Radiation Dose | US EPA
					

This page provides a general tool to calculate an estimate of your annual radiation dose from sources the public may encounter.




					www.epa.gov
				









						Radiation Absorbed Dose Rate, Total Ionizing Radiation Dose Rate Converter • Radiation and Radiology • Compact Calculator • Online Unit Converters
					

Radiation Absorbed Dose Rate, Total Ionizing Radiation Dose Rate Converter measurement compact unit conversion calculator.




					www.translatorscafe.com
				









						Radiation Safety Training and Reference Manual | Worcester Polytechnic Institute
					

Note: Several symbols and notations commonly used in regard to radiation such as Greek letters, subscripts, and superscripts are not supported by all WWW browsers. Therefore, substitute symbols and notations have been used in this document.




					www.wpi.edu
				




The last reference has a formula for calculating dose from radioactivity:
***********************************************************************************************************************************************
"An empirical rule which may also be used is
6 x Ci x n x E = R/hr @ 1 foot,
where
Ci = source strength in curies.
E = energy of the emitted photons in MeV.
n = fraction of decays resulting in photons with an energy of E.

It should be noted that this formula and the gamma constants are for exposure rates from gamma rays and x-rays only."
***********************************************************************************************************************************************
Ci = .9E-6 Ci, E = .0597 MeV

Furthermore R (Roentgens) = .86 Rad = .86 rem. (ref. #3) and the equation becomes:

6 x Ci x n x E= .86 x rem/hr @ 1 ft.

Substituting, 3.75E-7 x n = rem/hr@1ft. or 3.75E-4 x n = mrem/hr@1ft. and

n = mrem/hr/3.75E-4 = 2.67E3 x mrem/hr@1ft

Now for the hard part. We have an number for the annual exposure in a typical home with an ionization type smoke detector of .008 mrem The inverse square law applies to radiation so we need to make an assumption as to the distance from the source. Let's say 10 ft. also, we need to estimate the number of hours/yr in proximity of the source. Let's say 2000. This will make the exposure 4E-4mrem/hr@1ft.  Substituting in the equation, n = 2.67E3 x 4E-4 = 1.068.  While the assumptions are just a wag, it implies that there is one 59,7 KeV x-ray photon emitted for each alpha particle.


----------



## rwm

Most impressive.
R


----------



## homebrewed

Very nice classic back-of-the-envelope calculations!  I love it...


----------



## homebrewed

I did some browsing for thin Manganese foil.  There are some sources that are breathtakingly expensive -- Goodfellow will sell you a .025mm x 25x25mm sample for ONLY $632.  Sigma Aldrich is even worse.  Jeez....makes me wonder what it takes to electroplate the stuff (not possible with all metals, at least in water solution).  I wonder if a manganese salt solution would work.  Potassium permanganate is fairly easy to come by and water-soluble (and the solution is a really pretty dark-purple color) .  Sounds too easy though.


----------



## graham-xrf

Wow!

Umm.. 0.025 x 25 x 25 = 15.625 cubic mm.
Which is 0.015625  cubic cm.
At Manganese density 7.21 g/cm3
0.015625 x 7.21  = 0.11265  grams of manganese.
$632 for that much is *$5609.98* per gram.

Gold           --> $55.94 per gram
Platinum    --> $24.63 per gram
Palladium  --> $67,34 per gram

Cheapest diamonds are $4500/caret, or $22,500 per gram.
So manganese worth about a quarter of gem diamonds.
Unless rolling manganese into thin foil is unusually tricky and expensive, that just feels wrong!
[Then again - I have encountered Aldrich before. One would think they make their products atom by atom]


----------



## rwm

I have some relatively pure electrolytic Mn that I use for casting alloy. Manganese dioxide in fine powder is easy to get. How could you modify the physical form to work? How about a layer deposited on another material? Could you electroplate Mn onto something?
Robert
Edit: apparently Mn is very difficult to e-plate.


----------



## graham-xrf

@rwm : Robert
I think he wants to use it as a filter in a separation test mode to help tell if there is cobalt in the iron alloy
Very thin is probably OK. Maybe precipitated onto something X-Ray transparent, then held down with a whiff of Rustoleum clear.

(OK - I admit the Rustoleum bit was just make it to sound like the thread well belongs in HM).


----------



## rwm

Yes, I understand the application. You really just need a thin homogeneous layer of the element. I was wondering if something like a powder with a binding resin could substitute for a foil. Mix it with JB Weld! (I followed your lead.)
R
How about a layer of Manganese based paint? It is used for a blue oil paint.
R


----------



## graham-xrf

I am thinking a foil from "Aldrich_may_as_well_be_made_of_Unobtainium" is not needed. All we need is some stuff with Manganese in it, the better it does not contain any other metal.

OK - even potassium permanganate might do, but manganese dioxide sounds better.
Apparently several kinds, the stuff is widely used in the alkaline battery industry.
Batteries need "electrolytic manganese dioxide".
Ferrites need "chemical manganese dioxide".
Wikipedia explains how to make it.

Either way - if there is manganese in there, just use the stuff. Can that be right?
Should I be breaking up alkaline batteries to find out if the stuff can be a filter? I dunno, but when I get something going, I just might give it a try!


----------



## homebrewed

graham-xrf said:


> I am thinking a foil from "Aldrich_may_as_well_be_made_of_Unobtainium" is not needed. All we need is some stuff with Manganese in it, the better it does not contain any other metal.
> 
> OK - even potassium permanganate might do, but manganese dioxide sounds better.
> Apparently several kinds, the stuff is widely used in the alkaline battery industry.
> Batteries need "electrolytic manganese dioxide".
> Ferrites need "chemical manganese dioxide".
> Wikipedia explains how to make it.
> 
> Either way - if there is manganese in there, just use the stuff. Can that be right?
> Should I be breaking up alkaline batteries to find out if the stuff can be a filter? I dunno, but when I get something going, I just might give it a try!



You may be on to something.  According to information I found  here x-rays are generated by inner-shell transitions so it doesn't matter if the metal is in its elemental state or not.

The thickness (and density) of the metal compound will only affect the overall attenuation of the x-rays so you're looking at a balancing act -- overall signal vs peak separation.  I believe the paper I referenced in post# 159 was shooting for a ratio of 25:1 to 50:1.  With metal foils you can easily calculate the needed thickness from the u/p factor for that particular metal, but it's going to be a trial-and-error thing if you're using a composite like MnO2 in casting resin.

I did find a source of metal powders on ebay here for Mo, Fe, Co and Ni, among others.  

Iron through nickel can be electroplated but the choice of a substrate could be an issue.  From an availability standpoint, copper would work nicely but it is a pretty good absorber of X-rays.  However, I just thought of a substrate that could be the ticket.  It's pyrolytic graphite.  You can buy it in adhesive-backed sheets from DigiKey for WAY less than moly sheet, and it's electrically conductive!  As RJ has pointed out, carbon is quite transparent to x-rays so it won't affect x-rays in the energy range we're interested in.  Not to say it might not be problematic to make good thin films with pyro graphite -- electroplating often results in layers that have built-in stress, which will cause the metal to peel off.  If the film stays in place long enough to plate it up to the right thickness this isn't necessarily a bad thing, you'd just need to transfer it to a flexible substrate.  Peel it off with adhesive-backed tape...and you've got something much like the Goodfellow/Sigma-Aldrich stuff, which has some sort of backing as well.

For working this approach up into a viable analysis tool it also will be necessary to get our hands on some pure elemental standards; or stable and relative nontoxic compounds like MnO2.  If folks try the metal powder or pyrolytic graphite approach they already will have the standards they would need.  

One negative about the electroplating approach is that it will involve the use of some unpleasant metal compounds in the electroplating baths, and each metal will require its own separate witches brew of chemicals.  The powder approach would need a uniform density of metal that's not TOO high -- remember, in the X-ray filter paper they indicated that it only took 25um of copper to do the trick....and the ebay powder vendor didn't specify the particle size of the powders.  

I'm an amateur chemistry guy so I'd be inclined to try the electroplating method but others may feel differently.

Although interesting to think about, this aspect is quite a ways down the road (but maybe we now have a crack at a possible roadmap).  First we need a few working gamma spectrometers and functional S/W.


----------



## RJSakowski

I did a lot of work with manganese dioxide as an analytical chemist for a battery manufacturer.   Manganese dioxide will work.  The density will be less but that can be compensated for by a thicker layer.  For the latter, I would mix with epoxy to make a paste and spread it on a backing film.  The components in epoxy are basically carbon, nitrogen, oxygen, and hydrogen.  The particular epoxy I used in another job was 7.90% H, 68.38% C, 2.98% N, and 20.57% O by weight.  MnO2 is 63.19% Mn and 36.81% O.
I wouldn't consider potassium permanganate as it is reactive and contains a much lower % Mn.  It's been a long time since I was a battery chemist but the black gunk in a battery is a mixture of MnO2 and C in the form of carbon black.  Alkaline cells will have a KOH electrolyte and the mix should be washed thoroughly to remove it.  Old fashioned zinc carbon cells used a zinc chloride electrolyte as I recall.  Many of them had a small amount of HgCl2 as well.


----------



## RJSakowski

Those high priced metals from Sigma  Aldrich are so because of their purity. 

When we used to do assays on manganese dioxide, we would digest the samples in concentrated HCl on a hot plate.  This would make MnCl2 which is ware soluble. Start with the battery gunk and wash out any solubles.  Then digest in HCl.  Filter to remove the carbon.  I havent tried it but you may be able to plate manganese from the solution.  It may be possible to convert back to MnO2 by using NaOH.  The MnO2 should precipitate out.  Wash and filter to remove the NaCl byproduct as well as the residual NaOH.

edit: On further thought, the precipitate with NaOH would most likely be MnO.  Also, the digestion process produces clorine as a byproduct so it should be carried out in a well ventilated area, preferably outdoors.


----------



## rwm

One guy I read about plating Mn it showed up as a black precipitate loosely bound to the metal. That might just be poor technique though. 
Robert


----------



## GrayTech

Why not just take it down to the scrapysrd and pay them a few bucks to XRF it for you.


----------



## graham-xrf

GrayTech said:


> Why not just take it down to the scrapysrd and pay them a few bucks to XRF it for you.


Hmm.. 
1) I get an excuse to play in the shop with real RADIOACTIVE stuff in a darn good cause.
2) I get to do cool stuff with my grown-up chemistry set you would _never_ find being marketed now.
3) We get to play with a kit that includes little computers doing cool stuff.
4) Discounting all the stuff we mangle on the way, if we end up with something that will effectively analyze the materials, costing maybe $200 to £300 in parts (mixed up currencies there!), instead of the $6K to $11K depending + some assembly and tryout adventures, I feel OK with that.
5)  This is something I can see myself using way more often than I would want to trek to a XRF-equipped scrapyard for. I live rural. The stuff in the nearest place that might be called "scrapyard" is pretty agricultural.

Now that I have spent real money on a photo-multiplier tube (yet to arrive), suitable control tiny computer, radioactive mantles, various A/D electronics, and ex smoke detector innards Americium 241, the bill is mounting up. So far - about $75.
The only thing missing (so far) is the chance to make something explode!

Welcome to this (isolated) now not-so-little thread.


----------



## homebrewed

GrayTech said:


> Why not just take it down to the scrapysrd and pay them a few bucks to XRF it for you.


Where's the fun in that .  And if you got something for free, you just made it cost something.  This is about scrounging -- if we had all the money we wanted to we'd buy what we need and skip the analysis altogether.  And if you're really concerned you can ask the supplier to include the material analysis (many include it anyway).


----------



## graham-xrf

This all started because I have this pile of steel things, accurately machined, clearly something aircraft/military related, that will not rust, but are well magnetic. In making chips, it is rare that I go out and actually _buy_ the steel. The back-plate for a previous lathe started out as a brake disc no longer OK to leave on a car .. and so on.

Yeah - I just realized I must sound like HM's biggest $$[ tightwad ] $$.


----------



## graham-xrf

@homebrewed : If we are looking for purest elemental stuff, I have an plano-concave infra-red lens made of the purest germanium, about 25mm diameter. I am not sure it will provide a calibration line anywhere near where we are interested in, but if we need it, I can cut it up.


----------



## homebrewed

I did some calculations to see what would be needed in the way of a manganese energy filter, to separate the iron vs cobalt x-ray lines.  It required interpolation on both sides of the absorption edge to get the attenuation factors for iron and cobalt.  For iron, the mu/rho ratio came out to 62 cm^2/g and for cobalt it is 404.8 cm^2/g.  If we assume the usual attenuation vs thickness equation is valid, I = I0*exp(-alpha*t), in this case "alpha" = mu/rho.  Now if we are willing to accept a loss of 50% of the iron signal, what do we get for the cobalt line?  I calculated that it would require a Mn filter that is .0112 cm thick to reduce the iron signal by a factor of 2.  This would reduce the cobalt signal to .011 times its original intensity, so the ratio of iron/cobalt signals would be 45.6:1

Going with the idea of a metal powder in a polymer matrix, let's go a bit further.  If we want to make a filter that is 2.5cm in diameter (about 1 inch), the total amount of Mn would weigh 254 milligrams.  Not a huge amount, but I've got a small digital scale that goes down to 1mg.  I'd mix up a lot more, cast and machine it down until I got the desired ratio between Fe and Co.  The polymer blend filter could be much thicker than the bulk Mn filter, so the metal particle size wouldn't be so critical.  The tricky part would be getting a uniform blend.  It might be necessary to use some kind of "zero gravity" casting scheme, where the stuff is continually rotated so the effect of gravity is canceled out.  Just riffing on the idea here, there probably are other approaches that would work.


----------



## homebrewed

graham-xrf said:


> @homebrewed : If we are looking for purest elemental stuff, I have an plano-concave infra-red lens made of the purest germanium, about 25mm diameter. I am not sure it will provide a calibration line anywhere near where we are interested in, but if we need it, I can cut it up.


Unfortunately, Ge's absorption line(s) aren't even close to what we'd need for any of the ferrous metals.  They're all in the 1Kev range.


----------



## GrayTech

Following with interest.


----------



## graham-xrf

Although I am in awe of you guys when it comes to physical chemistry and nuclear physics, I do attempt some calculation myself, if only to learn how. Now I am out of my depth. It is about deciding how long, or thick, the scintillator crystal needs to be.

Consider these --> LYSO crystals available from epic-scintillator.com.
For $22, we get something 7mm long, and at 1mm x 1mm, about enough to fit on the end of a SiPM photodiode. I can see why they are put into arrays. Before we even consider the probability of of a X-ray photon going right through without encountering an atom of Sodium, or Iodine, or Thallium (or hygroscopic water), there is the low probability of the photon arriving hitting the end of the tiny 1mm^2 crystal anyway. The rest, at slightly wrong angle, or just plain off to one side, and the remaining approximately 800mm^2 shower of incoming hits are wasted!
OK - we get it that you can use an array - or a bigger entry area crystal and a perspex light pipe down to the diode.

The $90 offering is 30 x 30 x 0.5mm. The area looks respectable, but is that even useful?

*So do I have this right?*
Among the atoms it is mostly very empty space. If the X-Ray enters a crystal made too thin, there is some cross-section probability of it not encountering the atoms anyway to make a scintillation before it exits the other side, said crystal being too thin. If the crystal is thick enough, it eventually stops all but the (unluckiest?) X-Ray photons. With thick, you always get a light flash - yes?

So now we consider all the other scintillator opportunities. CsI(Ti), NaI(Tl), whatever.
Even before one thinks about end area, how do we figure the crystal length needed?

*Sources of scintillators*
I looked at the low cost eBay source --> HERE
4 x 4 x 22mm, but apparently, the seller does not ship to the UK, though I could ask.

You can get an eBay array --> like THIS
At $395, I would not consider it anyway. My point is that it is 22mm thick. Enough to scintillate nearly everything?

*Do the X-rays go through aluminum?*
Looking at NaI(Tl) on the end of a PMT tube.
I get these from the very informative video by bionerd23
--> a close look INTO a scintillation crystal (radiation detector) / sodium iodide + thallium / NaI(Tl)

Particularly, about how is it sealed up from water ingress?
In one form, the crystal is "deeper down", or cylindrical, because she sticks her finger in there.




In another version, The NaI(Tl) crystal is in a aluminum can.
The window at the other end is glass, put up against the PMT




Turn the can over, and you see the glass end that butts up against the PMT tube




.. and compare to one which has had exposure to air water vapor by leak.




So I guess aluminum end is where X-rays just go right on in regardless, and scintillate away.

I like the PMT vs SiPM because of the area to fit up against all sorts of crystals, big or small.
I think you need a reasonable crystal area, say about 25mm diameter, or a square equivalent.

You don't really need a PMT if you can pipe the light onto a SiPM avalanche photo-diode, but the thing that needs to be large enough to justify setting up a whole ring of Am241 pellets is the scintillator. Also long enough, so as not to let them X-ray photons get away.

I think there are risks in acquiring the hygroscopic types, unless they are very low cost, and with a reasonable assurance they are either new, or "new old stock" not degraded. I would not ever consider "pre-owned" for NaI(Tl) or CsI(Tl). At least, if one is using scintillator crystals designed to fit on the end of a PMT, they are likely to already be a suitable length.

So is there even a rough approximation way of deciding the crystal length

Sorry if my take on this is a bit neophyte. This is all stuff I never got to grips with before.

[Edit: I just realized that in the video by bionerd23, whenever she switches on the X-ray beam, photons from somewhere manage to hit the CCD in the camera making the video]


----------



## homebrewed

Graham, I didn't want to quote your entire post because it's pretty long so I'll just try to answer or at least point to some directions to explore for answers.

Regarding the length of scintillator crystal, most appear to be meant for much higher energy x-rays.  Higher energy photons have longer penetration depths so that (probably) is the primary reason many are quite long relative to their other axes.  Some indications regarding the length required for a particular photon energy can also be obtained by looking at the same NIST table of x-ray absorption edges for the major component(s) in the scintillator.  Basically what you want is a crystal that is long enough to absorb 90%+ of the incident photons -- I'm assuming that if they're absorbed, they will contribute more signal to the PMT.   

1.
Let's be aggressive and say we want to absorb 99% of the photons that enter the long axis of the crystal.  Going to the NIST table for Lutetium, I see that the "alpha", or absorption factor per cm of depth, is 3,129 at 6Kev.  If 99% of the photons are absorbed, we can use this formula:  .01 = exp(-alpha*d), where alpha = 312.9 and d is the required depth.  Taking the log of both sides we get:  4.605 = 3129*d (I removed the minus signs from both sides).  Solving for d we get d = 1.47e-2 cm, or .147mm -- 147 microns!!!  The actual penetration depth will be more than that because we're talking about a compound that contains other elements, but....it's hard to believe that a few mm's won't suffice, eh?

Sodium has an "alpha" around 70 at 6Kev so it would take .66mm to absorb 6Kev photons.  Not too bad there, but...iodine, the other component, has an alpha of 617 @6Kev so it is the one that really defines the penetration depth.  Of course, we're talking about a compound so the actual penetration depth will be somewhere between the two, but in any case it doesn't appear to be a limiting factor for us.

2.
I've stayed away from NaI just because many of the vendors on ebay caution about opening the package without taking precautions about moisture.  However, the assemblies that are designed to directly interface with a PMT probably are OK w/regard to moisture, if they are new/unused.  An aluminum front window would have to be thin enough to be transparent to ~6Kev photons.  The NIST tables can tell you what that thickness is, and I just did that.  Here's the deal:  at 6Kev, aluminum's "alpha" is 115.  So if you want 99% of the photons to go THROUGH an aluminum window you don't want it to be thicker than 8.7E-5mm  .....that's 87 nanometers....ugh!  Probably nowhere close to what them there aluminum windows are.  Given the fact that we're looking at a relatively low gamma ray flux from the Americium, I don't want to lose any more photons than absolutely necessary.

Just to restate the basic equation I'm using:  I = I0 * exp(-alpha*t) (that's "I nought"), where t is the thickness and alpha is the absorption factor obtained from the NIST tables.  So to calculate thickness for topic #1:  .01 = exp(-alpha*t).  Taking the log of both sides we get:  -4.61 = -alpha*t, or t = 4.61/alpha.  If alpha is in 1/cm units, t will be in centimeters.  Topic #2:  Calculating the thickness of aluminum to only attenuate the x-rays by .01, we just calculate ln(.99) and proceed as before, using the alpha value for aluminum.

I've corrected myself several times to get orders of magnitude right but STILL may have messed up.  Everyone is more than welcome to check my math!


----------



## homebrewed

homebrewed said:


> Graham, I didn't want to quote your entire post because it's pretty long so I'll just try to answer or at least point to some directions to explore for answers.
> 
> Regarding the length of scintillator crystal, most appear to be meant for much higher energy x-rays.  Higher energy photons have longer penetration depths so that (probably) is the primary reason many are quite long relative to their other axes.  Some indications regarding the length required for a particular photon energy can also be obtained by looking at the same NIST table of x-ray absorption edges for the major component(s) in the scintillator.  Basically what you want is a crystal that is long enough to absorb 90%+ of the incident photons -- I'm assuming that if they're absorbed, they will contribute more signal to the PMT.
> 
> 1.
> Let's be aggressive and say we want to absorb 99% of the photons that enter the long axis of the crystal.  Going to the NIST table for Lutetium, I see that the "alpha", or absorption factor per cm of depth, is 3,129 at 6Kev.  If 99% of the photons are absorbed, we can use this formula:  .01 = exp(-alpha*d), where alpha = 312.9 and d is the required depth.  Taking the log of both sides we get:  4.605 = 3129*d (I removed the minus signs from both sides).  Solving for d we get d = 1.47e-2 cm, or .147mm -- 147 microns!!!  The actual penetration depth will be more than that because we're talking about a compound that contains other elements, but....it's hard to believe that a few mm's won't suffice, eh?
> 
> Sodium has an "alpha" around 70 at 6Kev so it would take .66mm to absorb 6Kev photons.  Not too bad there, but...iodine, the other component, has an alpha of 617 @6Kev so it is the one that really defines the penetration depth.  Of course, we're talking about a compound so the actual penetration depth will be somewhere between the two, but in any case it doesn't appear to be a limiting factor for us.
> 
> 2.
> I've stayed away from NaI just because many of the vendors on ebay caution about opening the package without taking precautions about moisture.  However, the assemblies that are designed to directly interface with a PMT probably are OK w/regard to moisture, if they are new/unused.  An aluminum front window would have to be thin enough to be transparent to ~6Kev photons.  The NIST tables can tell you what that thickness is, and I just did that.  Here's the deal:  at 6Kev, aluminum's "alpha" is 115.  So if you want 99% of the photons to go THROUGH an aluminum window you don't want it to be thicker than 8.7E-5mm  .....that's 87 nanometers....ugh!  Probably nowhere close to what them there aluminum windows are.  Given the fact that we're looking at a relatively low gamma ray flux from the Americium, I don't want to lose any more photons than absolutely necessary.
> 
> Just to restate the basic equation I'm using:  I = I0 * exp(-alpha*t) (that's "I nought"), where t is the thickness and alpha is the absorption factor obtained from the NIST tables.  So to calculate thickness for topic #1:  .01 = exp(-alpha*t).  Taking the log of both sides we get:  -4.61 = -alpha*t, or t = 4.61/alpha.  If alpha is in 1/cm units, t will be in centimeters.  Topic #2:  Calculating the thickness of aluminum to only attenuate the x-rays by .01, we just calculate ln(.99) and proceed as before, using the alpha value for aluminum.
> 
> I've corrected myself several times to get orders of magnitude right but STILL may have messed up.  Everyone is more than welcome to check my math!


Oh yeah, I just DID find an error.  Several times I misstated the absorptivity for Lutetium, it IS 312.9 not 3129.  But I used 312.9 to calculate the thickness needed to absorb 99% of 6Kev photons.  Sorry for the confusion.


----------



## rwm

I really think if you just embedded manganese dioxide in epoxy the resin will be so thick that you would get a nice even distribution.
Robert

Edit: I should have said "so viscous".


----------



## homebrewed

rwm said:


> I really think if you just embedded manganese dioxide in epoxy the resin will be so thick that you would get a nice even distribution.
> Robert


Dunno, haven't tried anything like this (in so many ways).  It should be interesting!  But a vital way to evaluate energy filters is a good set of elemental references.  Without that we really have no way to determine how our various gizzies are working.


----------



## graham-xrf

Roll your own (scintillators)?
I was just reading Wikipedia on organic, and then plastic scintillators.

*Napthalene:*
Smelly stuff, anisotropic with problems of energy resolution - but hang in there for now. It gets used.

*Polyethylene napthalate:*
This is sailcloth and drinks bottles plastic. Scintillates by itself without adding other fluors.
"Is expected to replace existing plastic scintillators due to higher performance and lower price".

Base plastics + fluors
*Polystyrene:*
As a base.  A good thing for which to melt down those non-degradeable transparent disposable spoons.

*Polymethylmethacrylate (PMMA):*
i.e. Acrylic has advantages. High ultraviolet and visible light transparency. Transparent to it's own radiation.
Add some napthalene with the solvent.

*Fluors wavelength changers. *
Used to catch UV and render it visible blue or green. Generally yuk polyphenyl hydrocarbons, but only needed in small amounts. I would not know how to come across oxazole or n-terphenyl (PPP).

I would not be past melting up up some acrylic or polystyrene, stirring in some re-purposed mothballs, making into a scintillator and a taper lightpipe all in one.  Like all simple-sounding schemes conjured in ignorance, this notion may have some downsides, but is the idea completely mad?


----------



## rwm

I am surprised those non metallic substances have the density to absorb x-ray at the energies we are talking about. Are they useful in this range?

"But a vital way to evaluate energy filters is a good set of elemental references. " Are you suggesting this will be hard to come by? I was thinking that would be the easy part. The elements do have to be of super high purity since the signal from any minor contaminant would probably be below our noise level?

Am I understanding your notation correctly? I = I0 * exp(-alpha*t) . What does "I" represent represent? Attenuation as a fraction? Just off hand the absorption distances seem too small. You are certainly correct that the thicker crystals are intended for higher energies. 80- 140 KeV would be common in medical imaging. Still, I am guessing a crystal should be at least 1 cm thick for this.
As you probably know, aluminum is typically used to filter an x-ray tube. Typically 0.5mm thick. At 100 KeVP (peak KeV so the mean is probably near 50 KeV) this preferentially attenuates a large portion of the lower energy x-rays (to reduce patient dose.) An aluminum window is probably a bad idea here since these are the energies we want to see. Plastic would be a much better choice and just as easy to use.

The crystal in the video Graham shows is designed for higher energies so the aluminum is not a problem. Graham- I think that probe is used to measure gamma sources. Those energies would not be well attenuated by aluminum.

I hope this doesn't sound critical, I am really enjoying learning and thinking about this as we go.

Robert


----------



## rwm

Any use?









						Hamamatsu High Accuracy, High Sensitivity Compact Gamma Radiation Detector Probe  | eBay
					

Find many great new & used options and get the best deals for Hamamatsu High Accuracy, High Sensitivity Compact Gamma Radiation Detector Probe at the best online prices at eBay! Free shipping for many products!



					www.ebay.com
				




Robert


----------



## graham-xrf

*Re: Non-metallic substances.*
They may be non-metallic, but I think the atoms on them play as hardball as any other.

*Re: Calibration*.
I must fully learn the detail for the plotting software, but  I think the height of the signal peaks in the pulse depends only on the photon they release when provoked. The brightness of a scintillation signal peak is not related to the proportion of other cluttering substances.

The height of a _software display_ peak is a different sort of peak, it being a number count of the received pulses, previously sorted by height. This one is very definitely _is_ related to the substance proportions.

I would think that, so long as you know the calibration substance has enough of one element, say more than *30%*,  so as to show it's count well above the other atoms in there, it will serve OK for setting the wavelength/frequency scale on the X-Axis.

Other materials, even those atoms having scintillation pulses very much higher, will not necessarily show higher displays, because any one of their (possibly huge) scintillations still only delivers one count. It is the accumulated count of complete proper pulses, sorted by energy, so betraying belonging to only one element, that lets you scale the proportions. Divide the bucket count by the total of the whole lot in a measure interval to get the percentage.

There may be some mileage in using a 2-element compound that you can get quite pure. Just about any chloride or oxide. Salt, titanium dioxide (i.e. white paint), ferric chloride, zinc sulfate, whatever. Those old NiCad batteries that won't holds a charge anymore, leaving you with several electric drills that don't have a life is full of two proper transition metals. Who cares if the energy of the chlorine emission is off the scale, or happens at all.

Batteries seem to be a good source of useful elements. If you can learn the care you need to dismantle them without fire-related lithium runaway accidents, those old laptop (notebook?) computer batteries that you replaced from eBay, have got _cobalt_ in them.

In some ways, using fully oxidized compounds can be good. It makes them safer, no longer toxic, and you can get the salts pure. When I get this going, I am bound to put all sorts of stuff in under the thing.

*High Energy?*
Not to be confused with "lots of".
For the range of materials we want to see, are some of the emitter X-Ray wavelengths "high energy" enough to choose one of those scintillators that fit the PMT tubes, or maybe a LYSO crystal that is more than 0.5mm thick?

I was dreaming up the homebrew acrylic plastics concoction around a "gun" type, or probe-type gadget. All much smaller. Based on a Si-PM photodiode, the trick bit of tapered plastic, and some Am241 "buttons". That may have to be Mk2. I am going to try photomultiplier tubes first.


----------



## graham-xrf

rwm said:


> Any use?
> 
> 
> 
> 
> 
> 
> 
> 
> Hamamatsu High Accuracy, High Sensitivity Compact Gamma Radiation Detector Probe  | eBay
> 
> 
> Find many great new & used options and get the best deals for Hamamatsu High Accuracy, High Sensitivity Compact Gamma Radiation Detector Probe at the best online prices at eBay! Free shipping for many products!
> 
> 
> 
> www.ebay.com
> 
> 
> 
> 
> Robert


Not really. It is a gamma detector.


----------



## rwm

graham-xrf said:


> Not really. It is a gamma detector.


Not sure what you mean. Do you mean because it won't detect energies low enough?
I did find specs on some of the Hamamatsu's that say they detect down to 30 KeV efficiently. We would obviously need to be at and below that number (down to 1KeV?) I am not sure how bad the detector signal would fall off below 30 KeV. It is kind of attractive to find a brand new detector for $20 if it could be make to work.
Robert


----------



## homebrewed

graham-xrf said:


> Roll your own (scintillators)?
> I was just reading Wikipedia on organic, and then plastic scintillators.
> 
> *Napthalene:*
> Smelly stuff, anisotropic with problems of energy resolution - but hang in there for now. It gets used.
> 
> *Polyethylene napthalate:*
> This is sailcloth and drinks bottles plastic. Scintillates by itself without adding other fluors.
> "Is expected to replace existing plastic scintillators due to higher performance and lower price".
> 
> Base plastics + fluors
> *Polystyrene:*
> As a base.  A good thing for which to melt down those non-degradeable transparent disposable spoons.
> 
> *Polymethylmethacrylate (PMMA):*
> i.e. Acrylic has advantages. High ultraviolet and visible light transparency. Transparent to it's own radiation.
> Add some napthalene with the solvent.
> 
> *Fluors wavelength changers. *
> Used to catch UV and render it visible blue or green. Generally yuk polyphenyl hydrocarbons, but only needed in small amounts. I would not know how to come across oxazole or n-terphenyl (PPP).
> 
> I would not be past melting up up some acrylic or polystyrene, stirring in some re-purposed mothballs, making into a scintillator and a taper lightpipe all in one.  Like all simple-sounding schemes conjured in ignorance, this notion may have some downsides, but is the idea completely mad?


I had looked at organic scintillators as well.  Anthracene is supposed to be a very good scintillator, too; and Stilbene is commercially offered as a scintillator.  The main concern I've had is whether or not this class of scintillator outputs light whose intensity is linearly proportional to the incident x-ray photon energy.  Also the relatively-low x-ray "cross section" compared to the inorganic scintillators.  Again looking at the NIST absorption edge data, carbon's "alpha" at 6Kev is 10.95, so to absorb 99% of those photons STILL will only require less than 5mm!  This data is for pure carbon/graphite so polymers would have to be thicker than that.  So I guess the main (remaining) issue is if any of these materials are proportional-enough to be useful in this particular application.  It certainly is an intriguing idea to incorporate the light pipe AS the scintillator.  You will have to keep us informed regarding your results <g>.


----------



## graham-xrf

I am getting a PMT tube, maybe two. Also some avalanche diode SiPM(s) Also any low-cost scintillators that fit the PMT, so long as they are at least "new old stock". Also, any crystals I find interesting. Add to that any crazy plastic concoction I might stir up, with intentions of making a light pipe taper. Critical angle is close to that of glass near 42°

I have been cautioned by the lady of the household that any processes involving smelly stuff, fire with the risk of er.. "faster reactions", are relegated to outside, and must not scare any passing horses. (Just full of rules - this one)! Also, I have to collect toxic liquids. Cannot tip anything from methanol through paraffin all the way to toluene onto the road (as if I would ever do that)!
I mentioned I would be experimenting with "smoke alarms". Is that OK?

The "embodiments" are two. One kind just for development and messing with. Final electronics is small as possible, and uses a USB connection to a phone. Powered from the USB. The other side  of the electronics has a multiple choice of photomultiplier technologies. You just leave out the unwanted components. It's a kit. If some HM members want to make up kits and move them to other HM members, that's OK. It would be cool if they do it at cost, and only cover their expenses. I have not thought through the probe part yet. It's size can be the same, whatever is inside. It has to fit the hand, seal up the light, house the radioactives.

I have not decided whether the computing should tax the processor of the smartphone, but I am inclined to having the computing done external, and the phone app is just a control and display device.

I am called away now.  Playing with this gadget has to share time with certain other "household stuff", some of a relatively major nature. Nobody would begrudge me the construction of my shop outhouse/shed/man-cave/lathes repository/hideout, would they?


----------



## homebrewed

I found a web page describing experiments with a plastic scintillator coupled to a SiPM here .  Unfortunately they didn't mention exactly which material they used.  When they tried it with Americium they didn't detect any gammas at all.  I don't know if that is due to their choice of scintillator or not...

And YES, there's nothing that should stand in the way of getting that man-cave built


----------



## rwm

Check this out. Crystal thickness calculator that is based on the formula Homebrewed put forth: 
	

	
	
		
		

		
			










						Efficiency calculator
					

The number of photons of a given energy stopped or "Percent Absorption" by a certain scintillator thickness is shown in the Efficiency Calculator tool.




					www.crystals.saint-gobain.com
				




HB you are correct that the crystals can be very thin for the energies we are talking about. If you take 50 KeV as the max possible in our system:
For CsI at 50 KeV you only need .36mm to get 88% absorption. At 10 KeV only .03mm!
Interestingly, Plastic at 50 KeV requires 100mm.

Also useful to calculate shielding.

Robert


----------



## graham-xrf

Suppressing the phrase to begin with "in the light of the above", I try to discover what the scintillators actually do, and match it to the detectors we are considering. Thin or thick, that will be material dependent.
If I fumble here - then do help!

Some elements we might be interested in, that might be in an alloy, may be too low in response to be practical.
Like Boron, Carbon Nitrogen Magnesium. It would be nice if we could have got a response from carbon (0.277KeV), but that cannot realistically happen. The highlighted ones in the picture are the realistic range.




Silver steel will have Ag at 22eV and 24eV. The highest will be lead at 74eV and 84eV.
We  gloss over some HM gun enthusiast possibly making bullets out of depleted Uranium.
I trawl the Epic-Crystal emporium looking for Eijen EJ xxx or Saint-Gobain equivalents.

- - - - - - - - - - - - - - - - - - - - - - -
OK - so this one *LYSO* 30 x 30 x 0.5mm *--> HERE* for $90 should be suitable perhaps?
The range of main applications is not encouraging, but we now know some stuff.
It matches PMT tubes with bialkali photocathodes as well as SiPMs
It glows at 420nm, which looks like this colour --> #6a00ff RGB(106,0,255) ██████
The sensitivity is around 27600 to 33200 photons/MeV.
At best, 33photons/KeV
If 84KeV is is the maximum possible in our system, then that gives 2772 photons.
If that is the maximum, it comes to me across as possibly pretty feeble, but I don't know this stuff yet.

- - - - - - - - - - - - - - - - - - - - - - -
.. or 20 x 13 x 0.75mm *--> HERE#2* for £56 is maybe also OK?
It is also *LYSO*, as above, only a different size, and slightly thicker

- - - - - - - - - - - - - - - - - - - - - - -
Among the plastics is the equivalent of *--> Saint-Gobain BC 408 20 x 20 x 50 mm for* $95.00
This one is 50% to 60% of Anthracene output, glows at this colour (#7600ed) or RGB(118,0,237) ▇▇▇▇▇
Almost the same colour output, fractionally deeper violet.
The blurb says "it is very sensitive for alpha, Beta-rays and other particles with lower energy range".
My mind says that may be OK for looking direct at Am241, but how good is it for X-Rays?
They don't say, so I go after anthracine. So far, I have not found what is 50% of anthracine's photons/MeV.

3 benzine rings. $35 for 25g from Aldrich - but we won't go there.
Apparently, you stir it into the acrylic and let it cool.
I think it is too short for a taper.
- - - - - - - - - - - - - - - - - - - - - - -

Hmm - getting a scintillation to happen is one thing.
Having the sensor photocathode or diode be happy with it it is something else, and we need to pay attention to that.

Also, I want stuff that does not cost so much - unless there is no other realistic choice.


----------



## rwm

keep in mind you will not get any X-rays above 59 KeV because that is the energy of the gamma from Am that is doing the excitation. It cannot displace a K shell electron of a higher energy. You will not see any characteristic x rays from Pb (K-alpha) because these are too high in energy.
I am not going to pretend I can be of help in selecting the scintillator. I know some of the Bruker units use NaI. I would consider CsI srongly since it is similar and not so hygroscopic. 
Robert


----------



## graham-xrf

I would have checked on thorium from Coleman lamp mantles (older sort), but I think I will avoid them.
I have a couple of them, claimed to be good for checking Geiger counters.
Loose thorium dioxide is damn dangerous. Not very radioactive, but very bad if you get it on/in you.

Small X-ray tubes? I don't know.
Pretty much most other isotopes are not on. We can't be casually using cobalt gamma sources.

I read that common steels made from a proportion of recycled scrap have become more radioactive over the years, because of the crushed up radioactive junk that ends up in it. This includes scrapped hospital treatment isotopes.
I reckon if you test a steel with some of that in it, the detector will let you know pretty quickly.


----------



## graham-xrf

@rwm : You mention not getting any X-rays above 59 KeV, because that is the energy of the gamma from Am241. We are  now at the limit of my knowledge about how we work with wavelengths,

Does the 59KeV photon get weaker by inverse square law as it disperses in all directions (like light).
I get it that we are skirting around the "does it behave like a particle" thing, but I wanted to confirm that a 59KeV thing has a wavelength connected to that 59KeV by Planck'e constant, and that color of the photon stays that way.

This is where maybe @RJSakowski may know lots more than us. We talk of X-Rays, and gammas rays, but I am not sure where is the join. If I apply (say) 85kV to a electron tube, into a tungsten anode, is that a direct way of making a 85KeV photon, or do we only get X-Rays locked to the wavelengths the jangled up atoms of tungsten are willing to give?

Kα1 --> 59.32 KeV
Kβ1 --> 67.24 KeV
Lα1 -->   8.39 KeV
Lβ1 -->  9.67 KeV

These would be X-Rays, but with the sort of KeV we talk of when we mean "gamma", coming from Am241. I don't quite get that.

The actual amount of Am241 in a smoke detector is, I have read, about 0.1 milligrams. Is that right?

Still waiting the arrival of the PMT tube. Allegedly dispatched.


----------



## RJSakowski

As I recall, an X-ray tube emission is fairly broad spectrum with output energy determined by the accelerating voltage.  x-ray technicians and medical physicists measure peak energy in Kvp.  X ray machines have filters which filter out "soft" x-rays.  This would be something like 1.5mm of aluminum.

I believe that the term x-rays was originally applied to electromagnetic radiation generated by impact of a target with an electron beam and gamma radiation was applied to electromagnetic radiation originating from nucleaar decay.  Theraputic x-ray genera5tors use linear acclerators to generate x-ray beams up to 4 or 5 Mev.  Cosmic radiation was radiation from space.  The three specta do overlap.  For our purpose, we can consider gamma and x-ray radiation to be interchangeable.


----------



## graham-xrf

RJSakowski said:


> Theraputic x-ray genera5tors use linear acclerators to generate x-ray beams up to 4 or 5 Mev.  Cosmic radiation was radiation from space.  The three specta do overlap.  For our purpose, we can consider gamma and x-ray radiation to be interchangeable.


Thanks - that gets some perspective.
Years ago (too many), I worked on an auto-focus scheme for a image intensifier thing that allowed continuous viewing of one's innards, because of the very low level of X-rays used. To test it required access to a hospital X-ray machine, and I was given a 5 minutes speedy instruction on how to work the controls, and then the staff left me to it. I could not leave the room during on time. I had to be right close up to it while the beam was on. I was given a heavy white apron affair that covers front and back. I could see and adjust what I needed to if I sat on the treatment table, and had the beam go downwards past me, but right next the sit spot (so to speak).

I set the machine for the most feeble X-rays I could, I think it was around 25kV or maybe 30kV. The dial could go up to well beyond 120kV. The first try totally overwhelmed the imager, so I used a 150mm square x 1mm thick piece of copper sheet as a "neutral density filter", to cut the level down, though the beam still had to get past me before it encountered the copper.

It left a strong memory. This light you cannot see, that just goes through metal.

YouTube is absolutely full of videos of people get up to stupidly dangerous experments by applying high voltage to various old vacuum tubes, DY86 old TV power supply EHT rectifiers, or even any old light bulb. Amid them is a very interesting one by "_glasslinger_". I was more absorbed by his glass-working skills, but he makes up a X-Ray tube about the size of 3/4 of a finger. He turns up a piece of tungsten (where does one even get hold of that?), and puts the angle on it to direct the X-Rays. Most interesting is, with full voltage applied, you get zero X-rays, until you heat up the filament to supply electrons.

It seems the "amount" of X-Rays is controlled by the filament current. This would set an intensity of illumination, but from what you say about energy per photon, I guess the fewer photons (from low filament current) go just as far, and penetrate just as deep as the many (from higher filament current). The voltage sets the wavelength, and the filament current sets the intensity. Add to that, the timer sets the probability the X-rays will find and modify a DNA amid one's internals.

-->


----------



## RJSakowski

That's a great video.  He has a great glass working shop as well.  

Correct.  The penetrating ability depends on the energy of the beam but the dose depends on the number of photons which are proportional to the current and to exposure tme.  Actually, as diagnostic tool, it is the x-rays that get stopped which convey the useful information.

A product that we made was called a DAP or dose area product meter.  It uses an in-line ionization chamber to monitor the x-ray beam  aqnd does so by integrating the total beam over time.  It was a required instrument on all diagnostic fluoroscopy machines in the EU. 

Actually, an x-ray generator might not be a bad way to go.  You wouldn't have a portable unit but the photon flux would be much higher.  You would probably want to filter out the lower energy photons but that isn't too difficult.  I happen to have an x-ray systen from the 1950's.  It's never been fired up and I don't know if the tube is still good.


----------



## graham-xrf

RJSakowski said:


> Actually, an x-ray generator might not be a bad way to go.  You wouldn't have a portable unit but the photon flux would be much higher.  You would probably want to filter out the lower energy photons but that isn't too difficult.  I happen to have an x-ray systen from the 1950's.  It's never been fired up and I don't know if the tube is still good.


Wow! You kept some amazing kit! I would say that your misgivings about the tube be set aside. When would you get a better opportunity to try it again. A X-ray tube has the virtue of being constructed of solid basic stuff, unless yours has some sophisticated magnetics around it to control focus etc. In what ways could the tube become "no good". Filament coating gone? Getters used up from leak?

Applied to XRF, and allowing we lose some portability, it seems to me we do not need high filament current intensity. We just need enough events at high enough voltage. Nor need the voltage be continuous. It can be by "shots" of a limited number of X-Rays of short enough wavelength. I would say up to 70KeV, which gets no scatter return from lead shielding, but covers most other. Come to that, a clear return from the lead is OK. You know where it came from, and can calibrate on it.

I think turning the X-ray on as pulsed samplers, as short as possible consistent with provoking a response from the material, say 200nS pulses. Enough to fill up the histogram plot, perhaps 2000 to 5000 pulses. It all depends on how many come back from the material, and how fast. It begs the question as to what is the disintegration rate of Am241 delivering gamma photons.

I can't believe I am actually asking this, but will a 1/8" or 3mm thick lead roofing flashing material be enough to stop a 70KeV X-ray?


----------



## homebrewed

The inverse-square law applies to the intensity of the x-ray (or gamma-ray) flux.  The photon energy does NOT change.  If that was the case, a blue object would look redder and redder the further away you got from it.  Doppler shift is a different thing altogether.

The lab where I used to work had a real-time X-Ray unit.  It used a fluorescent screen and a CCD camera to image the x-rays.  The x-rays were generated using a "tube" that was basically a scanning electron microscope without the scan coils.  The electron beam was accelerated up to 120KEV and focused on a thin tungsten (IIRC) diaphragm.  One side was at vacuum, the other side was at atmospheric pressure.  Since the effective size of the x-ray source was basically a point source, the imager showed you the shadows cast by objects between it and the source.  The closer the object got to the source, the higher the magnification.  We used it to image gold bond wires attached to integrated circuits, and they are just a few mils in diameter.  We placed the objects on a carbon-fiber tray that was remotely controlled for x,y,z, pitch and roll so we could adjust the object to get the exact view we needed -- in real time.  A very cool device, but it had a very large footprint, and of course was very expensive.  It had a mechanical pump and a turbo pump to get the "tube" down to its operating pressure.  The pressure had to be low enough to stand off 120KV without arcing...not a trivial thing to accomplish!

For awhile I was interested in making my own fusor, a relatively simple type of fusion reactor.  Since typical fusors operate in the 30-40KV range, one of the primary safety concerns is x-rays -- not from the fusion reaction, just plain old electrons hitting metal at high speed (although if you're successful you DO have to worry about neutrons, too).  So if one has a turbo pump (or diffusion pump) and a mechanical roughing pump it's not outside the realm of possibility to make your own x-ray source.  Not a trivial effort, and likely another hole to pour time and money into.  

The attractive aspect of an XRF system using Americium is that most of the pieces can be gotten from ebay and the like.  If anyone wants to try making their own x-ray tube I have some thoriated tungsten wire that was used to make old-style SEM "hairpins" for their electron gun. Free for the asking....


----------



## RJSakowski

graham-xrf said:


> Wow! You kept some amazing kit! I would say that your misgivings about the tube be set aside. When would you get a better opportunity to try it again. A X-ray tube has the virtue of being constructed of solid basic stuff, unless yours has some sophisticated magnetics around it to control focus etc. In what ways could the tube become "no good". Filament coating gone? Getters used up from leak?
> 
> Applied to XRF, and allowing we lose some portability, it seems to me we do not need high filament current intensity. We just need enough events at high enough voltage. Nor need the voltage be continuous. It can be by "shots" of a limited number of X-Rays of short enough wavelength. I would say up to 70KeV, which gets no scatter return from lead shielding, but covers most other. Come to that, a clear return from the lead is OK. You know where it came from, and can calibrate on it.
> 
> I think turning the X-ray on as pulsed samplers, as short as possible consistent with provoking a response from the material, say 200nS pulses. Enough to fill up the histogram plot, perhaps 2000 to 5000 pulses. It all depends on how many come back from the material, and how fast. It begs the question as to what is the disintegration rate of Am241 delivering gamma photons.
> 
> I can't believe I am actually asking this, but will a 1/8" or 3mm thick lead roofing flashing material be enough to stop a 70KeV X-ray?


The tube and power supply were new Korean War surplus from a MASH unit.  The tube/power supply are red lined at 85Kv@15ma.  The tube is well shielded and the beam is collimated.

My understanding is the x-ray tube will fail from loss of vacuum. 

From a chart that I have, .28mm of lead will attenuate a 125 Kv x-ray beam by 50% so 3mm of lead will attenuate the 125 KV beam by 99.95%.  .05mm of lead will attenuate a 40 Kv  x-ray beam by 50% or 10e-18 of the beam  passing through 3mm.


----------



## graham-xrf

homebrewed said:


> The attractive aspect of an XRF system using Americium is that most of the pieces can be gotten from ebay and the like.  If anyone wants to try making their own x-ray tube I have some thoriated tungsten wire that was used to make old-style SEM "hairpins" for their electron gun. Free for the asking....


Agreed on using Americium for cost and convenience and eBay availability. The thing is interesting enough without getting into making X-Ray tubes - for now.

Fusors have moved on, I think. Last I read of it, there were serious numbers of folk working a variant called "polywell", with some input from US Navy, and some private companies, to hit Boron-11 with hydrogen ion plasma confined magnetically. I think it has problems. This would be a different order of hobby machine, if not for "Final Nail"
(see https://en.wikipedia.org/wiki/Polywell)

Re: The chart. Is that an available PDF?


----------



## homebrewed

The Polywell is another one of those fusion projects that has been "just around the corner" for quite a few years now.  This really is OT so no more on it.  But if anyone is curious on what amateur "fusioneers" are up to, you can go here and look around.  Plenty of opportunities for machining projects if you're so inclined.  Also plenty of opportunities to spend money....electrocute yourself.....get radiation sickness...all in the name of some good fun!


----------



## rwm

Great explanations guys.
I mentioned 59 KeV since that is the highest energy of Am gamma. For identifying elements we are interested in the characteristic photon from the K-shell. This electron gets ejected by photoelectric interaction with the incoming gamma, and then emits the xray when the vacancy is re-filled. It requires a gamma of the same or higher energy to do this. So Am should not be able to eject a higher energy electron or create a higher energy xray.
My understanding of the difference between gamma and xray is as RJ describes. They are physically the same but gammas come from the nucleus and X-rays come from the electron interactions. I believe when Roentgen discovered this ray, he had no idea it was like light or gamma and therefore called it X. (It was also called the Roentgen ray.)
The xray tube I showed earlier failed due to vacuum leak. When that happens the filament burns out just like a light bulb.  After much use the tungsten targets can actually wear out. So much erosion of the tungsten occurs that the geometry gets messed up.
I would love to mess with some of this stuff but quite honestly I am too e'scared of the high voltage!
Robert


----------



## pontiac428

graham-xrf said:


> Yeah - I just realized I must sound like HM's biggest $$[ tightwad ] $$.


So you shall be known as Her Majesty's biggest tightwad!  Behold!

I think this thread has been a hoot to keep up with.  I have very little buy-in for the undertaking, because I have years of inorganic analytical chemistry and field-portable XRF in my background.  Knowing what's involved had me thinking it would be a fruitless effort, but I have enjoyed the progress you've made with the idea.

To provide some motivation, I've been working with 3M-Thermo-Fisher on obtaining an XRF for identification of unknown metals for one of the commands I serve.  With the library and a spare battery, we're talking $35,000 per instrument here.  At least they don't have all of the headaches of a Cd-109 source now that they've switched to photo tubes (I used to haul those across borders, fun!)  Anyway, the technology has gotten amazing, and even further out of reach for us tinkerers.  If you come up with something that works, people will follow.  You know this is a masters' student's final project for physics or chemistry, and y'all are doing it in your garage in your spare time!


----------



## graham-xrf

Getting back on topic, I have been taking a first look through the source code PyMca5 software for X-Ray fluorscence  that was on the repository for my PC. Written in Python, there is a LOT. It appears to be all the software component programs as developed and used at CERN accelerator. I have only had a brief look through, but there appears to be a GUI package set, and all sorts of component programs for capture and analysis of scintillation data.
There is the "PyMca X-Ray Fluorescence Toolkit"
Just getting to know how to drive it is going to take quite a lot of study.

The commands do run on the example test data provided as a check the installation has gone OK. This stuff is clearly science rigorous in very serious mode with extra stamps and thumps! I suppose that given it was and is so widely used for PhD careers at the LHC, that is to be expected, but I don't think that makes it unsuitable. There may be powerul stuff in it one may never use in a modest, somewhat approximate application like ours, but it already runs on the Pi-4.

I have received my GPIO interface kit from eBay. Still no sign of the PMT tube, and I still have to get the act together on scintillator and Si(PM) diodes. I have set the Pi-4 up with a heatsink that has a 40mm, apparently silent, little fan, and set it to clock at 2GHz.

PyMca can be downloaded from sourceforge.net --> HERE


----------



## graham-xrf

Yikes! Now we have @pontiac428 keeping an eye on us!  
Meantime..

*The Radioactives Have Arrived !*




They are ionization chambers, and the Am241 in there is pointing "upwards" I guess. I will post pictures of the teardown later. These are less specific about the amount of Americium in there. The description on the container says..

" Contains Radioactive Material
 <29.6KBq ( <0.8uCi ) 241 Am"

I guess the amount is as small as they could make it. I am looking at all the "less than" signs.
BUT - supposing the amounts are 0.8uCi. I have to look back in the thread. I know we calculated the amount of Am241 somewhere earlier, and I used Avagadro's number to get at the number of atoms. Then there was the half-life assumption of when the waste was made.

OK - it does not really matter. We just "try it". I was just after a rough calculation of the flux, with a view to discovering how few we could get away with. For instance, could we make it work with just _one_ smoke detector?
Maybe we only need the numbers in the description, to determine the flux.

The gamma rays will not be range limited. They will slam the test sample every time. The question is, how often?
A whole lot of them will be going off in other directions. Only some go where we want. The same is true of the X-Rays. We only get some of the some. Of the X-Rays, only about 1/8 head towards the scintillator, and of those, perhaps 1/6 are at an angle narrow enough to find the crystal

The mass of the source is 0.2332ug or 0.2334ug depending whether we start with uCi or KBq.
I have a calculation which I will not amuse you with yet.


----------



## rwm

That is great!
I am amazed that software is available like that. Could it work for your purpose without adaptation? Sure looks about right on those graphs.
Robert

In reading the tutorial is seems this software does not handle the raw data but rather handles the "back end" of identifying elements from the data you record. Still very valuable and a big chunk of the work is done! You would still need software to record counts per "bucket" or channel corresponding to the KeV ranges. Am I interpreting that correctly?
Robert


----------



## graham-xrf

rwm said:


> That is great!
> I am amazed that software is available like that. Could it work for your purpose without adaptation? Sure looks about right on those graphs.
> Robert


Yes and no. We still have to make a main calling program.
We pick through those software modules, and discover what they do.
Our program is essentially calling these modules to do their part.
It is essentially complete. My first guess is we only need to use some parts of it.

There will still have to be careful programming to invoke these modules, and to do that right might get beyond my skills. That's OK. because have perhaps thousands of HM members who can make a few suggestions in that area.

The rest of PyMca is probably beyond what we should attempt in advanced data analysis.
These programs are run on CERN's network
- - - - - - - - - - -
We also have Gnuplot which can do anything imaginable for plotting.
Then there is Octave, which can do anything MatLAB, and much more, also used at CERN.
We may not need the much of stuff I am looking at. I was just having fun checking out what it does.
I used command "apt-get install octave". It happens in a seconds or a couple of minutes. No "registrations". No forced "updates". Download only.

It found all the (many) libraries and dependencies, resolved version conflicts, and simply downloaded and installed it from the repository. This is secure also. Digital signature exchange, and you know you get it from a place where the most elaborate mechanisms exist to ensure no entity meddled with it. You can compile the source code yourself, and the fact you can read and modify the source means you know it only does what it is supposed to do. No "extra" functions hidden in there.

Check out Octave. I ran out of screen height to list it all. There was still more to go after octave-symbolic.
I loved having it do calculus on expressions - amazing"!







I think we can expect to simply take advantage of the free software. It can clearly do the job - and much more.
Moreover, we can see the source. Other free software may be free, but the source is often not. I prefer not being restricted to the API (interfaces) decided by the provider, and sometimes to their hardware.

All of this runs natively on the ARM platform in the little Pi-4B computer.




I happen to be using the 4GB SDRAM version, which is about $50

You have to beware. When you fire up one of these, and discover it is entirely capable of being a general purpose desktop PC, with Chromium browser and more software than you have enough life left to try, twin 4K video, Wifi, Bluetooth, USB3, Gigabit/sec network, it's easy to get distracted.

I left mine playing this --> 



(except I skipped the first track)


----------



## homebrewed

I played around with Octave as well when I was exploring the idea of making an FTIR spectrometer (some of the IR optics and a decent MWIR detector were the sticking points, given the limitations of a hobbyist budget).  The Matlab examples of things like modeling double-slit interference patterns didn't need any modifications to run under Octave -- and it's free!

Octave's FFT, curve fitting and deconvolution routines could be helpful w/regard to extracting elemental info from the MCA data.  It is very cool that it runs on an RPi.  I have one of Hardkernel's XU4 boards that is similar and, as you say, it's easy to get distracted by playing around with it.  The monitor dwarfs the board -- when I tell visitors that tiny board is the computer they're blown away.


----------



## graham-xrf

For @RJSakowski :
Sheet lead is available as building material as per the chart image.




In post #206, you mentioned that 3mm thick lead would attenuate to 10E-18 remaining.
(Did I mean 10^-18 or 1E-19)? No matter, 3mm is much more than we need.
The most readily available from eBay seems to be code #3 and code#4.

There are two shielding schemes, one for the PMT, and a different one for the Si(PM). The thing they have in common is a conical shield from the Am241 sources to the test surface, to exclude stuff from X-Rays going out in less useful directions. Unfortunately, the X-Rays have wavelength too small to get up to useful stuff like reflection.

The next shield would be the one around the PMT. It may have to have a mu-metal magnetic shield tube as well. Since photons cannot go around corners, the shield extends a little past the scintillator to exclude them. In the case of the Si(PM), it extends past the light pipe. We can expect the light pipe to scintillate a bit by itself.

Your chart would come in useful right now.I am thinking 1.32mm thick lead may be all we need. £28-50 gets 3m, so I guess 500mm or so x 4" widemight be around $5.00. (Mixing units and currencies really well there).


----------



## RJSakowski

graham-xrf said:


> For @RJSakowski :
> Sheet lead is available as building material as per the chart image.
> 
> View attachment 323412
> 
> 
> In post #206, you mentioned that 3mm thick lead would attenuate to 10E-18 remaining.
> (Did I mean 10^-18 or 1E-19)? No matter, 3mm is much more than we need.
> The most readily available from eBay seems to be code #3 and code#4.
> 
> There are two shielding schemes, one for the PMT, and a different one for the Si(PM). The thing they have in common is a conical shield from the Am241 sources to the test surface, to exclude stuff from X-Rays going out in less useful directions. Unfortunately, the X-Rays have wavelength too small to get up to useful stuff like reflection.
> 
> The next shield would be the one around the PMT. It may have to have a mu-metal magnetic shield tube as well. Since photons cannot go around corners, the shield extends a little past the scintillator to exclude them. In the case of the Si(PM), it extends past the light pipe. We can expect the light pipe to scintillate a bit by itself.
> 
> Your chart would come in useful right now.I am thinking 1.32mm thick lead may be all we need. £28-50 gets 3m, so I guess 500mm or so x 4" widemight be around $5.00. (Mixing units and currencies really well there).



Sorry about the mixup in terminology.  Yes, I meant 10^-18.
Here is the site that I got the chart from.  It is a .png file about the third post down.  https://www.researchgate.net/post/H...required_to_stop_a_particular_X-Ray_frequency
My reasoning.
From the chart, you will see that .28mm of lead will reduce 125Kv x-ray flux by 50%  It will take 11 thicknesses of lead to build a 3mm thickness so a 1125Kv beam would be attenuated to 2^-11 or4.9E-4 of its original flux.  Similarly, for 40Kv photons, .05mm to halve and 60 sheets for 3mm thickness yields 2^-60 or 8.7E-19.
A graph of the energy vs. thickness, it appears that assuming a linear relationship between 40Kv and 125Kv is conservative so for an 80Kv x-ray, it will take .1mm of lead and 30 thicknesses to make 3mm and the beam will be attenuated to 2^-30 or 9.3E-10 of its original flux. You caqn easily make the calculation for other energies and thicknesses.


----------



## graham-xrf

@RJSakowski
Thanks for the link to the chart. I was working it from the other direction, starting with the cheapest thickness of building supplier's lead, 1.32mm

13 layers of 0.1mm should attenuate 2^-13 = 1.22E-4. So 1.22 ten thousanths using the code #3 builder's lead.

The code #4 thickness, 1.8mm attenuates s 2^-18 = 3.81E-6  So 3.8 millionths

Since 1.8mm is easy enough to work with, is easily available, and looks to be a total radiation stopper, I will fix my choice on that - unless of course I unearth the chunk that may be lurking in the garage somewhere, in which case, I just use it.

[Edit - Now I have to firm up on A/D converter, high voltage gadget, Si(PM) avalanche photodiode, and scintillators]


----------



## homebrewed

Just to be a contrarian...

Going back to the NIST X-Ray mass attenuation data, lead's absorptivity at 60KV is 5.02, if thickness is in cm.  The intensity of an exit beam passing through a sheet of lead can be calculated using:  exit-intensity = incident-intensity * e^(-5.02*t).  If you want to attentuate the beam by 99% -- i.e., exit-intensity = .01*incident-intensity this equation predicts you'd need .92cm to do it:  ln(.01) = -4.6, so t = 4.6/5.02 (there are negative signs for both the numerator and denominator so they cancel).

In contrast, lead's mass attenuation for 6KV x-rays, which is close to the XRF spectra of interest, is 467 so you'd only need about 99 microns to drop the intensity by 99%.  So an order of magnitude energy change results in about two orders of magnitude in the attenuation factor.


----------



## graham-xrf

Are there any issues about plastics?

I think some types of plastic may not like being irradiated without an ion chamber enclosing the bad stuff.
I know plastics, being such insulators, can be pietzo-microphonic. You only have to wiggle a PTFE coax to get a big noise row off it. Used for movement detectors in fences. It may not be an issue if we confine the gamma racket to stay between a little lead.

Radiation particles going through soft polymer plastics can leave a track of carbon through. Even sunlight is damaging to many plastics. The question arises in choosing tube covers and front assemblies housing the sources. Maybe we can use any old PVC tubes we please, so long as there is lead shielding where we are going to make a noise with gamma.

Should we stop the helium nuclei with some card covering the sources? Do these alpha particles contribute to noise clutter in this process?


----------



## graham-xrf

homebrewed said:


> Just to be a contrarian...
> 
> Going back to the NIST X-Ray mass attenuation data, lead's absorptivity at 60KV is 5.02, if thickness is in cm.  The intensity of an exit beam passing through a sheet of lead can be calculated using:  exit-intensity = incident-intensity * e^(-5.02*t).  If you want to attentuate the beam by 99% -- i.e., exit-intensity = .01*incident-intensity this equation predicts you'd need .92cm to do it:  ln(.01) = -4.6, so t = 4.6/5.02 (there are negative signs for both the numerator and denominator so they cancel).
> 
> In contrast, lead's mass attenuation for 6KV x-rays, which is close to the XRF spectra of interest, is 467 so you'd only need about 99 microns to drop the intensity by 99%.  So an order of magnitude energy change results in about two orders of magnitude in the attenuation factor.


The highest energy photon of interest is about 59KeV, that being the most a Am241 can wring out of it's quantum probability electron re-arrangements.

Tungsten will shine at 59.318KeV, and 67.244KeV , so one inside of 59.541KeV, and one  outside of Am241 excitation.
If Am241 shows up so clear in the Theremino plot on page #9, then so will tungsten it gets fired up.
The other two glows are 8.4KeV and 9.7KeV.

We set the lead thickness to sufficient to block up to this energy - or we end up looking at a whole lot of unwanted scatter.


----------



## RJSakowski

homebrewed said:


> Just to be a contrarian...
> 
> Going back to the NIST X-Ray mass attenuation data, lead's absorptivity at 60KV is 5.02, if thickness is in cm.  The intensity of an exit beam passing through a sheet of lead can be calculated using:  exit-intensity = incident-intensity * e^(-5.02*t).  If you want to attentuate the beam by 99% -- i.e., exit-intensity = .01*incident-intensity this equation predicts you'd need .92cm to do it:  ln(.01) = -4.6, so t = 4.6/5.02 (there are negative signs for both the numerator and denominator so they cancel).
> 
> In contrast, lead's mass attenuation for 6KV x-rays, which is close to the XRF spectra of interest, is 467 so you'd only need about 99 microns to drop the intensity by 99%.  So an order of magnitude energy change results in about two orders of magnitude in the attenuation factor.


From the NIST site: 
******************************************************************************************************************************************************
A narrow beam of monoenergetic photons with an incident intensity _I_o, penetrating a layer of material with mass thickness _x_ and density _ρ_, emerges with intensity _I_ given by the exponential attenuation law





(eq 1)​

Equation (1) can be rewritten as




(eq 2)​

from which _μ_/_ρ_ can be obtained from measured values of _I_o, _I_ and _x_.

Note that the mass thickness is defined as the mass per unit area, and is obtained by multiplying the thickness _t_ by the density _ρ_, i.e., _x_ = _ρt_.


*********************************************************************************************************************************

The t in your equation is mass/unit area and has to be divided by the physical density to get the thickness.  So .917/11.35 = 081cm or .81mm of lead will be required for 99% attenuation.


----------



## graham-xrf

So.. if 0.81mm of lead causes 99% attenuation, then the transmission is  1-0.99 = 0.01
Then 2 x 0.81mm  = 1.62mm causes 0.01 x 0.01 = 0.0001 , or 99.99% attenuation

1.8mm of lead (the common code#4) is more than that 1.62mm. It will do.
(1.8/0.81 = 2.222 (2's forever). Code #4 lead amounts to 2.22 layers of 0.81

Using the simple observation..
Transmission = 0.01 ^ (no. of 0.81 thicknesses) = 0.01 ^ 2.22222222?
= 3.5938136638E-5
.. and attenuation (1 - 3.5938136638E-5) = 0.999964061863

Even code #3 lead (1.32mm) is worth 1.6296 layers of 0.81.
0.01^1.62 = 0.000575439937337
So attenuation is 1-transmission ≅ 0.999449.

So - it is 1.32mm lead if you like 99.945%
But if you want to push the decimals for a satisfying set of 9's, use the 1.8mm.
We are not trying to safety shield smoke detector radiation. We are trying to limit responses and noise from unwanted stuff, and get a clean plot.

OK - I get it. We don't need loads of thick lead!
( I can already imagine the lady of the house saying.. "It's bad enough you bring your radioactive junk into the house, and now you say your less than 1mm thick lead shielding is going to let as much as 1% leak out" ) ? !!!!!


----------



## homebrewed

RJSakowski said:


> The t in your equation is mass/unit area and has to be divided by the physical density to get the thickness. So .917/11.35 = 081cm or .81mm of lead will be required for 99% attenuation.


Aha!  Thanks for the clarification!  I thought that a cm of lead seemed like overkill.  That also means my calculations on scintillator dimensions are off, too....they can be even shorter and still absorb most of the incident ~6Kev photons.


----------



## graham-xrf

It occurs to me that a simple cheap steel tube would stop the stuff, but we need to control, collimate, and collect without scatter from sundry materials. Lead looks the best, and if we do it right, given that photons still cannot go around corners, we can even pehaps arrange the geometry that XRF from lead in the test sample can be counted, because we know it did not come from the shielding.


----------



## homebrewed

I'm not planning on using steel for shielding because it could produce a substantial contribution to the "background" XRF signal.  Lead does have an x-ray line at 10.549Kev, quite a ways away from vanadium through nickel.  Nickel is the closest at 7.472Kev.


----------



## graham-xrf

homebrewed said:


> I'm not planning on using steel for shielding because it could produce a substantial contribution to the "background" XRF signal.  Lead does have an x-ray line at 10.549Kev, quite a ways away from vanadium through nickel.  Nickel is the closest at 7.472Kev.


I agree - and it's not to hard to source some lead sheet.

*Re: False positives from the shielding*
This is a trick of geometry. If the shielding (a truncated inner ring cone)  is so arranged to shadow the Am241 sources such that responses from the shielding can't get back to the scintillator, because they cannot do any more than diffract at an edge, and cannot go around corners, nor reverse direction,  we have substantially reduced the shielding scatter.

Then go a little further. If the short lead collimator respond with X-Rays off the "hot" side, those X-Rays cannot re-stimulate any lead into fluorescence. I am still messing with the angles in a sketch, but I think one could eliminate response from shielding lead, and even get a genuine xrf response from a test lead sample, or lead in alloys, if placed in the central un-shadowed region.

The 60/40 mix of tin and lead in traditional solder will do as a check sample.

I don't see shadowing, collimating, nor controlling the "beam" reduces the output. All the photons that hit the shielding were headed in a useless direction anyway. Neither do those "response" photons provoked a from a gamma clipping the edge of the shielding get to make it up the scintillator (separate) shield.

When I have the cross-section sketch figured out, I will post it here.

*The "slow pulse" loose end.*
If you can recall, you once came across the rationale for "pulse stretching" with a low-pass filter.

I think the idea was that losing the higher frequency components from the photomultiplied raw scintillation waveshape (by filtering), to leave a delayed, attenuated, pulse that still contained enough information to identify the material. I think all that gets used is the peak amplitude.

This by simply storing the peak value on a analogue peak detector circuit, the accessed and captured at leisure with a low cost, and hence very slow A/D converter.

There was also, I think, a collection of spectra where the contributer was using some data modification technique to "make the bumps stand out better".

This is not the way I was thinking, but since the cost of a good A/D converter is anywhere from about $6 to more than $40, I wanted at least to understand it.

If you still have the link, or a stored explanation pdf, I would love to get at it. Many thanks if you can find it again.


----------



## graham-xrf

Should we call this thing "HM-XRF" or something?


----------



## homebrewed

graham-xrf said:


> If you still have the link, or a stored explanation pdf, I would love to get at it. Many thanks if you can find it again.


It might be this one: theremino data processing.  You will need to tell your browser to translate it to English.  This page has PDFs regarding their data processing as well but you will need to scroll about halfway down this very long page.  Look for links to things like "ThereminoMCA_Deconvolution_Eng.pdf".  You don't need to translate many of these to English (but the English versions have some peculiarities that need puzzling out).  For instance, I think they are using "pictures" when they mean "pixels".

The relevant info on their web site is a little hard to track down, sometimes it is necessary to page through the entire page before you get to what you want.

The Theremino folks claim that pulse stretching improves the quality of their results, something I'm still trying to get my head around.  I suspect the filter network behaves like a charge amplifier -- basically a passive (and fast/cheap) integrator, so the peak value is proportional to the total energy in the pulse.  And it automagically resets so previous pulses don't affect the quality of the data.  THIS makes sense to me:  but I have been wrong before.  Once or twice anyway  

I need to find a decent Spice simulator that runs on Linux to check some of these ideas out.  EasyEDA claims to include a simulator in their free web-hosted schematic capture and PCB layout tool so I will look into that to see how difficult it is to use.  Since it's browser-based it runs independently of the OS.


----------



## graham-xrf

homebrewed said:


> I need to find a decent Spice simulator that runs on Linux to check some of these ideas out.  EasyEDA claims to include a simulator in their free web-hosted schematic capture and PCB layout tool so I will look into that to see how difficult it is to use.  Since it's browser-based it runs independently of the OS.


Thanks for the Theremino link

Re: SPICE
ng-spice works with Kicad, gEDA, (forked lepton-eda) and a number of others.

The full blown tool is qucs. That is more than original Spice network matrix solving. It extends into harmonic balance and suchlike.

Getting up an instant powerful spice-only tool, use immediately, free, is to get LTSpiceXVII from Linear Technology (now part of Analog Devices). It loaded into my Linux Mint, and when I clicked on it, the system fetched and installed wine, and installed it.

LTSpice was aimed at letting prospective customers figure out designs for switched-mode power supplies, using quite elaborate models of LT products as sub-circuits and fast mathematical models, but it is a general purpose SPICE engine.

Now that Linear Tech is part of Analog Devices, I am about to check out if the A/D converters are modeled.





https://www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.html#
You can, of course, run it under Windows. Your mileage will vary. It runs perfectly OK on Linux under Wine.

Kicad can make any PCB you like, and produces files to have the made online, and posted.

If you want to keep your EDA programs in-house, then..
apt update
apt install kicad
or .. just use your package installer - Synaptic, whatever.

gEDA, or it's fork Lepton-EDA also has all the power, but it takes a significant effort to go up it's learning curve, make the models, get the connections between footprints and schematics to work seamlessly.

Right now, believe it or not, sketches in school-style 5mm squares feint ruled paper using colour crayons, pencils, and generally anything that makes a mark actually works.

Getting back to the point about A/D sampling. Everything I know says that one should grab as much information as possible, with as high a sample rate as possible, and then apply the smarts. If all we need is the value of a peak, and we have a way of "telling" if there are two peaks, or some other combination, then we can use a simpler analogue electronics and a slow sampler. I am willing to explore both ways, but looking at the titles in the PyMca software, clearly they want a good representation of the whole scintillation.

Re: Theremino. All the code related to the PIC at the heart of it is compiled from C sources available. Not so the display. The "app" that goes on a PC, apparently to handle various data protocols for external devices, communicated via USB, is a closed source proprietary .exe executable, and no app for a phone that I could see. I won't be using it. The Pi is low cost enough, and powerful enough to do it's own video, and if you really do need to have it show on some other PC's monitor, then use NoMachine and a network. A USB link to phone which provides a remote display - like a GoPro, can be a separate project.


----------



## graham-xrf

Acronyms, buzzords, jargon!
Re: Theremino "Minimize the FWHM"
Duh! Should I have guessed that means "Full Width Half Maximum"?

[Edit: And while we are on this, "MCA" as seen in PyMca and ThereminoMCA apparently means "Multi-Channel Analyzer"]


----------



## graham-xrf

*The Theremino way*
OK, I have read it. I don't agree with a whole lot of it, but I take nothing away from the guys who  that the guys who made real kit originally, and did real stuff. I can skip over an actual critique unless someone really wants to know all the points where I thought otherwise. This is boring technical stuff, and I want to get to the point where HM readers can see pictures of real stuff in action.

I must mention his points (8) and (9).
Apparently advocating 16-bits rather than 14-bits, and mentioning at least 20 samples per pulse. His example pulse is 5uS long. the 5uS/20 = 2.5E-7 or 250nS intervals.
That would be 4MS/sec, which looks at odds against his final solution of using a sound-card A/D at 192KS/sec.

We must carefully make clear the difference between a pulse from a scintillator and the peak on a histogram made up of counts per second in "buckets" of similar amplitude. horizontally sorted by amplitude. You can get a high count of a low amplitude pile of pulses, which would make a higher peak of counts, but on the low energy side of the spectrum

*I entered the Theremino signal conditioning circuit into LTSpice simulation.*
It uses transistors from 40 years ago, and honestly, this is not the way to do instrumentation when there is so much high bandwidth low cost integrated circuits available.

How to do peak detection  --> https://www.analog.com/en/technical-articles/ltc6244-high-speed-peak-detector.html
Many A/D converters have built-in track/hold.

The simulation speaks for itself.
The green trace is a fast getup to generate a pulse similar to the one in the document.
I could have used a carefully defined piecewise  waveform, but this was faster.
Notice that the Y-axis zero is suppressed in some of the traces.
The green trace starting has about 115mV amplitude. What survived the C8/C9  "high-pass filter" to the testpoint fits between 591mV and 593 mV. Massive amounts of signal thrown away! No buffering.






What you have at the end is a low amplitude smeared lomp, and I would not agree that it's tiny amplitude is more easily separated from other amplitudes with this circuit. Of course, it could be that the whole pulse was much larger to start with, and all the mumbers are bigger. Even so, the degradation of the pulse information is obvious!

Using BC237 transistors in a circuit that I would have binned 40 years ago! Sorry - but I go my own way with this.
I ws looking for a way to make it extremely low cost, and if capturing the peak and counting them is all it takes, this can be done better.

BUT, I an not sure about capturing scintillation peaks, and interpreting "pileups", etc.

Just starting out on this. Expect me to pretty much get right down to the bones of it. If it REALLY works, then we shall have some. Otherwise, it get ignored.

I include the save LTSpice files if anyone wants to play with it.


----------



## rwm

By "pile ups" I assume you mean simultaneous events? Can we just ignore these at first and only count the isolated events within a relatively short time interval? You might need to adjust the Am source activity if you are getting too much flux and not having a lot of discrete peaks.
Robert


----------



## graham-xrf

rwm said:


> By "pile ups" I assume you mean simultaneous events? Can we just ignore these at first and only count the isolated events within a relatively short time interval? You might need to adjust the Am source activity if you are getting too much flux and not having a lot of discrete peaks.
> Robert


Yes indeed, but you need a way of "recognizing" a pulse as being isolated, and of a set of similar height pulses, to have it be counted into the right bucket. I don't think we need limit activity. The article talks of 50,000 pulses/sec, and I have read of some sample runs taking several minutes. If the scintillations arrive, glow, and die at a pace determined by the scintillator response, that would be the constraint. I have read that Csi(Tl) scintillations are about 1uS duration.

Either way, I am going to first get the PMT and scintillator up, and measure with a storage scope. I want to get used to what happens, the magnitude and speed of the signal. Then I will figure out what it takes to measure it, sort the measures, and count into the right buckets. I am thinking a 5Msamples/sec 16-bit A/D converter would do it, but I am still intrigued by using a video bandwidth op-amp peak detector , with a trick trigger comparater to "detect" when the slope of the pulse has turned around, and so capture the peak. In such a scheme, it may be possible to use the audio input channels of the little computer to get the 16-bit captures, and there being two channels, one can double the capture to 2 x 192kHz. 

It should be possible to discard signals from pileups. It would be great if the gamma from only one smoke detector source was enough.


----------



## homebrewed

I'm not disputing your simulation results, but something to consider is the effective CPS for your simulation is 2E5, while the Theremino expectations are in the 1000CPS range.  The pulses should be spaced at least by 10 time constants to avoid that slow downward drift of V(output).  Theremino also recommends using USB sound cards that can acquire at 192KSPS (still far short of what would be needed to capture a full-bandwidth pulse out of a PMT or SiPM).

The Theremino approach appears to employ a lot of data processing -- both analog and digital, including throwing away a lot of pulses that don't fit their criteria.  To me this suggests that their main intent is to manage scintillator+PMT noise -- the heavy filtering plus (least squares??) curve fitting would do that.  A more modern approach using low-noise electronics and a faster ADC might produce even better results.  

I believe that SiPM's are inherently quieter so that's something to think about.  And cooling one with a TE cooler wouldn't be too difficult.  If taking that approach I would stay away from scintillators that are even slightly hygroscopic.  Unfortunately, it seems that the best scintillator materials are extremely hygroscopic.


----------



## graham-xrf

homebrewed said:


> I'm not disputing your simulation results, but something to consider is the effective CPS for your simulation is 2E5, while the Theremino expectations are in the 1000CPS range.  The pulses should be spaced at least by 10 time constants to avoid that slow downward drift of V(output).


Ahh yes - please don't misunderstand. I get it that the pulses might come very slow, every now and then, but once the photon hits the scintillator, the glow response duration is microseconds. I set the simulation time to count two pulses, to nearly mimic a coincidence pile-up. There is no implication that the simulation pulses are continuously coming at 200kHz. In practice, there might be smaller, and larger scintillations, maybe separated, or sometimes on top of each other, randomly timed.

A PMT or Si(PM) does not know when there were two or more glows simultaneous.What it sees is additional energy, so making a "higher" pulse, that may have some other duration characteristic. Recognizing these, and coming up with ways of excluding them, or dealing with them, is part of the game.

Consider an analogue peak detector with a trigger and a run-out timer to flag any pulse durations longer than (say) 1.6uS. That would deliver only genuine single scintillations. Others so exactly simultaneous as to "look" like a single can be rejected for being over an energy threshold. Exactly simultaneous smaller scintillations could masquerade as a larger single, but not frequently enough to much adjust the statistics bucket.

Of course, much more "recognition" could be done with software, but that requires a very high resolution sampling.


> I believe that SiPM's are inherently quieter so that's something to think about.  And cooling one with a TE cooler wouldn't be too difficult.  If taking that approach I would stay away from scintillators that are even slightly hygroscopic.  Unfortunately, it seems that the best scintillator materials are extremely hygroscopic.


You may be right, but in my experience, reverse biased avalanche diodes are so spectacularly good at generation of wideband white noise that they are used  loud noise generators to make standard noise calibration signals. There is a constant noise coming out of them.

Nor am I convinced about "noisiness" in the PMT tube circuits. They may be, but not in the way as in the article. A capacitor across a tube divider is to supply electrons, not a crude "smoother" of waveform noise. We can limit noise with inductance along with the capacitance. Noise from a resistor (from molecules banging about therein) is √4*Kb*T*R. The higher the resistance, the more the noise to be short-circuited by the capacitor, and it is not good at it!

I am more used to trying for the extremes of low noise amplifiers in another context, where the gain is more like 50dB or 60dB, the signal input around -110dBm to -120dBm, and the galactic and atmospheric is 10K to 100K noise temperature equivalent. If one is truly after low noise signal processing, the wrong way is to allow a 1Meg resistor to contribute, and then offer it at a BC237.


----------



## graham-xrf

Yes - still looking for a cheap & cheerful circuit dodge. If anything can be hung together that uses one smoke detector, one cheaper diode from Mouser or Digi-Key, and some bit of recycled transparent plastic, and some small electronics almost anyone can hang together, then I will try for it. 

PMT is to be tried, including with non-hygroscopic scintillators, and also Si(PM) avalanche diode. My low cost Ukrainian PMT is still "in transit".


----------



## Tim9

I don’t overthink this stuff. I used to. If it looks like it’s got a lot of chrome/ nickel in it.... I touch with file first and then just chuck it up.  I’ve had some stuff that looks like high stainless actually turn nicely. Other stuff looks similar but it turns with a stringy nightmare bird nest.
PS....you guy are impressive. I’m just lazy....my bad


----------



## graham-xrf

Tim9 said:


> I don’t overthink this stuff. I used to. If it looks like it’s got a lot of chrome/ nickel in it.... I touch with file first and then just chuck it up.  I’ve had some stuff that looks like high stainless actually turn nicely. Other stuff looks similar but it turns with a stringy nightmare bird nest.
> PS....you guy are impressive. I’m just lazy....my bad


Let's go there a bit. Can one tell what is in it from the way it turns, looks, smells, rings, chips, weighs?
I think there are too many variables, including the wear and condition of the lathe, but I have seen there are some "difficult" materials that turn a good finish only when quite a deeper cut is used. I see on YT a video of a guy even turning tungsten carbide, and having a hell job with the fine chips and dust, keeping them out of the machine - and his lungs!

There are probably lots of HM guys with a fine-tuned sense of sight and feel and smell who can tell in the first seconds what the steel likely is. They may not be able to tell the difference between 4140 and EN24T, but they can tell which stainless is messing up the tool. Handling those that work-harden the pass before the final cut must be maddening!

I had thought a carbon arc against the material would yield light spectrum that contained all the materials signature in the spectrum. Maybe it does, but optical spectrum analyzers are many $$$. I am intrigued by the notion of capturing the flare on a smartphone through one of those toy hologram filters that make rainbow colors, and then analyzing the stripe of spatially dispersed pixels. (OK - maybe been done before, but I don't know the trick yet)

For now, I am going to have a little play with XRF.  After all pushes some good buttons. Consider..
1) I am messing with stuff that is RADIOACTIVE!
2) I get to play with CHEMISTRY junk like they wouldn't let me do at school!  
3) Dang - but that thing uses HIGH VOLTAGE - like KILOVOLTS even!
4) It's got glowing crystals and X-RAYS!

It does everything except come with explosions and rocketry. What's not to like?


----------



## homebrewed

graham-xrf said:


> It does everything except come with explosions and rocketry. What's not to like?


Surely there's a way to fit them into this .


----------



## graham-xrf

I find that 10 bucks gets a set of 1000 lines/mm diffraction gratings (eBay - and I bought it). One free iPhone app later, some plastic tape to make a slit, and you are good to go. (Now looking for Android version).

Maybe not quite what we want. The gadget is excellent at chemical concentration photometry. Qualitatively OK at demonstrating the spectra of fluorescent lights  at Home Depot. Maybe it can ultimately make excellent spectrograms (not seen yet), but the one weak point is that for our needs is it requires an incoming light with either absorption spectrum lines or ionization lines from the test material.

I don't know how that is contrived, other than by something expensive and complicated and involves vacuums. Maybe a carbon arc against the material will have either direct plasma excitation lines, or absorption lines, or both, where one blinds the other.

 XRF is at least point & shoot non-destructive!


----------



## graham-xrf

Theremino version - optical spectrometer.
-->


----------



## homebrewed

I made a visible-light spectrometer using one of the ebay diffraction gratings and a webcam.  I initially bought one of the Public Lab kits but needed a more stable optical setup, so I re-used the webcam and slit, added a "real" diffraction grating (the kit includes a blank DVD that you split apart to make your own grating--pretty funky).  I used wood blocks to mount the grating and webcam and milled out pockets on the bottoms and glued super-magnets in so I could move them around to optimize the optics.  The base of the spectrometer is a steel faceplate from a defunct rack-mount power supply, and the case was made from black poster board (the kind with the foam core).  Here's a photo of it:




I didn't like the Public Lab S/W approach so I wrote my own data-acquisition and plotting package using SciPi and a computer vision module (also written for Python).  Below is a spectrum of a CFL lamp obtained with my home-brew H/W and S/W:



The vertical scale is in arbitrary units, basically the pixel brightness averaged over multiple video frames to reduce noise.  I'm currently working on a UV fluorescence attachment for the spectrometer, using an array of 3 watt 360nm UV LEDs I picked up from ebay.  BTW making this thing eye-safe is a big part of the design!  I also got a webcam better suited for spectrometry use -- it has higher resolution and no IR filter (it is sold as a "night vision" webcam).  It came as a PCB so I had to make a mount for it, used my mill and lathe for that.  The base of the mount also has a magnet attached to it so I can easily move it around as needed.


----------



## homebrewed

To give credit where credit is due, I used code I found here as a starting point for my spectrometer S/W.  It had some significant data management limitations because it acquired entire images from the webcam before performing the averaging on just a few lines from each image -- so it used lots of memory.  My variation supports averaging over an arbitrarily-large number of video frames.  2 frames?  50 frames?  1000 frames?  No problem, other than the time needed to acquire them. However, the original code was key to finding the computer vision package that made it pretty straightforward to grab images from a webcam.  Figuring out the vectorized array processing part of SciPy was interesting but definitely worth it -- using that capability reduces execution time quite a bit.

If anyone here is interested in the program code just let me know.  I view it as a (mostly) derivative work so can't see keeping it to myself if someone else might find it useful.


----------



## graham-xrf

Looking through the postings, I can see we have all been working through this thing, and some of us learning this stuff from scratch. Heavyweight contributions are from @RJSakowski in post #27, and @hman in post #59. We know that @pontiac428 knows a whole lot about it, but is not saying much just yet, which I take to be an indication we are still all making sense. @GrayTech is lurking, and of course all the major content from @rwm and @homebrewed . Software skills and the exploitation of the same from others seems to be something he just has.

I am clearer about what I want to try. There will be some bench messing about with ..

1) A PMT with one or more scintillators. Powers supplies, Signals measure, noise, etc.

2) A Si(PM) with at least one bought-in scintillator. Similar measures.

3) A side experiment to find out if an acrylic "light pipe" can be made to deliver down onto a Si(PM). Can somebody please turn up an acryllic taper, cut off and polish the ends? It needs one end about 3 mm diameter, and the other end something to cover the size of a scintillator crystal - say about 15mm to 19mm diameter, with a taper half-angle about 10°. Can such be 3D printed? shine a laser or something up it. I don't have the best recipe yet, but the 10° is small enough for most entry angles to exceed the 42° total internal reflection, and make the whole thing about 40mm or around 1.5" long.

4)   A possible offshoot where somebody tries mixing up something into a hot melt blob of acrylic, to find out if it scintillates.

5) If (4) works, then how on earth to cast a bit of that into a light pipe - or should we just make a disk melted onto the end of the pipe, or don't bother, and push it together with coupling oil and tape it up. Maybe use a drop of model airplane glue, whatever.

6) Follow the route suggested @RJSakowski using a computer-controlled gated pulse peak grabber. This is in essence the same as the monoflop timeout method, using the compute to control the grab, the duration, the reset and wait for another, and the comparator to exclude sillies. (Duh - why is "comparator" not acceptable to the spell-check) ?

7) Plunder and use as much of the PyMCA software as we can. That goes for Thermino, and all other XRF-related code.

8) I had thought that Python, being an interpreted language, would be a significant overhead. I understand it has "semi compiled" speed-up features in that after the first pass, it need not re-interpret every line.
I thought that Java, with the latest version of Pi4J back end, which gives fast access to the GPIO connections, SPI, I2C, and similar stuff related to working external ICs might be needed.

Of course, getting at GPIO directly has been done with C and C++ programs, but by far the majority of projects out there, large or small, have used Python. So for now, I roll with Python. I have to get used to the darn indent being significant.

In all of the above, I am looking to figure out the lowest cost, yet functional gadget. I might end up with a first try that is significantly more expensive, but it has to be capable of showing us how we can lower costs.

e.g. One smoke detector instead of 6 or 8. More if needed
       One photodiode, helped by an acrylic light-pipe. More/bigger area only if needed.
       One scintillator, non-hygroscopic, thin, with sufficient area to make best use of the Am241 radiation.
       One small computer - a £35 Raspberry Pi - perhaps with link to a regular laptop (notebook?) computer.
       One external circuit, possibly mounted on to of the P-4 in the way most school project interfaces do.

Have we got this sort of right - so far? I am happy to have any suggestions at all, and even go after it very differently if it is explained why that would be better


----------



## graham-xrf

In reading the Elettronica Open Source page for "_Signal conditioning techniques for Gamma Spectrometry_", the one which explains all about pulse stretching, recognition, etc. we notice that *LTSpiceIV* was used for simulation.

The circuit partly models a PMT, and has differences to the MCA pulse conditioner we simulated.

Pulse ringing is blamed on the anti-aliasing filter of the sound card. Hmm..
It is a great article.

I cannot help thinking that it applies a very sophisticated, knowledgeable, clever application of software to recover information from a pulse that was needlessly messed up in the analogue circuits taking the pulse from the PMT in the first place. We shall see when I get to measure real pulses, hopefully soon. Still no PMT arrived yet.


----------



## homebrewed

I found a publication that uses an analog peak-hold circuit here.  There also is some useful discussion regarding the pulse shaping, filtering etc that might be a starting point for a home-brew XRF.  The A/D is 8 bits -- but that choice probably was dictated by the specific job they wanted their device to perform (looking for high energy gammas to monitor radioactives).


----------



## rwm

Looking forward to this. Any update? 
Robert


----------



## graham-xrf

rwm said:


> Looking forward to this. Any update?
> Robert


Hi Rob
I am waiting on the PMT tube ordered. I have yet to figure out which Si(PM) will suit, and how we do "light pipe".
Along with both comes the question of scintillator material/assemblies. My first scintillator purchase attempt stumbled on temporary COVID-19 related delays.

A whole lot of this attempt is hijacked (by me) from the work of others, but the final "down at the nuts" practical work is a learning thing that has to fit in with humdrum stuff - like doing the accounts and taxes. Also less humdrum stuff like setting out the stakes and profiles for the outhouse/shop/man-cave to be. When I have actual hardware - I will not be able to resist getting up something to have a play with it.

I sometimes wonder if it is safe to have the eight Am241 sources in the same bag as the thorium mantles. I think I will separate them. I read that  this sort of stuff is capable of "breeding". [Ref: David Hahn - Radioactive Boy-Scout]

In tipping out the contents of an old filing cabinet in the garage, all adding to my pile of stuff to be dumped when the household recycle/disposal facility reopens, I find THESE..





At least 20 years old, the information inside is the kind of stuff that made these probably quite expensive technical texts. The books belonged to one R.Harris, from the days of making covert night-vision cameras (in my  previous life)! The stuff inside seems not very different to the modern tubes. I guess the pinnacle of electron tube technology was about then.

So it reveals all about dark current, shot noise, thermionic noise, signal-to-noise ratio.
All kinds of amplifier and processing circuits are there.
We discover what is scintillator "afterpulse", and "gated scintillator" circuits.
They even deal with detecting _positrons_!

I was looking at some build options. I used a couple of Raspberry Pi(s) to hold the book open before I resorted to the 1-2-3 block. the one with the honking great fan heatsink and GPIO development breakout is a Pi-4B that I experiment with. That is where the A/D conversions etc. will be interfaced to the computer

It amounts to a 2GHz ARM computer with twin HDMI graphics, audio, WiFi, Bluetooth, 4GB DRAM, USB-3 and USB-2 and Gigabit Ethernet. Overkill it is.

The other Pi is a Model3 B+ Running RiscOS. In that OS, even as 1.4GHz thing, it is blindingly fast!
The same software can run on a ten buck$ little Raspberry Pi Zero..




If we can figure how to get the USB link to a smartphone, Theremino perhaps, we may end up with something useful and affordable for the guys who want it for the materials analysis, and are not getting distracted into the rest of the science.

So not much that most folk would be interested in for the present. I am plodding my way through understanding the most basic software making stuff happen on a Raspberry Pi, and picking through PyMCA, and DIYspectro.
I now also have a couple of new old books to trawl through.

[Said filing cabinet is also going to the tip Err.. "recycle centre" . I was thinking a nice tools drawers chest on wheels could go right in it's place!]


----------



## homebrewed

I've been working a lot on expanding our vegetable garden and subsequent planting so of late I haven't spent a lot of time on this project.  I have acquired a couple of LYSO scintillators but no SiPM yet, and I still need to track down those old dead smoke detectors I meant to recycle (  ).  Still mulling over whether to try the Theremino pulse-stretching scheme or shoot for a fast 10 bit A/D approach.  

It might be advantageous to perform the pulse processing in the frequency domain because (it is claimed) this assists in improving the SNR.  If the noise is uncorrelated to the pulse (and why wouldn't it be) then the FFT sort of acts like a filter all on its own (because it samples different parts of the input signal to calculate the magnitude of each frequency component).  A number of ARM processors support the FFT in hardware so the transform step will be very fast.


----------



## rwm

As an aside, I bough a RPi4. I just plugged my 4K monitor into the HDMI port. It makes a nice stand-alone web browser.
Robert


----------



## graham-xrf

Sure Rob - I found that also.

The Pi-4 can get along OK well as it is , but given that this one has the kind of power you find in a general desktop computer, it deserves  some sort of heatsink,  or it will keep throttle back to 600MHz if it encounters intense computing. Running YouTube + browsing at the same time as compiling does it. The CPU temperature monitor gadget shows 60C to 75C. 

Passive heatsinks can help lots - to about 55C, but I found that even the smallest 30mm fan blowing down on the smallest 50cents little set of fins dramatically reduces the CPU temperature - to around 38C to about 48C.
One of those is on the Pi3 Model B, and it is pretty quiet near silent.

The Pi4-B, with the bigger fan is just silent hard to hear, and runs at around 32C. That Pi4 is overclocked to 2GHz. One could take it further, but I kept it to something safe. I have yet to stress it hard.

Normal running is to idle at 600MHz. As soon as a task gets going, it flips to 2GHz. The Raspian desktop is fast and lightweight, but I installed the Mate desktop from the repository. One can use Ubuntu "mate", but I preferred the Debian repository "Buster" that comes with the Raspian. It's a wasteful extravagance, but just way too easy to leave it on Internet Radio, or YouTube Dr Saxlove smooth, and let the Bluetooth speakers have their way.


----------



## homebrewed

If anyone is considering building up their own ADC for this project, one important parameter (other than sampling rate) you want to pay attention to is the ENOB or SNR of the ADC.  Most ADCs don't actually produce data that is as accurate as you might think.  For instance, high speed ADCs used for DSOs may be labeled as "8 bit converters" but their Effective Number of Bits (ENOB) may only be 6 bits at their maximum sampling rate.  ADCs designed for audio purposes often are specified in terms of their SNR, signal-to-noise ratio.  A perfect ADC's SNR can be calculated using this equation:  SNR = 6N + 1.76, where N is the word length in bits.  For example a perfect 16 bit converter would provide a 97.8dB SNR, but you are pretty unlikely to find a 16 bitter that can actually achieve that.  For instance, the SGTL5000 that's used for the Teensy audio board is spec'd to 90 dB.  While this may not seem like that big a deviation from 97.8 dB, keep in mind that 20log(2) = 6, so the chip is "only" achieving less than HALF the theoretically-possible SNR (it actually is closer to 2.5 times worse).

This is why I'm looking at the PCM4220 which boasts a 123dB SNR (for a 24 bit data word).  However, even 123dB works out to an effective bit length of (123-1.76)/6 =  20 bits, not 24 bits.  Still, better than the SGTL by quite a lot.  The PCM4220 can sample at 192KSPS, as well.  Unlike the SGTL5000 the PCM4220's operating modes are all set up using device pins -- so you actually could hardwire the thing for a specific application and not have to bother with an I2C or SPI interface.  Of course, your processor still has to support an I2S serial input stream.

On DSOs it is possible to put them into an averaging mode, where the acquired data is averaged over time -- and this greatly improves the effective SNR.  However, pulses coming from a scintillator are 1-shot events so it's not possible to use averaging.  I thought about this some but couldn't come up with a way to perform averaging without mangling the multi-channel analyzer function.  It doesn't appear to be easy to do because you'd have to classify each pulse correctly BEFORE you average it with a previously-identified pulse.  Sort of a nasty chicken and egg paradox there.  However, if you generate a pulse "library" by using pure elemental samples you MIGHT be able to do some meaningful classifications.  Something to think about.....


----------



## graham-xrf

You somehow track my thoughts.

I have trawled available ADC's trying to select on speed, number of bits resolution, signal-noise ratio, in-stock availability, price, and signal processing complexity overhead. I come a number of conclusions that reduce the choices. I throw in a little preference from previous actual design implementation and experience of trying to reduce the number of lower order bits that were being rendered random by (mostly) common-mode noise from SMPUs, computing, the isolation in transfer of the digital numbers from the point where there is necessarily a common ground return. At the time, this was to measure S-Band Satcoms transmitter over a 76dB dynamic range.

1. The A/D converter choice converges on Analog Devices, and Linear Technology products, and they are now all part of the same company.

2. I cut the choice by looking for only the products in stock at Mouser and Digi-Key. There is some overlap with Farnell/Element-14 and RS Components. The rest of the choice is driven by price. I was OK with under $10 to $30.
The whole thing, built as a 16-bit, 5MB/sec rate device, on demo PCB seems to cost around £44 to £55. (Sorry - I freely use both $ and £, and I don't know where sits "Mackenzie Kings") Maybe too pricey here, after the other costs. Makes me want to go after "pulse stretching"

3. I was pleased to discover that of the possible products, most of the range of Linear Technology part numbers, now mixed in with some Analg Devices part numbers have available evaluation boards. The designs are published, or you can buy some PCB only. Also, can buy the full assembled kit. These can come in two forms. One includes an elaborate interface, with more electronics, and cable to PC, with Windows "evaluation" software. Then there is the simpler kind, which is the device, and some surrounding isolation  interface parts, like voltage level translators, local low noise regulators, etc. Intended for I2C and SPI interfaces.

4. You are right about the number of bits, but take care. When the product claims "no lost codes", what may be going on is that to deliver (say) 16 bits, the LSB bit is actually a 17th bit. The normal LSB uncertainty over where the threshold is (turning 65536-1 levels into 32768-1 levels) is removed. That extra bit hidden away in the bottom register makes the whole 16-bits available.

Mixed in there is consider the sampling method. For example, the _Delta-Sigma_ types get past quite a lot of quantization noise. This is where you have to spot what are 1-bit modulators. We don't go into the principles here, but there is a speed trade-off in return for signal quality. The implementation can offer cost convenience and reduced circuit complexity - but slower.

Some A/D converters get up to fast types of pipelined averaging, which boosts signal-to-noise ratio.

4a. I consider the signal-to-noise ratio available from Si(PM) avalanche diodes in reverse bias at room temperatures, and parallel thoughts about PMT shot noise, dynode noise modulation from supplies, photocathode dark current, etc. There is no point in having a 90dB S/N A/D converter when the lower order bits are jumping about from a incoming 60dB S/N ratio. In passing, S/N ratios for me are power ratios..

10Log10(signal_power/noise_power).

5. I throw in considering using the filtered pulse stretching method, which has to get a credibility check. Even if it works well, the circuit implementations published, especially the filter, are not going to be followed by me.
I would "roll my own".
This opens the possibility of offering buffered, low noise, sorted pulses as line-level inputs into the audio A/D channels of the very same Pi doing the rest of the work.

6. *"Pulse Stretching"*
After what I have read about scintillators, afterpulses, etc, I am definitely a fan of high speed A/D conversion intitial information snatching.

All that stuff about "losing the ringing", caused by the filtering in the first place, does not impress me. What amounts to a crude diode clamping instead of an analog instrumentation circuit - what? All that stuff to deal with an artifact needlessly the consequence of strange signal conditioning in the first place! I am willing to check out the validity of "pulse stretching", but in a deliberate way to prove it works.
If the amplitude information is retained, and the only distortions are from constants in snatching it into energy storage in a filter, and waiting out the aftermath to leak away before bumping it again , then OK. The circuit needs to be gated, and block A/D conversion until ready for the "next" pulse candidate.

*Triggering!*
The random arrival of pulses does not prevent my DSO scope from averaging. If the trigger is set high enough to to miss the low-level pulses, it builds a trace, triggering when it has to. It remains to be tried out on a proper scintillation signal.

Forgive that all this is a bit expansive. I wanted to let you know my thinking, and where I am as yet undecided.
The stuff from Sphere's is interesting --> https://www.sphere.bc.ca/test/photo-tubes.html
So far, the shipping $66 exceeds some of the product $45.
My "other" PMT is somewhere "in transit" from Ukraine.
---------------
Do you have a Si(PM) photodiode in mind? How much does it cost?
What is your (so far) choice for scintillator?
Are we going to attempt an acryllic " long pyramid" light pipe to deliver from scintillator to a 1.4mm2 diode?

It's quite strange - shovelling shop site spoil into a heap (energetic + boring) while thinking about A/D conversion!


----------



## homebrewed

I also am looking at DigiKey as the main parts supplier.  They have SiPM eval boards for not much more than the bare chip so for a first pass I'll go that direction.  So far I haven't found anyone selling SiPM boards on ebay.  

As far as a scintillator goes, I have a couple of LYSO crystals that can be used to at least evaluate a complete DAQ system and also permit experimenting with better-designed pulse stretching circuits.  Right now I'm not going to try a light pipe, will initially try wrapping the sides of the crystal with aluminum foil to direct more photons into the SiPM.  Some papers I've read have described wrapping white teflon tape around the crystals or painting them with highly reflective white paint.

The issue with using a DSO for averaging is that its triggering isn't all that sophisticated when it comes to distinguishing an iron pulse from a nickel pulse -- the energy difference is just barely noticeable, if you believe the Theremino results.  So if you are averaging iron and nickel pulses together you aren't going to get very far.


----------



## graham-xrf

homebrewed said:


> I also am looking at DigiKey as the main parts supplier.  They have SiPM eval boards for not much more than the bare chip so for a first pass I'll go that direction.  So far I haven't found anyone selling SiPM boards on ebay.


OK - if you think there may be advantage that we both go down the same road starting with the same Si(PM) then I can get the same one as you have. I will of course be attempting things with the PMT. PMTs appear able to outperform Si(PM) in various ways, but require very careful, specific setups to do that, and have a big "looking after it" overhead. They die from runaway electron burn inadvertent light leak, and even need to be stored in the dark.

Should I start with the same Si(PM), or should we explore a couple of different ones.?


> As far as a scintillator goes, I have a couple of LYSO crystals that can be used to at least evaluate a complete DAQ system and also permit experimenting with better-designed pulse stretching circuits.  Right now I'm not going to try a light pipe, will initially try wrapping the sides of the crystal with aluminum foil to direct more photons into the SiPM.  Some papers I've read have described wrapping white teflon tape around the crystals or painting them with highly reflective white paint.



Which LYSO did you get? I will have to trawl the thread previous posts to find the link to that catalogue again.


> The issue with using a DSO for averaging is that its triggering isn't all that sophisticated when it comes to distinguishing an iron pulse from a nickel pulse -- the energy difference is just barely noticeable, if you believe the Theremino results.  So if you are averaging iron and nickel pulses together you aren't going to get very far.


OK - agreed. At least for design, any DSO captured pulse is useful in the early stages.
For distinguishing iron from nickel, that is a challenge, because Ni is such a common alloy add-in to iron.
Come to that, most steel now that has come with a considerable recycled component tends to have at least some of a whole lot of elements as remnants, including a little nickel. Steel is even getting slightly more radioactive over time from recycled input.

*Re: Pulse Stretcher*
I still don't quite get it why all that was ever necessary. It is only that the guys who did that design were plenty smart, actually made the kit, and put a lot of research into it, and wrote a lot about it, has me be cautious. I keep thinking I might have missed something.

If the signal from nickel is hard to distinguish from that of iron, then it is hardly likely to help that the signal be smeared by having a first differentiator without op-amp assist nor buffering (i.e. the low value series capacitor), and then the remnant of energy be low-pass filtered such that the transient attempts to charge whatever filter components store energy to finally leak away slowly, making a "stretched" pulse that has a (tiny) maximum amplitude vaguely related to the the height of the original pulse. Any difference of Ni to Fe signals is now a whole lot smaller!

If all we need is the measured height of the peak, let us snatch it with a peak detector. These can work even at microwave speeds, though we need hardly go that far. Then, we can can measure the level "at leisure" with an affordable, accurate A/D, before "reset", and ignoring the remainder of the pulse.


----------



## middle.road

Cool thread!
I do believe I got left at the curb around Post #2...   

and here I thought this might be a nice long thread on getting lawn equipment running.


----------



## graham-xrf

middle.road said:


> Cool thread!
> I do believe I got left at the curb around Post #2...
> and here I thought this might be a nice long thread on getting lawn equipment running.


Sure Dan - good that you still look in.
This is going to be a fairly determined experiment, but I have not lost sight of the hope that it can maybe yield an affordable gadget/app thing that can help tell what the steel is.
Sometimes I am thinking that I may have a better shot at lawn equipment!


----------



## middle.road

graham-xrf said:


> Sure Dan - good that you still look in.
> This is going to be a fairly determined experiment, but I have not lost sight of the hope that it can maybe yield an affordable gadget/app thing that can help tell what the steel is.
> Sometimes I am thinking that I may have a better shot at lawn equipment!


I'm not so sure about that. I believe that your endeavour in creating a test for materials is a much better effort that trying to keep lawn eq running.
Currently I have (4) gas trimmers, and a chainsaw not running.
(Sorry about the off-topic, but I couldn't resist...  )


----------



## homebrewed

I've been debating over the 3x3mm or 6x6mm SiPM -- see this list on Digikey (please let me know if the link doesn't work).  The 3x3 is a little too small for the LYSO scintillators I got here, which are 4x4mm on the SiPM face.  If I want to avoid the complication of a light pipe I guess that means the more expensive 6x6, at about $100USD.  The bare chips are darn near the same price, something to think about if you're going to lay out a PCB for an ADC anyway.

Looking at the Theremino approach, it appears to me that the main thrust of their approach is twofold.  The first is noise management using the passive filters.  I'm thinking that a Bessel low pass filter instead of a crappy passive "whatever" filter might be beneficial, because it will do a better job of preserving the pulse shape.  This said, an active filter that can handle sub-microsecond input pulses suggests a pretty fast amplifier will be needed in order to really achieve the filter performance you want.  The equivalent of a 741 op-amp will NOT cut it.   This is where LTC's Spice package can really come in handy, since it includes models for a number of their amplifiers.  I have Wine, guess I need to download LTC Spice.

The second Theremino approach is pulse management, where they cull out all the doubtful pulses .  They also claim some improvements using their custom deconvolution S/W but that's where I would want to use either Octave or SciPy and leverage stuff that's already out there.

I've gotta say this is is a really interesting project, if that wasn't obvious  . It uses a number of different disciplines that I really like, and the end result depends on balancing physics, optics and electronics (and an underlying $ consideration) that's so much fun.  Really a prototypical definition of what "hobbyist" means in the best sense of the word.  The broad range of knowledge of folks that have contributed to this thread is terrific, and, best yet, I've learned some things along the way.  What's not to like about that!


----------



## graham-xrf

homebrewed said:


> I've been debating over the 3x3mm or 6x6mm SiPM -- see this list on Digikey (please let me know if the link doesn't work).  The 3x3 is a little too small for the LYSO scintillators I got here, which are 4x4mm on the SiPM face.  If I want to avoid the complication of a light pipe I guess that means the more expensive 6x6, at about $100USD.  The bare chips are darn near the same price, something to think about if you're going to lay out a PCB for an ADC anyway.



Yes - $100 - $68 = $32. You are saying the hassle of getting the perspex in, and making a polished taper exceeds $32, and on the face of it, I agree. I also get it why you went for LYSO. It's _non hygroscopic_! No extra waterproofs and X-ray transparent foils, etc.

*A calculation*
I was thinking about it entirely another way. Previously,  @RJSakowski showed us that for the energies we want to capture, scintillator need only be 1 or 2mm thick to stop 98% of the X-rays.

The cost of a scintillator is very much about the amount of crystal, and the hassle of dealing with hygroscopic, but my considerations were all about not wasting the area, starting with the shower of X-Rays coming from the sample. I put a lot of value on the input area of the scintillator. I spent a while trawling the QST Photonics site looking for thin versions with area, unfortunately mostly among the hygroscopic ones.

*For your scintillator.*
For the size of the scintillator 4 x 4 x 22 mm, then using it against a 3x 3 photodiode gathers 56% of the flashes.
If the original area delivering the X-Rays was (reasonably) about 1" diameter, that was 506.2mm2. (Units!)
Those X-rays photons would be headed all directions, including deeper into the sample, and only half headed approximately in the hemisphere toward the scintillator (say about 25mm diameter, at about 40mm range), and only some of those aimed well enough to hit it.

In a crude volume estimate, what I am saying is that there is a huge waste of photons unless the scintillator area presents a bigger truncated cone capture region. If the end of the scintillator is 16mm2 compared to 506mm2, we get 56% of only 3.1%.  I was hoping for better than this  1.8%.

If you cut your scintillator into 4 pieces with 3 cuts, using a metal disc and wet abrasive, losing (say) 1mm per cut, and then stacked them together to yield a 4.75mm thick scintillator of 64mm2 area, you get a massive increase in efficiency. If you are willing to use up both your scintillators like this, you get 128mm2.

I set this against getting hold of a chunk of this acryllic  stuff.




Then turning a taper onto it, and rubbing up the surface with abrasive, finishing with toothpaste or whatever folk use to polish plastic. Even if the S-(PM) diode is only 1mm2, it captures the lot, compared to a horrifically expensive area array 314mm2.

The "bang for your buck" is much amplified by a 11 quid piece of plastic and the HM machining style effort.
I am sure there are many HM members who can offer good advice on how to make this thing.

The taper needs to be narrow enough that most rays starting from the scintillator end hit the inside at more than 42° to the normal.


> Looking at the Theremino approach, it appears to me that the main thrust of their approach is twofold.  The first is noise management using the passive filters.  I'm thinking that a Bessel low pass filter instead of a crappy passive "whatever" filter might be beneficial, because it will do a better job of preserving the pulse shape.  This said, an active filter that can handle sub-microsecond input pulses suggests a pretty fast amplifier will be needed in order to really achieve the filter performance you want.  The equivalent of a 741 op-amp will NOT cut it.   This is where LTC's Spice package can really come in handy, since it includes models for a number of their amplifiers.  I have Wine, guess I need to download LTC Spice.



Sometime around 1985 I had already abandoned any kind of 741 OP-Amp. To lose the DC drift, I would use chopper-type AC versions, or Instrumentation types. By around 2002, there was every kind of video speed op-amp including current feedback types. It is not too hard to find Op-Amps with >50MHz bandwidth. You can get a OPA2300AIDGSR from mouser.com for £2.03. It is a low noise 16-bit accurate 150MHz bandwidth (which would come down to about 10MHz actual operation with feedback). It's a very old device. LTC devices come with Spice models. We have nothing to fear here. It's a dual. Use one for a zero-loss peak detector.



> The second Theremino approach is pulse management, where they cull out all the doubtful pulses .  They also claim some improvements using their custom deconvolution S/W but that's where I would want to use either Octave or SciPy and leverage stuff that's already out there.



This is one area I have not thought through, but I think there is massive potential in the PyMCA and all that free CERN software from the LHC, and the NRLXRF (Fortran) software to get somewhere.

Before even we go there, I think there is mileage in side-stepping a whole lot of it, and just do what you would do if you were just looking at it. Your original suggestion, similar to @RJSakowski 's switched capacitor,  of a one-shot monostable timed capture-lockout-reset does a lot of the hard stuff in one hit.

Really fancy stuff, like capturing the whole scintillation, and/or parts thereof, subjecting to FFT analysis via octave, and all that clever stuff only has a point if there really is new information in the pulse to spot overlaps, etc. If the main information is the pulse amplitude, that is all we need, we can skip much of the rest.

The really clever sorting will be the analysis of accumulated counts of pulses meeting the criteria to be in the quantized energy "buckets". Assigning some kind of hash value, as a signature of the set of weighted buckets might allow a fast lookup on alloy probability, and display the conclusion on the plot. Maybe that is already done for us in PyMCA

*Theremino*
The biggest, nicest chunk of Theremino is the app display - a general purpose screen of graph that can be used on phones, etc. None of the XRF stuff that fed it need be replicated by us.
For me, the Raspberry Pi already comes with 2 full HDMI displays. Initially, I don't need a Theremino.

For folk who might want to use a smartphone, I think there are very likely apps that will do a USB link, or use Theremino. This is completely another branch to this job, something to be tacked on at the end.

Re: PCBs etc.
Most folk here would not have too much trouble hanging together evaluation boards. More difficult when it comes to soldering SOIC components. All one can fit on 1sq ft of PCB cost about £40 as a prototyping quantity, which would make about 10 lumps of electronics. I was hoping to use something like THIS




The "plug-in" prototyping breakout, ribbon cable extension, breadboard, and set of connector wires as seen in post #249 cost £8.49.

I will be trying out a S-(PM) like you are, and it will be one of the smallest cheapest. I am convinced that a light-pipe is a good idea. More problematic is a "big enough" scintillator, though it need not be very thick.


----------



## rwm

Sawing a thick scintillator into multiple thinner scintilators seems like a good plan if you can do it. Perhaps a lapidary saw? That adds a whole new discipline!
Robert


----------



## homebrewed

I think most scintillator crystals are >2mm thick because they're designed for higher energy X-rays.  Unfortunately, the thinner ones don't seem to show up on ebay.  I found a supplier that sells these.  Based on info in this paper, CsI(Tl) .1mm thick scintillators are OK for x-rays up to 10Kev, and you'd get more than 75mm^2 in area.  LYSO is denser than CsI (7.4g/cm^3 vs 4.57g/cm^3) but the NIST absorptivity tables indicate that Cs is twice as absorptive as Lutetium -- so overall the crystals probably are similar.

The idea of making a larger composite scintillator does have its attractions.  But I'm a little concerned about cutting and polishing the LYSO.  It's a big unknown w/regard to its brittleness.  I have done a LOT of polishing, both on glass and silicon so I do have some experience with polishing hard, brittle materials -- but some, like GaAs, are a real SOB no matter what you do.  Also, according to Wikipedia Lutetium Oxide is toxic if inhaled so some care would be needed during the cutting/polishing process.

My thoughts on collection efficiency are a bit different anyway.  If I have to accumulate counts over an hour to get decent statistics that's OK in my book.  I'm not gong to be doing this for a living.

I've assembled SMT PCBs without much difficulty, but I used a stereomicroscope to do it.  Leadless packages might seem to be a nonstarter but if you pre-tin the package pins AND the PCB footprint for it, it can be done on a hot plate (it also is advisable to tin the pins where they are exposed on the SIDES of the package, too) .  When the solder melts its surface tension automatically aligns the package to the PCB footprint.  If your board has a solder mask layer, anyway.  You also want to use small-diameter solder and a fine-tipped soldering iron, and so-called "smt tweezers" are very handy for holding resistors and capacitors in place while you solder them down.  They have wider flat tips to better grip small rectangular parts.  Oh, and water-soluble flux really helps when soldering down packages.


----------



## rwm

"Really fancy stuff, like capturing the whole scintillation, and/or parts thereof, subjecting to FFT analysis via octave, and all that clever stuff only has a point if there really is new information in the pulse to spot overlaps, etc. If the main information is the pulse amplitude, that is all we need, we can skip much of the rest. "
Yep. Good point.
"My thoughts on collection efficiency are a bit different anyway. If I have to accumulate counts over an hour to get decent statistics that's OK in my book. I'm not gong to be doing this for a living. "
YES- agree strongly. Would using a lesser collection efficiency or a lower activity source also be helpful by preventing simultaneous or temporally overlapping signals?
Those crystals are getting pricey but if that is the only major expense it still looks cheap compared to a Bruker.
Robert


----------



## homebrewed

I realized there is a good reason to prevent Americium's gamma rays from hitting a thin scintillator.  Due to the greater penetration depth of the 59.54Kev photon, a thin scintillator will generate SOME photons, just not the full complement -- so the pulse will "look" like some other element.  Fortunately, based on RJ's input, it won't take too much lead shielding to accomplish this, but the physical layout of the americium, shielding material and scintillator is more important than just getting rid of the 59.54Kev background signal.


----------



## graham-xrf

Hi @homebrewed :
I happened on this KETEK site --> https://www.ketek.net/store/category/sipm-standard-devices/
Whole arrays of what seems to be Si(Pm) devices, one for less than €15
I got there via Instructables circuits "Scintillino"  https://www.instructables.com/id/Real-time-Radiation-Detector-Scintillino-test/
Is this one you have come across before?

In context, I was checking out BC408 plastic scintillators, many of which seem reasonable low cost.


----------



## homebrewed

Hi Graham,

I had looked at the KETEK site as well.  There are plusses and minuses with their offerings compared to the ON Semiconductor SiPMs.  ON's pricing for the bare IC is nearly the same for 1x1 or 3x3, a bit less than $60USD -- unlike KETEK, which is asking a lot less ($17.90-$22.36 for the 1x1 and 3x3 respectively).  But if you want to buy a demo board with the SiPM pre-installed both are asking nearly the same price (not including shipping).  

If you have the ability to solder WLP packages you definitely could save some money by going with a KETEK product.  However, I have no confidence in my ability to solder a WLP down to a PCB.  At work we had a technician who had figured out how to do it, but it took awhile to get it down -- and she had access to the right solder flux, a temperature-controlled hotplate, and lots of parts to play with.  Just for an example of all the variables at play, she found that the parts moved around too much when heated up, because the solder flux would start to bubble up as steam was released.  She solved that problem by pre-baking the fluxed boards in an oven we always kept heated to 80C.  It also made the flux tackier, which made it easier to nudge the parts into place.

 BTW, unless you immediately solder surface mount IC's after opening their original packaging, you need to bake them for a few hours at 80C to remove moisture that enters the package.   That's why we had that lab oven always turned on.  Otherwise the absorbed water will turn into steam and can potentially break bond wires due to the pressure buildup when heated to soldering temperature (we called it the popcorn effect).  We once had a horrendous failure rate on an assembly line due to this problem, which literally shut that product line down for awhile.  It is particularly insidious because the bond wires can temporarily reconnect once the package cools down, but eventually the part would fail -- and by then the products were in customer hands!!  This is something to keep in mind for those DIYers among us who may wish to roll their own PCB and populate it.

H


----------



## homebrewed

After looking a bit more at the KETEK SiPM modules, I like theirs better than the ON Semiconductor demo boards.  The ON versions have a built-in pulse transformer so the design options are more limited.  The KETEK versions just bring out the anode and cathode of the device, so it's more like a standard break out board.


----------



## graham-xrf

Hi @homebrewed :
The Ukrainian PMT finally arrived. The Soviet version of cold-war surplus. Clearly new old stock. When I cut past the labels and un-stapled the box, it was nestling in sponge that clearly had be given 3 decades to deteriorate. I am having to put some time into decoding the Cyrillic 


Who knows why on Earth the data sheet document is a "passport"?
This one would work with almost any scintillator put up against it, but initially I am going to try an unblemished clear Na(Tl) that fits right on it (I think). Ordered from the same seller.

I am, of course, going for the Si(PM), but I did order this one quite a while back. If it works, it will still be a bargain.
Even so, for any who may check on this thread, I think the stuff in the Hamamatsu PMT handbook Third Edition should be here for them to find.


----------



## homebrewed

graham-xrf said:


> Hi @homebrewed :
> The Ukrainian PMT finally arrived. The Soviet version of cold-war surplus. Clearly new old stock. When I cut past the labels and un-stapled the box, it was nestling in sponge that clearly had be given 3 decades to deteriorate. I am having to put some time into decoding the Cyrillic
> View attachment 326291
> 
> Who knows why on Earth the data sheet document is a "passport"?
> This one would work with almost any scintillator put up against it, but initially I am going to try an unblemished clear Na(Tl) that fits right on it (I think). Ordered from the same seller.
> 
> I am, of course, going for the Si(PM), but I did order this one quite a while back. If it works, it will still be a bargain.
> Even so, for any who may check on this thread, I think the stuff in the Hamamatsu PMT handbook Third Edition should be here for them to find.


Passport, eh?  It's gotta be the output of one of those amusing automated translator programs.  Some of the Theremino publications are hard to figure out as well, probably for the same reason.

Now "all" you need is the HV supply, resistor divider chain, fast A/D and MCA S/W   .  The python-based stuff you found may be helpful in the latter case.  Just guessing here, but I suspect you have a decent 'scope to look at waveforms.  I got spoiled at work so my tastes run on the expensive side there; but, really, a 1GSPS Hantek, Rigol or Siglent should be plenty good for stuff like this.

H


On a slightly different subject I downloaded the LTspice package and tried it with my version of Wine.  It seems to work just fine.


----------



## graham-xrf

homebrewed said:


> Passport, eh?  It's gotta be the output of one of those amusing automated translator programs.  Some of the Theremino publications are hard to figure out as well, probably for the same reason.


Nope - definitely no automated translator funny. Just reach back to your math Greek symbols.
*ПАСПОРТ*
The *П* is a Greek capital Pi, as in Raspberry.
The *А* is exactly what you think it should be
The *Р* is a Greek Rho, as in "R"
The *Т* is a "T" of the usual kind, another letter where the correspondence to Latin is the same, as is "O".

Also, remember the USSR was spelt *СССР* for Sojúz Sovétskix Socialistíčeskix Respúblik.
That was _Союз Советских Социалистических Республик in Russian._
..from which I infer that the Cyrillic "C" is pronounced "S"
Not quite code-breaking, but the darn thing unquestionably spells "*PASPORT*"

It may have been a Soviet administrative thing from their cold-war culture. This sort of kit was perhaps not the sort of thing to be in the possession of just anybody. Maybe they just use the term to mean "identity" in the same sense as with people. Who knows?


> Now "all" you need is the HV supply, resistor divider chain, fast A/D and MCA S/W   .  The python-based stuff you found may be helpful in the latter case.  Just guessing here, but I suspect you have a decent 'scope to look at waveforms.  I got spoiled at work so my tastes run on the expensive side there; but, really, a 1GSPS Hantek, Rigol or Siglent should be plenty good for stuff like this.


One discovers all sorts of very sophisticated resistor divider chain in that Hamamatsu handbook. Everything about extracting the signal without noise, and whether it is to be used for "counting" as opposed to amplititude extraction. How to use DC amplifiers. How to AC couple. We note the careful way they filter and buffer the dynode voltages while not limiting the bandwidth of the output. This stuff has been developed for decades. Still quite easy to implement, but it makes the Thermino version look a bit basic. I will be putting some thought into that part.

For Si(PM), the diode current needs to be supplied carefully, so that the signal from it is from photo-induced carriers, not messed up with diode thermal and other noise.

My scope is not as fancy as a 1GS/s Rigol. It is an "older" scope, a 500MS/sec Hewlett Packard 54520A. Even well beyond the 0.5GHz, it has served well for picosecond risetime measurements. I admit it could be time for something a bit younger, but I hardly use it much. In the last 10 years, the kit was usually spectrum analyzers and VNA's from Rhode & Schwarz and Keysight.  They were not mine to own. I do have a R&S analyzer FSH3 good to 3GHz, and Anritsu 20GHz analyzer, both "in need of repair". One has a burned up attenuator because some git connected it to a 150W transmitter, and the other has a display supply problem because some git plugged in the wrong polarity charger. To be fixed "someday" if I really need to.


> On a slightly different subject I downloaded the LTspice package and tried it with my version of Wine.  It seems to work just fine.


I just knew it would work for you. The full models and reference circuits for the LT range A/D converters evaulation boards are on the Analog Devices site, but if you just peek in the LTSpice library, I think I saw some there. Now that you mention Wine - > infers you also drive more than one kind of OS.


----------



## homebrewed

Your electronics lab definitely is better-equipped than mine!  Fortunately no RF gear will be needed for this project.  I do have a cheap SDR dongle I have used for some troubleshooting purposes but with a baseband bandwidth of only 1MHz it isn't very useful as a spectrum analyzer. 

Regarding your comment on Wine and different OSes, Linux is our main platform.  These days the only time I fire up a Microsoft product is to do our taxes.  At work our desktop computers were all WinXX but the design tools we used were Linux-based.  I didn't design IC's, I took 'em apart -- but needed circuit and layout info to track down the failure site.

I haven't looked at the Hamamatsu document yet.  It sounds like it was a good find.


----------



## graham-xrf

Hi @homebrewed
Have a little explore of https://madexp.com/
Papadopol Lucian (not sure which is the surname) emailed me with some stuff about the FEC84-5 PMT tube having "low gain". Find what you will, and note the amount of lead and radiation stickers the lad uses.

[Edit --> https://madexp.com/2019/06/09/diy-scintillation-probe-the-easy-way/ ]
[Edit #2 The name is Lucian Papadopol ]


----------



## homebrewed

graham-xrf said:


> Hi @homebrewed
> Have a little explore of https://madexp.com/
> Papadopol Lucian (not sure which is the surname) emailed me with some stuff about the FEC84-5 PMT tube having "low gain". Find what you will, and note the amount of lead and radiation stickers the lad uses.
> 
> [Edit --> https://madexp.com/2019/06/09/diy-scintillation-probe-the-easy-way/ ]
> [Edit #2 The name is Lucian Papadopol ]


That's an interesting web site -- thanks for sharing it.

It's nice to see some of the details for making a scintillator/detector assembly.  I'm not sure what to conclude regarding the massive lead shielding he's using.  Maybe he's looking at much higher energy gammas than we will be?

One of his blogs also has a link to another scintillator vendor, epic-scintillator.com.  That could be useful.


----------



## graham-xrf

I am after not so much what he does, but rather, where all his links lead to, especially those of his favourite suppliers. It will take a good long while to read all his site.

Meantime, I have also got thoughts about plastic scintillator + Si(PM). The more I think on it, the more convinced I am that there is value in collecting the light from the scintillator in a light pipe, delivered onto a 3 x 3 mm photodiode. To shape an acrylic plastic scintillator into being it's own light pipe is just a cool thing to try.
I have no UV light source, but I am curious what happens to PMMA (perspex) acrylic if one shines UV onto it.

I know it must seem humdrum parochial thing to say, but I can be a bit tightwad stingy when it comes to eBay priorities. More scintillation crystals and suchlike XRF stuff got stalled because I blew the budget on good green laser level kit capable of working OK outdoors over respectable ranges. This is in the interests of the shed/shop/man-cave/home-for-machine-capable outbuilding project.

Checkin' out epic-scintillator.com


----------



## homebrewed

Being a hobbyist means choosing your battles, funding-wise.  You don't sound all that different from me, in that regard.  Too many projects, too little money.....as usual.  Here's a toast to all the tightwads in the world!


----------



## rwm

Still watchin'
R


----------



## graham-xrf

@rwm : Yum! it's so long since I had those. No longer allowed the drizzle of maple syrup on it.

*Look at a different kind of workshop*
More of a lab. As far as we at HM are into building collections of machines, tools, measuring kit, etc. so is Lucian into spectroscopy. There is a not-yet-organized shared folder he uses for some of his stuff.
Just look at the pictures!
--> https://madexp.ns0.it/nextcloud/index.php/s/n2FRPQmxqnjyjCP
Now that we get some idea of what he does - consider this..

*His audio-channel codec A/D version of Thermino already exists!*
.. and has been delivering worldwide. He used Kickstarter funding for an audio card based spectrometer about a year ago. That is what this gadget is on the madexp site.

--> PMT adapter
--> Audio card based USB Interface spectroscopy









Keep in mind - his interest is gamma ray spectroscopy, as opposed to xrf.

As I understand it, his method is to drive the switched-mode power supply FET from a PWM (Pulse-Width-Modulated) waveform generated from an Arduino, in effect doing what purpose-built ICs from Linear Technology/Analog Devices do, but getting into the loop to make the voltage adjustable.
Better resolution circuits pictures are in the project documents.

*Why a "thin" crystal?*
If you guys don't already know why this is so, then we may need help from @RJSakowski, or @pontiac428 .
For me, the power is about the sheer number of photons, an energy density that can disperse in all directions as photons/sec. I get it that the energy in any photon is locked to it's wavelength, and could travel to the ends of the Universe undiminished.

I believed that a scintillation crystal needed to be "thick enough" to have a high probability that an X-ray photon would get stopped, presumably by encountering a scintillation crystal atom/molecule. Withinn limits, there is no "too thick". A thick crystal would flash, and that gets detected.

*BUT.. I quote Lucian..*
"The problem is that for XRF you need a thin crystal and possibly one with good resolution in the XRF energy region.
I've experimentally understood that I need to buy a CsI(Tl) and slice it by myself and I've done that... I've to search for the pics and resulting spectra.
The CsI(Tl) could be handled also unenclosed, you can cut and polish it and it's very stable to moisture."
---end quote---

.. from which we learn that he has sliced CsI crystal.
He is even planning a crystal growing furnace for CsI and Na(Tl) with his friend Stanislav.

Lucian had cause to cut a thin crystal - and I don't understand why?

*Can we take the short cut?*
It seems the low cost hardware may already be available - slightly modified, can we use it?
I am going to try the home-brew Si(PM) diode thing. Do consider that there must be a good reason it has not displaced the use of PMTs.

*Lucian's new project*
With his colleague.. quote
"The high speed spectrometer.
It's self integrated into a single pipe-probe, usb powered, high speed and high quality (FWHM <8.5%).
I've even made my own MCA software: AmericiuMCA, you can see in pictures. It's at the developing stage but working to test our proto".

As it is with the internet, one discovers that there is very little one could contemplate, work on, spend on, that has not already been thought of before!


----------



## graham-xrf

The RAD LAB - a supplier
This happens to be an eBay store --> https://www.ebay.com/str/theradlab


----------



## homebrewed

The CM108 looks like a pretty decent audio codec -- according to its spec sheet, with an SNR of 93.6 dB it has 15 bits of "real" resolution.  Since he's using an audio codec he also is using the Theremino-style filters to condition pulses coming out of the PMT, but I haven't compared the schematics to see if the time constants are exactly the same or not.  Still using a discrete transistor amplifier/buffer scheme, I see.

Regarding the advantages of using a thinner scintillator crystal (other than the fact that it might be less expensive), it may be that more of the generated photons have a direct path to the detector, increasing the odds of being detected.  This is speculation on my part so don't take it as gospel.


----------



## graham-xrf

It is possible to model the output pulse, and it's driving impedance, in Spice, for a PMT, and settle the issue of pulse extraction design. Come to that, it is possible to model the entire dynode set in a PMT as a series of current-controlled current generators. I will know the truth of that aspect of the design.

I am not convinced about the thinner scintillator. They are glass-clear all the way through. An incoming event will produce a flash when it penetrates deep enough. I don't know much of the detail of the scintillation mechanism, but if a flash was caused, whether crystal was thick or thin, the now visible light will make it to the output surface.

The motivation to physically cut a thinner crystal out of a thicker chunk is not likely over saving money - unless the aim was to make several scintillators out of one.

The mind is also thinking on Si(PM). I don't have nearly as much information on circuits for these.


----------



## homebrewed

I believe the visible-light photons generated by an x-ray photon are emitted at random angles.  Given the usual scintillator/detector geometry, it won't be possible to collect photons emitted away from the detector (if they don't exceed the angle needed for TIR).  So you are inherently limited to the ones that either directly make it to the detector, or are reflected back into it (again, if their direction in the crystal results in TIR from the sides of the crystal).  A thinner detector could have improved geometrical aspects, basically a greatly-reduced "side reflection" component.  A specialized form of ray tracing program for optics might shed some light on this question.  I have a copy of Goptical, which is a package for ray-tracing optical systems, but haven't used it enough (not any, in fact) to know if it could be used for this.  Maybe a user-defined light source A.K.A. a "scintillator" is possible.

Speaking of optics, I had wondered if it might be possible to collect more light (which appears to improve energy resolution) by placing the scintillator at one of the foci of an elliptical mirror.  Place the detector at the other focal point and (perhaps) enjoy better energy resolution.


----------



## graham-xrf

homebrewed said:


> I believe the visible-light photons generated by an x-ray photon are emitted at random angles.  Given the usual scintillator/detector geometry, it won't be possible to collect photons emitted away from the detector (if they don't exceed the angle needed for TIR).  So you are inherently limited to the ones that either directly make it to the detector, or are reflected back into it (again, if their direction in the crystal results in TIR from the sides of the crystal).  A thinner detector could have improved geometrical aspects, basically a greatly-reduced "side reflection" component.  A specialized form of ray tracing program for optics might shed some light on this question.  I have a copy of Goptical, which is a package for ray-tracing optical systems, but haven't used it enough (not any, in fact) to know if it could be used for this.  Maybe a user-defined light source A.K.A. a "scintillator" is possible.


Hi @homebrewed Re: The first part.
Consider first a thin crystal. I don't know if one X-ray photon slamming into a crystal atom (molecule?) will beat it up enough to yield more than one photon of visible, but let us say for the moment it is only one, in a random direction.
The fraction that makes it to the photocathode are those from a wide solid angle, almost a hemisphere.

Now imagine add a small thickness. The photons from the layer next to the photocathode will still behave as before, but this time augmented by another layer's worth, able to collect a slightly smaller solid angle fraction of the slice volume, and those will be slightly attenuated by the light loss through the first slice.
.. and so on.
We might get up a calculus integration to provide an expression, and discover a maximum, if there is one.


> Speaking of optics, I had wondered if it might be possible to collect more light (which appears to improve energy resolution) by placing the scintillator at one of the foci of an elliptical mirror.  Place the detector at the other focal point and (perhaps) enjoy better energy resolution.


Once we have visible light happening in a crystal volume, I can see value in using metal reflective sides, to re-direct light back into the crystal. Consider also the X-Rays coming at the crystal input. Even if they included X-rays that were made from a gamma slamming into aluminum in the test sample, the X-Rays will go right through a thin aluminum into the crystal, but the scintillator light going the "wrong" direction will get reflected back into through the crystal, to end up at the photocathode.

Making reflective optics of the kind you suggest would be worthwhile if the size of the photocathode was a point region focus, but instead, it is a large disc. Not so if it is a small Si(PM) diode. In that case yes, make one surface curved - or use a lens - or use a plastic light pipe

Covering the scintillator with metal (which they do) is an approximation to an "integrating sphere" where all that makes it into the inside can only come out one hole.
https://en.wikipedia.org/wiki/Integrating_sphere

Doing what you suggest could be a great idea to gather wayward photons heading out of the crystal in unfortunate directions, back onto a small area silicon at the focus. Goptical may be able to show (say) 8 rays, starting from a source inside a crystal volume, going in various directions, to test the reflector. Aluminium is, in this case, a frequency selective surface.

You happen upon what I do - i.e. "The dishes"!




Ignore the (expensive) little black random circles, which are there for photogrammetric surface measurement.
The feed at the prime focus is of a frequency that can pass right through the smaller dish. The feed down in the middle of the main dish at the Cassegrain focus is of a frequency that can only reflect off the smaller dish.
Inside the smaller optic dish is dichroic frequency selective surface tchnology - a microwave array. This arrangement is somewhat equivalent to X-ray photons going through aluminium, but visible light unable to.

*We have one answer to the question about why thin crystals.*
.. From Lucian's colleague Stanislov.
" - - - - - - -
[9/6, 11:47] Stanislav: To cut high energy background and minimize light losses
[9/6, 11:48] Stanislav: At low energies, crystal has no active volume but an active surface

And this is all! For XRF we need a thin and whide. 25x5mm for me Is a good compromise but I know that Advantech UK makes also 1mm thick cristalls with Be window.
" - - - - - - - -

My thought on that is the compromise can be shifted considerable by limiting the high background energy possibilities into the test sample region - say with a sheet of lead under the test sample.

I think Stan means that at low energies, the X-Rays don't penetrate the sintillator crystal, but only work at it's surface.
Huh?? I dunno about that!

Once the scintillator has made light, a very large fraction will travel on through it. They are glass-clear!
A pause now - while I scramble some hardware together.


----------



## rwm

" Consider first a thin crystal. I don't know if one X-ray photon slamming into a crystal atom (molecule?) will beat it up enough to yield more than one photon of visible, "
My understanding is that an xray absorption event will cause a chain of photoelectric interactions with a shower of light photons of various energies. The sum of the photon energy is equal to the energy of the incident xray.
The only problem I see with putting a reflector on the front of the crystal is that it may block some of the very low energies we are looking for. I suppose you could try very thin aluminum. It would be a good experiment to try with and without this thin reflector to see how the efficiency changes.
"I think Stan means that at low energies, the X-Rays don't penetrate the sintillator crystal, but only work at it's surface.
Huh?? I dunno about that! "
I think that is what he means also. That is a great website BTW! Lots of good stuff.
I can't wait to see some hardware!
Robert


----------



## homebrewed

RWM is correct in that a single x-ray photon interacts with multiple emitter atoms in a scintillator.  The number of atoms varies in proportion with the energy of the x-ray.  As a result every event results in an angularly-distributed shower of visible-light photons, VLPs (my acronym to reduce the amount of tyeping oops typing corrections I have to do .  If only a random portion of them wind up hitting the detector, the resultant pulse has a random variation.  I think this is one of the reasons for the relatively low resolution of scintillators vs solid-state detectors.  For solid state detectors, once the hole-electron pairs are generated they are swept up by the internal electric field, so the notion of "direction" affecting detector efficiency doesn't exist.

I like the idea of coating the scintillator with a thin Al layer.  More elegant than the ellipsoid scheme, and the aluminum wouldn't need to be very thick so it probably won't absorb the low-energy photons to any great extent.  Unfortunately, Al-coated scintillators don't seem to be all that available, maybe @graham-xrf has found a source?  If not, there's a relatively inexpensive answer -- send your crystal to a telescope-mirror aluminizing service company.  I found one that serves amateur astronomers and will coat one for $69 (USD).  That is, if the scintillator is less than 6 inches in diameter.

Alternatively, awhile back I came up with a scheme to edit integrated circuits using electroless silver -- the old mirror-silvering process -- and it was pretty easy to do.  You need silver nitrate, ammonium hydroxide, distilled water and Rochelle Salt.  The silver film is pretty thin and is highly reflective.  You just need to practice some basic safe handling methods -- PPE's, and be sure to discard any left-over silvering solution once you're done.  If allowed to dry it may form silver fulminate, which is a sensitive explosive.  OK, nothing's free   .  The stock solutions -- silver nitrate in distilled water and rochelle salt in distilled water -- are stable.  Silver nitrate will stain your hands so you will know soon enough how good your handling protocol is.


----------



## homebrewed

Biasing SiPMs.  

The KETEK data sheet for their 3x3 device says the breakdown voltage, Vbd, has a temperature coefficient of +22mV/K.  The gain tempco also varies with Vov (V over-voltage).  Gain tempco varies from -0.6%/K at Vov = 2.5V to -0.3%/K at Vov=5.0V.  Avalanche gain is about .9E6 at Vov=2.5V and around 1.75E6 at Vov=5.0V.  The final parameter we need to know is the variation of dark current vs Vov:  .2ua(max) @2.5V and 1uA(max) @5V (this is at 21C).

This is a lot to swallow at one go.  But there are some obvious things to consider.  First, do we really care if gain varies a little bit over temperature?  I think so, if we are planning on using some kind of reference library to help extract concentration information -- day-to-day temperature variations will cause shifts in the position of peaks from the MCA.  Since many of the elements we're interested in will have overlaps, we need all the stability we can get.  The alternative is to implement a quick & easy way to swap in your elemental standards without disturbing the temperature of your detector.....but it still would make it difficult for Graham and me to trade data sets (for instance).  And to make this thingie generally useful to others, it would be great to have a data library of elements and alloys that everyone could use.

If we use a fixed bias voltage to give us Vov = 5V at 21C with a simple resistive load, we can expect the quiescent voltage to increase as temperature increases (because Vbd increases).  This should increase Vov and therefore the gain should increase, but this is offset some by the negative tempco of gain vs temperature.   If we put the detector inside a DC feedback loop to maintain a constant dark current, this would stabilize Vov and eliminate gain variation due to changes in Vov, but it would not address gain vs temperature.  However, now we have a single temperature dependency that could be addressed in software -- place a temperature sensor near the detector and massage the raw data accordingly.

Before I go to all that trouble I need to write a system of equations to see just how bad a simple fixed-bias + resistive load approach really is.  Wouldn't it be nice if there's a sweet spot with a very low overall gain tempco.


----------



## rwm

Would it be hard to control the temperature at a fixed value? Perhaps heat it slightly above room temp and maintain it there with a heater and control circuit? Although perhaps it would be simpler/easier to correct for temp in the software with a thermocouple as you suggest. Either route requires a probe to measure the temp. 
Robert


----------



## homebrewed

The SiPM's breakdown voltage has a tempco, +22mv/C.  It should be possible to use it for the temperature-measurement function.  Small Peltier heat pumps are cheap and could be attached to the back of the SiPM board.  I'd opt for cooling, just to reduce the background count rate.  If you can reduce the temperature to 0C the thermally-generated background will go down by about an order of magnitude.

But then you'd have to worry about condensation, especially if you are using a CsI(Tl) crystal.  While it's called "slightly" hygroscopic, it probably would NOT like liquid water on it.  But halving the background count rate should be feasible, at least in the temperate parts of the world.


----------



## homebrewed

I've been thinking about Graham's comment about an integrating sphere as a more efficient light collection system.  It has some attractive aspects to it.  One issue I've wondered about all along is concerning the reflections off the crystal/coupler/detector interface.  Scintillator crystals typically have a high index of refraction and that makes it difficult to avoid reflections -- yet another loss mechanism.  Light emitted at an angle that is less than the angle of TIR relative to the sides of the crystal will be lost.  And, of course, a portion of light emitted away from the detector will be lost (there still would be some internal reflections that would re-direct the light toward the detector).

While this might appear to be less optimal than an aluminized (or silvered) scintillator, it so happens it's not too difficult to make your own DIY integrating sphere.  And, since it isn't an optical solution (like the ellipsoid idea), it should be more compatible with a 2D detector.  Finally, concerns regarding the absorption of incoming x-rays by an aluminum or silver film would not be an issue.

You can buy aluminum hemispherical "baking pans" for very little money, then coat the interiors with highly reflective paint.  For one example, see here.  I just bought a pair of aluminum baking hemispheres and barium sulfate powder for that very purpose.  Thankew Amazon -- the hemispheres cost less than $10.  It shouldn't be too difficult to make some clips to clamp the two halves together.  We ARE machinists after all (a brief justification for this crazy mostly-physics thread).

Personally, I'm not too concerned about absorption due to a thin aluminum layer.  So I am thinking of an integrating sphere with a hole in it for the entering x-rays and a hole on the other side for the detector.  The scintillator would be placed behind the entrance hole, which is covered by a piece of aluminized Mylar to reduce loss back out toward the sample being bombarded by the 59Kev gammas.  Internal reflections in the scintillator crystal will eventually find their way outside the crystal and then (eventually) hit the detector.  Worried about how to fix the scintillator in place?  Glue one side to an acrylic rod.  If the glue and rod are transparent, the light will exit THEM, too.

One issue regarding internal reflections in the scintillator is the possibility of a so-called whispering mode, where the photons stay trapped inside the crystal.  This can happen with spheres, and has been used to make very efficient whispering-mode lasers.  Rectangular hunks of glass may not exhiibit whispering modes; but if they do, modifying them so they have slightly tapered sides would eliminate that.  Frosting their surfaces would likely work, since it would introduce random variations in the crystal's surface normal.


----------



## rwm

Sounds complex. Are you overthinking it? A crystal of the right geometry may be efficient enough. Is light collecting efficiency that important if we don't care much about acquisition time?
Robert


----------



## RJSakowski

Assuming that the excitation source is going to be a ring of Am 241sources, the fluorescence x-rays will be a fairly diffuse region.  As such, it would seem that an integrating sphere will less beneficial.  I would think that you would want the target material to be in close proximity to the scintillation crystal.  I would also think that you would want the scintillation crystal to be in close contact with the detector. The surfaces of the scintillator could be coated with a reflective coating  with the exception of the window to the detector to maximize capture by the detector. I would suggest aluminum foil for the window to the sample.  The side geometry needn't be thin and there would probably be an advantage to using a high Z material to prevent fluorescence from the target x-rays interacting with it.  Gold foil as used for gilding purposes may be a good choice.  Presumably the sides of the crystal will be further shielded with lead to prevent source x rays from entering the crystal.

I would think that the scintillation crystal would be thicker rather than thinner to permit greater interaction of the fluorescence x-rays.


----------



## homebrewed

All open questions that only experimentation will reveal.  Not having done ANY experiments yet, I freely admit that I'm whistling in the dark...  Graham will likely be the first to have some results and that will be interesting to see.  I'm interested in an experimental platform that allows exploration of some of these ideas, and that could take some time to work up.

I'm still working on getting the garden in -- so progress, if any, on my part will be slow for some time to come.  Summers around here are short and precious!


----------



## graham-xrf

From the pictures in post #182, in set #7 (Good Grieff - that many?), you can see how deep is a standard Na(Tl) crystal.
Also see that it is enclosed in a little aluminum can. The clear end goes up against the PMT detector.
Any incoming X-Ray photons had to go through the aluminum - which apparently it can do with ease.

@homebrewed : If you are committed to, or have purchased a particular Si(PM) avalanche photodiode, then do tell, so I can get the same.

For me - not garden, but it feels like it. Clearing ground the manual way for the concrete hardstand. The foundation footings do not have to be very large for the relatively small walls, but it is still hard going! When it becomes possibly to hire a dinky digger again, I might go for it!

Now that I have tapped into a little of what Lucian does, I have much respect for what he knows.


----------



## homebrewed

I am planning on getting the KETEK 3x3mm PM3325 demo board.  It has 25um^2 cells and has somewhat higher photo detection efficiency than the PM3315 (better fill factor???) but has the same dark count -- 125K/mm^2 at Vov=5V.  It should be easier to adapt for our purposes compared to the ON Semiconductor version.  Plus, it should be easier to stick a Peltier on the back if temperature control becomes necessary.

Hopefully we don't need to sweet-talk KETEK into selling their modules to mad scientists


----------



## homebrewed

Back to the idea of coating a scintillator crystal with a reflective layer.  I continue to think that a significant increase in collection efficiency will result in a noticeable improvement in XRF resolution.

Tollen's reagent is used to test for the presence of sugars, being signaled by the deposition of silver on the sides of a test tube.  I never did this one in college chemistry but it's a classic.  Don't want to buy all the chemicals to deposit a small amount of silver?  You can buy mirror-silvering kits here for not a lot of money. This approach is not compatible with hygroscopic or "slightly hygroscopic" crystals, so CsI(Tl) is not a suitable choice.  The substrate has to be scrupulously clean in order to get a good silver dep.  The same vendor sells kits for applying aluminum metal leaf, but the "glue" is gelatin dissolved in water so, again, not suitable for hygroscopic crystals.  It could be a challenge applying leaf to a relatively small crystal.  I have a cheap BGO crystal I could experiment with.

I have an inquiry in to AngelGuilding regarding the thickness of the chemically deposited silver and aluminum leaf.  Since they're into the art side of this, they may not know.  From my experience with silver dep, it is pretty thin.  Fortunately, silver's K-alpha line is a long way away from Cr, Mn, Fe, Co and Ni so it wouldn't interfere with the analysis of ferrous alloys.  And, while silver is readily tarnished, it also is my experience that the inside of the silver layer stays nice and bright....which is exactly what we want.


----------



## graham-xrf

Did I read it wrong? I thought Na(Tl) was the bad one for hygroscopic. Cs(I) was "slightly" hygroscopic. That was the kind Lucian cut through. It also begs the question of how you get the water out of them in the first place. Heat? Vacuum? Never?.

One can find boxes of Na(Tl) units on eBay, where the seller carefully describes the yellowing condition of some, and which ones have the "bubble" in them, presumably a water boundary. I rate these as unusable, but it begs the new question, "do they work in any fashion at all"? Can they be recovered - after all, they still have all the correct elements present.

Best of all - I like the idea of plastics that scintillate. No need to "grow" the crystal. It brings the new question. Acrylics are not crystalline (I think). Heat them up and they melt. Is the business of making them scintillate a matter of "stirring in" whatever additive stuff scintillates and letting it cool? Will someone with a UV light point it at perspex? Does it need to be UV(B)?

We now know that in almost any field, any question we may have, and any idea we might cherish, has a high probability that someone has already been there! Somebody, somewhere, already knows!


----------



## graham-xrf

*Polyethylene Napthalate (PEN)*
Wikipedia states this plastic scintillates so well it is expected to replace classic plastic scintillators.
It begs the question why it has not done so by now!

Used industrial food packaging, durable films and adhesive tapes, flexible circuits material, plastic drinks bottles, tyres, and more.

Made by DuPont, Toray,Teijin, BASF at least.
(You have to imagine trying to explain oneself dumpster-diving or raiding plastics recycle bins with a UV light)!
What might be the chances of liberating some of this stuff?


----------



## homebrewed

Silica drying beads can be rejuvenated by baking them in an oven @250F for a few hours.  I've done it and it works (you can tell because the beads usually have a little bit of cobalt chloride in them, which changes from blue to pink as it transitions from "wet" to "dry").

I've read that copper (1) iodide may be a good material for use in plastic scintillators -- see here.  I'm not aware of anyone selling the CuI complexes so it probably would be necessary to roll your own.  Pyridine is toxic and apparently really noxious so I would look into the triphenylphosphine -- but would need to look into its toxicity, too.  There are a number of organophosporous compounds that are extremely toxic, featuring in things like insecticides and nerve gas (think Phosgene).  I also found a paper here that describes scintillation properties of CuI single crystals and powder.  So one possibility would be to buy or synthesize copper(+1) iodide and make a plastic scintillator with it.  I found someone on ebay selling 99.995% pure CuI, $38.12 for 25g.


----------



## homebrewed

graham-xrf said:


> *Polyethylene Napthalate (PEN)*
> Wikipedia states this plastic scintillates so well it is expected to replace classic plastic scintillators.
> It begs the question why it has not done so by now!
> 
> Used industrial food packaging, durable films and adhesive tapes, flexible circuits material, plastic drinks bottles, tyres, and more.
> 
> Made by DuPont, Toray,Teijin, BASF at least.
> (You have to imagine trying to explain oneself dumpster-diving or raiding plastics recycle bins with a UV light)!
> What might be the chances of liberating some of this stuff?


It would be interesting to experiment with.  There are some indications that plastic scintillators may not be very good for detecting low-energy gamma/x-rays -- take a look at this:  open-physics plastic scintillator test.  They describe an attempt to see the 59Kev gammas from americium, which was a bust.  Doesn't bode well for the ~6Kev photons we're interested in, although the plastic should be somewhat more absorptive compared to the primary gamma (a built-in energy filter???).   A composite detector, plastic + high-Z scintillator powder, might work better.  It IS interesting that they are using a reflective wrap around the scintillator to increase the light collection efficiency.  Their approach looks simple but effective.....right up my alley.

Don't buy PEN from Goodfellow -- they want an arm and a leg (maybe more) for their stuff.  I can't believe how expensive EVERYTHING is there.  They sure aren't selling to hobbyists.


----------



## graham-xrf

homebrewed said:


> Silica drying beads can be rejuvenated by baking them in an oven @250F for a few hours.  I've done it and it works (you can tell because the beads usually have a little bit of cobalt chloride in them, which changes from blue to pink as it transitions from "wet" to "dry").
> 
> I've read that copper (1) iodide may be a good material for use in plastic scintillators -- see here.  I'm not aware of anyone selling the CuI complexes so it probably would be necessary to roll your own.  Pyridine is toxic and apparently really noxious so I would look into the triphenylphosphine -- but would need to look into its toxicity, too.  There are a number of organophosporous compounds that are extremely toxic, featuring in things like insecticides and nerve gas (think Phosgene).  I also found a paper here that describes scintillation properties of CuI single crystals and powder.  So one possibility would be to buy or synthesize copper(+1) iodide and make a plastic scintillator with it.  I found someone on ebay selling 99.995% pure CuI, $38.12 for 25g.


With normal care, we should not be be unduly put off by "toxicity ". There is a difference in something being violently toxic, and it being an unmanageable hazard. Most stuff in the shop is toxic, even the bit of copper, and my bathroom store has at least two bottles of presidential strength thin bleach!

Pyridine has a fishy stink, which means someone at least survived smelling it. William Ramsay cooked up acetylene and hydrogen cyanide in red-hot iron tubes to make piridine when he was 22, and survived to pick up his Nobel prize in 1904 (for other adventures with Argon, Neon, Krypton, Xenon, and for isolating Helium). Maybe it was sniffing piridine that contributed to the nasal cancer which ended him.

I agree that for convenience we try for harmless stuff. Recyclable plastic bottles of PEN without paying Goodfellow appealed to my nature, and even supplies some warm feeling about re-using good plastics.


----------



## graham-xrf

homebrewed said:


> It would be interesting to experiment with.  There are some indications that plastic scintillators may not be very good for detecting low-energy gamma/x-rays -- take a look at this:  open-physics plastic scintillator test.  They describe an attempt to see the 59Kev gammas from americium, which was a bust.  Doesn't bode well for the ~6Kev photons we're interested in, although the plastic should be somewhat more absorptive compared to the primary gamma (a built-in energy filter???).   A composite detector, plastic + high-Z scintillator powder, might work better.  It IS interesting that they are using a reflective wrap around the scintillator to increase the light collection efficiency.  Their approach looks simple but effective.....right up my alley.
> 
> Don't buy PEN from Goodfellow -- they want an arm and a leg (maybe more) for their stuff.  I can't believe how expensive EVERYTHING is there.  They sure aren't selling to hobbyists.


Re: The Si(PM) with plastics has very interesting links to the detector amplifiers and diodes.
I note they wrapped the plastic in foil to increase the probability of capture.

The scintillation efficiency of Na(Tl) in producing about photons of visible from a photon of X-ray is around 40%
This compares to LYSO and plastic scintillators at about 8%.

I agree we need to take care of background noise, and diode noise as best we can. Fortunately, very good op-amps and other ICs are available at low cost.
*
Sloppy Arithmetic*
In the context of using PMTs, I am still kicking around some loose back-of-a-napkin style calculations
Start with even a "loud" X-Ray photon, say about 50KeV. Even at 100% efficiency, that can only deliver 50,000 electrons.

Now lose 60% of the energy in a Na(Tl) crystal. We are at 20KeV distributed in some new number of visible photons, perhaps 20 or 40, but let us imagine that is the lump we have. There is the photocathode efficiency, and I have no idea what that might be. Suppose we say it is also 0.4. It might be 0.2, who knows?

We are left with as few as 8000 electrons into the first dynode. This does not sound like much, but a "blue" light photon is only 3 electrons worth. The trip to each dynode speeds them up with about 100eV of kinetic energy, and every collision yields maybe 4 to 7 new extra electrons. The whole 12-stage PMT might have a gain of 10^8
8000 electrons is 1.28E-15 Amps, or 0.00128 pico-Amps. At the other end arrives 0.128uA, which is more like something we can use.

I would use a low noise transimpedance op-amp to capture this. It is small, but OK. Easier perhaps than a Ph meter.

Yes - I know this is a sloppy first order shot, just to get a feel for it. It is a long time since I did op-amp design with currents so small it was easier to use electron counts. For those who can appreciate that a single electron can take a week to get around a circuit, but the energy arrives at a large fraction of the speed of light  - I think the analogy of hitting a cue ball into a straight  line of placed snooker balls helps.


----------



## RJSakowski

homebrewed said:


> Silica drying beads can be rejuvenated by baking them in an oven @250F for a few hours.  I've done it and it works (you can tell because the beads usually have a little bit of cobalt chloride in them, which changes from blue to pink as it transitions from "wet" to "dry").
> Anhydrous Cobalt Chloride is blue, hydrated, it is pink.


----------



## homebrewed

Thank you for the correction to my spotty memory .


----------



## homebrewed

According to the folks at Angel Guilding, the thickness of their chemically-deposited silver is around 50 nm.  I assume this is somewhat dependent on deposition time, but if it's like electroless nickle, once the surface is coated the dep rate goes down by a large factor.  

The silver layer would be pretty delicate.  A thin coating of clear-coat (no pigments please) wouldn't absorb x-rays to any significant degree.  And it might help the exterior stay a nice shiny color, too!


----------



## homebrewed

A couple of things.  First, regarding silver-plating scintillator crystals, the small mirror-coating kit from Angel guilding already includes paint that is meant to be applied to the exposed silver to protect it from scratches.  Applying that soon after the deposition is completed should make it a lot easier to handle coated scintillator crystals.

Second, I've been running simulations of variations on the Theremino pulse processing filter scheme.  An AC sweep of the Theremino filter reveals, as expected, really poor performance -- to start with, the filter attenuates the input pulses by 10dB, starting at 10Hz!  And the filter slope isn't all that great, either.  As a result, the output of the filter for a 1 volt, 100usec wide input pulse is only a few micro-volts.  While that is amplified by the transistor amplifier by about a factor of 100, the output signal still is down into the tenths of a millivolt range -- hardly the optimum situation for an ADC whose full-scale input is a few volts.  No wonder they want a 16 bit ADC.  I think they're also trying to attenuate 60Hz pickup -- but the cost is pretty high, because their filter attenuates the pulse frequencies even MORE (not the right way to improve SNR, if you ask me).  Amplifying a low-level signal will also introduce thermal noise so I think they've painted themselves into a corner, so to speak.  

I also simulated three different 2-pole low pass filters -- Bessel, Butterworth and Chebychev, each with a -3dB cutoff frequency of 1KHz.  The output signal amplitude still is low, on the order of mV, but it IS much higher than the Theremino filter.  All of them appeared to perform about the same w/regard to a 100uS input pulse -- there were only small variations in the peak voltage levels.  

For those who are not familiar with the filter types, they differ in the sharpness of their filter response.  Bessel is the least-sharp, Butterworth is the best you can get without any peaking in the frequency response, and Chebyshev has a small peak just before the cutoff frequency.  The use of one vs another depends on whether or not you want good phase response, maximally-flat response, or faster rolloff above the cutoff frequency.  For filters in this "slow" regime it probably doesn't matter much which one we want to use.  So to eliminate high frequency noise I'd probably just go with the Chebychev.

Also, out of curiosity, I checked to see how the output amplitude scaled as the input pulse height varied.  As expected, since the filter is a linear system, there was a nice linear relationship between the input and output pulse heights -- F(A+B) = F(A) + F(B).  For the model I used, a 1 volt change in the input pulse height resulted in a 2.3mV change in the filter's peak output voltage.  That's without any subsequent gain.

Not much to do with machining here but there is a lot of "magic" in the background that will be needed to get to that "more than a spark test" goal.


----------



## homebrewed

I was searching the 'net to pursue some other ideas on XRF when I came across a post on the OpenPysicsLab web site.  The entry describes using a silicon photodiode array to directly detect x-rays, no scintillator needed:  this.  The detector runs about $110 from Mouser, although they don't have any currently in stock.  The manufacturer also sells their detector integrated with a CsI scintillator but that's gotta cost more.  The detector technology looks a lot like the SiPM approach (but the intrinsic layer may be thicker to improve gamma absorptivity compared to visible light detection).

According to the datasheet, the X100-7's gamma absorption efficiency at 5KV is close to 90%, besting the diode/scintillator at the low energy end (the region we're most interested in).  

I found a Hackaday post here which suggests that the detector's pulse height doesn't vary much with photon energy, but the pulse width does.  A charge amplifier would take care of this issue, although it might be necessary to incorporate a reset circuit to accommodate higher count rates.

I also found an Instructables account of someone's attempt to use one of these but there are some aspects of their circuit schematic that just don't look right to me.  Here's that entry.  The most obvious problem is the charge amplifier -- the noninverting input only has a 1pF capacitor connected to it, so eventually its input bias current will charge the capacitor up to the point where the charge amp stops working.  This one looks like a beginner's attempt at circuit design, and not implemented very well.


----------



## graham-xrf

Hi @homebrewed
You have been so energetic! At least, I mean in the research sense. Because of the vulnerability of two in our household, I have been shielding here in the countryside, and my meddling with PMTs has be somewhat displaced by struggles with a tree stump right where my shop/outbuilding/man cave hard-standing is to go, and a whole pile of other stuff.

I will be playing some with my (working) Ukrainian PMT. The scintillator has not arrived yet. Even so, I think that an affordable alternative gadget that reduces the amount of exotic material components is exactly the way to go. Direct pickup of the X-Rays for the low energy range we are interested in seems obvious, so long as the efficiency of the PIN diode is high enough. We are used to photodiodes delivering for visible light. One hopes it can be near as good for X-Rays, skipping out the scintillator.

*Re: Your filter researches.*
You are right that when you see a 1pF capacitor, you know that it would only be appropriate for either very high frequency RF or picosecond pulses, or be involved in extreme high impedance circuitry.

In passing, in that you design and simulate with electronic stuff, you will have come across, or deployed active filters. There is no need to allow depletion of original signal information through a passive filter placed on, of all places, a low level signal input, as in Thermino (and a few others).

One can even get multi-stage OP-amps with places to connect R, C, and sometimes L in various networks, often in the feedback circuit, to synthesize all the filter types, band-pass, low-pass, notch Chebyshev, Elliptic, Bessel, etc.

Generally, the first device should supply a whole lot of gain without contributing a significant proportion of noise from it's own input, and have enough dynamic range not to saturate it's own output. In this case, the noise from PMT's, diodes, etc. is way more than the input NF anyway, so the first stage can be an impedance buffer also, at the expense of some gain. The first device amplifies the signal AND the noise, to the point it is hard to add any more noise from subsequent circuitry. The S/N ratio gets preserved.

The best way to stop 60Hz hum is to prevent it getting into the information in the first place. Not sharing common mode current paths, star point design, grounding, shielding, etc. can do this completely. If some gets in, it can of course, be stopped by a (say) 90dB op-amp active notch filter only a few Hz wide.

*About shaping*
I draw a distinction between the "shapes" of scintillator afterglows, including waveforms produced by slow, capacitively loaded stuff, and the shape of the diode pulse from electrons returning to their stable energy levels. We need the magnitude only, with a gated peak detector so steered that if a "new" bump happens to lift the waveform somewhere during the first pulse decline, it too can be captured, whether it be smaller, or even bigger, than the first. This can be done with analogue circuits. I think it might be better done in numbers, digitally, after the A/D conversion, but I am still thinking about that.

Thanks much for the links. I have to park them for a bit because I have to deal with boring paperwork. (It's accounts and tax time - yuk!)


----------



## homebrewed

Understand about other things getting in the way of 'fun'.  Our choir director had a saying to cover that -- Life Happens.  For us right now, the veggie garden is the Happening place -- so I'm getting a pretty good farmer's tan, what with all the weeding.  Gotta wear a hat, though, for some reason the sun finds the skin part of my head a lot more easily these days   

Regarding your comments about filters, I've been thinking that the Theremino approach doesn't really throw away any more information than the so-called "classic" MCA approach.  The detector output, which is indeed a current pulse, is immediately integrated by a charge sensitive amplifier (CSA).  Just a fancy term for a fast integrator.  The "zero-pole cancellation circuit" is there to compensate for the large difference in time scales between the risetime of the CSA due to the fast current pulse, and the slow exponential fall due to the CSA's long RC time constant (even 1pf takes awhile to discharge if shunted by 10^8 ohms).

After writing my previous post I found a module offered by Sparkfun which combines an X100-7, a bias generator to run it, a CSA and pulse shaper + comparator.  It's touted as a highly sensitive geiger counter, but that's because the comparator squares up the pulse.  All yours for $69.95 USD!!  It also has a connector on it that make the shaper output and bias voltage easily accessible, so it may not even be necessary to do any hardware hacking to the board.  I haven't seen a boost circuit quite like the one used to generate the bias voltage, but I note that it is pretty heavily filtered -- there's a 100K resistor and 1uF capacitor on the the output -- so it looks like it should be pretty quiet, just what's needed for an MCA application.  It probably mostly depends on how well the board is laid out, more than any design shortcuts.  I may have to buy one of these.....


----------



## ericc

Isn't the time constant of that RC filter a little long for this application?


----------



## homebrewed

ericc said:


> Isn't the time constant of that RC filter a little long for this application?


Eric,
Can you be a little more specific on which filter components you're referring to?  Is it in the CSA or 2nd amplifier circuit?


----------



## ericc

It's the output stage to the connection port which you mentioned above with a 100k resistor and 1uF capacitor,


----------



## homebrewed

ericc said:


> It's the output stage to the connection port which you mentioned above with a 100k resistor and 1uF capacitor,


That's the filter network used to reduce switching noise from the switching regulator.  The regulator steps the input voltage (3-9V) up to around 30V to get the x-ray detector into its proper operating range.  We WANT this node to have a big capacitor on it.

In normal operation the detector diode is operating in its avalanche breakdown mode.  In this mode, carriers produced by an x-ray photon are amplified by a process called "impact ionization".  It's similar to (but not exactly like) what happens in a photomultiplier tube, but doesn't require the high voltage and resistor divider chain that a PMT does.  There's no real magic here -- the electric fields for the two devices are similar, but since the PMT dynodes are spaced further apart, that means the applied _voltage_ must be higher.


----------



## homebrewed

I ordered one of the detector boards from Sparkfun.  It should be interesting to play with.  At this point I'm thinking about making something similar to the standalone Arduino-based MCA, but with a better peak-hold.  I suspect the Theremino group's claims regarding the necessity of a 16 bit ADC are due to the fact that even the amplified pulses are a small fraction of the ADC's dynamic range (so they're throwing away a lot of effective resolution).  Only one way to find out.... 

I also have ordered some Americium smoke detector capsules but they're on a slow boat from China so they are several weeks out.  The 1/8" thick lead sheet I purchased from ebay arrived last week.  I haven't ordered any mirror-silvering chemicals yet, that's something that can happen once the other components are assembled and verified to be working properly.


----------



## homebrewed

I don't know if it's my particular version/configuration of Linux, but so far I have been unable to get Theremino_MCA to run under Wine.  I get a slew of error messages and then Wine aborts.  I'd be interested to hear about other folks' experiences in this regard.

On the other hand,  "PRA" does seem to run OK under Wine, although I haven't tried it on a sound file yet.

For the ultimate in portability, pyMCA probably is the way to go -- Python runs natively on all sorts of platforms.  I haven't messed with this one yet, so I don't know if it can be used in combination with a sound card or not.


----------



## graham-xrf

*When the text on the package is Cyrillic..*
Yep - then you know the snail-mail from Ukraine finally made it. I now have a Na(Tl) Scintillator. Of the batch I worked my way through among the original offerings, this was the only one that did not have water in it, so I bought it.

Packed in multiple layers of bubble-wrap, it was a bit of a struggle to get at.




Very interesting! Getting a look at the glass end that butts onto the photomultiplier tube, you see the bottom of the aluminium can, apparently all the way onto the other side of the window, or with only a very thin amount of crystal, if any, between it and the glass. The colour is of silver, that definite silvery-white.

I know that one can deposit silver from grape-sugar and other reduction solutions onto almost anything, although the layer is so thin it is fragile. It used to be painted over with something red for mirrors. It definitely looks like silver down there.

This crystal is pristine, no sign of yellowing, nor any bubbles.




I guess the crystal lights up, and the light goes out from the ring region around the bottom of the can




Turning it over, the "input" end shows the deep metal can that you can stick the pinky into and touch the bottom.
It is almost as if the thing is built to "surround" some sample or material placed into the can with scintillator crystal all around it.

However this works, it is clear that if X-rays are coming at it from some surface being bombarded by gamma rays, then getting any to go sideways through the tube into the crystal might be awkward. X-rays aimed directly down the can will not encounter much crystal unless there is a bit between the bottom of the can and the output window. Any other X-rays, if started outside of the can would have to travel through the walls of the can at a steep angle, nothing like "normal" incidence.

*Of course, I may have this completely wrong!*
Perhaps the X-Rays can enter the crystal by coming through the thin aluminium larger outside walls from all sides, and the central aluminium can is maybe there so it can maybe be held on a support rod up the middle (far fetched idea)!

Then again - what colour is clean Tellurium? Apparently silver-white "metalloid", meaning "somewhere in between" metal and non-metal. A semiconductor along with friends boron, germanium, silicon, arsenic, selenium and antimony.

However this works, I don't yet understand it. The build has that charm of military lab style markings done with a mapping pen and Indian ink, then varnished over. Very typical of British and US labs in the past, and may even still be done that way on prototypes - I don't know.

Even if this stuff does not feature in what we end up with, it is going to be a fun one-off. As I have learned more, my preference now has evolved to some kind of photodiode thing, and if the "direct to diode" X-Ray detection photodiode sans scintillator can work out, that is what I would consider ideal.


----------



## rwm

I think what you have there is a scintillator crystal from a dose calibrator or well counter. The idea is you put a dose of a gamma emitter down into the hole in the crystal so it is surrounded by scintillator material. The counts then correspond to the dose in mCi. These are commonly used in nuclear medicine labs.
Robert


----------



## homebrewed

I second Robert's conjecture.  I don't know how the well geometry, if used as-is, will affect its usefulness for XRF, but I just had an interesting thought.  The issue is how to collect the x-rays created by the Americium gammas, without hitting the PMT's photodetector with the primary gamma rays.  Put a lead "puck" on the bottom of the well to block the primaries.  Dump your sample into the well (on top of the lead) and place the Americium source over the well opening.  A lead collimator "pinhole" will be needed to keep the primaries from hitting the aluminum walls and, of course, the scintillator.   A ruler can be used as the "computer" to get the geometry of the source and collimator right.  It....could....work..... (as Young Frankenstein said).  Of course, that show was entirely factual, right?   

That sort of setup could very well be more efficient than the crystal-stuck-to-a-PMT approach we've seen in other DIY XRF builds.  I wouldn't suggest this approach except for the fact that you indicated the well has an aluminum liner, hopefully robust enough to handle rough metal samples being dumped into it.  Of course, the aluminum has to be thin enough to not significantly attenuate the ~6KeV photons emitted by V, Mn, Fe, Cr and Co.

The thallium component in the scintillator is a dopant to increase the efficiency of light production.  According to Wikipedia, Thallium Iodide is used in trace amounts to dope NaI scintillators.  Its room temperature crystal form is light yellow in color, and is unusual because its halides are relatively insoluble in water (and thus not hygroscopic).  So any silvery colors you see inside your scintillator module probably are there to improve the coupling of light into the PMT, not because of the Tl.

FYI, the mirror-silvering kits available from AngelGuilding include a bottle of paint to protect the silver from oxidation and scratches.

My x-ray diode hasn't arrived yet, darn it.  I'm really interested to see how it pans out.


----------



## homebrewed

I thought I had posted this earlier, but guess I need to do it again.  My X100-7 based "geiger counter" arrived a little while ago.  It is very compact.  See below:




The copper foil is wrapped around the detector, and probably is used to stop alpha particles.  I don't see an electrical connection to it, so it probably is not a shield to reduce electrical noise pickup.  The black thing on the upper right corner is a phone jack to interface it to a cell phone, but it sounds like the geiger counter app does't work on Samsung smartphones.  For my purposes, I will remove the shield -- the whole thing is going to be inside a lead box anyway, so noise pickup shouldn't be an issue.  I will have to tap into the analog output, but that is brought out to a 2 x 6 pad array on the back side of the board.

The package includes a box to house the board, and two brass sheets that are used to block beta particles so the device can be customized to only detect x-rays.

I worked up a model to simulate the circuit, to see if the output of the analog portion of the board is compatible with sound card-based MCA's, and it looks like it is.  The pulse width is over 100us wide.  The main question in my mind is the pulse amplitude.  The datasheet for the X100-7 is completely silent regarding the magnitude of current pulses coming out of it.  Examination of the schematic shows that the comparator trip voltages (to distinguish noise from real betas/gammas) are 2.69 V and 3.09 V respectively.  The difference is about 300mV.  My simulations indicate that a 100nA current pulse will result in a 300mV pulse coming out of the second amplifier.  So a ballpark number is about 100nA -- but for our purposes that will vary, depending on the incoming x-ray energy.

The X100-7 is a special silicon PIN diode, and it is not operated in its avalanche mode like a SiPM.  That's why they can get away with only a 27V bias applied to the diode.  The actual voltage across the diode is lower yet.  Again looking at the schematic, the DC voltage across the diode really is about 24V (this is due to the fact that the amplifiers are being operated in a single-supply mode).


----------



## rwm

I am gratified to see some actual hardware! What's next???
R


----------



## homebrewed

rwm said:


> I am gratified to see some actual hardware! What's next???
> R


  Graham has acquired some significant components as well, so he definitely is on the way, just (like me) subject to "distractions" like house projects, vegetable garden, family-related things and so on.  But to outline a rough path, I'm going to solder some wires to this bad guy so I can look at some pulses coming out of the analog block.  I have a lab power supply to operate it, no problem there.  Digital 'scope, also in hand --fortunately, the pulses are pretty slow so my very cheap 10MSPS O-scope can handle it.  I have plenty of steel lying around to excite.  I have some 1/8" thick lead sheet.  I have 8 Americium sources scheduled to arrive later this week.  I have a MCA program (PRA) that appears to run OK -- as best as I can tell right now -- on Linux.   So many of the pieces are at hand, or nearly so.  A physical configuration really is needed to make the next big step forward.  So I need to make some lead pieces to shield the detector from  Americium's primary 59Kev gamma rays, a holder to space the Americium sources around the entrance hole to the detector, and make/buy whatever is needed to get the mechanical configuration correct and stable enough to survive the inevitable screw-up or two...or three....or more.  I'm hoping to first see some pulses whose height depends on the stuff being hit by those 59Kev gammas.


----------



## graham-xrf

homebrewed said:


> The copper foil is wrapped around the detector, and probably is used to stop alpha particles.  I don't see an electrical connection to it, so it probably is not a shield to reduce electrical noise pickup.


While you will most often see a shield connected to a circuit ground at _one_ point only (if it's any good), it not being connected at all does not stop it acting as a Faraday shield, and many may be deliberately so, depending on all sorts of things.

Any external field cannot exist beyond the short circuit boundary condition of the copper. Inside that copper cover, they cannot exist, save for a small amount near the "entrance". The diode is the possible receiver of a multitude of high level RF, from Wi-Fi, phones, radar, everything. Distinguish between RF, once it has become propagating EM, (like light), and the real near field precursors (magnetic, and electric). The field from a power line is huge. Even the (50Hz) field from my house wiring is so strong it maxes the screen on my scope if I touch the end of a probe, and it won't go away entirely if I put my other hand on the scope chassis.

For some measurements, the only way to lose the unwanted noise is to use two probes, one subtracting in differential mode.

While I have not yet read up in detail, (and my "radiation lab experiments" budget got hijacked), I am considering one of these also. As I understand what was said before, this device responds to input energy in the X-Ray region directly, instead of needing a scintillator material to down-convert to visible light frequencies, and work like a regular photodiode.

From it's application description, it would seem to be used in "Geiger counter" mode. That concerns a little, because we want a preserved pulse maximum amplitude. Geiger counter pulse makers often use comparator thresholds, followed by lots of non-linear gain, to make the loud click pulse. Excellent that you have untangled it enough to check this out in simulation.

You are right about the "distractions". The next is accounts, and the (ugh!) paying of taxes. I have worked up a lot of aerobic digging under the tree stump interfering with my future shop hardstand. So far - about 30% of the big roots "disconnected". The darn thing (tree) still feels more solid than my left side lathe support block! It gives a negative blend to the phrase "My Lathe Rocks"!


----------



## homebrewed

Info I found on First-Sensor's web site indicates the detector is a PIN diode, not an APD.  Also, their leakage current vs. bias voltage curve shows that the device isn't anywhere close to its avalanche breakdown.  The Pocket Geiger design has two comparators to turn the analog signal into pulses -- one  is set to generate the "noise" signal and the other, with a higher threshold point, detects a real particle/photon event.  So the detector itself is not operating in a geiger mode, it's linear.  That is the only reason I went forward with buying one of these.

Regarding the shield issue, I guess I will find out.  But the whole thing is going to be inside a rather substantial lead box anyway.  Parts of it will actually have two layers of shielding, since I want to shield myself as well as the detector from the primary gamma rays.  The skin depth of lead is greater than copper but 1/8" layers should attenuate even 60Hz EM fields by a substantial amount.  

The other thing is, since copper's K-alpha line is 8.04Kev, it's possible that it could fluoresce and contribute a stray energy peak.  It wouldn't be from the steel alloy metals, but I don't want to limit what this to just analyzing ferrous items.  For instance, it could be handy if you collect antique jewelry -- silver's K-alpha is 22.1Kev, and gold's L-alpha line is 9.7Kev -- and copper is often added to silver and gold alloys.

Good luck on that stump.  I've fought with 'em as well, and it's amazing how difficult it can be to remove them....unless you've got some big machinery to do it.  Don't try pulling it by tying a rope to a vehicle -- the rope can stretch like a rubber band and when it breaks it can turn into a projectile.  Even worse if part of the stump breaks and remains attached to the rope.  I had a near-miss once and that was scary enough.


----------



## graham-xrf

Slowly - slowly, I am getting into into circuits that make bloody high voltages. I am going to play with this (sensitive) PMT all the way to the end, but I have already decided that small, solid state, is better.  It will be a PIN or a avalanche photo-diode route for a practical, low cost project gadget. The software display end will be much the same, so when I get the diode kit, it should not be too hard to apply it. If the PIN diode type is the winner - then yay - no scintillator!
PMT SPICE!! - and it seems I don't know how to spell "dependent" 




Reluctant tree stump has finally yielded. It was becoming my outside aerobics replacement. Cut up into chunks for the wood-burner next year. There is now a huge hole where it was, and I now realise how much top-earth I am going to have to remove before putting in some hard-core. Just out back is the neighbor's wheat crop. After it is harvested, which has to be soon, I can maybe borrow his tractor with the big scoop bucket in front, and clear the land for "chez workshop".

There seems still a never-ending list of "other" stuff needing doing, but I now ease into my "playtime" slot  after 16:00, and get mixed up with South Bend(s), and sometimes, the nuclear chemistry!


----------



## homebrewed

I had trouble believing the adage that a tree's roots are about half the tree's total volume until I tried digging out a stump.  Now I do!  

I also thought I could pull the stump out using my (small) 23HP tractor.  No dice -- the wheels just dug holes in the ground.....so I innoculated that one with some wood-eating fungi and let time do the heavy lifting.  It took just one season and the roots turned into punk.  Probably not what you want under a workshop, though!

A question about the bias string in your PMT SPICE model.  Are the Ca's and Cb's parasitic caps or there to reduce "droop" due to current pulses traveling through the dynodes?  I think I know the answer but best to not guess.


----------



## graham-xrf

homebrewed said:


> A question about the bias string in your PMT SPICE model.  Are the Ca's and Cb's parasitic caps or there to reduce "droop" due to current pulses traveling through the dynodes?  I think I know the answer but best to not guess.


 Yes -  the capacitors supply the electrons for the dynode signal, though not like "smoothing capacitors" for a conventional supply. The dynode current is supplied by the transistors, fed by the capacitors, and these are set between the dynodes, not taken to ground.

The rationale starts from the values of resistors to set suitable voltages, each relative to the next. If set low enough to supply electrons into the tube without the voltage collapsing, then one needs a (dangerous) amount of mA from a (hard to make) supply, and hot high wattage resistors. If the supply is a tiny thing, getting up a high voltage from a little switched-mode circuit, it is going to be high impedance. The chain will have typically meg-ohms in it.

Throw in the need to have a low value signal load resistor, because noise is √(kTBR) (V).  A decent scintillation pulse will run many times more current than is available from the bias chain. Hence the need for some local energy storage for the last six stages.This is provided by 3 x *Ca* and 3 x *Cb* working with transistors that have a high Hfe gain. The secondary electrons flow through the successive dynodes, and into the collector of each transistor. The emitter potential of each transistor increases while the collector current decreases, along with the decrease in base current. At this point, the decrease in collector current is nearly equal to the current flowing through the photomultiplier tube. With very high gain RF-speed transistors, in this way, they supply the current for the PMT. The capacitors have to be high frequency types, and only large enough to supply the electrons to that single stage through the highest pulse, not the whole tube.

The circuit is a published one, developed by *Fermi National Accelerator Laboratories*. Our thanks to them.
This is code-speak for "I copied it from their handbook"!  

We are _not_ going to be shunting signal with capacitor-laden "filters" on the output in the cause of "losing noise".
Noise cannot be "lost" once it has contaminated the signal information. The electrodes are not like grids in a vacuum tube. They are more like a series of anodes. There is not direct "gain" from a dynode voltage change, only a tiny change in that stage gain. Even if there are volts of "noise" in the resistor chain, they should only fractionally change the accelerating voltage of any dynode in their noisy way, and end up supplying useful secondary electrons to the current pulse anyway.

The SPICE model allows to put a loud noise voltage source onto the supply - just so we can get curious about how to get the supply clean. My strategy is to use a very high frequency supply - maybe 2MHz or more. Making it clean then only requires much smaller capacitors and inductors. Come to that, if one makes the supply control loop bandwidth so fast that it can actively supply against some kinds of noise, you can say goodbye to 50Hz and 60Hz house fields and much other racket. One still has stop magnetic fields from modulating the electron stream.

I could be wrong about it, but so far, no crack-ups, flashes, smoke, bad smells or other untoward stuff yet.

There are some other features you can't see. Precautions to prevent any part of the chain voltage rising to do damage in case any part of the chain becomes open circuit.  This gadget is allowed to fail, and it will do so gracefully.


----------



## homebrewed

With about 100V dynode-dynode voltage drops, that knocks a lot of RF transistors out of the running -- many have fairly low breakdown voltages.  What devices do you have in mind for the purpose?


----------



## graham-xrf

I did not see this as a problem. I admit that when I said "RF", I did not mean anything well into VHF/UHF.
I was hoping for something that would respond at a few MHz if the circuit gain was more than about 20.

Avoiding those that have gain minimums that start too low - e.g. Hfe = (40  - 140), we can select from (say) mouser.com. I suppose Digi-Key and other suppliers would have others, with overlap on some.

Setting the *Vce > 120V*, and the gain-bandwidth product *fT = 100MHz -> 300MHz*, there are *19* through hole types, and *57* SMD types. After that, we go by price.

Just looking at the very first one, £0.209 each if you buy 10.
*RHOM 2SC4102U3HZG* has BVceo = 120V, and it can run 50mA (do we need more?)
The gain hFE (min) = 180, and hFE(max) = 560,  and fT = 140MHz (typ)

If 50MHz is enough, and hFE 50-150 is enough, then Diodes Incorporated *ZETEX FMMT459QTA*  SOT-23 package lets you have Vceo=500V. Slower, and it costs £0.379 each if you order 10

I tried again on *ROHM* for the *2SCR375P5T100Q* 120V 1.5A (but not simultaneously in a SOT-23 package).
If it were asked to deliver 5mA with the whole 100V across it, it would be trying to do 500mW of getting hot.
But.. it does not have to, unless there is a blizzard of pulses so fast it is on all the time.
This one has gain 120 - 390,  fT = 200MHz, and it costs £0.376 each of you buy 10.

I am thinking there is probably a sweet choice somewhere among the 76 we can see already, after we eliminate the _way-too-expensives_, and the _low gains_, and the _gets-too-hots_, and the _goes-too-slows, _but at a pinch, that last 200MHz thing would have a chance.

I am happy to run with any reasonable cost suggestion anyone might have.


----------



## graham-xrf

I did not see this as a problem. I admit that when I said "RF", I did not mean anything well into VHF/UHF.
I was hoping for something that would respond at a few MHz if the circuit gain was more than about 20.

Avoiding those that have gain minimums that start too low - e.g. Hfe = (40  - 140), we can select from (say) mouser.com. I suppose Digi-Key and other suppliers would have others, with overlap on some.

Setting the *Vce > 120V*, and the gain-bandwidth product *fT = 100MHz -> 300MHz*, there are *19* through hole types, and *57* SMD types. After that, we go by price.

Just looking at the very first one, £0.209 each if you buy 10.
*RHOM 2SC4102U3HZG* has BVceo = 120V, and it can run 50mA (do we need more?)
The gain hFE (min) = 180, and hFE(max) = 560,  and fT = 140MHz (typ)

If 50MHz is enough, and hFE 50-150 is enough, then Diodes Incorporated *ZETEX FMMT459QTA*  SOT-23 package lets you have Vceo=500V. Slower, and it costs £0.379 each if you order 10

I tried again on *ROHM* for the *2SCR375P5T100Q* 120V 1.5A (but not simultaneously in a SOT-23 package).
If it were asked to deliver 5mA with the whole 100V across it, it would be trying to do 500mW of getting hot.
But.. it does not have to, unless there is a blizzard of pulses so fast it is on all the time.
This one has gain 120 - 390,  fT = 200MHz, and it costs £0.376 each of you buy 10.

I am thinking there is probably a sweet choice somewhere among the 76 we can see already, after we eliminate the _way-too-expensives_, and the _low gains_, and the _gets-too-hots_, and the _goes-too-slows, _but at a pinch, that last 200MHz thing would have a chance.

I am happy to run with any reasonable cost suggestion anyone might have.


----------



## homebrewed

OK, not talking about GHz here -- that opens up your options quite a bit.

You might be able to narrow the search by looking at the collector current needed to achieve Ftmax.  If the transistor needs 100mA to get there, you won't get full speed out of it at Ic=100uA.   Choosing a transistor with the highest-possible Ftmax that has a BVCES > 100V would be the best (but perhaps the most expensive) way to ensure you have sufficient BW in this application.

I don't know if the transistor models available from LTSpice include this Ft variation vs Ic or not.  Hopefully they do, otherwise it's not very useful for RF designs using BJT's.

Something else to think about:  higher collector currents will increase the current flowing through ALL the resistors in the string.  So if your supply is 1200V and it needs to supply 5mA that's 6 watts.  If you split the bias string in two, the all-passive portion can use much less current.  600V * 5mA = 3W, a bit nicer (but still dangerous if you happen to get across it).

However, 5mA probably is overkill.  The data sheet for the Rohm part you mentioned (*RHOM 2SC4102U3HZG) *gives a typical value of 80MHz @1mA, 'way down from its maximum -- but probably good enough (see Figure 8 in the DS).  Still, you still would be looking at a HV supply capable of sourcing 1.2W.  If you can find a transistor that still has decent Ft at Ic = 100uA that will make things even easier.  The fact that the Ca's and Cb's can provide the transient current needed (and so the transistor Ft's will transiently go up) means my back-of-the-napkin "design" is a worst-case scenario.  So there's some good news there   .


----------



## graham-xrf

homebrewed said:


> OK, not talking about GHz here -- that opens up your options quite a bit.
> 
> However, 5mA probably is overkill.  The data sheet for the Rohm part you mentioned (*RHOM 2SC4102U3HZG) *gives a typical value of 80MHz @1mA, 'way down from its maximum -- but probably good enough (see Figure 8 in the DS). Still, you still would be looking at a HV supply capable of sourcing 1.2W. If you can find a transistor that still has decent Ft at Ic = 100uA that will make things even easier. The fact that the Ca's and Cb's can provide the transient current needed (and so the transistor Ft's will transiently go up) means my back-of-the-napkin "design" is a worst-case scenario. So there's some good news there  .


So far, I have been meddling with LT switcher circuits. Turning the mind to the PMT chain, I was after getting something good, freely grabbing at circuits that took decades to emerge, even though the end circuit looks relatively simple.

The way those transistors work is elegant, looking simple, but not really so, with a diode bias. The voltage between dynodes is being "regulated" in a way that does not, I think, require a big linear quiescent current. All in series, with perhaps a  relatively tiny collector current overall, each sitting there with a local capacitor energy store, ready to deliver.

The resistor chain can be high impedance (again - I think). When the pulse comes, and the voltage (tries to) change, the transistor turns more on, and the gain goes up as the collector current goes up, and wham, the transistor replaces the electrons being sucked off the dynode. I think they all pretty much act together. The transit time between dynodes is tiny.

It is because I did not fully understand how this happens that I thought the SPICE model would help. A current-controlled current source handily models secondary electron emission. Models for the transistors have been the norm for decades. If not available from the website (usually they are), you can get the values from the datasheet, and plug in. Transistor models are normally mathematical functions, for done speed, instead of being included as sub-circuits. Full sub-circuit modeling every internal bulk resistance, capacitance, etc. is done, but we obviously like the speed of the mathematical equivalent.

So far as I know, fT is catered for. In the transistor hybrid model, there are input and output parasitic capacitances, and a "Miller" capacitance CjBC. These, along with transit time, delivers the gain-bandwidth product fT, though that is not the fast way. Normally, one does not have to do any of this. If the transistor SPICE model is available, you don't have to mess with datasheet entries to contrive your own, and they do show the frequency roll-off.

If the SPICE model hangs me up for too long, I will simply build the circuit, (and maybe watch it fry)!

In the last couple of days, it has been hot and dry, so the monster combine has been out there, and the view to the North is transformed. Harvested, and all the straw in big rolled up bales. I can't believe it is already August. This has been a _very_ strange year so far!


----------



## homebrewed

Second the strangeness, on this side of the pond.  I live on the outskirts of Portland, Oregon, and have seen lots of crazy stuff going on downtown.  The Portland cop who lives next door says what we've seen on TV is about 1/10 of what it really was like .

The issues w/regard to transistor selection may be overblown.  It is all to easy to dive into the weeds to get some hypothetical optimal solution -- I've gone there and had to haul myself back when I figured out I was worrying about absurdly small improvements.  As you say, at some point we just need to get 'er done and see how it works out.  Who should ever believe that their first attempt at something will be the last?  It's all a learning experience when doing this kind of thing

On a slightly different subject, the Americium capsules I ordered from China (via ebay) arrived today.  Curiously enough, the package had been opened (probably by US Customs).  Things have been too busy to fire up my detector circuit yet, hopefully that will happen soon.

Mark (A.K.A. Homebrewed)


----------



## homebrewed

I've been thinking more about the problem of accurately determining the peak voltage of pulses coming out of the Pocket Geiger circuit. I'm planning on extracting the peak value from the digitized data (rather than building a peak-hold circuit) so this is relevant.

I decided to analyze a (simulated) pulse coming out of the circuit, by looking at the first through fourth differences (a simple form of numerical differentiation).  As expected, the first difference switched from positive to negative near where the peak voltage occurs.  The second difference was almost constant for values around the peak, suggesting that a second-order polynomial fit might be good enough.  So I found an online polynomial regression calculator and entered some data.  It looks pretty darn good:



If you look at the residual error, it is about 4.5E-13.   Not bad, not bad at all.  But this is for noise-free data so it's a best-case result.

There are many code examples on the web that can be used for a starting point if you want to write your own code; or, of course, numpy/scipy will do it for you with relative ease.  Using more than 4 data points will improve the performance in the presence of noise.

The reason I'm looking at this approach is that the PC-hosted MCA programs I've found all expect the data to come from a sound card outputting data at one of the standard audio sampling rates (which are slower than what I want).  I want lots of samples around the peak value so I can reduce the impact of noise as much as possible.  My Teensy 4 processor chip running at 600MHz has more than enough processing power to do the polynomial regression (it has a built-in FPU) so I likely will roll my own second-order polynomial fitting code and just send peak values to the host PC.


----------



## graham-xrf

homebrewed said:


> According to the folks at Angel Guilding, the thickness of their chemically-deposited silver is around 50 nm.  I assume this is somewhat dependent on deposition time, but if it's like electroless nickle, once the surface is coated the dep rate goes down by a large factor.
> 
> The silver layer would be pretty delicate.  A thin coating of clear-coat (no pigments please) wouldn't absorb x-rays to any significant degree.  And it might help the exterior stay a nice shiny color, too!


Re: the electroless nickel reaction. I was startled at how it initially just plates withing seconds, but very thin, the a slowdown, but only for about 15 seconds, and then it really gets going! 

The reaction is "self-catalyzing". Palladium, platinum and various other metals will catalyze the nickel deposit - including nickel. I don't fully understand how nickel can be it's own catalyst, nor exactly what happens with the reaction, but no question, it gets going with some fury if hot enough. Seeing hydrogen come streaming off, (without any electrolysis power supply connected) is completely convincing!

[BTW - Do NOT let your significant other read the label on the nickel sulfate reagent bottle]!

Silver is used as a "strike" metal because it can be reduced from silver nitrate to plate into the microstructure of almost anything, like glass or plastics. If you leach out the butyl in ABS by wiping with solvent, or wipe over the vinyl with acetone, (dulling it's surface permanently), then deposit the silver, you can then plate over that a sufficient thickness of copper, which will be mechanically bonded into the spongy surface microstructure. Buff that up, and follow with nickel, and then chrome, whatever  if you like. The thin layer, if protected with paint, is good for mirrors, though not for first surface mirrors. Optics are usually "silvered" with aluminum, deposited in vacuum, and covers over with deposited other substances (zirconium)?

Electroless nickel for plating on iron and steel has the advantage that it deposits an even thickness everywhere, not depending on the siting of electrodes, nor current density. Initially, a "Woods Nickel Strike", started with the help of a current, for a minute or so, grabs on in the same way. (1:1 nickel chloride and hydrochloric acid). Then copper, if wanted, laid on thick enough to allow the pits and imperfections to be buffed away. Then back to the nickel.

I have the various recipes for plating, some dating back a century or more. I could post them, but I thought that if I could find them, so could anybody.

I have been well distracted by a peculiar mix of lathe fix-ups, house fixups, XRF PMT circuits design, Python software that is out of my depth, and now, adventures with electroplating nickel. So far, it is the nickel that has had the most success. It could be because the little cellar, where the chemistry is done, is also a haven of cool in a humid UK heatwave!


----------



## graham-xrf

homebrewed said:


> I've been thinking more about the problem of accurately determining the peak voltage of pulses coming out of the Pocket Geiger circuit. I'm planning on extracting the peak value from the digitized data (rather than building a peak-hold circuit) so this is relevant.
> 
> I decided to analyze a (simulated) pulse coming out of the circuit, by looking at the first through fourth differences (a simple form of numerical differentiation).  As expected, the first difference switched from positive to negative near where the peak voltage occurs.  The second difference was almost constant for values around the peak, suggesting that a second-order polynomial fit might be good enough.  So I found an online polynomial regression calculator and entered some data.  It looks pretty darn good:
> View attachment 333753
> 
> 
> If you look at the residual error, it is about 4.5E-13.   Not bad, not bad at all.  But this is for noise-free data so it's a best-case result.
> 
> There are many code examples on the web that can be used for a starting point if you want to write your own code; or, of course, numpy/scipy will do it for you with relative ease.  Using more than 4 data points will improve the performance in the presence of noise.
> 
> The reason I'm looking at this approach is that the PC-hosted MCA programs I've found all expect the data to come from a sound card outputting data at one of the standard audio sampling rates (which are slower than what I want).  I want lots of samples around the peak value so I can reduce the impact of noise as much as possible.  My Teensy 4 processor chip running at 600MHz has more than enough processing power to do the polynomial regression (it has a built-in FPU) so I likely will roll my own second-order polynomial fitting code and just send peak values to the host PC.


In the end, however good is the sample quality, and however great is the resolution of the A/D converter, however careful one is to prevent the common mode current from the roll-over of digital counters delivering into the analogue part common connection point, the number you get depends on an analogue thing in the front.

There is something sweetly efficient about using an analogue circuit to capture and preserve a buffered peak value, noise free as best any circuit could have it, to be sampled at relative leisure. By that I mean, sample rates from Hertz to some MHz, if you like. The whole business of getting the number, with fewer of the least significant bits jangling about, only to be steadied by software averaging, Kalman filtering, and the rest, ending up delivering at a the same rate you could have had with digital filtering, but without all the software struggle.

A analog contrivance, including filters, integrators, peak-hold, etc. delivers at the speed of electrons, and the "program" is inherent. Even now, the very fastest digital processing, can never deliver faster than the analogues that were up front  anyway. I don't say we need it fast. I am saying that even modest analogues, put in the right spot, can hugely ease the digital post sampling processing load that follows.


----------



## homebrewed

graham-xrf said:


> Re: the electroless nickel reaction. I was startled at how it initially just plates withing seconds, but very thin, the a slowdown, but only for about 15 seconds, and then it really gets going!
> 
> The reaction is "self-catalyzing". Palladium, platinum and various other metals will catalyze the nickel deposit - including nickel. I don't fully understand how nickel can be it's own catalyst, nor exactly what happens with the reaction, but no question, it gets going with some fury if hot enough. Seeing hydrogen come streaming off, (without any electrolysis power supply connected) is completely convincing!
> 
> [BTW - Do NOT let your significant other read the label on the nickel sulfate reagent bottle]!
> 
> Silver is used as a "strike" metal because it can be reduced from silver nitrate to plate into the microstructure of almost anything, like glass or plastics. If you leach out the butyl in ABS by wiping with solvent, or wipe over the vinyl with acetone, (dulling it's surface permanently), then deposit the silver, you can then plate over that a sufficient thickness of copper, which will be mechanically bonded into the spongy surface microstructure. Buff that up, and follow with nickel, and then chrome, whatever  if you like. The thin layer, if protected with paint, is good for mirrors, though not for first surface mirrors. Optics are usually "silvered" with aluminum, deposited in vacuum, and covers over with deposited other substances (zirconium)?
> 
> Electroless nickel for plating on iron and steel has the advantage that it deposits an even thickness everywhere, not depending on the siting of electrodes, nor current density. Initially, a "Woods Nickel Strike", started with the help of a current, for a minute or so, grabs on in the same way. (1:1 nickel chloride and hydrochloric acid). Then copper, if wanted, laid on thick enough to allow the pits and imperfections to be buffed away. Then back to the nickel.
> 
> I have the various recipes for plating, some dating back a century or more. I could post them, but I thought that if I could find them, so could anybody.
> 
> I have been well distracted by a peculiar mix of lathe fix-ups, house fixups, XRF PMT circuits design, Python software that is out of my depth, and now, adventures with electroplating nickel. So far, it is the nickel that has had the most success. It could be because the little cellar, where the chemistry is done, is also a haven of cool in a humid UK heatwave!



I've used electroplated and electroless nickel for various applications at work.  I mixed up the electroplating solution pretty much as you describe, but bought the electroless nickel solutions premixed -- one solution contained the nickel salt and other magic chemicals to do things like get the pH right, and the other contained the reducing agent, either phosphorous or boron-based (it probably was sodium hypophosphite).  The reducing agent didn't last all that long once the bottle was opened because the oxygen in the air destroys it.  I was able to extend its lifetime by backfilling the bottle with nitrogen, which was readily available to us -- the whole building was rigged as a fab and our lab occupied a small part of it.  Thankfully, I didn't have to wear a bunny suit, though!

 IIRC, electroless nickel is used to tack down diamond grit as a first step to making "diamond plated" grinding and cutting tools.  Not to tempt you down yet another rat hole   .


----------



## homebrewed

graham-xrf said:


> In the end, however good is the sample quality, and however great is the resolution of the A/D converter, however careful one is to prevent the common mode current from the roll-over of digital counters delivering into the analogue part common connection point, the number you get depends on an analogue thing in the front.
> 
> There is something sweetly efficient about using an analogue circuit to capture and preserve a buffered peak value, noise free as best any circuit could have it, to be sampled at relative leisure. By that I mean, sample rates from Hertz to some MHz, if you like. The whole business of getting the number, with fewer of the least significant bits jangling about, only to be steadied by software averaging, Kalman filtering, and the rest, ending up delivering at a the same rate you could have had with digital filtering, but without all the software struggle.
> 
> A analog contrivance, including filters, integrators, peak-hold, etc. delivers at the speed of electrons, and the "program" is inherent. Even now, the very fastest digital processing, can never deliver faster than the analogues that were up front  anyway. I don't say we need it fast. I am saying that even modest analogues, put in the right spot, can hugely ease the digital post sampling processing load that follows.



I understand what you're saying, and usually take more of an analog route when the path is well defined.  In this case I'm trying to keep the hardware to an absolute minimum and move the smarts into the digital realm ASAP....because I don't know precisely what will be needed.  

I've built more than my share of rats-nest circuits, adding this block and then that block to address various problems; and past a certain point I end up spending more time troubleshooting my circuit tangle than solving the original problem.  And if I quit and come back a few months later....well, it's just a tangle of parts and wires looking back at me.  With well-commented code I can usually figure out what I was up to.


----------



## graham-xrf

homebrewed said:


> I've used electroplated and electroless nickel for various applications at work.  I mixed up the electroplating solution pretty much as you describe, but bought the electroless nickel solutions premixed -- one solution contained the nickel salt and other magic chemicals to do things like get the pH right, and the other contained the reducing agent, either phosphorous or boron-based (it probably was sodium hypophosphite).  The reducing agent didn't last all that long once the bottle was opened because the oxygen in the air destroys it.  I was able to extend its lifetime by backfilling the bottle with nitrogen, which was readily available to us -- the whole building was rigged as a fab and our lab occupied a small part of it.  Thankfully, I didn't have to wear a bunny suit, though!
> 
> IIRC, electroless nickel is used to tack down diamond grit as a first step to making "diamond plated" grinding and cutting tools.  Not to tempt you down yet another rat hole   .


Nickel with a small percentage of phosphorous, like a "alloy", if you can call it that, is a standard, desired smooth hard bright type. It is something to do with the crystalline matrix. Steel is like that too. It has a matrix of all sorts of non-metallic additives. The mix of nickel with phosphorous can be made directly when plating, instead of it being a furnace operation.

Funny you should mention the locked-in diamonds. Only days ago, I finally purchased another double-sided credit-card sized diamond metal hone. Two grades of diamond grit 320 and 600 I think. It replaces one that I have had for 17 years, and I won't throw it yet, because it still has life in it. So far, the most use has been in rubbing up tungsten carbide stuff like router tools.


----------



## homebrewed

graham-xrf said:


> Nickel with a small percentage of phosphorous, like a "alloy", if you can call it that, is a standard, desired smooth hard bright type. It is something to do with the crystalline matrix. Steel is like that too. It has a matrix of all sorts of non-metallic additives. The mix of nickel with phosphorous can be made directly when plating, instead of it being a furnace operation.
> 
> Funny you should mention the locked-in diamonds. Only days ago, I finally purchased another double-sided credit-card sized diamond metal hone. Two grades of diamond grit 320 and 600 I think. It replaces one that I have had for 17 years, and I won't throw it yet, because it still has life in it. So far, the most use has been in rubbing up tungsten carbide stuff like router tools.



The son of one of my co-workers had a project where he electroplated a special ferromagnetic alloy composed of iron and nickel.  I helped him iron out a few equipment related issues to improve film uniformity.  It's an interesting approach for putting down thin alloy layers, but has a lot of variables you need to control in order to get a specific composition.  Bath temperature, iron/nickel salt concentration and ratio, pH, complexing agent type and concentration, cell voltage, agitation..... lots of knobs to turn.  It was a good thing that his dad knew how to design experiments!

If you need an even finer-grit diamond hone, take a look at lapidary diamond lapping disks.  I have 300, 600, 1200 grit and 3,000 grit ones for shaping and honing carbide scrapers.  Not too expensive if you shop around.


----------



## homebrewed

For a first crack at using the pocket geiger as the detector for an MCA, I was going to use the Teensy4.0's 12-bit A/D and just tap into the output of the filter, an analog signal.  But my circuit simulations indicate that the filter's DC level is about 4.5V, far above the Teensy's 3.3V supply.  A voltage divider can drop the voltage to below this, but at the expense of reducing the already-small pulse height.  So I have decided to make a simple signal-conditioning circuit using some low-noise opamps.  One for adjusting the signal offset, and another to boost the signal level to take better advantage of the A/D resolution.

It's a simple enough circuit to hand-wire, and I already have the active components I need (and most of the passives, too).  Time to get out the soldering iron....


----------



## graham-xrf

Just a note: I am still here, and wanting to press on with some construction. For the present, a whole lot of other (good) stuff is getting in the way. I want to also get the same diode detector as @homebrewed . Mark may be further along that route by now.

While I am going to make the PMT tube work, if only because I already have one, (and it's fun ), in the longer term, the attractions of small, lightweight, low voltage, and possibly not needing a scintillator count big-time with me.


----------



## homebrewed

I decided to design a PCB for my pocketgeiger-to-Teensy signal-conditioning circuit.  Mostly as a way to learn how to use EasyEDA.  When I was using ExpressPCB I got kind of spoiled by having 4 layer PCB's available for not a lot of money so, although it's overkill, I went with a 4-layer PCB for this one.  It really does make it easier to lay out boards if you can avoid all the Vcc/Vee/Gnd traces by just sinking a via down to a power or ground plane.  Even with the two "extra" layers, it only cost $7 for five boards (the minimum quantity they will make).  That includes silk screen and solder mask layers for the top and bottom!  It cost more for the shipping than to make the darn boards!  The SMT components I don't already have are on order from Mouser

Anyway, I've attached the schematic to show folks what I'm up to.  There should be enough comments there to figure things out, but if not I'd be happy to clarify.  I'm using the LMC662 because it should have very low current noise (Iin = 2FA @RT).  The input RC time constant is 10 seconds so it won't distort the low-speed signal coming out of the pocketgeiger board.  It's important to minimize baseline drift because that will affect the peak voltage, which is what the MCA uses to determine what element(s) are present.


----------



## graham-xrf

You have been busy!
Have you simulated this one?
I have been otherwise occupied. I have to get back into this.

My first thought about PCB layout involving 4 layers (yes - I have gone to 6 layers at times), is the design philosophy about shielding, and having the circuits in between copper planes for Vcc, Gnd, etc. When it comes to dealing with noise, a ground (or power) plane is not just a place where the operating currents from any device can simply be dumped into. I found that by putting carefully placed slots into the ground/power planes, one can "guide" the current paths so as to prevent any more energetic device from polluting the signal in an input circuit via common mode return impedances. I am thinking you probably already know this.

I will get to understand it better soon. My first reaction is that I see a 1978 device, and a 1998 device, both of which I have used extensively - back in the 1990's.  That's OK. For this purpose, a JFET Op-Amp is perfectly fine, and comes in packages with pins that make it "constuctable" without needing fancy PCB assembly kit. For me , a 1uF cap with a 10M resistor as a simple 1-pole low pass filter with a 10 seconds time constant up front is confusing.

Baseline drift is solved by clamping, and DC coupled goodness. Alternatively, zero drift switched AC circuits. Earlier in the thread, I spoke of finding just the right amount of front end gain, while also going for getting some power into it (lower impedance more robust signal). A follower at the front (LMC662) with a 1K feedback resistor only does the latter. The buffer stage gain is only 1 - or else I misunderstand.

To get a signal up and away from noise, the very first device it finds must have a very low noise figure, and importantly, must have enough gain to amplify the signal (and the noise) to such a level that any subsequent circuit contributions to noise cease to be significant.

Have you simulated this design?


----------



## graham-xrf

Mark - remind me where we get the


homebrewed said:


> I decided to design a PCB for my pocketgeiger-to-Teensy signal-conditioning circuit.


Mark - just to catch me up on this. There are things I am not understanding.

From your post #306, you found the (quite expensive) X100-7 photodiode array, and a Hackaday posting which described direct detection of gamma rays, and describes relative insensitivity to gamma energy in pulse height, but that there was information in the pulse width. OK - so we don't know why there was energy storage in the diode that only delivers late, but we think measuring the pulse width, possibly then multiplied by a height value, could make it useful?

In the same post - there is reference to the Instructables schematic which you did not like because it looked like it had a unbiased *AD743 BiFET Op-Amp* with a 1pF hanging on it. You may be right, and I am skipping along too fast here to give it the full attention, but the first swift look at the data sheet shows a spectacularly low noise very high performance amplifier which would surely show the door to a *LMC662*. Agreed, we may not like the circuit it got put in, or it's lack of bias, but I do like the data sheet as a starting point.

Moving on (to catch up). You found the SparkFun module *SEN-14209* at $69.95 from DigiKey which apparently incorporates the *X100-7* sensor.
Is this one of those "economies of scale" things where a *£100.05* sensor can arrive on a *$69.95* built module?

So what I get from this is that the GeigerCounterType5_circuit_diagram is what is on the module, and you (rightly) don't like it, and so you make your own PCB, and use the X100-7 (at $69.95). Did I get that right?

While I am going to mess with the PMT - even if only as a comparative cross-check, (let each test the other), I propose to sync up and go with the sensor you are using. I just needed to be sure that I am not making a mistake here.

Which vendor did you use? I think I may have to set up with Digi-Key. Mouser has a whole bunch of dev boards, but not, apparently, that one.


----------



## homebrewed

graham-xrf said:


> You have been busy!
> Have you simulated this one?
> I have been otherwise occupied. I have to get back into this.
> 
> My first thought about PCB layout involving 4 layers (yes - I have gone to 6 layers at times), is the design philosophy about shielding, and having the circuits in between copper planes for Vcc, Gnd, etc. When it comes to dealing with noise, a ground (or power) plane is not just a place where the operating currents from any device can simply be dumped into. I found that by putting carefully placed slots into the ground/power planes, one can "guide" the current paths so as to prevent any more energetic device from polluting the signal in an input circuit via common mode return impedances. I am thinking you probably already know this.
> 
> I will get to understand it better soon. My first reaction is that I see a 1978 device, and a 1998 device, both of which I have used extensively - back in the 1990's.  That's OK. For this purpose, a JFET Op-Amp is perfectly fine, and comes in packages with pins that make it "constuctable" without needing fancy PCB assembly kit. Forme , a 1uF cap with a 10M resistor as a simple 1-pole low pass filter with a 10 seconds time constant up front is confusing.
> 
> Baseline drift is solved by clamping, and DC coupled goodness. Alternatively, zero drift switched AC circuits. Earlier in the thread, I spoke of finding just the right amount of front end gain, while also going for getting some power into it (lower impedance more robust signal). A follower at the front (LMC662) with a 1K feedback resistor only does the latter. The buffer stage gain is only 1 - or else I misunderstand.
> 
> To get a signal up and away from noise, the very first device it finds must have a very low noise figure, and importantly, must have enough gain to amplify the signal (and the noise) to such a level that any subsequent circuit contributions to noise cease to be significant.
> 
> Have you simulated this design?


No, I haven't simulated the design.  As far as choice of opamp goes, just about anything that has internal compensation and compatible footprint could be used.  I put the LMC662 and TL072 in there mostly because I have them on hand (and the LMC662 is used in the PocketGeiger).  They are SOIC style packages so not too difficult to hand-solder.


I've done some RF PCBs, to the extent of making some test structures to check the impedance of asymmetrical strip lines.  But for this low-speed circuit I was more interested in ease of layout (along with minimizing noise).


----------



## homebrewed

graham-xrf said:


> Mark - remind me where we get the
> 
> Mark - just to catch me up on this. There are things I am not understanding.
> 
> From your post #306, you found the (quite expensive) X100-7 photodiode array, and a Hackaday posting which described direct detection of gamma rays, and describes relative insensitivity to gamma energy in pulse height, but that there was information in the pulse width. OK - so we don't know why there was energy storage in the diode that only delivers late, but we think measuring the pulse width, possibly then multiplied by a height value, could make it useful?
> 
> In the same post - there is reference to the Instructables schematic which you did not like because it looked like it had a unbiased *AD743 BiFET Op-Amp* with a 1pF hanging on it. You may be right, and I am skipping along too fast here to give it the full attention, but the first swift look at the data sheet shows a spectacularly low noise very high performance amplifier which would surely show the door to a *LMC662*. Agreed, we may not like the circuit it got put in, or it's lack of bias, but I do like the data sheet as a starting point.
> 
> Moving on (to catch up). You found the SparkFun module *SEN-14209* at $69.95 from DigiKey which apparently incorporates the *X100-7* sensor.
> Is this one of those "economies of scale" things where a *£100.05* sensor can arrive on a *$69.95* built module?
> 
> So what I get from this is that the GeigerCounterType5_circuit_diagram is what is on the module, and you (rightly) don't like it, and so you make your own PCB, and use the X100-7 (at $69.95). Did I get that right?
> 
> While I am going to mess with the PMT - even if only as a comparative cross-check, (let each test the other), I propose to sync up and go with the sensor you are using. I just needed to be sure that I am not making a mistake here.
> 
> Which vendor did you use? I think I may have to set up with Digi-Key. Mouser has a whole bunch of dev boards, but not, apparently, that one.


I bought the module directly from SparkFun.  I've purchased stuff from them before and like supporting them.  It isn't their design, though.  It looks like it was designed as a response to the radiation released from Japanese reactors that were damaged by the tsunami.  The relatively low price, compared to the expensive-by-itself detector, is a bit of a head-scratcher, so you could be right about the economies of scale.

So, on to the module itself.  I have been planning on leaving the detector on the board, and tapping into the analog signal coming out of the second LMC662.  The module is convenient because it has an on-board 27V bias generator for the detector.  The analog  signal, along with the detector bias voltage, is brought out to some pads on the back side of the board (probably to facilitate board testing).  I HAVE simulated the analog portion of the module, but only so far as to get some sense of the pulse height/width coming out of the front end -- and use the data to test some peak-finding methods.

Since the X100-7 is in a DFN style package it should be possible to extract it from the board and repurpose it, but for a first crack at an XRF system I just want to know if there's even the ghost of a chance it will work for us.  If I DID take the repurposing route I'd put the detector on its own separate board so I could easily test different circuit designs.  As you have pointed out, the AD743 bests the LMC662 on a number of specs.  And there are a number of auto-zeroing amplifiers one could use to boost the signal level so there's no doubt there is room for improvement -- if preliminary results justify it.

The design I was critical of is a completely different one that was an electrical engineering student's class project.


----------



## graham-xrf

OK - your reply happened while I was typing.

Firstly - if you want a custom proto circuit, before one thinks about taking the chip off the board, there is probably more mileage in modifying the board, and/or, removing some components, and mounting it straight on top of  board of your own. A bit hack, but I don't like de-soldering small pin semiconductors, especially those which cost more than 10 bucks for one!
- - - - - - - - -
Re: Noise
The trouble with noise is, even if it is in a low speed circuit, the noise it adds can be full spectrum. If the interface cable goes to PC, or Arduino, or something, unless the PC audio innards are designed to have returns isolated from the digital electronics, like the best motherboards featuring onboard audio do, an instrumentation signal can get drowned. We need not be too concerned about noise if we get the S/N ratio preserved on a signal large enough, and low impedance enough, to make it immune, so that it could be casually taken via an audio cable to a PC. Better still, get it into numbers before it goes to the display device - via USB.

I may be getting a little too over-critical on this. It comes from the days when I had to crawl through a DC4, preserving a 15uV signal from a bridge sensor that was at the rudder, through a maze 400Hz inverter high current cables making exceptional splat. I found out about balanced differential pairs, and double screening with the inner connected at only one end, and how it was possible to collect even tiny currents if you controlled what other currents could be added to them, or induced in them.
- - - - - - - - -
I may end up with my own flavour [OK - flavor], of input data sample collect circuit , but that's OK. I am still motivated to make it go using the ready-made board. That is - unless you think a de-solder and fit to one of your boards is easy enough. I guess I don't like de-solder reworks, even using the Polish coil-wire trick to take them off unharmed.

The Op-Amp pin format was, and is, a remarkable casual "standard". "Other" Op-Amp circuits we contrive may well be built on the module board.
Unlike the more usual situation where manufacturers try to invent their own standards, with the aim of making their kit compatible only with their own, on this feature, if they could not offer "plug-in" replacements or upgrades, they were doomed.

I also get it that components with part designations beginning with "AD" can have a price premium, and it goes crazy if they have "883D anywhere else in the code.

Regarding the kind of pulse response, and the Hackaday article about (pulse height x duration) being important, I think there is no problem in integration the pulse energy in software. I do think that getting at more than one pulse in ten seconds is something we should go for.
So - ordering one for me sometime tonight.

[Edit - new distraction - how much old Mercedes estate car stuff one has to fight through to get at a screen-wash pump]!


----------



## homebrewed

With the right tools it's not too difficult to remove most SMT parts from boards.  A temp-controlled hot plate can do it, if you're careful.  Lead-free solder melts at a higher temp than 60/40 so the hot plate needs to get up to 300C or thereabouts.  Before de-soldering, you must bake the board @80C for a couple of hours to remove moisture, otherwise the water could turn into steam and "popcorn" your part, breaking bond wires.

After removal, the package pins need to be re-tinned, mostly to re-level them.  You need to do that in order to mount them on another PCB.

BTW, when creating footprints for QFN or DFN style parts, it's really handy to include a silk screen outline of the package.  This makes it easier to align the package w/respect to the soldering points of the footprint.  If you've had to roll your own footprints, you probably know that anyway, but I thought it was worth mentioning.


----------



## graham-xrf

homebrewed said:


> With the right tools it's not too difficult to remove most SMT parts from boards.  A temp-controlled hot plate can do it, if you're careful.  Lead-free solder melts at a higher temp than 60/40 so the hot plate needs to get up to 300C or thereabouts.  Before de-soldering, you must bake the board @80C for a couple of hours to remove moisture, otherwise the water could turn into steam and "popcorn" your part, breaking bond wires.
> 
> After removal, the package pins need to be re-tinned, mostly to re-level them.  You need to do that in order to mount them on another PCB.
> 
> BTW, when creating footprints for QFN or DFN style parts, it's really handy to include a silk screen outline of the package.  This makes it easier to align the package w/respect to the soldering points of the footprint.  If you've had to roll your own footprints, you probably know that anyway, but I thought it was worth mentioning.


Yep - you and I seem to have traveled the same road.
I had some solder+flux paste stuff in a pack with a tiny needle that would temporarily "stick" the little 0402 components down "sort of" in place, then I relied on the silkscreen boundaries and surface tension to let them "flow" into place. They kind of centre up by themselves, except the odd one now and then that would go into tombstone attitude. That company had a real nice regulated hotplate that could be programmed to do a "cook" sequence. There was also an IR thing that could take a board up to heat, and hold it for just the right number of seconds. All that is now in a past life. 

Making one's own footprints, especially those for microwave RF, that have loads of parallel shunt inductance grounding vias, was a tedious business! That's not even counting the simulations to get at the S-parameters. For home stuff, most times I can go for the luxury of packages I can work with. Even SO8 seems "big" these days. I am not even beyond using stuff with through-hole pins 0.3" apart, on 0.1" pitch if it's something useful that I happen to have around.

I think the point of all those "hats" and add-on development boards that fit on Raspberry Pi('s) GPIO pins. It's to let us us folks with real fingers, and schoolkids, be able to work with them.

The SparkFun website crapped out on me repeatedly, even when trying using two  FireFox browsers, and one Chromium-based "Brave" browser. The site works, but kept going into a pointless loop near the end when trying to pay up. The folk at SparkFun emailed me. I'm going to have another go at it, maybe tomorrow.


----------



## homebrewed

It's odd you ran into problems trying to buy stuff at SparkFun, but it sounds like they're trying to take care of you.

Regarding the self-align effect with SMTs, it works the same with pre-tinned pins and pads -- as long as you have some solder flux in there, too.  Of course, solder paste has flux in it so no problem there.   A few times we did have alignment problems when the water in the flux started to boil off.  On occasion the part would move around too much to get the self-align to work -- but if you were alert you could nudge the part back into position before the solder actually melted.  It was cool to see the part suddenly move over a bit as the surface tension did its thing.

The solder paste method is the way to go if you are soldering multiple parts at the same time.  Our test boards typically had just one IC package on them so our simpleminded approach worked fine..  The remaining components were hand-soldered.


----------



## homebrewed

The PCBs arrived today.  They look pretty good, and ohmed out OK so at least I know I didn't screw up when I placed the vias.  Here's a photo of the unpopulated board:




The board differs a little from the schematic I showed in an earlier post.  I added some clamp diodes and a limiting resistor to ensure the signal going into the Teensy doesn't go below ground or above the Teensy's supply voltage.  I don't want to damage my $20 controller board! 

The "KS Design" name is taken from our street name.  I've used it for a few other PCBs as well, but no commercial stuff yet.

The board is much bigger than it really needed to be, and 4 layers are overkill for a design like this.  The back side of the board only has a few traces on it.  But it does make for a much cleaner layout.  Anyway, $7 for five of them isn't going to break the bank.  I can't believe how cheap PCBs are these days!  Years back when I was designing and building audio gear it was much more expensive (for just 2 layers and no through-hole plating), plus it was necessary to lay the boards out on Mylar using tape and stick-on pads.  Sooo much easier now.


----------



## Boswell

Who is providing 4 layer boards with resist and silkscreen for $7 in low volume?  I assume there was a separate setup charge, right?


----------



## homebrewed

"Who is providing 4 layer boards with resist and silkscreen for $7 in low volume? I assume there was a separate setup charge, right?"

Nope, NO setup charge.  Shipping cost more than the boards.  From EasyEDA.com.  I have no association with them other than as a customer.

The web site offers schematic capture, simulation, a large library and a PCB design suite (including DRC and a fairly lame auto router).  Free, if you're OK with allowing other users the ability to view your designs.  If you pay 'em money, you can keep your designs all to yourself.


----------



## Boswell

That is an amazing price. It looks like you do not have to use their design software. be sure to let us know if you find any production problems. Otherwise, I will likely give them a try on my next PCB run.


----------



## homebrewed

Boswell said:


> That is an amazing price. It looks like you do not have to use their design software. be sure to let us know if you find any production problems. Otherwise, I will likely give them a try on my next PCB run.



Will do.  BTW, you have a choice of different resist and silk screen colors so you can customize your boards somewhat.  I just went with the default colors.


----------



## homebrewed

Boswell said:


> That is an amazing price. It looks like you do not have to use their design software. be sure to let us know if you find any production problems. Otherwise, I will likely give them a try on my next PCB run.


Yeah, just sending them Gerbers will protect your IP.  I haven't worried too much about that yet.  Maybe at some point.

I see that Cedar Park is a suburb in Austin.  I visited Austin quite a few Novembers back for a conference and liked it.  Maybe because it was dryer and sunnier than Oregon in November .


----------



## Boswell

I use Diptrace for board design so only interested in their mfg process.   I love the austin area hill country but it can get pretty hot in the summer. Just expanded my shop this last winter and added a Min-Split to keep it cool.


----------



## graham-xrf

SparkFun have been operating their site remotely, no live chat, no answer to emails, etc. After messing with my browser anti-tracking and anti-canvas fingerprinting protections, I finally purchased the little board with the X100-7 sensor. I had to navigate a load of questions about export restrictions. We shall see if it makes it to _chez moi_ sometime soon.


----------



## homebrewed

I had wondered if you might run into export restrictions.  The X100-7 itself is manufactured in Europe (their HQ is in Berlin).  Go figure....

I haven't done any assembly on my PCB yet.  I decided I needed to get some stainless steel flat-tipped tweezers to make it easier to handle (and solder) chip resistors and caps.  Our engineering tech at work let me try hers when I was assembling a test board and that style was much better than the pointy-tipped ones.  I've got a couple of different types on order and they should arrive next week.

SMT tweezers aren't cheap, though; one of them was about $15 and the other was about $21 (USD).  Hakko and Excelta make 'em -- I got one Hakko CHP 105-A and an Excelta 103-SA from Amazon.  IIRC, we pretty much used Excelta tweezers at work.  Their fine-tipped tweezers were small enough to pluck individual wirebonds off of IC's.  But if you dropped them and the tip hit the floor, it was all over with.  I never could re-bend the tips well enough to make them usable again.  You'd think it would be possible to get the tips parallel again by using fine sandpaper on them but they always came out too curved so they didn't grip the bond wires.


----------



## graham-xrf

I have seen a black, non-metallic tweezer with special ends shaped to fit over 0603 and 0402 that fit more or less over the SMD, gripping from the sides. Turned through 90°, it almost had possibilities of hanging onto a SOT23, but not quite!

I have also seen a trick where a guy adapted the tube from a foot-switch operated solder suck thing onto something he extracted from a ball-pen. He puts the resistor, which is suck onto the end of the tube by vacuum, into place, then stops with the vacuum. I don't think it would be all that successful for most, but he had developed the skill.

He taught me the "Polish Coil Wire trick" to remove IC's when you need selective removal, and cannot heat up the whole board. For small outline ICs and quad packs. It requires the quite fine enameled magnet wire, I guess about 30 or 36 AWG. You first use a wick to remove the top excess of solder. Then thread the wire through under the pins in the gap between the IC body, and the pin pads. Secure one end somwhere. Wrap it around a component or something. Then tug on the other end sideways, while applying heat to the top of the pin, to spring them one by one, pulling on the coil wire. It works well as a controlled, no-damage removal, until you get to the last two pins. Here, I found. it pays to heat the last two pins simultaneously, and lift off the IC.


----------



## homebrewed

I had read about the "Polish coil wire trick" but, lacking any further explanation, thought it was a cheap replacement for solder-wick.  Thanks for the explanation, it's a neat trick.

Non-metallic carbon fiber (or plastic) tweezers would work OK if you're placing components onto solder paste (although I wonder about solder paste sticking to the tweezers and getting into places you don't want).  I use fine solder and a fine-tipped soldering iron and hold the SMTs in place as I solder one side down, so the tweezer tips have to withstand soldering temperatures.  Ceramic-tipped tweezers are available but I haven't seen any with suitably shaped tips for SMT work.


----------



## graham-xrf

Having something that can be used to hold down the SMD 0402 without it slipping about, and allow that whatever you grab it with is unobstructed can be awkward. Then I discovered that sometimes a better way is not to get a grab from the sides, but to press on it in the middle with a sharp point of a dentist's pick tool.
--> HERE
Second from the bottom in the picture. The sharp point has high friction, so stops any sideways movement, without pressing down hard at all. It allows to get at the pads with a soldering iron, way easier than working past tweezers. Most other ways seem clunky in comparison.


----------



## homebrewed

graham-xrf said:


> Having something that can be used to hold down the SMD 0402 without it slipping about, and allow that whatever you grab it with is unobstructed can be awkward. Then I discovered that sometimes a better way is not to get a grab from the sides, but to press on it in the middle with a sharp point of a dentist's pick tool.
> --> HERE
> Second from the bottom in the picture. The sharp point has high friction, so stops any sideways movement, without pressing down hard at all. It allows to get at the pads with a soldering iron, way easier than working past tweezers. Most other ways seem clunky in comparison.



I typically use 0603's, somewhat easier to handle -- especially with SMD-specific tweezers.  However, sometimes the tweezers don't hold them flat against the PCB.  That's where your technique could come in handy.  But don't you have to change tools for each part you put down that way?  A dental pick isn't going to pick the part out of the bag (or off the tape).  I also can see a bit more futzing around to align the parts to their PCB footprint but I'm probably just not getting the whole picture.

One test fixture I made had to have relatively high resistance on one input, with minimum capacitance (it actually was an active probe to measure AC signals on the internal circuit nodes of IC's, up into the GHz range).  I had thought that the more-widely-spaced contacts of the 1206 size would give me lower capacitance, but the 0201 quite handily beat it out.  However, they _really_ were a bear to handle and solder down.


----------



## graham-xrf

It's a two-handed affair. Right hand with tweezers puts the component down.
Then while it is in position, left hand pins it down with the dental pick point.
This gets over the problem of it shifting about from the attempted let-go.
Also, if it needs some position perfection, it's easier while using both tools.
Once in place, right hand uses soldering iron, while left is still keeping it held under the pick-point.
This method suits solder paste, unless there is enough tinning on the pad already, or you are good at carrying a smidge of solder on the iron.

More of a flap to use, and not so successful without a bit of practice, is a ghetto lash-up spring point for when you definitely need the left hand to feed in fine solder, instead of having the pre-applied paste. I used a sharpened piece of piano wire bent into a almost semi-circle, one end clamped into a PanaVise, which has a heavy base. I set the point to press on the component position without the component there. Then I use two tweezers, to lift the point, and get the component under, and into position.

At this stage, both hands are free. I used this method to hold down a 0.5mm pitch quad-pack while I secured the corners. I will admit, getting it right was fiddly, but I got it to work. I also did this to hold down a microwave FET which had tabs to be soldered to microstrip coplanar waveguide. That was a really awkward thing, because the gate was so small, even low charge transfers would have it expire, so all the connections had to be kept shorted together by a fine wire spring coil thing that gets pulled off after the part is down and soldered.

I guess I didn't have the skills of a line operator, and I needed the "third hand". Definitely this sort of stuff cannot be done if you have just had an _expresso cappuchino laté_ !


----------



## graham-xrf

*PocketGeiger Type 5*

For just initially poking around among the circuits downloaded from the SparkFun site, clearly the board is over-produced spillover from the little white plastic goodie that plugs into a smartphone. We note the 2012 date. We have a little smile at the Japanese transposition of "R" and "L" that extends from the way they pronounce into the documents spelling. "Open corrector output" is exactly what you think it should be, if ever you encountered "lestaurant".
*
First the PocketGeiger-5*
I note there is the SIG radiation detection pulse, and the NS noise detection pulse.
The explanation is there is output a positive HIGH pulse when "vibration noise" has been detected a NS signal is delivered.
Hmm.. It would seem that in addition to detecting radiation, the chip is somewhat _*microphonic*_. I suppose most any crystals are by the piezoelectric effect. That is concerning because of the very high outputs possible, and the fact we are to have some gain on the end of it.

The text at the end gives the clue that the NS pulse is used to trigger a dump to ignore the last 200mS of whatever is going on at the SIG connection. Quoting..
"Pulse width differs depending on vibration pattern and regardless of pull-up resistance R.
Dispose measurement data for last e [sec] {e<200[msec]} when vibration noise has been detected".

*The circuit*
We were agreed that the circuit is not best for what we want, and I get it that you may be using anything handy for now while checking it out.
The LMC662 is a OK CMOS OP-Amp. The original circuit is asking a lot to have a follower with 66M  feedback resistor. The actual feedback current would be tiny. For most practical purposes, the 66M is almost not there!  All the bias current the CMOS ever needs for the (+) input comes from the divider chain. I think the 1pF feedback is to keep it stable.

The (-) input works from only those few electrons that can fight their way through 66Mohms, and of course whatever might come out of the diode.
The bias condition of the diode is not obvious, done via 100K to a little switch-mode supply. At this stage, I admit I don't quite understand the thing.

It follows with a gain stage G=100, then offered at standard voltage window comparators in  LM393. These are set to flip when the signal goes below 2.68V (assuming the 9V is exact). and when it goes above 3.09V. If it goes low, U3A output is open collector, looking to be pulled up hard by something it is hopefully connected to down the audio jack. current limited by 470 ohms. If it goes high, then U3B yanks the output low. If it is somewhere in between, regardless of diode noise and other information, things are quiet. I note the 4.7nF directly on the output of U3B open collector. There is no excuse for this! Let us bury this circuit now!
*
But we are not doing that!*
We go linear instead, to try and extract whatever was yanking those comparators. I don't yet understand all of your Teensy circuit.  How P2 selects the gain, and indeed how the signal makes it to the output. My search for HDR-IDC-2-54-2X3P did not find a datasheet - only 7 results of unrelated gabble.

*PIN diode performance*
The X100-7 SMD data sheet is encouraging. It is operated reverse biased. Looking at the dark current, I would choose to operate it at very little reverse bias, instead of the tens of volts as in the PocketGeiger. We see the "Absorption Probability" vs "Gamma Energy" graph. The main part of the curve is what I would call X-Rays. The graph is about the *probability* of absorption, which is not the same thing as "*pulse height*" nor "*duration*".

This diode could apparently detect Chromium (5.4KeV), Vanadium (4.95KeV). From the graph, even Calcium and Potassium have more than 80% probability of being absorbed. Even Aluminium has a 30% probability. These probabilities are just that, and would not be directly related to the pulse size, only to how often they occur - whenever they do. We don't really know how much a given energy from incoming photons, once absorbed, will contribute to diode current above the dark current (which will be noisy racket)! It may not be much. I suppose we could estimate it, but I would just go for showing it some metal.
*
First thoughts about the detection*
The thing is, the energy from the photons are not showing their presence with the help of huge gain, such as we would have from a PMT, or a avalanche diode. Therefore, I think, one needs to operate with as little bias as possible, limited by the PIN capacitance getting large enough to soak up the signal. Perhaps about 6V, where the dark current is is only 2nA, and capacitance (ugh) as much as 100pF. If the detection circuit can
still get pushed around enough in the face of 150pF, then 4V bias gets you 1.5nA dark current.

From then on, it is about capturing that (current) pulse and applying the sort of gain one would get from a PMT or avalanche diode.  The amplifier has to have a bonkers low noise figure, and a gain that I am thinking should be more than 100. Perhaps 100,000? I cannot know without knowing what actually happens with a MX-100. Avalanche diode gains are around 10E5, and PMT gains are like 1.7E6.
*
A crazy thought.*
The capacitance curve is so steep, it makes me think that if one used the PIN diode as part of a RF oscillator, the frequency shift when a pulse arrives just might be useful. We get here to the parametric amplifier techniques that used varactor diodes, very popular for avoiding noise, and widely used for radio telescopes and satellite receivers. Now, with availability of pHEMT FETs , one does not go to the expense of them, but for extreme low noise, they are still ultimate!
Enough with the crazy thought!

*Why a buffer?*
Of course - to stiffen up a high impedance signal. Is it that? It's from a diode, with a whole 3nA  of dark current. A stage with a gain of 1 adds the noise of it's first semiconductor molecules bashing around, and then it gets increased by as much again when it reaches the gain stage, so worsening the S/N ratio without yet any gain. You get an admittedly lower impedance signal, delivering a stiff, low impedance pile of extra noise!

 I am thinking that a very low noise high gain stage is needed at the beginning. Bias, offset, signal clamping, etc, can all be dealt with, but the basic grab at the little current in excess of the dark current needs to be done right at the beginning, and brought to safety.

So, if I am wrong about all this, you can bet that I will just build yours!


----------



## homebrewed

Hi Graham,

A lot to unpack in your comments, so I apologize in advance for (most likely) missing something.  Just to preface everything, the circuit I've designed (and will build up soon) really is just a shot across the bow.  I have built a myriad of circuits for all kinds of things, and quite a few didn't pan out at first, often because I didn't understand all the factors involved.  I have hopes that some signal processing can address some of the problems encountered along the way.  Also keep in mind that the whole idea behind this scheme is "cheap as possible to get the job done".

First, regarding the noise detection function, I know from experience that charge amp and electrometer setups and the like are extremely sensitive to vibration, mostly due to triboelectric effects.  Attempting to use your average coaxial cable in a  high-gain circuit is a sure way to get frustrated due to that problem.  It's possible that your average FR4 PCB is pretty bad w/regard to stress-related issues as well.  I'd just assume that is the case, given the fact that just about EVERYTHING seems to play a part when it comes to introducing noise into high-Z circuits.  I haven't seen noise issues in silicon devices due to vibration, but I can say for a fact that stress in the active devices in an integrated circuit can dramatically change their operational characteristics.  It blew one high-gain RSSI design right out of the water because that wasn't properly taken into account (I could swing the output by volts by simply pressing a microprobe down on top of one of the input transistors).  I didn't design it, I just got to figure out why it had serious problems.  However, in the situation of this particular sensor residing inside a lead-lined box, vibration shouldn't be a big issue -- I hope....

Regarding the input circuit, I've been interpreting it as a charge amplifier.  If so, the capacitor actually determines the gain:  if Q = CV, then V = Q/C.  A small C = large gain.  The feedback resistance is there to provide the bias/offset current, but does of course introduce a time constant as well.

I agree with burying part of that circuit now .  Certainly not useful for us, anyway!

About the reservations about the PIN diode's high capacitance.  Since the charge amp input is a virtual ground, all the voltage variation across the diode is internal to it, so, ideally, there shouldn't be any delta-V across the diode -- so it shouldn't play a part in the system's bandwidth.  That assumes an amplifier with infinite bandwidth so not precisely true.  But (hopefully) good enough.  Yet another open question.  I do like the approach of using a high bias voltage, mostly to reduce the diode's internal capacitance as much as possible.  Below breakdown, the leakage current is mostly due to thermal generation so it's not highly dependent on the bias voltage.  I agree that the PIN diode "gain" is far below what can be had with an APD or PMT.  THAT is one of the major unknowns which may skuttle this approach.  I'm hoping that a least-squares curve fitting approach will address some of the noise issues you are concerned about; but, if not, a step up in the amplifier technology will be needed.

Regarding the diode's sensitivity vs X-ray photon detection probability.  Not knowing what criteria the vendor is using to define "probability", it's hard to tell what it means in terms of energy resolution.  Yet again, another unknown.  I THINK it just indicates what the detector output is for a given X-ray photon.  So a slope is good.  Flatness = no energy resolution.  Maybe.  

Your thoughts about using the detector's capacitance variation are very interesting.  A pure capacitance is noiseless so that's pretty attractive. One potential issue I can see is that the voltage change necessary to swing that capacitance suggests some sort of resistive load -- and its thermal noise voltage will, in effect, modulate the voltage across the PIN diode.  Gotta think about this one some more.  I just thought about a capacitive load with a high-value resistor to sink the DC current, but will need to run some numbers to see if that's reasonable or not.  The capacitive load + drain resistor's time constant would have to be long enough to attenuate noise in the frequency range of interest.

Finally, about the gain-of-one buffer.  Yep, not so good w/regard to minimizing noise.  But I'm looking at the simulation results I got and thinking that ***maybe*** it's not a killer.  Maybe...

Oh, one more thing.  You were wondering about the 2x3 header.  It's just an on-board jumper setup to select the 1X, 10X or 100X signals.

If you want one of my boards, just let me know.  5 boards was the minimum quantity so I've got some extras.  I could probably mail one or two for just a few dollars.  That probably depends a lot on what kind of downstream data acquisition scheme you've got, but PM me if you're interested.


----------



## graham-xrf

*I'm learning PIN*
The photocurrent from a ~5KeV or ~10KeV contribution might not shift the PIN bias voltage enough to be useful to a oscillator shift. PIN diodes do not work like that. Below a certain frequency, they work like normal diodes. Above the frequency that the carriers in the depetion region have time to re-form, it acts like a variable RF resistor. That said, there are such things as PIN diode RF modulators and phase shifters. I think a PIN diode, while it does change capacitance with bias, is not like a varactor diode in an RF oscillator.

*The pre-amp is trans-impedance!*
When we look harder at the "no good" op-amp follower we have been so critical of, it might not be altogether a follower. Instead, the reverse biased diode may be leaking it's current into a 66M "perfect" resistor. The amplifier presents a low impedance load to the photodiode, forcing that what works it is the current. In effect, a transimpedance -6.6E+7 gain amplifier, driven by direct injection of XRF KeV inspired electrons + dark current + thermal noise into the inverting input.

The reverse bias signals that a PIN diode photodetector is operating in photoconductive mode, as opposed to photovoltaic.

With such a large gain, any OP-Amp input offset voltage will result in output offset. There are ways to deal with this. A few pF across the feedback resistor collapses the gain at frequencies which would have it become a powerful oscillator all by itself. That capacitor, along with the input capacitance provided across the diode (50pF - 150 pF) define the roll-off.  In this case, about 16Hz to 48Hz. Given that the recombination time of carriers in the PIN layer is about 5uS to 10uS, it is still the wrong design. A lower gain first stage, to get the roll-off around 100KHz to 300KHz or even 500kHz would be better. The gain, if need be, can be made up in the second stage.

*About microphonics*
The way to get past cable flex, substrate flex, and all other piezo voltages that can only live in a high impedance world is to not offer them a high impedance to live in - and chose the material. e.g. that thin PTFE coax is so active, it is used threaded through fences as intrusion detection microphones.

I don't think the stuff we are dealing with is necessarily intrinsically extreme impedance, like say, an electret microphone, but whatever it is, so long as it finds it's amplifier within as few mm as possible, gets some low noise transimpedance gain change , then microphonic effects won't have much chance. Better still, if it finds its way into becoming numbers within the next few mm, low frequency pulse noise of that kind has even less chance.
*
Camera X-Ray sensors?*
Another passing thought is - many image sensors use pinned photodiodes (PPD) CMOS sensors that matched and exceeded CCD sensors.
So - is it possible a cheap camera sensor can see X-Rays? After all, X-Rays would go straight through the color filters!
[OK - I just ask out of ignorance]! What happens if one waves a smoke-detector source, or a gas mantle right up to a web cam sensor?
I don't know if this can ever be true. I think X-Ray sensors need to have a certain thickness. We only got GaAs sensors when it became practicable to make the stuff pure, and thick enough without laying it on by diffusion epitaxy.

*SPICE?*
Meantime, it should be possible to find an equivalent circuit model for a PIN diode with a blob in it representing electrons contributing to the current from external KeV inputs, just like you can have for other injected carriers, or thermal noise sources. Note that in some circuits, we see a 1 GigaOhm across it, purely to avoid a SPICE circuit dividing by zero. This is much the same as orphaned capacitors in filter circuits with no DC path to GND. I can't find application notes on MX-100. Maybe we can find a similar thing among it's competition?

One wonders what is seen if an ordinary oscilloscope is connected to a reverse biased PIN diode (say MX-100)?


----------



## homebrewed

The cutoff frequency of the pocket geiger's input amp circuit is about 2.4KHz so the 1pf capacitor has a substantial impact on the pulse response.  Given the fast current pulse coming out of the detector, I think the circuit more resembles a charge amplifier.  The 66M resistor is there mostly to take care of the amplifier's bias current.  It is a which-is-it puzzle because TIAs also need a capacitor in the feedback loop so they don't oscillate.  The capacitance of the photodiode introduces a pole that (in the absence of a feedback capacitor) destabilizes the circuit.  So it depends on the bandwidth of the amplifier relative to the input signal BW if you call it a TIA or charge amplifier.

Since a charge amp acts like an integrator, the output pulse's peak amplitude is proportional to the total charge delivered to its input.  No need to numerically integrate the waveform coming out of one of these, the integration has already been done for you.

Here's an explanation of charge amplifiers:  charge amps.

I hadn't known about using PTFE coax as a kind of intrusion detector.  That's a pretty cool use for an effect most others want to get rid of, like taking a lemon and making lemonade.


----------



## graham-xrf

Hi Mark.
Thanks for the Hamamatsu article. I think it is one I already have. I should have looked first.

The Hamamatsu circuit, which is essentially the identical same circuit we are talking about, has a very complete analysis of the simple version circuit, and it is in all respects, the transimpedance amplifier, which (when not mistaken for a follower by me), is extremely well known and developed. Nearly all the Hamamatsu analysis can carry across to the more elaborate circuits.

The 66M resistor is not to take care of the amplifier's bias current. It is fundamental to the device gain, and is not usually 66M. The best JFET low noise devices have input resistances of 10^14 ohms. What happens with a charge amplifier is the input current onto the (very small) gate will have the voltage between the OP-Amp inputs attempt to change, resisted mightily by the enormous gain to make the output change enough to correct the situation via the feedback resistor (Rf) , and it has to move volts to do it. The gain is essentially the value of the resistor. The capacitor, values between 0.1pF and about 10pF, provides stability for the gain stage, with local roll-off decided by the capacitor and the Rf.

Then, when  the photodiode is added, it brings about a new roll-off, decided by the capacitor across Rf and the capacitance of the PIN diode.
The more usual value for the transimpedance stage gain is nearer 12M or 20M.

*First stage goodness*
It's two decades old technology, and costs a whole 5 bucks for one, but I like it, even with the added expense of a another Op-Amp to servo-stabilize the offset. *LT1793* input bias is 3pA, which is significant given it has a voltage gain more than 4 million. Noise is 0.8fA/√Hz, and low voltage noise is 6nV/√Hz.

*Pushing the limits!*
It is possible, at relatively low cost, to use a single low-noise JFET, put inside an OP-Amp feedback loop, and have a charge amp that will uncompromisingly force something that approaches the limit of theoretical noise performance. In the circuit attached, it uses a *IFN147* JFET, which is extreme, but there are many other low cost JFETs that would do instead. That circuit is from the Analog Devices (Linear Technology) collection. The gain-bandwidth product is high enough (2.4GHz) to deliver near 4.8MHz bandwidth at gain 500K. Having this available allows all sorts of roll-offs, compensations, pulse damping, and refinements. One could, of course, just use a 200Hz roll-off, and go for 12M gain in one hit, but I would not be inclined to. To get enough gain in one device, and a bandwidth more than about 200Hz, this is what you need. Having a Gain-Bandwidth product of (say) 500MHz, would likely require another stage.

Now that I have searched, I am astonished at the sheer number of published variants of this circuit! Many have servo-controlled anti-drift arrangements. *LT1793* (without extra JFET) can be had on standard 2 x single Op-Amp evaluation kits (we don't need them). On some of the circuits, one has to add bias, since it is not a photovoltaic type.
Easy to be overwhelmed by simply entering "Photodiode Amplifier" into Google, and look for Images.

In the near ultimate JFET input circuit, there is no real need to expend on two kinds of op-amp. Finding a dual JFET OP-Amp will do, and you can take your pick over gain-bandwidth product. I may opt for something beginning with "LT" simply because we are likely to find the model in the *LTSpiceVII* simulation store.

One can also get fully compensated photodiode charge amps with additional stage gains, compensations, etc, in the same package as A/D converter(s).  That's found in Analog.com. I have not yet checked if the prices would make eyes water, but it might be a one-device-does-all thing that only need digital numbers to be sampled by SDI.

Enjoy the --> Photodiode Circuit Design Wizard

There is a --> How-To article from Digi-Key

There are, of course, lots more articles, and YouTube videos, but I think that if we can hang together a nice diode model, we have all we need to completely handle this thing. We are pretty much overwhelmed by choice. There are some pitfalls - like having to be aware that ESD protected products can have the input bias current run away with temperature sensitivity, which is something the LT products have addressed. We can still stumble, but I feel a whole lot better about this part of the design, and I am perusing the possibilities of amp + A/D conversion one-chip stuff.


----------



## graham-xrf

This YT video is very clear, and very good.
--> Photodiode/Transimpedance Amplifier Design





It makes me think we need to cover the diode with kitchen foil.


----------



## homebrewed

The pocketgeiger simulation I have put together suggests that the first amplifier is basically acting like an integrator -- i.e., a charge amp.  Here's how I came to that conclusion:

The input current pulse is a triangle, with a peak current of 100nA, lasting 100ns.  This is a total charge of 5E-15 coulomb.  The output of a perfect integrator obeys the relationship Q = CV, or V = Q/C.  When C = 1e-12, we find that V = 5mV.  The simulation predicts a delta-v of 4.17mV on the output of the LMC662.  On the other hand, 66E6*100e-9 = 6.6 volts.  Either the opamp's nonideal bandwidth is turning the circuit into a fairly decent resemblance to a charge amp, or the feedback capacitor is.  Probably some of both.

You've found some good reference material -- thanks for the info!  I haven't looked at the YT video you found, but, FYI, there *is* a copper foil shield around the detector.  It may be necessary to remove it so it doesn't filter out the XRF-generated photons, but the whole board will be inside a lead shield anyway.

The schematic of the IFN147 application shows a cute way to null the DC component in the input.  It took me a moment or two to figure out that the bottom amplifier is a non-inverting integrator, after that I knew what it was doing.

Hands-on work on this thing is going slowly right now because I'm working on a barn rehab project and trying to get it into reasonable shape before the winter rains come.  I'll probably pour at least one concrete footing today.  Today's high will be around 70F (21C),  perfect for pouring concrete.


----------



## graham-xrf

I truly wish I was at a concrete pouring stage. The outside work got stalled shortly after I won the "Battle of Ye Olde Tree Stump". Everything else just does not go as well as I would like, and takes longer than I thought. I have quite a lot of house internal stuff still to be done. We have had about a month's worth of rain in a few days, and it's steadily getting colder, between 10C (50F) and 14C (57F). We are into October. Next month, the heating will kick in, if not before. Halloween usually sees frost out back.

Do check out the YT video. It makes the whole thing we are doing abundantly clear.

Another thing I have figured out is that amid some noise, an incoming energy will make a difference of some kind, usually a lump taking 4uS to 12uS to be over with. If this charge is grabbed by a slow enough amplifier, it becomes an integrator. Whether we use a local peak detector to capture it to measure at leisure, , or sample it to bits and roll in the software, does not much matter, so long as it looks bigger for a more energetic photon.

Provided the rise and decay of the energy in the detector is not too much modified by local filtering storage in the electronics, there is some value in thinking that the height of the pulse, and to some extent the area under it correlates with the energy of the photon. The re-combination time of the carriers in the diode does have information. We need some program smarts to dump pulses that crashed each other.

I have found a Op-Amp available as both 2-channel and 4-channel (3 to 5 bucks) that can be the transimpedance charge amp, gain stage, offset regulator, and maybe peak detector all in one. There are certainly other nice ones. So many out there!

The integrated photodiode amplifiers, some including the photo-diodes, with all the built-in digitals, are all many channels monsters, used for those medical imaging tomagraphy X-Ray detection array things. I think we may end up with at least these..

1) A 4-parts Op-Amp, perhaps with extra FET
2) An A/D conversion.
3) Some kind of back-end arrangement to get the numbers away into a small computer, unless the serial data can be taken direct from the A/D conversion IC.

It would need a small, low power uP down there if something like a USB cable is used to get the info into a smartphone. The latter is quite appealing to many who would like a gadget that does it's stuff using a phone.

Other fall-out is possibly needing some good substrate PCB, or using lacquer on regular FR4, and a guard ring around the input to take up surface currents to GND instead if to the charge input. With input resistance between 100Giga and 450Giga-Ohms, the whole circuit has to be seen as a kind of variable conductive soup. This is how you would measure the resistance of insulators!
FR4, though not exactly short-circuit, is maybe not insulating enough in this league. but maybe can be made so.

There has to be every effort to keep the output screened away from the input, preferably sampled into digits as soon as possible. This gadget has a gain so high, it will make us pay if we ignore the size of the low-frequency pickup loop we make with circuit conductors. Like an open oscilloscope probe being waved about, it will let you see the 50/60 Hz mains wiring in your house if you don't take care of it.

The digital signal return current has to be resistor limited. We can't have the hard-won input be jerked around by powerful serial pulses common mode noise. Easy stuff - but we have to anticipate it.

Having a "clean" power supply may best be done by having the critical instrumentation stuff powered from a little cell battery - like in the YT video.
This is all extremely low current stuff. A cheap 2032 Lithium cell, or two, may be all that is needed. If power is to be taken from the mother kit, then it needs isolation, local capacitor storage, low noise regulators fast enough to control out the racket, and other design care. I admit it is nice to be "USB-powered", but in this case, the instrumentation may be better served by a little battery.

The serial data route can be powered from the receiving gadget, be it phone, Raspberry Pi, Arduino, whatever. It should touch with only a single star point at the A/D converter, and with as much isolation as can be contrived. An opto-coupled A/D  would be good.

I think that whatever the value seen in exploiting the audio channels A/D as a "cheap A/D already there" could be hopelessly lost it trying to get an analogue signal up a cable to the 192K music input. Exact instrumentation, even if low-cost, is, I think, too precious to be risked in that way.
I allow that others may just love using the audio channels, and I take into consideration that there may be lots of ready-made software out there.

My MX-100 has not arrived yet. When I have it, I suppose I might give it a few minutes hooked to a scope, and be shown some Am241, but from then on, it's only the diode that I want. I have not abandoned my PMT. Its a juicy goodie, and everything it has to do is known from past decades. It can hardly "not work" except in the physical arrangements around it. For the present, however, I wanted to stay more in sync with your developing kit. Honestly, it may be approaching Christmas before I truly get attempting any signals measured in a part-proto.


----------



## homebrewed

graham-xrf said:


> Other fall-out is possibly needing some good substrate PCB, or using lacquer on regular FR4, and a guard ring around the input to take up surface currents to GND instead if to the charge input. With input resistance between 100Giga and 450Giga-Ohms, the whole circuit has to be seen as a kind of variable conductive soup. This is how you would measure the resistance of insulators!
> FR4, though not exactly short-circuit, is maybe not insulating enough in this league. but maybe can be made so.



I've done some PCB designs using guard rings.  It gets a little hairy because, although guard rings are recommended by very knowledgeable app engineers at Analog Devices, LTC and the like, the package pin-outs don't lend themselves to it.  I really hate the idea of routing traces _between_ package pins, just seems like a recipe for ending up with shorts where you don't want them.  Instead, I've done things like lifting sensitive pins and soldering components to them.  Dry air is quite resistive .  Not a production-worthy approach, but this project ain't destined for that anyway.

Oh, regarding the issue of dealing with pulse pile-up.  I've been thinking that the second-order peak-fitting approach might handle that.  Well, actually, the squared error between the data and polynomial.  A second pulse hiding underneath the main pulse will screw up the fit; so if the squared error exceeds some threshold, it has been "contaminated" by a second pulse.  Or excess noise.  Either one is grounds to reject that pulse.


----------



## graham-xrf

homebrewed said:


> I've done some PCB designs using guard rings.  It gets a little hairy because, although guard rings are recommended by very knowledgeable app engineers at Analog Devices, LTC and the like, the package pin-outs don't lend themselves to it.  I really hate the idea of routing traces _between_ package pins, just seems like a recipe for ending up with shorts where you don't want them.  Instead, I've done things like lifting sensitive pins and soldering components to them.  Dry air is quite resistive .  Not a production-worthy approach, but this project ain't destined for that anyway.


Ahh .. yes. Taken to it's logical extreme, turn the DIP or SO8 upside down, super-glued to the board. I think it is called "Dead Bug" construction.  Staying right way up, and lifting one pin to a little wire that finds a ring is OK. That said, I think there is just about enough room to do this on SO8 style sizes.



I am a bit purist in having the ring around the pin only, with the only electrons arriving into it from the components directly connected, and even then, they may have to sneak in under a ground plane. Above, the guard ring is connected to the positive input. I have also seen guard rings that are "driven" from an active output.





The AD8552 is only there for a visual example, but on the way one spots that it is a "Zero Drift" thing supposedly competitive to auto-zero or chopper-stabilized amps. The little circuit with the extra JFET and anti-drift integrator, I think, would qualify for being "auto-zero". This one costs *£3.80 ($4.90)* from Mouser. 0.005uV/°C is quite good. 20pA bias, 700uA supply 2.7V operation. It would run off a 2032 cell, but we don't need to be mean with the pulse size. The more volts we have to sample after gain, the better. 1uV offset? It's interesting, so I attached the data sheet, but my point is, I think there is enough space between the pins, provided the SMD pads don't use it all up.


> Oh, regarding the issue of dealing with pulse pile-up.  I've been thinking that the second-order peak-fitting approach might handle that.  Well, actually, the squared error between the data and polynomial.  A second pulse hiding underneath the main pulse will screw up the fit; so if the squared error exceeds some threshold, it has been "contaminated" by a second pulse.  Or excess noise.  Either one is grounds to reject that pulse.


 Yes - agreed. If the pulse is out of range for calibrated energies, it gets rejected. If there is a very long duration pulse, with two peaks, it may be possible to use software to detect it, and use the peaks, but why bother? Even if two (smaller) pulses arrive together, are they going to add to spoof a valid (larger) pulse?  Even if they do, the bucket collection statistices will diminish the significance of the false positive. A pulse must look like a single energy event, so it needs also to fit in a time-frame, to weed out the arrive-nearly-togethers. The PyMCA and similar software may already do much of this.

I think, in principle, we may have just about got a handle this stuff!


----------



## graham-xrf

*Seebeck Voltages?*
You already mentioned unwanted voltages from flexing/piezo/vibration etc.

Umm.. On page 16/24 of the AD8552 data sheet, we get to address Seebeck (thermocouple) voltages from the junction of dissimilar metals, these being solder-to copper on board, and solder-to component lead. I thought that so long as one starts with copper, and ends with copper, any other metals in between would cancel (if at the same temperature). These folk use "dummy" components, to cancel the Seebeck voltages at the input!

This could be taking things a bit too far! I would hope we won't be needing stuff like this!


----------



## homebrewed

graham-xrf said:


> *Seebeck Voltages?*
> You already mentioned unwanted voltages from flexing/piezo/vibration etc.
> 
> Umm.. On page 16/24 of the AD8552 data sheet, we get to address Seebeck (thermocouple) voltages from the junction of dissimilar metals, these being solder-to copper on board, and solder-to component lead. I thought that so long as one starts with copper, and ends with copper, any other metals in between would cancel (if at the same temperature). These folk use "dummy" components, to cancel the Seebeck voltages at the input!
> 
> This could be taking things a bit too far! I would hope we won't be needing stuff like this!
> 
> View attachment 339429


I hope it won't be necessary, either!  This sort of thing would affect the baseline, but on a slow timescale compared to the pulses.   A calibration step using a few pure elements done just before you analyze your unknown would address a lot of generic thermal drift effects.  For instance, does the detector itself has an efficiency temperature coefficient?  I know that the mean free path of carriers has a temperature dependency (this directly affects avalanche breakdown).  Current carriers do have a finite lifetime, so the longer it takes for them to get to the anode or cathode, the fewer there are to contribute to the signal.  So I'd expect the efficiency to have at least a small dependency on temperature.  

BTW carrier lifetime is one reason for a high detector bias voltage, so the carriers are collected as quickly as possible.  Reducing the junction capacitance is another.


----------



## graham-xrf

Zero bias - i.e. operating entirely in photovoltaic mode would be nice, but as you say, the capacitance is so high the pulse gets lost in it, and not what one needs on a charge amplifier input. For us, it is a fine line compromise.

Looking at XRFSpec_ENG.pdf, I regret the inability to have Magnesium (1.25kEV), and Aluminium (1.48KeV), but we can hardly expect to be getting returns from the stuff we use because we know it it allows X-Rays to go right through. We know that we can stop the radiation with lead, so we can use it for shielding, but is that the same thing as not expecting a nice X-ray photon pinging out of it when slammed by a gamma photon? Whatever it does, the Pb excitation energy is 74.9KeV, with about a 2% chance of it getting a X100-7 excited!

I consider all the elements 22 through 30 as the very desirable minimum set. Titanium, Vanadium, Chromium, Manganese, Iron (obviously), Cobalt, Nickel, Copper, Zinc. At the poor end, we want to see 4.5KeV. At the other end, it's 8.6KeV. The graph is about probabilities of the incoming gamma proton to hit, and clearly the interior of Aluminium must be mostly empty space, because the chance seems to be about 2% to 3%.

Unfortunately, off the left side of the curve, the low probability ones (below about 4KeV)  are also the lighter ones that will deliver the least energy  X-Rays when they do get hit. I haven't figured it out yet, but suppose Aluminium delivers 3% of the time, but when it does, it provides a measurable signal. I just don't know if this is realistic. X100-7 is not claimed to do much below 5KeV, or above 100KeV.




*The Bias*
Moving on to bias. I am not sure why carrier lifetime is a problem. Is it so slow that the junction lets loads of hits go by?  I get it about the capacitance.
Fortunately, the graph scale for capacitance is no longer logarithmic, showing about 50pF at 30V bias.
The diminishing returns point happens at about 10V bias, with capacitance about 80pF.
For charge amp design, things are manageable up to about 200pF, (but one hopes for less)!

*The Dark Current*
Oh, the noise of it! Logarithmic scale and all. About 5nA for 30V bias, and 50pF.
At 6V bias, it is down to 1nA. The price of this is the capacitance is 100pF.
At 2V bias, the dark current is about 800fA, and we have reached the little plateau where the pips squeak, and the capacitance is about 140pF.




The stuff I don't yet know, but will be getting to soon, is how much bump we can expect from a 4.5KeV X-Ray, times the quantum efficiency of this gadget. If it is generously above 5nA, then bias away, no worries. If not, then we look to bias less.

Then I throw in the notion that, if one _can_ make the amplifier work OK with  80pF or 100pF across it's input, there is no need to find a 30V bias!
I like it if it can work off the same battery, without a 30V generator.

*1/f Low frequency Shot Noise*
Unfortunately, these can look like a wanted XRF target hit, and it gets worse, the lower the frequency we go. Learning how the internal offset auto-correction circuits, already built into the good op-amps, is a relief. They do not have exponentially increasing flicker noise at lower frequencies, because low frequency noise is treated as a slowly varying offset error.

I think my first lash-up is going to have the means to initially tweak the bias.


----------



## graham-xrf

*What can we expect to see?*

I suppose this is a question where @RJSakowski would know, but it is about what we can expect to detect.
So we have a detector where we can push our luck a bit so that it can see from about *2KeV* to *100KeV*, with unequal probabilities of it doing it's thing, as per the graph in post #376

We have Am241 as the first source. It decays 5.486MeV, 5.443MeV, and 5.388MeV alphas, which can't even get through a piece of paper, but are handy for detecting smoke particles. It does have a relatively feeble gamma output at *59.54KeV.*

So now we come to the materials. Looking at the Kα1 energies, we can see Tungsten (W) at 74, which glows at *59.318KeV*
So, it being that teeny bit less than the gamma, does that mean we get to detect Tungsten?
The next Tungsten state Kβ1 is *67.24KeV*, so cannot be excited by Am241.
But.. the Lα1 for Tungsten is only *8.397KeV*, and the Lβ1 is only *9.67KeV*

So my question is, does the incoming gamma energy have to first excite the "K-shell" states fully, before it gets to put excess into the "L-shell" states? Can a incoming gamma get glows from the (lower) energy L-shell states first?

I ask this because I can see something like Lead (Pb) No. 82, with K-electron states impossible to get excited by Am241, but with handy, detectable *10.55KeV* and *12.61KeV* responses from the L-electron states.

Besides  Lead (Pb), we have others, like Gold (Au) No.79. Pretty much all the elements can get their L-electron states hiked up by energies less than 18KeV, (which could come from Am241). I say that - but is that how it works? Do the lower energy transitions in the L-electron states happen first?

[The table is in XRFSpec_ENG.pdf, attached to the previous posting #376, just above this one]


----------



## homebrewed

graham-xrf said:


> *What can we expect to see?*
> 
> I suppose this is a question where @RJSakowski would know, but it is about what we can expect to detect.
> So we have a detector where we can push our luck a bit so that it can see from about *2KeV* to *100KeV*, with unequal probabilities of it doing it's thing, as per the graph in post #376
> 
> We have Am241 as the first source. It decays 5.486MeV, 5.443MeV, and 5.388MeV alphas, which can't even get through a piece of paper, but are handy for detecting smoke particles. It does have a relatively feeble gamma output at *59.54KeV.*
> 
> So now we come to the materials. Looking at the Kα1 energies, we can see Tungsten (W) at 74, which glows at *59.318KeV*
> So, it being that teeny bit less than the gamma, does that mean we get to detect Tungsten?
> The next Tungsten state Kβ1 is *67.24KeV*, so cannot be excited by Am241.
> But.. the Lα1 for Tungsten is only *8.397KeV*, and the Lβ1 is only *9.67KeV*
> 
> So my question is, does the incoming gamma energy have to first excite the "K-shell" states fully, before it gets to put excess into the "L-shell" states? Can a incoming gamma get glows from the (lower) energy L-shell states first?
> 
> I ask this because I can see something like Lead (Pb) No. 82, with K-electron states impossible to get excited by Am241, but with handy, detectable *10.55KeV* and *12.61KeV* responses from the L-electron states.
> 
> Besides  Lead (Pb), we have others, like Gold (Au) No.79. Pretty much all the elements can get their L-electron states hiked up by energies less than 18KeV, (which could come from Am241). I say that - but is that how it works? Do the lower energy transitions in the L-electron states happen first?
> 
> [The table is in XRFSpec_ENG.pdf, attached to the previous posting #376, just above this one]


XRF excitation:
I believe that all possible fluorescent wavelengths can be generated, as long as the incoming photon has sufficiently high energy to excite it.  IIRC, the Theremino blogs concerning their experiments indicate they are "seeing" L-alphas from some of the elements they played with.

Detector efficiency:
Detector efficiency vs. X-ray wavelength is also something that scintillators exhibit, so the real question is if lower efficiency is accompanied by a larger spread in the pulse energy distribution for a lower photon energy.  If it is weakly correlated, a set of known elemental references could be used to create a compensation curve.  If the sigma is strongly dependent on efficiency, well, that's a problem.  I suspect that the sigma at least has some dependency -- at least, for photons that are incompletely absorbed by the detector.  So let's look at the curve you show for efficiency vs photon energy in Kev's.  It starts out low, climbs to a maximum around 100% and then decreases.  In general, material absorptivity is inversely proportional to photon energy -- the more energetic, the lower the absorptivity.  That explains the decline above 10Kev.  Below 10Kev, I think the curve is dominated by absorption in the encapsulation material over the detector.  To put it another way, up to 10Kev, I think that photons which make it through the molding compound are completely absorbed by the detector.  That's a good thing when it comes to achieving the best statistics.  The varying attenuation of x-rays getting into the detector indicates that a good set of elemental references is highly desirable, but, based on my back-of-the-envelope hand-waving, yadayada, I don't expect a significant shift in pulse height sigma vs photon energy in the range of (our) interest.

1/F:
I was thinking that shot noise might be differentiated from a "real" pulse by its shape, but that won't be the case for the heavily filtered output of the pocket geiger's analog block.  That's where a wider bandwidth acquisition system could really shine, because photon-generated pulses would be pretty fast compared to 1/f noise.  I'm really hoping that 1/f noise isn't a big problem:  but, on the other hand, the pocket geiger comparator block has one that appears to be designed to detect noise.  It's all related to the amplitude of the pulse coming out of the analog circuit, so it ALSO might be possible to differentiate the two by the amplitude of the pulse.  I'd say that might be the case for some, perhaps most of the pulses -- but statistics being what they are, we're guaranteed that at least some of the noise pulses will look a lot like an x-ray photon.

Offset compensation:
My signal conditioning circuit uses a very simple offset compensation scheme -- a 10 turn trimmer.  Yet again going with the KISS principle when I can.....knowing that variations in the supplied VCC/VEE will directly affect the offset.  It's easy enough to address THAT particular design flaw.  I can see a V1.1 version of my circuit in the future .


----------



## graham-xrf

homebrewed said:


> XRF excitation:
> I believe that all possible fluorescent wavelengths can be generated, as long as the incoming photon has sufficiently high energy to excite it.  IIRC, the Theremino blogs concerning their experiments indicate they are "seeing" L-alphas from some of the elements they played with.


That is what I wanted to hear. The buckets with low probability samples won't be as full, but so long as they are consistent, the stuff is there, so in calibration the profile gets identified.


> 1/F:
> I was thinking that shot noise might be differentiated from a "real" pulse by its shape, but that won't be the case for the heavily filtered output of the pocket geiger's analog block.  That's where a wider bandwidth acquisition system could really shine, because photon-generated pulses would be pretty fast compared to 1/f noise.


 There is value in having the instrumentation bandwidth fast enough to capture the shape. It allows (us) to recognize the good ones.


> Offset compensation:
> My signal conditioning circuit uses a very simple offset compensation scheme -- a 10 turn trimmer.  Yet again going with the KISS principle when I can.....knowing that variations in the supplied VCC/VEE will directly affect the offset.  It's easy enough to address THAT particular design flaw.  I can see a V1.1 version of my circuit in the future .


I did that too - a long time ago. Pretty much all external offset compensation input circuits were a load of extra bits that needed a tweak far too often. Some types (like the original 741) had internal offset null circuits that could be fed from high precision stable resistors. I praised the day when op-amps got so good externals were not needed. My kit was military. It would get heated, and frozen, and shaken, and shocked, and vibrated to bits! I could never beat on-chip, laser-adjusted, temperature compensated ready-made offset adjust. There was never a time I needed to tweak the last nano-volt away. My goal was to have exact predictable circuit boards without any adjustments.

You get a bit messed when the design has gain circuits with programmable resistors. Watching software zip through a setup procedure to tweak the vector display for setting up a PAL colour TV camera is good fun. I get it that sometimes, one needs to adjust things.  That's not the same as adjusting away an offset that should not be there. For me, that was still not hardball uncompromising enough!

If we need to set a zero, or clamp to a reference, I would still look to some automatic way. Even my pH meter, that constantly needs to be dunked into this or that buffer solution, can irk me. Sure, dunk it, and push a CAL button. But when the instructions say, "now dunk in a different solution, and tweak a trimmer down a little hole in the plastic case", then I just want to throw it in a bin!


----------



## homebrewed

Military, aerospace, telecom, medical, ATE and automotive applications are all really demanding when it comes to circuit design requirements and/or reliability.  If you designed for any one of those, I'm not surprised that you abhor manual "tweaks".  Hard to do that inside a chest cavity anyway, the cost of the medical-grade screwdrivers is just a killer  .   OK, don't beat me too hard!

As for this application, I'm just trying to avoid feature creep before I even know if the basic approach is going to be good enough or not.  My signal conditioning board really isn't much of a step up from a jumper-wire-infested bread board so I know it's not "production ready" by any stretch of the imagination.  At this point I'm willing to live with some warts, even if they're big ones .


----------



## graham-xrf

homebrewed said:


> As for this application, I'm just trying to avoid feature creep before I even know if the basic approach is going to be good enough or not.  My signal conditioning board really isn't much of a step up from a jumper-wire-infested bread board so I know it's not "production ready" by any stretch of the imagination.  At this point I'm willing to live with some warts, even if they're big ones .


Agreed - and yes, the military design background has shaped my life. Even before that. it was aviation, which also had to be the best.
I had thought of adjustables as extras. If I could find an A/D with suitable op-amps on board, it would be lovely. No extra features here. Bonkers bare-bones leaves out the USB interface. I think the interface is perhaps a "feature" we need.

I was thinking only three main ICs besides the main sensor. Come to that, I am hoping your trawl that discovered the MX100 - 7 was reasonably extensive. Be sure that if we discover a $35 or $20 PIN diode example, then it gets considered. The three devices would be a quad op-amp, and a 16-bit A/D converter, and a tiny something, PIC, whatever, responsible for driving a USB connector, and obeying whatever the driving program asks. That would be one version.

I had thought a more expensive development version could  leave out the USB interface (so fractionally cheaper), and be driven directly from a (in my case) Raspberry Pi GPIO. It could be Arduino, or any other small thing that can at least wiggle the SDI stuff. The Pi delivers the OS, the computing, the screen display - everything! Hardware-wise, it's the cost of a Pi, + cooling fan heatsink, + screen, and all the bits that add up to a Pi-4 desktop, additional to the XRF front-end,

After consideration, I think one design only, with the high speed USB, is better. The program that works it from a Raspberry Pi can have a variant that runs in Android. I don't know how apps are done for iPhones. If you and I are the only ones doing this, then we don't much care. If it gets a wider liking, then it only stays attractive if it is one design, with the same basic program functions, though eventually implemented to suit some different phone OS.  This is how it becomes useful to many more folk.

If we get it going, just for ourselves, we can appeal to others to pitch in software interfaces for the various smartphones, and computers out there.
XRF identification kit is normally into the several $K. I have no idea how much HM members care about knowing what steel is in their lathe before they start. Maybe they already know, because they always bought it, and kept it marked. Who tries to use any bit of material in the junk box that happens to have enough volume? Me actually!

For the present, you and I can experiment. The diode was in the little Geiger counter pulser. Has anybody used it for XRF?


----------



## homebrewed

graham-xrf said:


> For the present, you and I can experiment. The diode was in the little Geiger counter pulser. Has anybody used it for XRF?



I found two blog posts on the physicsopenlab web site that feature experimental results with silicon PIN diodes and XRF.  This one features a Hamamatsu S1223 photodiode and circuitry based on a couple of demo boards from TI.  They used Americium-241 x-ray emissions to test the system's response.  I believe they used a sound-card based MCA to analyze the pulses. And here are their notes on using the X100-7, but in combination with a couple of off-the-shelf electronic modules for the analog signal processing.  They did not include schematics of the modules, nor did they describe how the X100-7 was biased.

In the latter post they state that the relatively high capacitance of the X100-7 makes it unsuitable for x-ray spectroscopy, but continue on to show results that say otherwise.  The S1223's junction C is 10pF vs. 40pF for the X100-7 (with bias applied).  I'm a bit skeptical about the assertion regarding the disadvantages of higher junction capacitance, because the input to the first-stage amplifier, whether you call it a CSA or TIA, is basically a virtual ground.  Zero voltage change across the diode capacitance = no current lost to charging the capacitance (for a theoretically-perfect amplifier anyway).  This being said, the "stiffness" of the bias supply then becomes important.  They show a 100M series R in the S1223 test circuit, but we don't know what the bias circuit looked like for their X100-7 circuit.  The pocketgeiger bias circuit places a 1uF capacitor on the input side of the detector so it should look pretty stiff relative to the short current pulses.  This is a good thing.  The bias network used for the S1223 is, in my opinion, not optimal.

Interestingly (and confirming my own hunch), they indicate that you want to use a high detector bias voltage in order to increase the depletion region width as much as possible -- to maximize the collection efficiency.  This also minimizes the junction capacitance, also good -- but at the cost of increased dark current.  I've been mulling over the idea of cooling the detector using a thermoelectric cooler stack to reduce thermally generated current, but the scheme has its drawbacks once the temperature drops below the dew point.  It would require a sealed chamber for the detector and dessicant (or a source of dry gas like CDA or N2), all for some as-yet-unknown degree of improvement in dark current.  And it would need a significant step-up in the complexity of the mechanical components in the detector system.  Temperature regulation and dark current offset compensation would be easier to implement.  I probably would still use a TE cooler, but the set point would only be a few degrees below ambient.

BTW, I just did a search to see who stocks the Hamamatsu part.  Newark has 'em for a bit over $10USD in single quantities.  I also found some on ebay, but (as usual) some of them are priced significantly higher than Newark.  Thorlabs has a model FDS1010 that is a 10x10mm detector, single quantity price is $55.73USD (not including shipping).  Its dark current is specified to be 600nA @ 5V, and its junction capacitance is very high compared to the X100-7.  Since its capacitance is so much higher but its area is the same, I don't think it is a PIN diode (and likely not a good candidate for XRF).  Their FDS100 photodiode looks comparable to the Hamamatsu, but costs a bit more (but larger in area compared to the S1223).  It is 13mm^2 in area, the same as the Hamamatsu S1223-01.

The disadvantage of using photodiodes is the necessity of keeping light out.  The optical window over the S1223  (and FDS100) also might be a bit problematic for lower-energy X-rays.   But for $10-15 a pop it might be worth experimenting with ways to remove the window.  A mill with a CNC setup makes it easy.  We had a CNC'd Sherline mini mill at work that worked like a champ for this kind of thing.  It only took about a dozen lines of g code to move a small end mill in a circular path -- but now that I'm retired I don't have access to the Sherline any longer.


----------



## graham-xrf

We need not worry about keeping light out of any good (meaning low cost) candidate. cover in 35um Al kitchen foil should work! The aluminum pot down the middle of the PMT scintillator is much thicker than that!
[I still like your suggestion of putting a lead disc down there, and force it to only collect sideways scatter]!

I have been trawling. e.g. -->HERE
It's a small thing, for less than a buck .. BUT .. it links all over the place to circuits.
--> CCT HERE

It's actually a Fairchild thing (so from the past). A good read about capacitance, and sensitivity and noise trade-offs, and a waveform.
I am not done with this, but am called away. I will get back sometime today.


----------



## graham-xrf

*Re: A/D converter cost, and other passing stuff*

Not in detail (yet), but I am interested in what you would think appropriate for the A/D cost.
I have been selecting from Linear Tech / Analog Devices, and I was punting for something between $7 and $20, with much attempt to keep it below $14.

There are some temptations to Linear Technology devices because they seem lower cost, are good stuff, and we get the simulation models, but I am considering all I can find. We can use devices generally up to 10MS/sec in that price range.

Trading off bandwidth, and other factors while selecting, I consider the pulse duration, and the reasonable bandwidth we need to sample it. I know that happens with PMTs. We can expect pulse widths of 3uS to maybe 10 uS. From the fastest risetimes and spectral content, I multiply by 2.8 to get a crude minimum estimate (loosely applying Shannon), and then add some. Taking (say) 20 samples out of a 3uS pulse is sampling at 6.6Ms/sec  It sets the upper reasonable limit at about 10Msps. There are excellent and affordable A/D at 2Ms/sec, but these could only get a coarse shape representation, say about 6 samples out of the very fastest pulse decays.

PIN diodes go slower .. I think.
Maybe not OK for a PMT, but is a PIN diode is a good deal slower, then we are probably OK for A/D costs.

We can use slower A/D (500kHz) if we filter the hell out of the pulse blob first, but we lose level, and energy information. Everything I have tried about "pulse stretching" shows that the stretched pulse amplitude and duration is still somewhat related to the energy that caused it, but is at a much lower level, and is a distorted version, this done only to still have something to offer to lower speed (audio) samplers.

I don't know what the *PIN* diode response time and carrier recombination times would be. Still trawling that!
I sneak out a hint from the first minute of  --> *HERE* from about 0:28 to about 0:42, with the info at* 0:36* revealing that the RD2014 device does 40uS to 150uS, depending on energy level.




Something that slow could be sampled accurately at 500kHz, and easily allows S/N ratios beyond 88dB or maybe 92dB if an affordable 1MS/Sec A/D was used. I would prefer that the back end be good, even for PMTs, and that is still actually affordable, but perhaps you want to do something different. I take into account that this is a thresholded Schmidt-triggered style TTL around the real pulse.

Still hazy - what exactly reads the A/D, and exactly how does it ship the measurements to the main computing and display platform?
Low power PIC? Power for the interface, and the digital power pin for the A/D can be taken from the USB. Only the instrumentation amplifier, and the A/D reference end need use a battery. i.e. isolated.

It occurs to me that a *Raspberry Pi Zero* is £4.80 and has the ready made USB to get at something with a screen. The W version with *WiFi* and *BlueTooth* on board is about *$10*, and has enough hit to do all the computing too. The amplifiers and A/D board can live direct connected to the GPIO. It also has built-in USB for the option of hooking to a laptop or phone or other PC by cable. That little 5 bucks computer has 1080p HDMI video on board as well. One micro-USB is a power connector, and the other USB is for keyboard/mouse or whatever you want.

I imagine a $5 Pi-zero version, taking it's power from the USB lead. That may be too much to ask of a phone. Another concept has it using it's own 5V power supply adapter - a USB charger would do. All sorts of ways this could go. For the present, I am not sold on anything. I might just use the Pi-4 I already have, for now.

In any event, do we have a shot at keeping the components to under $100?
Would that be likely OK for for folk who might want to attempt this?
I am thinking here that folk who do play can dream up all sorts of their own physical/mechanical screened measure box stuff, with one of these in the back of it.


----------



## homebrewed

I've got the feeling that the Fairchild PIN diode wouldn't work for our application -- further down in the Maxim app note they mention that the 60Kev gamma is near the bottom of the diode's detection range.  Milling off some of the molding compound might improve the situation.  The discussion on minimizing the noise contribution is good info.

I hadn't found the RD2014 in my online searching.  I note that the intro portion of the video mentioned a different model, I believe it was an RD2007, that is sensitive to lower-energy photons -- and that is the realm we are interested in. 

The frames showing the detector specifications indicates that the pulse width (not height) depends on the photon energy, so the MCA S/W would be different compared to the Theremino's pulse height discrimination.  If the pulse width is proportional to the photon energy, why mess with an A/D?  Gate a fast clock and send it to a counter chain.

Regarding your comment on using aluminum foil to block light, black paint might be a better choice if the pigment is carbon black (or an organic dye).  Carbon's absorptivity @10Kev is about 1/5 that of aluminum.  However, plain old black paint won't provide electrostatic shielding.  I don't know if aquadag would go on heavy enough to block all the light, but if it does it could serve as an electrostatic shield, too.  Or perhaps a double layer coating,  aquadag on top of black paint?  Or an electroless silver layer?  A light-tight box?

I haven't found anyone on ebay (or anywhere else) that is offering RD2014 or RD2007 detectors.  Mikroe sells a radiation detector based on the BG51 from Teviso (called the "Mikroe radiation click", Digikey has 'em for $134), but that particular detector's energy range doesn't go low enough.  The Teviso AL53 would be better suited but so far I haven't found anyone selling them.  Teviso doesn't have an online store so you'd need to contact their sales department to see if they'd sell us any.  I bet they cost at least as much as the X100-7, since their part is a module with electronics in it.


----------



## graham-xrf

We are OK to just keep an eye out for detectors. *X100 - 7* will do for now. It's big enough that even if we find some other goodie, it can still likely be arranged to "fit". I just keep seeing various photodiodes ID numbers in papers and literature that, given the date of the publications, makes them very old. I check, and yet I find they are still available. eg Microsemi's glass axial leaded *UM9441*  can be had from Mouser for $*108.81* (not that we ever want this thing). It delivers photo-currents in typically 6mA in 10nS from 2.5MeV Flash X-Ray, and the spec sheet test condition was 10^6 rads(Si)/sec.

To some extent, we just have to build it and test to see what it does. While my *SPICE* simulation is coming together OK, I don't theorize it to death before building. I do just enough to get some idea of response speed, noise, etc. so as to choose the nice parts, and explore various candidate circuits, and get through the major decisions to give the proto a fair chance.

*Gain?*
I am hoping a fixed gain would be OK, but I do like your selectable gain feature.
Anyway, it prompts that I at least try for a first-order guess at the signal range needed. When huge dynamic range is needed, I usually go dB logarithmic.  but I don't think anything like that is needed for this. When signals will range over several orders of magnitude, the electronics does not care. It's only us humans that need dBs.

My point is, if there is need for switching gains, then log compression amplifiers are the automatic way to do it. Given the range *2KeV to 60KeV*, I am thinking we don't need programmable gain. we only need the "right" gain. I get it that not all of the incoming energy turns into photo-current. Some gets lost heating up the package and leads, carbon black paint, whatever. One hopes the absorption probability curve for X100 - 7 is right. It scrapes 100% at some energies.



> The frames showing the detector specifications indicates that the pulse width (not height) depends on the photon energy, so the MCA S/W would be different compared to the Theremino's pulse height discrimination.  If the pulse width is proportional to the photon energy, why mess with an A/D?  Gate a fast clock and send it to a counter chain.


Hmm.. OK , even before I get my SPICE model finished, let us address this.
I think that when a photon arrives at a PIN diode, it _will_ put energy into a TIA gain stage.
That comes as a current. It _will_ cause a amplifier voltage to "go up".

I think what you are saying is the X100 - 7 has a specification behaviour whereby the energy absorbed delivers a current pulse related to the charge in a way that current rises to a value, and then stays at that value for a time, then drops away. Yes it does, but every description I have seen does not feature a plateau in the current waveform. Maybe X100 - 7 really does that, but that does not mean we ignore the amplitude.
Perhaps point me to the frames showing detector specifications that show this.

There are many circuits that, if sufficiently filtered, bandwidth limited, integrating, non-linear, whatever, can turn the transient into something with a flat top and of longer duration. The "pulse-stretcher" idea even depends on it.

*What we measure*
For us, we know that the voltage we measure is an analogue of the current pulse. It represents the rise and decay of what the photon delivered into the depletion region. The energy in the pulse is the integral of the current x time. The energy we want to measure is, as I am understanding it, accurately proportional to the _area under the curve_ of the pulse.

*Getting at the energy (accurately)*
If we want a number to put in a bucket, we don't just try for the pulse maximum, nor do we just  measure a duration.
Instead, we add up all the values of all the valid samples of the pulse duration. That represents the energy.

The "duration" is when the measure was above a threshold caused by the dark current.
If a value is "unrealistic", or a duration too long, it can be weeded out, or simply put in a bucket anyway, and let itself be seen as statistically unlikely. Either way, it gets recognized!

Even if we offset the majority of the dark current out of the measure before A/D, we need the dark number subtracted anyway.

*PIN Diode Model*
So far as I can tell, the equivalent circuit model for the PIN diode is the same as for a regular Si photodiode (for visible light). In PIN diodes, the undoped "I" region is still devoid of carriers when reverse biased. It's just that it is thick enough that incoming photons don't just go straight through without stopping. I am still getting myself sure of the model.

I know we have a high impedance charge amplifier. It has to be that way because the charge is tiny, but I don't treat it as a high impedance situation at the TIA input. The 40M resistance is not in series with the charge source. It is a _shunt_ resistance. The diode is presented with what looks like a near ideal zero impedance load. The op-amp does not allow it's inputs to develop volts between them. All the charge current goes into the freedback resistor, and the op-amp obligingly makes its output  voltage exactly what it needs to be to accept this current.

From the Hamamatsu chapter2




You can see from equation (1) that the wanted charge current I*L* has to be seen as a change in the face of an existing diode dark current I*D* and I'
A version of this is what drives my SPICE simulation. 

If the M100 - 7 delivery of energy back from the diode is a flat top duration-type pulse as the intrinsic region gives up its carriers and becomes depleted again, then so be it, but that makes the "pulse" unlike most others I have seen in what I have read. I am keeping in mind that this is PIN diode XRF, not PMT electron tube pulses. I don't think it matters, so long as we count the energy. I am not too keen on assuming we only need count a duration.


----------



## homebrewed

graham-xrf said:


> If the M100 - 7 delivery of energy back from the diode is a flat top duration-type pulse as the intrinsic region gives up its carriers and becomes depleted again, then so be it, but that makes the "pulse" unlike most others I have seen in what I have read. I am keeping in mind that this is PIN diode XRF, not PMT electron tube pulses. I don't think it matters, so long as we count the energy. I am not too keen on assuming we only need count a duration.



Sorry if I wasn't all that clear.  I was looking at the youtube video frames that showed the RD2014 specifications, not the X100-7.  The spec indicates that the pulse height coming out of the module is a TTL level signal whose width varies according to the photon energy.  I expect the analog signal going into the pocketgeiger's comparators to exhibit pulse height variations w/respect to photon energy.

Out of curiosity I took a look at the UM9441.  The spec sheet doesn't indicate the diode area, and the package type doesn't really lend itself to detecting lower-energy X-rays.  So I think we have been spared the need to spend $108 more on this project.

Regarding your simulation work, you will likely need to make some guesses on some of the parameters.  The X100-7 spec sheet gives you the diode area and capacitance.  The saturation current Is can be derived from the dark current vs. Vr curve, and they actually give you the shunt resistance (40Mohms).  The forward resistance is the biggest unknown.  If you have a SPICE model for a different PIN diode and know (or can derive) the area of the diode you might be able to scale Rs accordingly.  The most straightforward approach would be to make the (rash?) assumption that the two diode's dark currents only differ because their areas are different.  This because the saturation current in the standard diode model is proportional to the area of the diode.  So by using yet another rash assumption, that Rs only depends on the area, wallah.


----------



## graham-xrf

Ah --ha. I gotta say good morning. It has to be near 08:00 where you are. It's getting on 16:00 here. I have just come back in from a tree-pulling scene. The rest of the trees and rooted shrubs came out with a chain and a tug from a short wheelbase 4WD Land Rover Defender. One, which is not even a proper tree, refused. It's going to take some digging and/or the tractor and a bigger chain! The outbuilding area is now clear. Farmer G said I should put the building where I want to, then we place the boundary to suit the regulations, and agree it. Nice neighbor!

OK on the flat level pulse. So it was a TTL thresholded thing, with duration somewhat related to the energy. I feel better now!

Re: the X100 - 7 dark current. We are OK on that, because the measured values are in the data sheet plot. It depends on the bias, and my model allows to vary the bias, which is a quite important parameter.

The shunt resistance is 40M, which for the kit we are using, may be considered (low). That one is a major noise contributor.

On the forward resistance, we don't care. It is going to have reverse bias anyway.

*The bias*
One option is to have it operate at a tiny reverse bias, and big 350pF capacitance. Reverse bias between there, and about -30V is the range, and somewhere in there is the sweet spot. Choosing (say) 2V lets the gadget operate from one 3.3V 2032 Li cell. OK , make it two cells, and go for 5V or 6V. Perhaps we need to stand the cost of a micropower regulator, but I am hoping we can "borrow" the precision clean band-gap reference from the A/D, isolate it and use it for the bias. Anything else needs more components.

I decided we need not tangle with the 20fA electrometer grade ADA4530-1, with the built-in internal driven guard rings, low gain-bandwidth product (2MHz)  and £19-20 price tag. It's noise is greater than some cheaper chips anyway.

I am still perusing candidates, like LTC6240 (LTC6241 and 6242 also). The industrial (to 85°C) quad version is £4.77, or £2.72 if you buy 25.
There are others, like AD8615 at £1.71/1 or £1.53/25
I think I am OK with a 5 bucks chip for the gain and buffering, and maybe in a quad version, can do differential drive of the ADC.
If we get lucky, this kit is a 2-chip thing + the sensor. It needs another "something", and a bunch of software to have the "USB to any phone" feature.

Also mulling over various circuits, but not much longer.

[Early morning, unless of course, you are on MT. I thought yours was Pacific time]


----------



## graham-xrf

X100 - 7 data sheet does not mention quantum efficiency. Without that, it's kind of hard to get at how much photo-current happens when an incoming photon hits. I am assuming we would have the occasional hit, making a pulse, however many per second, instead of an "illumination intensity".

The low probability hits may not happen as often, but when they do, they deliver the energy. The probability curve is not something that affects amplitudes.


----------



## graham-xrf

I have been messing with it a bit, and trawling circuits and parts costs.
A first feel for the beginnings - the first TIA stage.

*Gain-Bandwidth Product.*
It turns out that this is very important. The photon-generated carriers make a pulse that first has amplitude that depends in the PIN diode capacitance. The shape is the same, but smaller if the capacitance is high. To get lower capacitance, you have to wind up the bias, which brings on the noise. There is a compromise to be found.

To get the very high gain, while still preserving the pulse shape information, one needs to use high bandwidth amplifiers, or split the task over several stages. Using Rf =10M in the first stage is not so good, because even a very fast op-amp would deliver a very slugged pulse shape. This does not prevent may designs out there to have the diode bias isolated by using capacitive DC blocking, and very high Rf in a first op-amp with GBW way too low, with too much phase lag, and several pF across the feedback resistor. The resulting pulse smudge is then only vaguely related to the original energy, and has lost it's bottom reference, so now subject to the pulse swinging back below it's start point. Charging the DC blocking capacitor much modifies the shape.  Yuk!

It turns out that there are many low cost op-amps with pA bias, and tiny offset that can go at 10MHz GBW, or 500MHz GBW, usually costing £2 to £5 each. Having op-amps with (say) 10M GBW to deliver a nice pulse shape in 4uS can only stand a gain of 20. We try to put as much gain as possible in the first stage, consistent with having enough bandwidth to keep the approximate pulse shape. This gets the best S/N ratio.

*The value of Cf (here called C2) is important!*
The capacitor across the feedback resistor. It decides the first frequency roll-of, and controls the peaking (overshoot) and stability.
Even with a high bandwidth precision amplifier, the effect is striking.

Here is a (passing) example. Note: it is unlikely to be in the final circuit!
The condition is a 20nA peak diode event current. Reverse bias was set to about -6V, to get a relatively unwelcome 100pF. I have not put in the noise generator yet. V3 is just a zero volts source, to let me measure the input current. The LTC6269 is way too expensive at about $12, but that does not matter for what I am exploring. We use something else in the end.




The green trace is an approximation to the 20nA pulse. The several output traces are for C2 from 0.25pF to 2pF in steps. I fumble a bit. The steps are 0.5pF, starting at 0.25pF. You can also see the constant lift from the dark current. You have to imagine that will be a noisy line. The capacitor that best suits seems to be the *0.5pF*, which I guess would be two 1pF in series, to help with the stray board capacitance. Time shifted, and scaled, the slopes reasonably track the pulse shape.

It is in fact handy to have the "low" 470K resistor there. To get this 500kHz bandwidth takes amplifiers with 500MHz GBW, so gain down to 1 at 350MHz. We do this example in 2 stages, but I don't yet know how much we need.
We can do one like this, but with different op-amps, some tricks to the bias, etc. The diode model is still coming together.

*Maxim's Radiation Detector*
The PDF is attached. I say at the outset that I consider it to be a *#@z! poor design! It does, however give some insights. As much as 10M for the first stage gain, with a whole 4.7pF, and the op-amp has GBW 10MHz.  The first gain of 10milliion via ac-coupled 10nF would imply the bandwidth is 1Hz (do I get that wrong?), but beyond that there follows three stages of gain = 10.

So the total gain in that, for some low frequency, would be 10million x 1000. That is a ten billion voltage gain of 200dB ! The smudge of the waveform in Figure 2 has everything I hate, including the classic negative lurch. In the text, they suggest replacing C1 with a digitally trimmable MAX1474 to have gain adjustment (Huh?).  There are more mistakes. eg. "A 60keV gamma from Am241 is close to the circuit's noise floor". Hmm maybe it is with their diode. They suggest R2 could be much larger than the 10M (wow!). I think all they want is a comparator pulse to signal something happened!

Now you can see why I think you and I could design these guys into the dust! Ten billion gain to end up with just over 100mV of nudge means something is wrong! Even my half a circuit has 1.5V output. I could have used a 2nA pulse, or 500pA and still done better.

I am going to try out Analog's TIA designer, if only because it has pretty plots with noise in them.

ADS and AWR Microwave office had noise generators, but they were on a "work" computer. I found an excellent article on how to trick LTSpice into making noise generators.


----------



## homebrewed

I finally got around to turning on my pocket geiger board to take a look at its analog signal.  Looking at the board vs. schematic, I was becoming suspicious that the connections to JP2 did not agree, so I needed to fire it up and make some measurements.  It turns out they do NOT agree.  The board swaps P2 and P4!  If you look at the bottom of the board, the pad marked with an "A" is the analog signal; and the pad opposite it is ground.

Since I had the board running, I decided to get out one of my Americium smoke-detector capsules to see what kind of pulses I'd get out of the thing.  I clamped the board in a Panavise with the detector facing down, then slid the Am241 source underneath.  The copper foil shield was left in place so I'd (hopefully) see at least a few fluorescence photons.  BTW this isn't an ideal configuration -- the only XRF photons I'd detect are the ones emitted on the exit side of the copper foil, from the somewhat-attenuated 60Kev primaries, PLUS some primaries (and reduced pulse height because the detector's response rolls off above 10Kev).  I'm assuming the copper will strongly absorb its own 8Kev XRF photons & that's why only ones emitted near the exit side will be detected.  Anyway, here are some photos showing a few pulses I captured using a DS212 mini-scope:






BTW, the count rate was quite low, maybe a few CPS....hopefully due to the nonideal test setup I used.  It's encouraging that the time scale agrees with my simulations.  The noise level is concerning to me though.  I also occasionally observed some very large negative transients, possibly popcorn noise.  I did not see any large positive transients.

I did buy 6 AM241 capsules so if the count rate really IS this low I can bump it up by using more, similar to what the Theremino folks did.


----------



## homebrewed

The largest-amplitude pulse I showed probably is not due to copper XRF or the Am241.  It's either background/cosmic rays or popcorn noise, because those pulses show up with no Am241 nearby.  When I remove the americium, the lower-amplitude pulses pretty much vanish.

Now it's time to work on a setup with some proper geometry.  I'm not going to even think about the MCA portion until I can get a decent physical setup.  I have some lead sheet for shielding and some punches to create an aperture for the XRF photons to enter (and to shield ME from the 60Kev primaries).  I will probably cut away the copper foil that's over the detector and replace it with aluminum foil, to reduce the attenuation of lower energy X-rays.

I wish there was a way to employ pulse averaging to improve the SNR, but since they can't be classified apriori that's not possible.  The best approach probably is to use least-squares curve fitting on each pulse.  I HAVE seen a few instances of what looks like pulse pileup, so -- hopefully -- the RMS error between the polynomial fit and pulse will serve as a way to reject excessive pileup.  I'll have to examine the Arduino code I found for polynomial curve fitting to see if the error is computed at the same time or not.


----------



## graham-xrf

Yay! Something actually bumps it! I do like your pictures! 

Try not to worry about the low amplitude, and come to that, not even the noise. We can get it to where what (our) kit can see to the noise floor. Significant that when the Am241 is not there, the smaller pulses go away. The detector is built to count, not to get to linear accurate pulse analysis info. I am glad that the pulse does at least have the same shape as my simulation assumption.

When you say "copper shield left in place", is that to hit it with Am241 from one side, and have the XRF from copper come out the other side?

I know this sounds nuts, but try uncovering the sensor and showing it a banana.

My sensor has not arrived yet. The whole import thing from the USA is odd. I can get everything from Sharpie pens to router cutters from China in the mail in a few days. The baggies have the standard Chinese customs form stuck on them. The whole business from the USA is needlessly expensive, and delayed, with no arrangement to get it to the door without some sort of exchange and payment to bring it from wherever it landed, by some carrier, even if it was the Royal Mail.

Regarding pulses, pulse pile-ups, noise, signal processing etc. Lesson 1 is we are not going to get very far with Analog's photodiode design "wizard". I get it that it is supposed to be used to recommend their products, but the circuit options are stupidly limited. I do not want a fixed choice about gains, filters, number of stages, etc.

*Higher Education*
Staring from a sensor, and a photon energy, and getting to a current pulse is actually not so easy. Incoming keV photons will be in the range 5keV to 10keV with highest probability, and probably 0.5keV to 60keV in all. Any others might be more direct stuff, scatter from cosmic ray excitation, and generally radioactive stuff around, like wine, or the strontium in the bones in your fingers. I never knew before that a simple radiation check of a wine can date it quite accurately, and that wine made before the 1950's nuke tests is simply not radioactive from fallout, and pretty much everything that grew after those test - just is.

Incoming photons whack into the Silicon. Is it Silicon? I think it has to be. The only other candidates are Germanium and Gallium Arsenide. They work over higher energies, and Silicon is the only one that has the correct dark current range corresponding to out X100 - 7. The energy pings loose an electron. The work function of all the metals is generally less than 6eV, so a 5keV hit will have most left over as a deflected photon, and go on to liberate more electrons. That's a bit of an over-simplification. Sometimes less is left over, and the liberated electron flies off with some high kinetic energy, and can dislodge electrons of its own. In the end, all are absorbed, and the electrons collected by the field from the bias, with a rise time, and a tail-off. A 5keV photon should liberate at least 800 electrons.

That is depressingly small, and may be less that we can see in the face of other noise. Loosely, if half of them the pulse rise-time of 500nS, the current involved is about 128pA. The input current for the op-amp is 3pA. It sits on top of a 1500pA dark current, which can be cancelled by offset adjustment. There is a noise hash which at 6.1E1-14 A/√Hz. At 500KHz bandwidth, that's 30nA, but as a peak-to peak.

If we accept the slowdown, and narrow the bandwidth, we can lose a lot of noise, but now I am feeling I made a calculation mistake.
If the makers of X100 - 7 were able to make a plot down to 600pA dark current, and claim 5keV was detectable, then we should be able to see it too!

The AREA under my pulse curve represents the electron charge knocked loose. In all this, I am trying to get at a realistic  peak value of Ip, the photodiode current.

On the way, I go through selected lectures from the absolute expert Professor at an Indian University. --> HERE
Lecture #40 gets close to what we do.

None of the energies get as far as Compton scattering or electron-positron pair formation and annihilation - thankfully.

Basically we get 5000 to 10,000 electrons appearing in a 100pF capacitance being discharged by a 40M ohm resistance. The trouble is, the mere presence of electrons is not actually a current. I know current is supposed to be a "flow" of electron charge in a time, but that's the point. Electron flow is about 2 to 3 cm per hour in copper and an electron can take a week to get around a circuit. Also, they never go through capacitors. The charge transfer is different. At near light speed.

*Do it backwards*
Let's first start with your 200mV to 600mV pulses. Then work back through the circuit to get at the Ip that caused it.

*Capacitor AC coupled.*
It can bring all sorts of problems, but is convenient to get bias onto the sensor without upsetting the charge amp. My simulations show exactly the same pulse, un-shifted, AC coupled or not.

Anyway, one justification I have seen for AC coupling into differentiator circuits was to "separate" other pulses that may happen during the trailing tail of a pulse. Edge detection like that may be good for circuits dedicated to getting simple count rates captured with a threshold comparator, but in our case, I think it loses the amplitude information, which for us is the only grip we have on what it's origin was. There may be some programming trick by which multiple pulses during a tail decline can still be analyzed, subtracting the right amounts before putting them in the correct bucket, but I think it is simpler to just reject them.

*The "right" gain.*
I think enough so that the A/D maxes out it's range a bit beyond the highest energy we expect from XRF, say 60keV. We can have a "zoom in" gain, mode, to analyze lower height pulses, and a lower gain setting in case we want to check out the direct radiation coming from isotopes (like the banana). Possibly some XRF identification can happen from seeing materials directly, instead of set glowing by Am241. Cobalt in an alloy might have a direct signature. Anyway,  programmable gain ranges sounds useful. Is this "feature creep"?

Potassium 40 (bananas) does MeV beta decay, but no gamma, so useless for XRF, but your sensor might see it!


----------



## homebrewed

graham-xrf said:


> Yay! Something actually bumps it! I do like your pictures!
> 
> Try not to worry about the low amplitude, and come to that, not even the noise. We can get it to where what (our) kit can see to the noise floor. Significant that when the Am241 is not there, the smaller pulses go away. The detector is built to count, not to get to linear accurate pulse analysis info. I am glad that the pulse does at least have the same shape as my simulation assumption.
> 
> When you say "copper shield left in place", is that to hit it with Am241 from one side, and have the XRF from copper come out the other side?
> 
> I know this sounds nuts, but try uncovering the sensor and showing it a banana.
> 
> My sensor has not arrived yet. The whole import thing from the USA is odd. I can get everything from Sharpie pens to router cutters from China in the mail in a few days. The baggies have the standard Chinese customs form stuck on them. The whole business from the USA is needlessly expensive, and delayed, with no arrangement to get it to the door without some sort of exchange and payment to bring it from wherever it landed, by some carrier, even if it was the Royal Mail.
> 
> Regarding pulses, pulse pile-ups, noise, signal processing etc. Lesson 1 is we are not going to get very far with Analog's photodiode design "wizard". I get it that it is supposed to be used to recommend their products, but the circuit options are stupidly limited. I do not want a fixed choice about gains, filters, number of stages, etc.
> 
> *Higher Education*
> Staring from a sensor, and a photon energy, and getting to a current pulse is actually not so easy. Incoming keV photons will be in the range 5keV to 10keV with highest probability, and probably 0.5keV to 60keV in all. Any others might be more direct stuff, scatter from cosmic ray excitation, and generally radioactive stuff around, like wine, or the strontium in the bones in your fingers. I never knew before that a simple radiation check of a wine can date it quite accurately, and that wine made before the 1950's nuke tests is simply not radioactive from fallout, and pretty much everything that grew after those test - just is.
> 
> Incoming photons whack into the Silicon. Is it Silicon? I think it has to be. The only other candidates are Germanium and Gallium Arsenide. They work over higher energies, and Silicon is the only one that has the correct dark current range corresponding to out X100 - 7. The energy pings loose an electron. The work function of all the metals is generally less than 6eV, so a 5keV hit will have most left over as a deflected photon, and go on to liberate more electrons. That's a bit of an over-simplification. Sometimes less is left over, and the liberated electron flies off with some high kinetic energy, and can dislodge electrons of its own. In the end, all are absorbed, and the electrons collected by the field from the bias, with a rise time, and a tail-off. A 5keV photon should liberate at least 800 electrons.
> 
> That is depressingly small, and may be less that we can see in the face of other noise. Loosely, if half of them the pulse rise-time of 500nS, the current involved is about 128pA. The input current for the op-amp is 3pA. It sits on top of a 1500pA dark current, which can be cancelled by offset adjustment. There is a noise hash which at 6.1E1-14 A/√Hz. At 500KHz bandwidth, that's 30nA, but as a peak-to peak.
> 
> If we accept the slowdown, and narrow the bandwidth, we can lose a lot of noise, but now I am feeling I made a calculation mistake.
> If the makers of X100 - 7 were able to make a plot down to 600pA dark current, and claim 5keV was detectable, then we should be able to see it too!
> 
> The AREA under my pulse curve represents the electron charge knocked loose. In all this, I am trying to get at a realistic  peak value of Ip, the photodiode current.
> 
> On the way, I go through selected lectures from the absolute expert Professor at an Indian University. --> HERE
> Lecture #40 gets close to what we do.
> 
> None of the energies get as far as Compton scattering or electron-positron pair formation and annihilation - thankfully.
> 
> Basically we get 5000 to 10,000 electrons appearing in a 100pF capacitance being discharged by a 40M ohm resistance. The trouble is, the mere presence of electrons is not actually a current. I know current is supposed to be a "flow" of electron charge in a time, but that's the point. Electron flow is about 2 to 3 cm per hour in copper and an electron can take a week to get around a circuit. Also, they never go through capacitors. The charge transfer is different. At near light speed.
> 
> *Do it backwards*
> Let's first start with your 200mV to 600mV pulses. Then work back through the circuit to get at the Ip that caused it.
> 
> *Capacitor AC coupled.*
> It can bring all sorts of problems, but is convenient to get bias onto the sensor without upsetting the charge amp. My simulations show exactly the same pulse, un-shifted, AC coupled or not.
> 
> Anyway, one justification I have seen for AC coupling into differentiator circuits was to "separate" other pulses that may happen during the trailing tail of a pulse. Edge detection like that may be good for circuits dedicated to getting simple count rates captured with a threshold comparator, but in our case, I think it loses the amplitude information, which for us is the only grip we have on what it's origin was. There may be some programming trick by which multiple pulses during a tail decline can still be analyzed, subtracting the right amounts before putting them in the correct bucket, but I think it is simpler to just reject them.
> 
> *The "right" gain.*
> I think enough so that the A/D maxes out it's range a bit beyond the highest energy we expect from XRF, say 60keV. We can have a "zoom in" gain, mode, to analyze lower height pulses, and a lower gain setting in case we want to check out the direct radiation coming from isotopes (like the banana). Possibly some XRF identification can happen from seeing materials directly, instead of set glowing by Am241. Cobalt in an alloy might have a direct signature. Anyway,  programmable gain ranges sounds useful. Is this "feature creep"?
> 
> Potassium 40 (bananas) does MeV beta decay, but no gamma, so useless for XRF, but your sensor might see it!
> 
> View attachment 340489


A lot of good comments. So in (approximate) order of questions/comments --

Yes, the first test had the 60Kev gammas enter on one side and the copper XRF photons exit on the other.  When we x-rayed IC packages, 60Kev was about the lowest we could go and get decent images through the molding compound and silicon chip itself so they will be strongly absorbed by the copper foil.

I happen to have some potassium chloride solution for storing pH meter sensors and had thought of exposing the detector to the bottle, so I immediately got the banana reference .

Yes, the detector just about has to be silicon-based.  Regarding the yield of carriers per photon, I think the threshold difference between the noise comparator and signal comparator could be used as a rough guide to the magnitude of "real" current pulse coming out of the detector.  Or just compare the actual pulse height coming out of the pocket geiger vs. the simulated result and scale the current pulse in the simulation accordingly.  So I'm on the same page as you w/regard to working backward to see what the detector really is putting out.

The comparison to the velocity of carriers in a metal is not relevant to a semiconductor.  For lightly-doped silicon, the mobility of electrons and holes is around 1000 cm^2/(volt-second).  Sounds pretty slow, but the junction width is pretty small!

Regarding your simulations and AC coupling (or not):  I see the same thing.  According to the Theremino docs, they're really concerned about preserving the baseline -- and that's why they use that pole compensation network along with the differentiator.  Their approach is all about getting a really good measure of the peak height, so it's important to establish a good baseline.  I'd thought of some sort of reset circuit to force a known baseline (after a good pulse comes through), but, again, it's something that needs some preliminary results to see what we really need to do in order to get decent data.  Software can come in handy here as well, to provide an averaged and quiet baseline voltage.

I think just simply rejecting overlapping pulses is best, at least for now.  Trying to de-convolve data in order to resolve the individual pulses is not something I want to try -- at least, not at first.  If we end with a couple of reasonably stable test platforms then we can test different ideas in order to improve the resolution.


----------



## graham-xrf

So far as I can see in the simulations, when the diode is the "right" way around, we get the nice pulse, with the stable baseline that corresponds to the dark current. In theory,  turned the other way up, it should be able to put electrons into GND, and make the signal at the op-amp go the other way, but the sim does not work like that. I don't yet know why.

That way up, when AC coupled, we get the pulse with the daft baseline. It goes up to a (sort of) peak, drops down _below_ the point it started, and then drifts back up to a point almost half up the total size of the peak.

Turning it back to the "nice pulse" direction, I think the amplified output from the dark current is actually useful. We can apply some offset at one of the later stages to shift most of it away, but we see the photon current poke up out of it. Add the thermal noise, and it expands into a "noise band".
That's OK. The level between pulses is what we want. I can limit the bandwidth to clean up the noise, to make the trace look cleaner. That would reduce the variation in the sampled numbers the A/D sampler will give.

I m also doing the trawl for a good low cost A/D that has a built-in band-gap reference, 16 true bits.
Adding the A/D is not, to my mind, "a feature creep".
If the pulse baseline wanders about for any reason, it's going to get clamped, like a old-style composite video.

- - - -- - - - - - - - - - - - - 
I am now spending most daytime setting out for the hardstand land dig, and working on "essential" internal (boring) DIY.

Using USA units approximations, the debate for width is 10ft..? Hmm 11ft..? er  OK.. 12ft..? Gulp! Hmm!
One of the HM members says something like, "You can't have too many tools, nor a shed that's too big"!
5m long.  That's 16.4ft.
A 16' x 12', less the wall thickness, would probably be considered "small" by many, but for me, that much is a big deal!


----------



## homebrewed

graham-xrf said:


> I m also doing the trawl for a good low cost A/D that has a built-in band-gap reference, 16 true bits.



When I bought the SMT components for my signal-conditioning board I also got an LTC2378 to play with.  It's a SAR style 16 bit ADC and goes up to 1MSPS.  Its SNR is pretty good, claimed to be 97 dB -- close to theoretical for 16 bits.  For some reason many ADC's don't include a built-in Vref circuit.  Of course, Linear Tech has plenty of reference generator parts.  The data sheet for the ADC shows a "typical" application using an LTC6655 Vref generator.  The ADC cost me $31.37.  The LTC6655 isn't all that cheap, surprisingly enough -- $9.13.  These are Digikey single-item prices.

To minimize package size and pin count, ADCs like this one use high speed SPI....so for a 1MSPS sample rate you'd need a clock that at least runs at 16MHz.  Actually faster, to handle the extra bits needed for the chip address and R/W bits.  

I also have looked at higher-end ADCs that are used for digitizing audio but they have all sorts of features that are overkill for this kind of thing, like 24 bits, different data-framing options and so on.  I thought I'd try to keep the ADC (and therefore programming) as simple as possible.

One nice thing about the Teensy's SOC is that it supports DMA so the processor doesn't have to deal with the overhead.  You can set it up for a circular buffer so you can do things like capturing pre-trigger data.  I don't know how easy it is to set up an RPi's GPIO subsystem for DMA, although it's likely that it IS possible.  In a perfect open-source world there's someone out there who has already done it, eh?


----------



## graham-xrf

When given a heatsink, and a USB3 SSD, the Raspberry Pi4 is a reasonable desktop computer in it's own right. When given over to single task instrumentation code, it can go as fast as most things want to. I am pretty sure one can have a continuously running buffer loop snatching whole registers. One can also have software running fast enough to control the  A/D for a data transfer, serial or otherwise, while the A/D is building it's next sample. Pipelined is just fine!
For speed, this one is order of magnitude faster than Thermino. How fast does Teensy go? It may be way more than enough!

I have a set of 1MHz, 2MHz, to 10MHz candidates in my notes.

It says things like AD4000      2M   93.0dB       £21.67  ($28.17)  or £11.09  ($14.42 ) in the MSOP pack sans pins
_                            LTC2380     2M   96.2dB       £35.99  ($46.79)  (don't want to go there!)
_                            AD7890     1M    91.5dB       £15.53    ($20.19)
_                      LTC2310-16     2M   82.0dB        £14.67   ($19.07)

There are some affordable 10M parts. I am staying resolutely at 16 bits.
None of the above is decided.

Aside from making the sampling reach to the noise floor, my reason for wanting built-in analog side powered bandgap reference was to use it (or something derived from it), for the diode bias, and for any offsets inputs. The digitals side can use the computer power, and only meet the A/D part at one place inside the A/D chip. I would be looking to have it that the energy for getting the digitals communicated did not share a return current path in any way that could bounce the analogs, especially the parts trying to gather pico-amps. If not opto-isolated, then at least with enough resistance in the digital leads to limit that energy, consistent with keeping the pulses slightly sharper than sine waves.

I have not thought through the digital comms yet. High speed serial is not what SPI and the like is good at.
LVDS  goes at the kind of speeds and low power that I like. Indeed, transferring a whole 16 bits register in a parallel chunk can be done, but I have used serial for a long time now. There has to be some sort of buffer, so the A/D can keep clocking regardless, possibly policed by the computer to have it snatch and deliver only proper, compete pulses.

Using a dedicated high speed sample/hold can accurately capture the peak. If in calibration, the peak value can represent the energy in the rest of the pulse well enough to be able to identify it as separate, the data gathering can be simpler. I don't want to build a fractionally better Thermino. (Strictly speaking, Thermino is only the general purpose display device, free, but not open source).

We will have more complete circuits to discuss soon. If the cost of stuff, including sensor,  can be kept to under about $120, I would feel almost cheerful about it!
The thing is, we are trying for a modicum of quality. Use fewer bits, and a tiny diode, and a Geiger-type amp, compromise it all in an audio lead to a mic channel, and we get something that I think would be difficult to make work right. Ahh well.. I still have a scintillator that twinkles - I think.


----------



## homebrewed

graham-xrf said:


> For speed, this one is order of magnitude faster than Thermino. How fast does Teensy go? It may be way more than enough!



The Teensy4.0 runs at 600MHz and has 512K of on-chip RAM that is used for buffering peripheral I/O; and apparently the DMA channel(s) can access the RAM at 1/4th the system clock rate, i.e., 150MHz.  There are two RAM blocks and the other is used for programming so I/O doesn't compete with code execution.  The data sheet for its MCU shows that a number of device pins can be configured as LVDS I/O, as well.  However, I didn't find much on the pjrc.com forum regarding a successful use of LVDS I/O.  DMA can be used in combination with the serial I/O subsystem -- I believe that is how the PJRC audio codec board is used. 

Apparently, the default register assignments for the Teensy4 are not set up for doing parallel 16 bit reads (or writes).  But I did find some info in this thread that suggests it can be done, at least for 12 bits.  No idea if LVDS functionality could be added in addition to this:  but the Teensy4 only has 23 digital I/O's connected to the headers so there aren't enough pins for LVDS anyway.

So it looks like the teensy won't work for 16 bit parallel LVDS I/O.  But if the lines are short and have proper impedance matching I'd think that single-ended I/O could go up to at least 10MSPS (the SPI clock for the PJRC audio codec runs at 30MHz).  

For anything much faster I'd start looking at an FPGA solution.  But I really don't want to go there -- I don't know Verilog that well, so that would turn into a real bootstrapping kind of project.  For now I'm just going to try using the Teensy's 12 bit 1MSPS on-chip ADC and see how that works out.  There already is a library for using the ADCs so that makes things a bit simpler.  I hope.....


----------



## graham-xrf

Re: SparkFun --> Pretty much _snafu._
For SEN-14209 $69.95 + $5.19 shipping and handling = $75.14.
No arrangement to pre-pay customs charge, so apparently +£18.97 => +$24.79 extra.
So total is £99.93, but that is the least of it.

I had repeatedly (3 times) tried to get Sparkfun to fix the misspelled first letter of my name, and they assured me that they would do it right away.
I checked, and it seems I succeeded. My correct name and address is there - 3 times repeated. Their system does not edit replace. It deletes and creates a new extra.

All this did not prevent them sending it with the wrong name. That causes an identity problem when it arrives, and it is time to pay customs and delivery charges online to get it delivered. The name must match the name on the card or the payment systems will never accept.  To (maybe) fix this I have to come out of isolation, travel to Alton, and try to extract the package from the mail depot, in person.

I do not know how the fees are comprised. I get stuff from China, and other places, Ukraine even, rather easier. They come with a customs sticker indicating prepaid. Regardless the charges, these traders seem to have it all set up. *eBay* may be a bit special, with standardized schemes to help traders. I am not sure about SparkFun. Are they Canadian?

We can try and make everything about the kit we are trying to make be relatively low cost - except, it seems, the photodiode!


----------



## homebrewed

graham-xrf said:


> Re: SparkFun --> Pretty much _snafu._
> For SEN-14209 $69.95 + $5.19 shipping and handling = $75.14.
> No arrangement to pre-pay customs charge, so apparently +£18.97 => +$24.79 extra.
> So total is £99.93, but that is the least of it.
> 
> I had repeatedly (3 times) tried to get Sparkfun to fix the misspelled first letter of my name, and they assured me that they would do it right away.
> I checked, and it seems I succeeded. My correct name and address is there - 3 times repeated. Their system does not edit replace. It deletes and creates a new extra.
> 
> All this did not prevent them sending it with the wrong name. That causes an identity problem when it arrives, and it is time to pay customs and delivery charges online to get it delivered. The name must match the name on the card or the payment systems will never accept.  To (maybe) fix this I have to come out of isolation, travel to Alton, and try to extract the package from the mail depot, in person.
> 
> I do not know how the fees are comprised. I get stuff from China, and other places, Ukraine even, rather easier. They come with a customs sticker indicating prepaid. Regardless the charges, these traders seem to have it all set up. *eBay* may be a bit special, with standardized schemes to help traders. I am not sure about SparkFun. Are they Canadian?
> 
> We can try and make everything about the kit we are trying to make be relatively low cost - except, it seems, the photodiode!


Ouch!  I'm sorry to learn about your problem -- rather surprising, overall.  I wouldn't have expected Sparkfun to be so inept when it comes to shipping stuff outside of the US.  BTW, Sparkfun is located in Colorado.

I found a European electronics distributor called Swatee Electronics selling them, but for about 2X what Mouser wants for them.


----------



## graham-xrf

That's OK - I expect I will have hold of it eventually, and it is probably the only one I would ever want. I do still have the PMT to play with.
We stay with it, though, even for USA folk, it is the largest cost chunk, proportionately, of all the bits (so far). We may revise that idea when it comes to the costs of the physical constructions of what goes around the AM241 stuff, and how the radiation lands on some steel offered. You wanted some lead bits in there too!

Keeping an eye out for other silicon PIN diodes of reasonable area, (betrayed by their capacitance), is something we should do. As I understand it, one needs more than simple area. The other thing needed is thickness, so that the photon actually gets absorbed instead pf passing right through. Diffusion thickness PIN diodes could reasonably easily be made. Getting up a thick enough epitaxial layer, that was pure enough was apparently uneconomic by slow diffusion. The technology moved on, and purer silicon and GaAs became available. Larger area diodes with the required absorption characteristics are still a very minority thing - but maybe we can get lucky. All the amplifier circuits and software can stay pretty much the same.

I did stumble a bit on the simulations. A perfectly well formed exponential rise pulse looks OK at 100nA, but starts to look a weird mess at 2nA.

I have to be reasonably convinced a build is going to work, and very definitely, it has to get actually built and the hell wrung out of it before I would expect anyone else to run with it on my say-so. When I do get hold of it, it's going to be winter breadboard time. I will be getting in some A/D converter stuff, probably one that uses SDA to command transfer of full 8 or 16 bits parallel at a time into GPIO. That will be at the A/D speed maxed out. Probably enough to get, (at the fastest), about 20 samples out of a 4uS complete event. It means about  200kHz to 500kHz bandwidth amplifier, and  2Msps to 5Msps A/D converter. The actual events would likely be slower. If we were counting detected "pulses", it would be Hz, to maybe a few hundred Hz, or some few kHz, but when they happen, we hopefully know their energy.

What we have is between about 5,000 and 60,000 electrons building up in a "pulse", being spread into a capacitance of between 50pF and 300pF, (depending on reverse bias), while at the same time being "leaked away" by a 40Meg ohms noisy resistance, and some few pA into (or out of) the charge amp . That little tickle of electrons in and out, onto the (tiny) junction of the TIA amp, provokes a feedback current to force the voltage between the inputs to zero. The feedback current, through the feedback resistance around the op-amp, gives us the first stage TIA gain.

In your vision of the gadget, do you have any preferences as to what batteries it carries? My notion is to have some button cells, or small batteries, enough to work the sensitive front end. It would be convenient if that also provided the bias, which can be between 2V to 10V. I thought the "back-end", A/D current, and data transfers could be powered from the receiving computing device.
- - - - - - - - - - - - - - - --  - - - -
My machine "fun" stuff is more or less mothballed for the present.. The profiles for the outhouse/shop/hideout are going up. If I get very cheeky, I can nudge it to (in USA units) _*18' x 12'*_. I may have to settle for *16' x 10'*, but I am perishing the thought!
It's odd, but who would have thought that an extra 2ft would seem like acres!

I see some of the other shops folk have on HM. Compared to what I hope for, even maxed out as hard as I can push my luck with it, they seem gargantuan!


----------



## homebrewed

I found some papers discussing the use of silicon photovoltaic cells as x-ray detectors but it wasn't obvious if their output is proportional to the x-ray photon energy.  The other "minor" issue is that solar cells are BIG, so their capacitance and dark current would be huge by comparison to the X100-7. 

I have done some comparisons between the X100-7 and silicon photodetectors offered by Thorlabs and Roithner and the one parameter that jumps out is the capacitance/mm^2 for them all.  The X100-7 has much lower capacitance, roughly .85pF/mm^2 vs about 4pF/mm^2 for the others.  This suggests that the intrinsic region in the X100-7 is much wider compared to standard PIN photodetectors, so they may not work very well for us as proportional x-ray detectors.  Oh well....

Regarding your question regarding battery operation, that's way out on my development horizon.  I'd just design or buy components that use relatively little power so it would be relatively easy to drop in a LiPO power pack and linears/switchers as needed to generate the needed voltages.  The pocketgeiger is a good example of using a boost switcher to generate the voltages needed to bias the detector and run the amplifiers/comparators (but at this point we don't know if it's quiet enough for our needs, eh?).


----------



## graham-xrf

Interesting about the capacitance/mm^2.  As a feature, I read that opposite to you, in that I think it to be a good thing.
It lets you know that the intrinsic region is thicker, hence the lower capacitance/mm^2.
The total capacitance is then made up back to (normal) or larger, only by more area.
The thicker layer brings more photons to a halt - is what I am thinking.

The supplied absorption probability plot lets us know that very near all in the range 5keV to 100keV are being collected, and perhaps enough of the remainder down to 1keV or 2keV to be useful.

I think what we gather is proportional to the energy. It just happens to be delivered as an awkwardly shaped pulse area. The amplitude is only nicely analogue to the energy if the pulse shape looked straight sided triangular with a constant duration length, which it does not! That said, there is enough "sort of triangle bump" in there to allow the "pulse stretcher" & peak detector approaches to make something that approximates more energetic photons arrival.



> I'd just design or buy components that use relatively little power so it would be relatively easy to drop in a LiPO power pack and linears/switchers as needed to generate the needed voltages.  The pocketgeiger is a good example of using a boost switcher to generate the voltages needed to bias the detector and run the amplifiers/comparators (but at this point we don't know if it's quiet enough for our needs, eh?


Normally, I also do exactly as you would, but when it comes to signals as low as less than 100,000 electrons, it gets difficult! The battery option was not available to me, and making correct bias tees with LDO regulators fast enough to fight line noise while also having their own band-gap references not contribute noise made the voltage supply circuits more elaborate than the amp. Chemical volts seemed clean by comparison.

I mostly attempted with pHEMt FET front ends at 8-15GHz, having noise at about 40K equivalent. S-Band FETs had noise at about 28K. Of course, a FET with 12dB gain at 10GHz is going to have unstable, unusable huge gain at 10MHz, and worse at audio, but the noise issue for our FETs is the same. Any resistive bits at all in the circuits before the first device gain hike would always raise the noise floor.

This is why I gave consideration to a cell-powered front end, and relegate anything with clocks, shifting bits etc, to not sharing it's noise by using a different power source, which can have regulators etc. The sensitive places are the TIA amp, and the bias voltage. The noise model is still coming together. If it indicates our noise contributions are less than the TIA and X100-7, then OK, we don't care anymore, but everything so far indicates that our amp would work well enough to be able to make the same plot as in the data sheet.

Here is a first partly assembled noise model using PWL approximation. (Try not to laugh)! It worked, but I have since abandoned it for a more direct way of making the PIN diode contribution, and for design purposes, we don't need most of the rest of it anyway. So it went down to something much simpler.




- - - - - -
So far, we are still having fun with the Royal Mail depot. This morning only open between 08:00 and 10:00, mostly accessed remotely via website, and a dysfunctional phone access options system. The COVID thing has made it kind of difficult. In person it shall be, or better, or if I can get to the postie (postman) when he visits our porch. He is a friend, and can likely help.

[Edit: Via my brother-in-law, who has more phone stamina than me. Success! Paid by card. Will be delivered Saturday. ]


----------



## homebrewed

graham-xrf said:


> Interesting about the capacitance/mm^2. As a feature, I read that opposite to you, in that I think it to be a good thing.
> It lets you know that the intrinsic region is thicker, hence the lower capacitance/mm^2.
> The total capacitance is then made up back to (normal) or larger, only by more area.
> The thicker layer brings more photons to a halt - is what I am thinking.



No, we're on the same page.  A wider depletion region = better for x-ray detection.  That's why I believe the photodiodes from Thorlabs & Roithner won't be as good as the X100-7 when it comes to x-ray detector efficiency.  

That's some diode model you came up with!  Does it slow down the simulations much?

I'm happy to learn that you have resolved your delivery problem, one issue resolved..


----------



## graham-xrf

There is a world of difference between having a mathematical equivalent and making LTSpice calculate it's way through a model subcircuit with a waveform transient. A Spice noise analysis provides a plot of the noise the easy way .

*The "hard" way.*
There are those folk who would generate a squiggly waveform of "noise" using a behavioral sources driven by RAND( ) and RANDOM( ) to make stuff like you see on the floor trace of a spectrum analyser. They even make filtered versions of pseudo-random bandwidth-limited noise, "white", "pink", you name it! To be fair, there are some analyses that need this. They are needed for spread-spectrum systems where the waveform looks like noise, but it isn't really random, and the data can be lifted clear of the noise if a coherent synced up pseudo-random local signal is used. Also for some modulation simulations. We definitely do not need them. In fact, for design, we hardly need any of the noise models in the previous posting anyway!

I don't do this..



*The "easy" way.*
Don't bother with the waveforms. SPICE noise analysis is just numbers. My one is from LTSpice doing its noise analysis from the known Nyquist or Johnson noise in a resistor from the molecules thermally bashing about in there. (OK - maybe wiggling about a bit)!

     Vnoise = √(4kTBR)   k = 1.380649E-23 Boltzmann's Constant
                                       T = Temperature K
                                       B=Bandwidth Hz
                                       R = Resistance Ohms

We choose 1nV/√Hz, so B=1.
We choose 300K. I normally use 290K, but 300K seems to be the "norm".
Solve for R, remembering that Vn^2 needs one to divide by 1e18 to get back to nV
We find a resistor *60.358* Ohms will deliver that *1nV/√Hz*

To turn that into any noise level we like, corresponding to what we see on the specification sheet, e.g the exceptional LSK389 from Linear Systems at 1.5nV/√Hz. Too expensive, and hard to get in UK, but anyway.. we use a Voltage-Controlled Voltage source, and put in 1.5 as the multiplier.




V1 AC 0 is just a dodge to persuade the .noise directive there is something making decades of frequencies for the plot.
The hit on computation time is just a blink. Simple and fast, and not even needed most of the time

Of course, this noise model is already built into the supplied op-amp device SPICE models from LinearTech and the like. I would only use it externally for things like FETs and X100-7's, and even then, not needed for design unless the need is to play dark current noise against signal, which we do, temporarily, have to check out.

*X100-7 noisies*
Saturated bias may give only 50pF from the PIN, but the dark current is 4nA.
6V bias gives about 100pF, with the dark current at about 2nA
100pF is still OK for TIA stability and bandwidth.

This is why I am trying so hard to get at how many nanoamps 5,000 or 100,000 electrons will provoke, if dumped in a pulse fashion into the capacitance and other stuff connected to it, this over a time 4uS to 10uS. The currents will be close to competing with the dark current. I still don't fully trust my figuring in that area, but it won't be long now, and most of my choices are already made. Hanging it together in proto form and getting some trial numbers snatched would have me cheering.

Of course, you have your own SparkFun toy, and your switched gain amp (which I might borrow), and a PCB. If you are slick with PCB layout, and you like mine, you can lay out what I test. Alternatively, I can do layout (a bit slowly) , and send you the manufacture files (Gerbers, whatever). Maybe there is a low cost small quantity supplier in UK, just like yours. I haven't researched that yet.

But that is looking ahead. Tomorrow we (hopefully) get the SparkFun thingie delivered. I may not even be able to play with it right away.


----------



## homebrewed

Unfortunately, the output of the pocketgeiger's first amplifier is not brought out to a test point, so I can't easily measure the DC voltage (in order to get a handle on the detectors actual dark current).  I think at some point I will have to replace the copper shield with thin aluminum foil, which will expose the LMC662 for doing some (careful) probing.

I looked up the LSK389 and its noise specs do look impressive.  Linear Systems doesn't have an online store, they want an RFQ (which I didn't submit).  When you say "expensive", what are we talking about?  I can imagine that their minimum quantity is large enough to put even a $1 part out of our reach.


----------



## graham-xrf

From memory, I think the price of the LSK389 would cost $4-67 each for SOIC 8L for 1000 pieces.
It gets to $6-70 each for the TO-71 6L package, also for 1000. They have also the LSK170
Ahh..Haa - I found this..
*https://audioxpress.com/news/linear-systems-reintroduces-lsk389-ultra-low-noise-n-channel-jfet*

They are much hyped, but are in fact a version of 2SK197 and its subsequent me-toos, revived from the previous century.
Mouser lists it as known, but not in their offerings.
Digi-Key also strikes out
Linear systems site does not offer them except by getting taking your details to get up an order for 1000+
Even if it could be had in singles, it needs to be something I can get in UK without a hassle
(I am not yet through importi in effect a single diode on a hobby board, treated as if it was a volatile military item!
When I then peek among more available JFETs, I find some with nearly similar performance.

If I need to use the FET-augmented circuit at all, those JFETs would have to be a tad more attractive to acquire and use.

I know I am peeking in deep at what, in the end, may turn out to be a minimalist, fairly low cost small circuit, but that's OK.


----------



## homebrewed

I scaled the current pulse so the simulated output of the pocketgeiger matched the real board, using one of its ~.4V output pulses as the target peak output.  Integrating the current pulse and dividing the total charge by 1.6E-19 indicates that the pulse comprises about 35,000 electrons.


----------



## graham-xrf

Mark - please run that by me again..
400mV amplitude pulses where? Do you work back through the gain to get the current pulse?

The work function for silicon is 4.6eV to 4.85eV.
If that is what it takes to knock every one of those electrons free to be gathered by the drift field.
.. and they all came from one photon starting out.

Hmm .. not sure.
Did it count a passing 161keV photon?
(It's late here - I may not be thinking clearly)!


----------



## homebrewed

graham-xrf said:


> Mark - please run that by me again..
> 400mV amplitude pulses where? Do you work back through the gain to get the current pulse?
> 
> The work function for silicon is 4.6eV to 4.85eV.
> If that is what it takes to knock every one of those electrons free to be gathered by the drift field.
> .. and they all came from one photon starting out.
> 
> Hmm .. not sure.
> Did it count a passing 161keV photon?
> (It's late here - I may not be thinking clearly)!


The 400mV pulses were coming out of the second linear amplifier.  To get the overall gain, I used the simulation results to calculate Vout/(charge in) and then back-calculated what input charge was necessary to get a 400mV pulse.

I chose the 400mV pulses as most-likely candidates because they disappeared when I removed the americium source.  The monster pulses still appeared.  I haven't tried my lead shielding to see how that affects things.  That's something I need to do anyway....

The absorption edge for silicon comes to about 1.2eV, which is about a 1.2um wavelength (this why silicon-based cameras crap out below about 1um). So its absorptivity isn't dictated by what's needed to knock an electron off into a vacuum, but what's needed to move carriers between a couple of energy bands, whose energy difference happens to be.....1.1eV!  

I confess to some confusion regarding how the X100-7 would respond to a 161keV photon -- at that energy, silicon should be pretty much transparent, but, on the other hand, the photon could generate a large number of carriers despite incomplete absorption.   The best approach may be an experimental one, to compare (say) zirconium and molybdenum, whose K-alpha lines are 15.478 and 17.43Kev respectively, and see how the pulse heights change.  Zr and Mo can be found on ebay for not a lot of money.


----------



## graham-xrf

Hmm - The thought that passes is that the circuit may be storing energy in low-pass filter mode, and delivering a pulse of longer duration than the integration deserved . This is not quite like "pulse stretcher", which at least seeks an amplitude, but I think you get what I mean.

In the most extreme form, the "peak-hold" detector, they give up on the pulse duration altogether, and settle for the amplitude only
This need not be too bad. The calibration exercise will discover "buckets" of counts in groups anyway.

It is possible that the "apparently 161keV" pulse actually started out as something shorter duration, provoked perhaps by *38keV* to (say) *50keV *originally. The circuits we are trying for do attempt a "real" measurement of photon energy. Perhaps unwisely. It might be considered a bit OTT, but it will give a very fine resolution , and can potentially hike the performance if two pulses arrive  a bit together.

*SparkFun Import Fun*
I have untangled what happens. The Royal Mail is a spun off "privatized" company, forced by statute charter to deliver everywhere in UK, regardless how low the population, allegedly "in competition" with other carriers. Then starved of cash while having to employ postmen. Basically, the costs went way up, and the level of service went down, from all directions.

It turns out that, without a "trade deal", import duty on anything over *£39* will happen. This amounts to *£10.97* on the $96.95 value listed. If I were a a trader, selling it on, this tax is recoverable. But if I am the end user, it gets paid. The flat *£8* charge on top is the fee to the Royal Mail, for the task of delivering it to me as a postal parcel.   So - if it is from the USA, only buy if less than £39!

I shudder to think what will happen after Dec 31st, when tariff-free trade with the EU ceases. The present situation is that a controversial condition was set that the European Union could never agree to, looking very much like a deliberate deal-breaker. We will see some lip-service gestures, but I fully expect that it will be a bust, and a big mess. The pre-owned South Bend compound part in USA, $125 asked, is going to stay in the USA. I don't know if used, worn, pre-loved, recycled stuff gets a customs charge, but I decline to find out right now.



[Duh! The caliper (empty box) was still in the picture].


----------



## graham-xrf

Although the Pocket Radiation Counter hails from 2012, there have been code updates as recent as 8 months ago.
This includes Python coded plotters, pulse "fairness" detection, "wild gamma ray" detection, etc.
*https://github.com/MonsieurV/ArduinoPocketGeiger*

APK program to have it work on Android Phone, etc. which would be the pages you likely already got to
*http://www.radiation-watch.org/2011/05/professional.html#emb*
*
Vibration Microphonics*
I won't be doing any of that, but the thing that is very concerning is the extreme sensitivity to vibration, and the warnings everywhere about it, and the extra circuits and coding to allow it to reject readings.

The key thing I see is that the energy polarity of the photon-inspired pulse is in the opposite direction to a vibration noise pulse.
That is what allows the noise pulse comparator to ouput HIGH when vibration is detected.

Since yours is already powered and running, do you see vibration piezo noise?


----------



## homebrewed

graham-xrf said:


> Although the Pocket Radiation Counter hails from 2012, there have been code updates as recent as 8 months ago.
> This includes Python coded plotters, pulse "fairness" detection, "wild gamma ray" detection, etc.
> *https://github.com/MonsieurV/ArduinoPocketGeiger*
> 
> APK program to have it work on Android Phone, etc. which would be the pages you likely already got to
> *http://www.radiation-watch.org/2011/05/professional.html#emb*
> 
> *Vibration Microphonics*
> I won't be doing any of that, but the thing that is very concerning is the extreme sensitivity to vibration, and the warnings everywhere about it, and the extra circuits and coding to allow it to reject readings.
> 
> The key thing I see is that the energy polarity of the photon-inspired pulse is in the opposite direction to a vibration noise pulse.
> That is what allows the noise pulse comparator to ouput HIGH when vibration is detected.
> 
> Since yours is already powered and running, do you see vibration piezo noise?


I did see some very large negative pulses coming out of the 2nd analog stage.  I didn't think about microphonics, perhaps because I didn't notice a ring-down (but maybe the scope's time base wasn't slow enough).  I had the trigger mode set to Normal so I'd only see the front end of a really slow pulse.  The pulse waveforms I showed were taken with the board held in a vise, and connections to the analog-out were via a soldered-on connector, so I wasn't even touching the board.  It would be easy enough to slow the scope down to get a better idea of what those giant pulses look like.  I'll post a photo or two when I have an opportunity to fire the board up again.

If microphonics are an issue that's another argument for some good pulse-discriminator S/W.

I do recall thinking I was happy to have added some diode clamps to the output of my signal-conditioning board so no big negative excursions would find their way into my 0-3.3V ADC.  But now I'm starting to wonder if I should have put some in my 10X gain stages so their recovery time from a large pulse won't be too slow.  Well, there are reasons for assigning the board a "version 1" title.

I did find the Android APK but, since our particular application requires access to the analog pulse, I haven't installed it.  If this thing doesn't work out as a detector for an MCA I might just use it that way.

****OT****
On this side of the pond we get a well-filtered story regarding the England-EU split.  We often watch the "BBC America" broadcast on our public broadcasting channel but, even so, it is painted with a very broad brush.  
\****OT****

Now, just where is that $125 SB you mentioned?


----------



## graham-xrf

homebrewed said:


> If microphonics are an issue that's another argument for some good pulse-discriminator S/W.


Agreed!  So far, we need..
1. The "It's bonkers size" rejection
2. The "It's too long duration" detector.
3. The "It's the wrong polarity" detector

*Microphonics*
The comparator in the supplied circuit only trips for vibration pulses going in the _*opposite*_ polarity as the photon pulses.
I don't know if this is some magic piezoelectric property of the chunk of silicon that it obligingly goes microphonic in one direction only.

*Crazy mad theory!*
I speculate that if the chunk of silicon is unbiased, and gets a thump in either direction, it can produce the microphonic pulse either polarity,  but if reverse bias happens to be applied, the chunk of silicon stresses, and (in theory) deforms a little. Very very small!

In that state, a microphonic thump in direction assisting the bend would deliver, but in the opposite direction, would have to be hard enough to bend it back enough to overcome the bias before it could make the material give a voltage. The circuit is clearly designed as if vibration noise was always going in one direction.

If this is so, then we have an extremely simple fix. A variation of the "Absolute Value" or "Perfect Rectifier" op-amp circuit.
A diode + very low value resistor across the feedback resistor of one of the stages will automatically have it only deliver the wanted polarity pulses. The non-linear diode characteristic is divided by the extreme open loop gain, and it becomes very linear indeed.

In general, this vibration sensitivity is concerning. We should consider de-coupling the diode mass from the board, onto something soft and damped, and make the connections with audio headphone/mic wire lifted from a earplug-type audio lead. That's the stuff designed not to ruck up with multiple flexing, where the main strain is fine nylon threads, and the conducting bits are foil spirals. I have just raided an old headset here. Stripped of the outer jacket, the little wires going to the transducers are very thin, and soft.

Whatever is is, we try not to carry vibrations onto the sensor.  Maybe a miniature variant on one of those 1920's Radio City style microphones which has a mic suspended in the middle of a circle frame on rubber bands?


> I do recall thinking I was happy to have added some diode clamps to the output of my signal-conditioning board so no big negative excursions would find their way into my 0-3.3V ADC.  But now I'm starting to wonder if I should have put some in my 10X gain stages so their recovery time from a large pulse won't be too slow.  Well, there are reasons for assigning the board a "version 1" title.


Again agreed. Crude clamps need not be used. We can use the full speed, classic op-amps circuits that precisely limit the signal excursion.


> I did find the Android APK but, since our particular application requires access to the analog pulse, I haven't installed it.  If this thing doesn't work out as a detector for an MCA I might just use it that way.


My son once made a little app for me, and went the route of making an APK. OK - he designs satellite data communication, tracking, and control software, so he has an advantage. At some stage, we are going to think about how to get this onto a phone, and I might well just ask him what was involved - but that is down the road some.


> ****OT****
> On this side of the pond we get a well-filtered story regarding the England-EU split.  We often watch the "BBC America" broadcast on our public broadcasting channel but, even so, it is painted with a very broad brush.
> \****OT****
> 
> Now, just where is that $125 SB you mentioned?


Oh yes - that was from the other thread --> *Re: Compound Ouch*
DAT510 supplied a link to *Lost Creek Machine*
It's the thirteenth down the set of listings, where one of the images has a "A" text in it.


----------



## homebrewed

graham-xrf said:


> *Crazy mad theory!*
> I speculate that if the chunk of silicon is unbiased, and gets a thump in either direction, it can produce the microphonic pulse either polarity, but if reverse bias happens to be applied, the chunk of silicon stresses, and (in theory) deforms a little. Very very small!
> 
> In that state, a microphonic thump in direction assisting the bend would deliver, but in the opposite direction, would have to be hard enough to bend it back enough to overcome the bias before it could make the material give a voltage. The circuit is clearly designed as if vibration noise was always going in one direction.



There are other components in the signal path that could contribute something w/regard to microphonics.  I speculate that the PCB probably is FR4, which is notably bad with regard to very high impedance circuits.  Flexure might produce signals just like the wrong kind of coax would. The other thing is the copper-foil shield over the detector.  There's a good-sized parasitic capacitor just waiting to wiggle some -- and, like the venerable capacitive (or electret) microphone, should be quite sensitive to vibration.

To resolve the copper-foil issue it would be helpful to know if the top of the detector is the cathode or anode....if it's the cathode, the signal coupled into the detector would be going into the relatively low-impedance bias voltage source.  And therefore wouldn't contribute so much in the way of microphonics.  Maybe First Sensor has some app notes that might shed some light here.

I tend to think some of these effects are larger than what would change the operating characteristics of a back-biased diode; but I could just be plain wrong in the case of a really large diode like this one.


----------



## graham-xrf

*Simulation Limitation Overcome*
There are some default settings for tolerances, and minimum value hidden components in default settings, put there to avoid division by zero, and to help convergence for some calculations.

When I find very silly things happening, I had to look for why. I know that the purist way would be to start with a keV energy, which just  suddenly "appears" in a circuit, (from a photon arrival), and then spreading itself around in the found capacitance, leaking away into the 40MEG resistance all the time, and some going into the charge amp. It's a bit laborious to model all that, so I take the shortcut, just enough to let me get on with the amp design.

I thought to just cook up a representative pulse that had a similar shape to those we have seen in the work of others. I could get close enough to the energy range by integrating afterwards. I only wanted an approximate maximum, and minimum, and I was interested in how much of it was dark current vs bias. Nothing I could do made sense! Bits of waveform turned back on themselves, Supposedly fixed, instantaneous sources would only get to the settings after ramping. A 2nA peak on a pulse was a mess, that suddenly comes right if you set to 20nA.

The answer is in Control Panel, where one can set the tolerances. Also, capacitors have an automatic minimum conductance across them. etc. It's a bit inconvenient that the settings are "per circuit", and keep going to defaults - but anyway..




I can get picoAmp plots, and femtoVolts etc. by adjusting the tolerances until things snap into shape.
Given the Pi4 can run it's SPI at 125MHz, I was thinking of using a A/D converter with only the serial wires going to it. It does not have to go that fast, just fast enough to gather (say) 20 samples or so over a pulse at the max speed of the converter.
I know I am still circling around solutions, but I will get there soon.

One little question in the mind is about the photon excitation. In the classic photo-electric effect, photons arriving at a metal, the fate of the excess energy after the electron has been liberated is simply to give the electron a speed (kinetic energy). What happens in a reverse biased PIN is much different, as all the liberated electrons, now called "carriers" get collected up, and drift around the circuit.

Here is where we maybe need @RJSakowski I thought that a single photon could only liberate one electron, and whatever was left after overcoming the work function only gave the electron speed kinetic energy. A zippy fast electron can be as energetic as you like, it's only going to ping around in the metal and silicon at speed. It's not going to deliver extra current. So at this point, I no longer understand how this works.

I put the point aside for now. I don't need it to get on with the design.  I can still make a TIA amp.

- - - - - -
One thing that is always depressing, is having to pay my taxes. Somehow, however much it is the civic responsible and good honest thing to be doing, I can never work up any sort of cheerfulness over it. (It happened today)!


----------



## graham-xrf

*FR4 Microphonic Noise?*
I have been searching to find any information, or even anecdotal mention, that FR4 can generate noise currents in traces printed on the PCBs, except in the context of it being a hard material able to carry vibrations to other components, like ceramic capacitors of the "wrong" type. FR4 itself seems to be regarded as very good to use in the most demanding (audio) applications.

Yes - I have had to navigate a mountain of audiophile tosh. If we are getting mechanical piezo noise, then I am finding it hard to see the mechanism.
Yet - the SparkFun counter was designed specifically to detect and flag this as something to be dealt with. A circuit with comparators to detect and invalidate pulses which we don't know how came to be there in the first place!


----------



## homebrewed

High-K ceramic capacitors are reported to be microphonic.  But it's hard to believe that the 1pF cap in the input amplifier's feedback circuit would contribute much.  Like you say, we just don't know where the microphonics are coming from (yet).  The .1uF coupling cap between the first and second stages would likely generate some microphonic noise, but that part of the circuit doesn't have really high gain.

At one point I'd thought about using X7R-based capacitors as piezoelectric actuators but never got around to testing the idea.  It's unlikely they would produce much motion, but at that time I was thinking about making a home-made nanoprober, which wouldn't need much range of motion anyway.

It sounds like it's time to fire the board up again and start tapping some of the components to see which one(s) is/are most sensitive to vibration. 

Regarding concerns regarding how many hole-electron pairs an x-ray photon generates, all I can say is that silicon drift detectors (basically huge PIN diodes) make pretty good detectors for commercial MCA's.  Ketek makes some whose energy resolution goes down to less than 200eV, but they're 'way out of our price range.  At least they don't need liquid nitrogen to cool them so they're known as "dry" detectors".  They have built-in thermoelectric coolers so they still are operated well below room temperature.


----------



## graham-xrf

What goes on capacitors far outweighs anything that happens in FR4 boards.
The pF value of the capacitor need not be related to the amount of piezo voltage it delivers.
A thick chunk of ceramic, with capacitor plates well apart, might be 20pF, but deliver volts!

Re: "tapping" -a quote [Not my original]
_"I submit that if you open up your amp and start tapping parts with a_
_pencil, the loudest noise you'll hear is the sound of parts being
tapped with a pencil. To solve this particular problem, quit hitting_
_parts with pencils"._

But you are right. If we can get at this mechanical noise, we take out a huge issue. Particularly I wonder about it being specifically always making a pulse in the opposite direction as the wanted photon pulse. It must do it that way, to have provoked the designers to set up the go/no-go pulse comparator as they have. This is why I speculated it was maybe bias related. In one direction, it can overshoot noisy. In the other, it would have to get over the bias - but I just don't know.


----------



## homebrewed

It must be from positrons   .


----------



## homebrewed

I had an opportunity to fire up my pocketgeiger board and did some tests to see how vibration sensitive it is.  Yep, it's quite sensitive.  I used the eraser end of a wood pencil and tapped the detector and also tapped the board near the signal/power jack.  The board was gripped in my Pana vise on the detector end so the tapped end of the board was free to flex.

It appears that board flex generates a much larger signal than tapping the detector itself.  See the photos below.  Note the vertical scale.  Also note that the _direction_ of the leading edge is different.  The most vibration-sensitive path generates a positive-going signal; but it also generates a large negative-going excursion after that.  I didn't flip the board over and tap it to see if the positive-going leading edge would become a negative-going pulse.  BOTH signals show a damped waveform that has both a positive and negative component, as opposed to an x-ray generated pulse.

The time frame for vibration-generated signals also is about 5X longer than x-ray generated pulses.  So the damped waveform or longer timescale could be used by a very simple S/W based routine to reject these things.  It doesn't make any sense to use a curve-fitting approach for this situation.


----------



## graham-xrf

Excellent work Mark!
The signal is AC coupled after the first amplifier with a whole 0.1uF, so it will work even to quite low frequencies.
Some of that is board vibration, some, I think, is circuit ringing overshoot,
I hope shortly to have opportunity to get at mine.
I would be trying first disconnecting the diode, and go again.
I would slowly bend on the board this way and that to feel this out.

What I think is happening is a capacitor soldered across two pads is being "stretched" or jiggled by board stress or vibrations.
The ceramic C4 1uF on the diode bias point is the favourite suspect right now.



(Top Half Excerpt of Geiger Type 5 Circuit)

We have been through this circuit before, but since it is all we have to play with for the present - consider..
The potential divider to 9V, with values that set the voltage at pin3 of LM662 to 2.88V
I nearly did not spot that connection, because in my world, for my whole life involved with circuits, it is _verboten_ to place a spot on a wire crossover, to make it a "connection". They should always be staggered, to make it unambiguous!

Going after this noise should be just a matter of finding the offender. I don't think it's FR4, but I do think it is a ceramic being wiggled by FR4.
The obvious stuff I would do.  Take the diode out, or cut the track to pin 2.
If it still "makes a noise" when bent or tapped, then C6 is next!

The response of this circuit is limited by the 1.1v/uS slew rate, related to the 1.4MHz gain-bandwidth product.
To get a signal even as slow as 1kHz through it unmolested leaves only 1400Hz before the gain is down to 1.0
The gain of this circuit by component values is 66 Million x 100. I do not understand it. It has a credibility problem!
I think the delivered gain of this circuit is much lower than the component values would imply, and is not decided by 66Meg Rf.

C16 is unforgivable. That is something that should never be done to an op-amp. Maybe it is a circuit drawing mistake.
Perhaps it was supposed to go after R18, to give a CR roll-off at 452.693kHz

There is not a whole lot there that can make microphonics. C4 is there to filter the noise from a switching bias supply (another bad idea).
Removing the diode is the fastest way to cut off that route - just to eliminate C4. If the microphonics persist, then the culprit is downstream.
C6 is the next suspect. Only a gain of 100, but 100nF ceramic could get loud!

C3? Another "smoothing capacitor" on the 2.88V. It is connected directly onto non-inverting inputs. No series resistor. OK, I get it the designer did not want to ground them. The circuit is operating with GND on the pin 4 V-. It was to lift everything up by 2.88V.

I think we can find the cause of this "sensitivity" and lose it.


----------



## homebrewed

The circuit has some definite hits against it.  The gain relative to the short current pulses generated by the x-ray photons is mostly set by the 1pF capacitor -- V = Q/C.  But the low frequency gain is very high so disturbances due to low-frequency vibration get the hell amplified out of them.  I'm not sure there is an easy around this if a charge amp topology is used.  Maybe a bandpass filter, but we're already throwing away an awful lot of signal away now as it is.

The second is, indeed, C6 -- what a great way to destabilize an op amp.  Seeing as how I have found at least one error on the schematic already, it is possible (I hope true) that C6 really is on the other side of R18.


----------



## graham-xrf

The charge amp circuit can do this. Admittedly with much smaller PIN diodes, there are communications circuits that go at fibre-optic speeds.
Just using fewer Megs in the feedback, and more stages of reasonable gain, and op-amps with GBW 300MHz and above, gets you there.
I am now less worried about microphonics.

The choices for A/D converter are a bit limited. Those with differential input need a dual op-amp extra chip to drive them. I am trying for one with internal reference, because that solves a noise problem. I am trying for one that does not cost £39. There is another at £27. There is even a candidate at £11, but it needs the differential driver, and external reference. I will get there. I may even go for it without doing anything with the SparkFun kit other than liberate the diode.


----------



## graham-xrf

*TIA Gain Bandwidth Analysis*
Other casual HM readers will get well turned off by this, but I wanted to do a walk-through. It delves the electronic technical using currents of less than 100,000 electrons in about 10uS, and is way far away from making hot metal lathe chips and surface metrology! 

A little passing check on the issues of what it takes to extract the signal in a credible way.. motivated by the Pocket Geiger 5.
The circuit looks so simple, but I can tell you almost none will "just work" easy.

I am now rather further along into A/D conversion selection, costs, and weighing up things like multiple supply voltages, including those that would trash the amplifier front end op-amp.  Some good affordable ADCs need external references and reference buffers vs ADCs with the reference built in. I try for using the full Vref range, even with differential inputs, and very low noise high bandwidth negative voltage generators. The circuit fragments shown here are not the final, just test circuits to investigate what it takes to believe that the pulse was preserved and measurable, instead of some smudged artifact.

The LTSpice test example shown compares a lower end photonic signal of *500pA* (which may be unsuitable as too big, but it compares to Id=2nA dark current), with a much bigger *80nA* signal (which may be unsuitable for being too small, but we already hit the rail)! That's OK. One could make the minimum signal smaller, and increase the gain, to no point, but stay with these for now.




It took some work getting the LTSpice app even to make these. To get the tool to work, I set the Absolute Current Tolerance to 5E-13A, and the Absolute Voltage Tolerance to 1e-7V. It may need more tweaking. I set Gmin to 1E-14, and that may yet not be small enough to compete with FET input currents in femtoamps.

This time, I use an op-amp circuit where the first stage "gain" is not defined by a silly feedback capacitance in integrator mode, in parallel with 66Meg resistor that may as well not be there! The gain is now defined by the feedback resistor. To be able to sustain a first stage gain as high as 510k, and still hope to follow to follow a pulse that will be over in 10uS, you need an amplifier having GBW of 300MHz and more. The LTC6269 is a dual op-amp, with GBW of 350MHz in S8 size package, or 500MHz in MSOP. I don't know how the LTSpice model can know how to choose.

I fully explored the value of C2, across the feedback resistor. At 0.2pF, and 2MEG , it oscillates madly. 0.5pF stops the madness, but still overshoots and distorts. 1pF is safe, and is already introducing bigger phase delays. The delay seen is near 1uS.

I fully explored the value of C3, which I use to take out the offset of the dark current. from 1pF to 1000pF. The signal captured gets bigger, and is running out of advantage at 600pF. I put a 1nF value there, and I would consider making it smaller.

The higher range for A/D converters chooses between 3.3V supplies, and 5V supplies. Choosing the larger, the Vref will be 4.096V from a low noise, buffered, bandgap reference.

In the circuits shown, the 500pA current delivers 26mV. Without the full noise analysis, I don't know yet if that is 26mV competing with highly amplified noise, but I think it, as design example, is OK, it being already  *-101.2dB* down for a devices which would only manage no more than *96dB* dynamic range anyway, and more likely to be nearer 90dB. This also lets us know that using a 2.048V reference only halves the small signal, and we are already 10dB below. THere would be no advantage.
[ These dBs are 20*Log10(voltage ratio)  ]

We could make the first stage gain a bit less, and the second stage gain a bit more, but to no point. We should make the gain suit the minimum signal we can have tickle the LSB of the A/D converter, starting with 4.096V. We will have a maxed out gain distribution that can see to the noise floor.

*Driving ADCs*
One needs a low impedance forcing signal to settle the speed of the pulse at the ADC input, which itself is going to take current suck right then. A differential driver, if it has gain, would allow we operate the TIA at lower gains, potentially allowing cheaper, lower GBW op-amps.

I get it that this stuff will look like gobbledegook to some, and is, to be truthful, relatively amateur level electronics design, but I wanted to take the mystery out of just about every XRF-type Geiger counting circuit I have seen so far, starting with Theremino.


----------



## homebrewed

The LMC662 spice model I downloaded from TI had a commented line indicating that GMIN=1e-16 should be used to properly model its low input current, so that's what I used for simulating the pocketgeiger circuit.  Right now my simulations aren't converging all that quickly, but that just means a few more seconds to wait for the results.  I probably have the minimum time step set too small.

In the case where the input amplifier is acting more like a TIA, the feedback capacitor is needed to ensure circuit stability -- it basically compensates for the parasitic capacitance(s) hanging on the inverting input node of the amplifier.  I'm sure you know this, just clarifying to the "casual reader" (if there are any at this point) on what's going on with the oscillation problem you described.

I note that your latest simulations could apply to a modified version of the pocketgeiger -- just different R's and amplifiers.   So am I correct in guessing that your development path involves swapping out some parts on the preexisting board?


----------



## graham-xrf

Even if the pin-outs were the same in places, I had not considered the preexisting board in any way.
I might not even get around to powering it up. The only thing on it we want is the photodiode.

My circuit goes right on into low cost differential drivers, and a low noise external reference, to allow affordable a high performance A/D convertor. Pseudo-differential, buffered ADCs with onboard reference cost £36 and up. A reference is about £5. AD4000 is about £11. A major thing in the metal debate is whether or not to mount the diode flat on the PCB at all. Depending on the lead stuff around it, I considered an end-on mounting, with low capacitance fine wires, and a lifted pin.

There are only six parts in the Analog Devices stable that fit the requirement 16 bits, and 2Msps. Three of them are Linear technology.
Maxim Integrated has only one product at 1.6Msps, and needs a reference.

AD4000  (£11.09) Mouser site is down)
AD4001
LTC2310-16
LTC2370-16  (Pseudo-Differential, Single-Ended £36)
LTC2380-16
AD7622

It's OK - we will get there in a sweet way.
- - - - - - - - - - -
It does lead to some questions about the specks of Am241, but I have to go now. I will return to it later.
- - - - - - - - - - -
Later is here now!
Re: Am241. The radioactive half a microgram, whatever, is in there somewhere


So after taking it apart, we get at the little button cup with the AM241 in it.
My question is, are the gamma rays squirting out of it in all directions, regardless that only one end of the button cup is open?
Going deeper. the little thing in the middle does not look like any oxide.  the surface in there is yet another tiny disc of metal - peened down.

Our photons cannot be reflected, aimed, nor collimated, except by putting into a little lead tube with a thick base, and what happens to come out the open end are those that are not wasted by expending themselves warming up lead. Not energetic enough to provoke any X-ray, they just knock electrons off the outer region of probable existence, and leave them to ping around in the lead with enhanced KE until they become exhausted.

It's nice to know that the "gamma exposure constant" is 1.3R-cm^2/mCi-hr  ????
It's much better to know that the amount of lead necessary to reduce the exposure by a factor of ten is 0.03mm.
That means a 0.15mm thick sheet reduces the radiation by a factor 100,000.

Do we have to have copper over the sensor? Can we use aluminium?
The thing is, I know copper to be used as a filter to cut down the strength of X-Rays. I did that myself once using 0.5mm and 1mm square plates with a hospital X-Ray on minimum, to an image intensifier. Maybe the adhesive-backed copper tape over the X100-7 is too thin to matter. It seems to be 0.05mm thick.

Since the assembly would shield the copper (or aluminium) from seeing any gamma, we would be OK. For total light shield, + electric field screening, I guess it has to be metal. That would stop any radiated fields in both electric and magnetic components. The problem comes from static and very low frequency magnetic fields. We don't want to be making the best 60Hz house stray field pickup on the planet!

I am going to have to check - I never tried to turn lead stuff in a lathe before!


----------



## graham-xrf

*About the Pocket Geiger Teardown*
Checking out the possibilities for the new mounting for X100-7, we start on the Pocket Geiger circuit.
The copper tape has got very tenacious adhesive.Under is a insulation layer of white plastic - also sticky with blue stuff.



	

		
			
		

		
	
 _ _ 
	

		
			
		

		
	




It came with two brass plates 25mm x 35mm x 0.5mm. Maybe they go in the plastic box that comes with it.



	

		
			
		

		
	
 _ _ 
	

		
			
		

		
	




The green wire under is soldered to the copper tape only, but it burns a niche for itself.



When we get to it, it is clear the only way it comes off is by heating it up for solder reflow.
The other possibility is to leave it on the PCB, but cut it away between the chip and the sensor through C3.

The sensor window is potted - filled with black epoxy. Light cannot get in.

The only pins used for operation are the two centre pins on each side. All the others serve to hold it down, but are not electrically connected.


----------



## homebrewed

Gamma rays are emitted from the americium in all directions, but their intensity depends on what they go through.  So the metal back of the capsule will attenuate them some.

Using the NIST mass attenuation coefficient table for copper, at 6Kev (close to iron's K-alpha line) we see  u/p = 115.6.  They are using a density of 8.96g/cm^3.  If we plug those numbers into the attenuation equation, we get an attenuation factor of 177 for .05mm thick copper, not a good situation for our low-energy XRF setup.  For 60Kev photons copper reduces the intensity by only .93.  So my simple setup of placing an americium capsule directly over the copper foil shield should be capable of exciting detectable XRF copper photons @ about 8Kev, although only ones near the exit side of the foil would make it out.  I believe it also would work for a thin sheet of iron (as in, shim stock).  This scheme will only work for very thin samples, not bulk, so an arrangement like the Theremino would be needed for analyzing chunky stuff.

If we replace the copper foil with standard-gauge kitchen aluminum foil, Wikipedia indicates it is .016mm thick.  At 6Kev it reduces the 6Kev intensity by a factor of .6 instead of 177.  Since the detector is covered by molding compound we don't need a perfectly pinhole-free piece of aluminum foil (to keep light out) -- it's just for electrostatic shielding.  The super-thin fake silver leaf might work OK for this.


----------



## homebrewed

You posted your teardown info while I was writing a post on this subject.  I think the brass sheets probably are there to filter out beta particles but I could be mistaken about that.

It would be interesting to see how bad the AC noise is with the shield removed.


----------



## graham-xrf

OK - we are agreed that a transparent" shield can be aluminium.
Underneath the sensor will be lead. Pretty much the entire little volume will have a liner of lead.
The "measurement cell" will also have mu-metal. Mu-Metal, as a metal box, schieves electrostatic screening as well.

*Concerning the mounting structure of the Am241 sources.*
I had planned a gadget looking shaped a bit like a flashlight from the days of D cells with a open end that one puts up against the metal to be tested. If the metal sample is small enough, it gets put down over it, onto a small sheet of lead.

My first CAD modelling of it sucked. I started again. I hoped to mount 6 or 8 sources in small drilled recesses arranged around a circular lead tube, all pointing at an angle onto the "hot zone". The holes just deep enough so as not to waste radiation, but masking it from making to the sensor. In the centre of all that is the tube with the sensor up it, again arranged to collect the maximum of what pings upwards, but shadowed from what comes out the sources.
I thought the sources could be put into their settings, about 5mm deep, down onto a dab of epoxy.

It is a bit of a fiddle to get at them.


	

		
			
		

		
	
 _ _ 
	

		
			
		

		
	




The ion chamber covers them up. They are facing "upward" away from the board. You eventually get down to a mounting disc that is itself peened into a contact ring. Maybe the arrangement differs depending on where you got them from.



	

		
			
		

		
	
 _ _ 
	

		
			
		

		
	




I had thought the most suitable would be the approx 5mm diameter peened disc which has the approx 2mm diameter metal-looking thing that is presumably some alloy with Am241 thrown in. That means losing the contact ring with connect solder tab.




I think I can cut the outer peening with the little die grinder diamond wheel, and pop the middle disc out. That would be compact enough to set around the radiation zone target region. We have quite a lot of lattitude to use a wide angle. The photons won't reflect off anything, and they definitely can't go around corners.

The sensor would be set on it's own little PCB, which is attached at right angles to the electronics PCB. At the rear, the LVDS network type cable goes off to the little computer. The region of PCB nearest the data cable take-off has an initially unpopulated section to mount a PIC or something to turn the cable into USB. There may be some case to make it USB from the outset.

Local circumstances make it awkward to do the experiment here right now, so I am hoping someone can tell me what the deal is in attempting to make an approximately 2" end of a Am241 ray gun assembly .. out of lead!

Another question comes to mind. Other than as a calibration source, is the stuff in Thorium mantles useful as a source?
I have to check what is the Thorium activity, to see if it includes gamma.

For the present then, back to A/D conversion.


----------



## graham-xrf

While you have yours working, maybe cut the foil free around the sensor, and check brazil nuts, allegedly rich in K40, but with significant amounts of radium, up to 444Bq/kg. ?? Units what? That is 12nCi/kg.

I think we already junked potassium as a source for being all beta, but I read that in 10.2% of the decays, it makes Argon-40, emits a neutrino which could go through the Earth with little likelihood of being stopped, and a *1.46MeV* of gamma ray. 500g of Potassium Chloride "health" salt, which is bad for you, but anyway..

K_mass = 39.0983u   Cl_mass =35.453u
K share of 500g -> (35.453 * 500g)/(39.0983 + 35.453) = 262.2grams.
So - if we packed salt from the jar into a tube - I dunno, an alternative use for a condom or something, and arranged it in a torus shape under a hood funnel of lead sheet, would that ever work? 1.4MeV would let is see pretty much everything, but unfortunately, it would also bring up the lead characteristic.

Most of the numbers I can see on internet search go on about microsieverts, doses, and banana equivalents, instead of saying what the radiation type is, and it's energy.


----------



## graham-xrf

*About Aluminium*
I had a passing thought..
k*α*1 = *1.487 keV*   kβ1 = *1.557keV*
These, if seen by the X100-7 photodiode, would yield more than 100k electrons each, so provided we are still above the noise floor, they could be seen, but not very often. The probability of either being successfully absorbed by the X1---7 is about *2%*, so the counts would be low, but still a signature that would be there if the test time is long enough.

Now we get into what software does.
In calibration, we show the gadget some stuff with the element in it, like (say) ferric chloride etch granules.
The signature is 100% iron. The amplitudes will be collections of pulse height numbers from *6.4keV* and *7.05keV.*
Of course, our samples would would make some buckets either side to make the signature shape. I don't expect to get "single spike" buckets, but given we are accurately trying to preserve the pulse shape and duration, we might hope for better resolution than Thermino#1

*Signatures.*
We can build up our own set of calibration signatures. They would correspond to published signatures only on where the peaks are for energy.
So do we get too "process" the buckets counts, to compensate for the probability, so as to be able to estimate the proportions of metals in an alloy?

In effect, to scale the buckets counts to be the inverse of the one the photodiode response. (i.e. 100% minus probability).
Does this happen automatically just as a result of the calibration process? I think it might. Sometimes, I only get there slowly. 



The aluminium, as you mentioned, reduces incoming X-ray intensity by *0.6%*. Here we know the Al over the sensor is not participating in being hit by photons that would get it excited, it is just letting through X-rays. Also, it only lets through *99.4%* of X-rays arriving, but the energy of those lucky enough to get through is not diminished at all! That's one of the nice things about quanta.


----------



## homebrewed

graham-xrf said:


> The aluminium, as you mentioned, reduces incoming X-ray intensity by *0.6%*.



Unfortunately, for standard-weight kitchen aluminum foil it's not .6%.  Exit intensity @ 6Kev = .6*(incident intensity).  That's why I'm mulling over the idea of using aluminum leaf.  My investigation has found that it's about 1 micron thick, which would transmit 96.9% of incident x-rays @6Kev.

Beryllium foil is available from ebay (not cheap though). Anyway, it's too thick -- there's no benefit in using it compared to much-thinner aluminum foil/leaf.


----------



## graham-xrf

homebrewed said:


> Unfortunately, for standard-weight kitchen aluminum foil it's not .6%.  Exit intensity @ 6Kev = .6*(incident intensity).  That's why I'm mulling over the idea of using aluminum leaf.  My investigation has found that it's about 1 micron thick, which would transmit 96.9% of incident x-rays @6Kev.
> 
> Beryllium foil is available from ebay (not cheap though). Anyway, it's too thick -- there's no benefit in using it compared to much-thinner aluminum foil/leaf.


I think not to worry about it. The little aluminium can in the scintillator is much thicker, and I guess they just live with it.


----------



## graham-xrf

*Re: Mu-metal magnetic shielding.*
This now comes about, only because I happen to be putting together some physical construction concepts, and I remember you saying the high gain + high impedance nature of the amp could pick up mains fields, and power line interference, and needs shielding.

Mu-Metal, being conductive, handily also doubles as electrostatic Faraday shield and RF block, but could be used for magnetic only, with extra copper or aluminium underneath for the electric fields. The stuff can be expensive, but one only has to look around a bit.
- - - - - - - - -
Here gets a initial flavour of what is out there.
It comes in sheets as thin as 0.002" --> *8" x 12" for $34.50 with crap review Amazon*     i.e.0.05mm

The better stuff is 0.1mm --> *Woremor WMF200 --> 4" x 24" for $35.99  Amazon.*
This one mentions specs u4=25,000, umax=100,000, Saturates at 0.55Tesla
It seems to be a mix of metals stirred up in a plastic goop, so not real mu-metal.

3ft length od 3/4" ID Flexible conduit
Probably not full annealed and hydrogen furnace treated.
                                           --> *$68.93 for for 3ft from Amazon*

Genuine Mu-Metal with mixed units. Claims 0.8Tesla. $8.36 to ship to UK.
*0.1mm thick, 91mm wide x 2 linear feet (609mm) --> £119.00 MS-91P  Amazon*
- - - - - - - - - - - -
*A Shielding Calculation Formula*
Calc Here --> *http://mumetal.co.uk/?p=103*

It can come as sheet, or ready-made treated cans --> *MuCans* These are sweet, but I don't know how much they cost.

We can go with or without, or leave it to individuals to raid old scopes, or get sheets from eBay.
One can take apart an old current transformer maybe.

I remember at school (physics lab) being told to roll the foil very gently, and shove it into a tube (toilet roll former), so as not to destroy it's mu value. The annealed mu value is good, but the heating in vacuum furnace in stages with low pressure hydrogen raises it by 3 orders of magnitude.
After that any unwanted excessive bending, or mechanical handling is not good for it.

The _*eBay's search scheme*_ truly sucks,  but I did spot one for the audiophile fraternity £13.88 + £3.09 postage from USA for 8" x 5" x 0.004" (0.1mm).

Possibly one only needs a small piece over the sensitive area, on each side of the PCB. My thought was to minimize the input loop area anyway.

A thought that occurs is - do we include a 50/60Hz deep rejection filter from the outset?
- - - - - - - - - - -
I don't actually have a clear plan for including Mu-metal shielding, but what I am trying for includes a physical layout plan that maximizes the irradiation of the target area, and having geometry to shadow the photon route to miss the sensor. The thing is used either by putting the test sample onto a sheet of lead (like builder's flashing) and placing the XRF end over it, or simply sticking the end up against the bit of metal to be tested. I wanted to include whatever we use in the way of Mu-Metal, but I am relatively ignorant about what we need.

I divide some time between the electronics and the physical stuff. I have (gulp  ) not seriously tackled digging into the software yet. That sounds a bit disorganized, and it is, but I need to set down ideas as they happen, so it comes together.

I envisage the main probe is end is about 40mm diameter, and is  funneled into larger sizes by using (lead sheet lined) push-on ends up to about 75mm (3"). The top limit can be anything you think you need, but the energy gets spread thinner. Even that may not matter too much if the area of the sample keeps up.

The concentrated range is about 30mm, and expands from there. The concept can allow all manner of push-on funnels and back-sheet blockers to let it go up against odd shapes (like rod stock, tool cutters, pipes, tool steels, etc), or stood over test samples, small containers of powders, liquids. The  "heavy end" has lead lumps in it, so it is always stable standing on end.

I hope to shortly post some of this stuff. I was thinking that if anyone else wants to make one, they get drawings, and have to turn up the bits themselves in their workshops, including learning the technique for turning lead! So far, there is no 3D printing involved.


----------



## graham-xrf

*Desoldering the diode?*
Umm.. upturned electric iron when the lady of the house is out? 
I dunno!


----------



## homebrewed

graham-xrf said:


> I think not to worry about it. The little aluminium can in the scintillator is much thicker, and I guess they just live with it.


Most scintillators seem to be made for detecting higher energy x-rays than found in our application, so  somewhat thicker aluminum is OK.  For example, at 60Kev aluminum's u/p value is just .278, compared to 115.3 @6Kev.

Mu-metal shielding:
Oddly enough, I just recently bought a sheet of mu-metal (but for a different reason -- I have another pie-in-the-sky project that needs really GOOD magnetic shielding). So I'm already aware of the forming issues that can affect its permeability, and why it really isn't possible to anneal it yourself.  Mmm, hot hydrogen -- what fun could be had there!

Apparently even mu-metal has some remnance so if you need to keep DC magnetic fields out you need to include some de-Gaussing coils in your mechanical design.

 I found some mu-metal boxes on ebay but they didn't say if they had been annealed after being formed or not....so I didn't even consider them.

De-soldering the X100-7:
Some hobbyists who regularly assemble their own circuit boards have used a cheap toaster oven + temperature controller to reflow parts.  At work we used a temperature controlled hot plate to assemble/rework test boards, and it worked fine.  To concentrate heat on the part we wanted to remove (or solder down), we used aluminum blocks as spacers and also to conduct heat.  One of the spacers was placed so it was directly underneath the part we wanted to work on and the others were scattered around so the board would balance on them.  Bottom-side components near the IC were problematic, so I always laid out my test boards so the bypass caps were on the top side.....or soldered the IC's down first, if I didn't have a choice.

The X100-7 is pretty large so I'd pre-bake it at 80C or thereabouts for at least an hour before de-soldering (or re-attaching it).  If there's any moisture inside the package it will expand into steam and might break the wire bonds.  I also worried about PCBs delaminating for the same reason so I always baked them before using the hot plate.  I didn't worry about that when soldering smaller components like R's, C's or individual transistors.


----------



## graham-xrf

The X100-7is filled all over the die with black epoxy, but I have to assume it can stand a ramp up to solder flow temperature, and a unforced cool-down in air.

I know I am just describing in words now, when a picture would be a whole lot better, but mechanically, it would be extremely convenient if the diode were put on a small PCB only just big enough to solder onto, and the board is circular to locate in a tube. That little PCB has a ground plane on both sides, except for a clearance on the side up against the diode, to have two (very thin) tracks come toward each other, this to almost eliminate the coupling loop area.

There is also a layer of lead on back of the little PCB, stuck on with epoxy. It needs only be about 1mm thick, but if it were thicker, say 3mm, with a 0.8mm little slot across it, that provides a way to mount the main electronics PCB at right angles, again secured by epoxy. There would be two holes in the lead, to bring  up the diode connections on thin solid wires up the middle of the holes in a low leakage, low capacitance fashion, to get to the board pins going to first amplifier input.

It is just a concept in my head right now. I'll try and get you a picture. It's just that quite a lot of very separate parts are suddenly coming together, and here I am still going after noise in amplifiers!


----------



## homebrewed

Well, noise could have a big impact on the energy resolution, since each pulse must be processed as a separate event -- there is no way to average pulses to improve the SNR, because you don't know the photon energy beforehand.  That's why I'm hoping that a least-squares fitting scheme will improve things.  However, starting out with the best SNR possible can't hurt.


----------



## graham-xrf

homebrewed said:


> Well, noise could have a big impact on the energy resolution, since each pulse must be processed as a separate event -- there is no way to average pulses to improve the SNR, because you don't know the photon energy beforehand.  That's why I'm hoping that a least-squares fitting scheme will improve things.  However, starting out with the best SNR possible can't hurt.


*About Noise*
It is a serious limitation. For going after these (low) energy X-Rays directly from silicon, without a scintillator, the whole thing can fall flat on it's face without we pay attention to noise.

*Incoming noise*
Without full shielding,  can't work in the face of the common electromagnetic racket in the average room, even without someone putting switching currents into the wall AC mains by using a welder. So OK, we know it needs screening, and by design, made to not respond to all the EMC threats, but we mean down to a new level way below what might be OK for average electronic kit. So good EMC immunity.

We are using the Am241 gamma to provoke a little racket of our own that we are interested in, and it must not be contaminated by "other stuff". I think it can only work if the gadget uses really good shielding, such that all of the path from the Am241 to the test material, and into the sensor sees only lead, and the test material. One mode uses lead sheet with the sample on it, and _XRF à la HM_ gets plonked down over it. The other mode uses a smaller shield pushed onto the end, and it is pressed up against the test material. With a little care, it can still work even if the lead shield is not complete, say for example putting it up to a rod too long to be in a kind of "lead lined test box".

*Amplifier device noise*
With just my first forays into trying various op-amps in the circuit, and also exploring the circuits with discrete FET front-ends, I see that for "large" signals, given enough gain to get near 4V for the ADC, in the bad scenario noisy cases, we get enough "noise" of various kinds to have about *80dB SNR.*

The lower noise circuits can get the racket down to below 160uVp-p at output, and I even have one at less that 90uV. That best one would have SNR at 93dB. I just threw in an example 80nA as the "biggest" signal, and I use 500pA to 5nA as the smallest signals. I do suspect the real signals might be as little as a third of that.

If we consider a "smallest" signal might from a 500pA signal, which pushes 440pA into the amp, and delivers 26mV at the output. Will that be seen above the noise racket? [The spice simulation does not show a transient analysis simulation of white noise added]!




The answer is "it might be", but perhaps at the cost of limiting the bandwidth, slowing it down, having a big phase delay. Also doing something about the shot noise, adding in noise filter stages. Ultimately, living with the "pulse" ending up as a much reduced, stretched thing with a loose approximation to the amplitude of the original, and an area under that has a very smudged relationship to the energy. This is where we get a threshold region below which we have the bumps from pulse that get going before the previous has finally died.

Here is where we come up against the noise figure of the amplifier. We have to deal with both voltage and current noise specs for the device (it seems there are two things accountable).
For most selection tables, "low noise" is anything <10nV/√Hz. Those "best" TIAs mostly have about 6nV/√Hz.
The (expensive) LTC6269 has 4.3nV/√Hz  and 5.5fA/√Hz.
The "ultra low noise" FETs have specs a NF noise figure 1dB, which I would know as 75K
Low noise RF pHEMTs I used to work with have noise figures 0.4dB (28K). I would like that without 14dB of gain at 2GHz!




When we take a circuit that uses one of those low cost FETs, like about *£0.54* each, or *£4.30* for ten of them, we can have *0.9fV/√Hz*, and lost a whole lot of shot noise.

*Shot noise and the like.*
I have not (yet) done much with the elaborate possible noise sources I posted earlier. The op-amps internal .MODEL have a noise contributor, as does all the resistors. Simply exploiting that we have no interest in slow signals down to DC, and AC coupling, loses noise. Then, if after the main sgain stage, we use a band-pass filter to start at (say) 100Hz, and drop off at (say) 200kHz, a huge amount of white noise is lost, as well as 50/60Hz remnants.

*Real hardware*
Everything about this so far is sloppy approximate - just about good enough to head for the main aim of deciding the basic amp with some gain, and hooking up a real circuit, and measuring some noise. I am not even using the right currents yet.
The integration of that 500pA current pulse over 10uS is 109.19pA x 10uS = 1.0919E15 Coulombs.
Dividing by the electron charge e = 1.602176634E-19 says this involved* 6815 electrons*.
That many, distributed over the 230pF would try to lift the voltage to 4.74uV at the input.
It would of course fail. Some would be lost in the 40Meg leak.
Pretty much all the rest would try to alter the state of the coupling capacitor, and fail again as the TIA zeros it out with the feedback, generating the voltage to make this happen at the amp stage output.

Where I get unglued is that the event that started this was a photon that could only have released *one* electron-hole pair when it smacked the sensor. I don't understand the physics process by which the thousands of electrons to make this current happen, came about. The pulse we get comes from a single photon arrival, not thousands in a bunch.

Maybe some experts here can set out what happens, but it may involve some extended lectures from Prof. M. R. Shenoy, Dept of Physics, Indian Institute of Technology, Delhi. About 46 lectures each 42min to 58 min long. The be-all and end all of photodiode semiconductor tech.
--> *Photodiode Physics Course*

*Do I know what I am doing?*
I think what actually happens is the incoming photon hits, and expends 4.15eV in liberating the electron, and the remaining energy is put into giving it KE kinetic energy. That speedy electron will ping around and (maybe) slam into atoms, trying to go right through, but in some way, liberating another electron, which ends up that bit slower. I don't know if the approach is correct, but I thought to find out how many work functions gets expended in this. Starting with (say) a 9.6keV photon from zinc, divided by 4.15eV silicon work functions, that might generate 2313 electrons.

*2313 electrons* is *3.7E-16* Coulombs.
If it delivered over *8uS*, the average current would be *46pA.*
Given the pulse shape we had, it's peak might be at *187pA.*

Compared to my *500pA* guess, the *26mV* pulse might be nearer *11mV*. It could be contaminated with 120uV of noise, making the numbers sampled jiggle about some unless we filter noise, or let computer averages do it for us. The very lowest energies might have us trying to sample 3mV pulses.

*We are in the right ball-park!*
Meantime, I do not have to understand the physics down to the last electron to make a better amp. So just working back from what the LSB from 16 bits can give, starting with a reasonable Vref, I get to the values I simulate with. Basically trying for minimum signals that sit up at least 10dB to 15dB above the noise at the input. We can do no better, and we have enough gain to see some volts at the output we can count, with still a dynamic range 80dB to 93dB. I expect it will work at least as well, and likely a good deal better than all those you and I have seen so far.


----------



## graham-xrf

@homebrewed:
Hi Mark. I did not really want to invest in  a T962 IR reflow oven, partly because before even using it, you need to take it apart, replace paper-based tape with Kapton, fix ground connection, add open source cold junction compensation improvement, and re-flash the software for something open source that actually works, including key debounce. UK eBay *£126.00* from Czech Republic, though it started in China.
That said, with free postage - it might be worth improving.




YT is full of videos of various projects to "improve" it.
The eBay.com link with prices in dollars seems to range *£299.00 + $34* shipping, to *$662.00 + $100 shipping* .. What! ??
-->  *eBay T962A Reflow Oven*

I did not miss that the "cheap" one is called T962, and the $300 one is called T962*A*
That's like = 1 lathe + DP + extra 4-jaw !

*Electric Iron?*
I do have some rescued PID controllers, thermocouples etc, but I thought it may be enough to get an upturned electric iron set to "low", and pre-heat the sensor board a bit, to say about 80C, then crank it up to something high, and just keep some slight tension on the diode using tweezers or something. Then, as the solder melts, just lift it off, and let it cool in air. It would amount to a "custom" temperature profile, but I thought it might be all it needs.

Maybe a temperature settable hot air gun just applied to the underside until the sensor lets go?
A lighter-fluid micro-torch might also work?


----------



## homebrewed

I was thinking more along the lines of modifying something like this but it sounds like it may not be just a matter of replacing the temperature controller.  A "real" reflow oven would be nice but it would take a consortium of hobbyists to justify getting one.

Our lab had a home-made hot plate that used two soldering iron heater elements installed in an aluminum block.  The temperature controller was thermocouple-based.  We didn't use it for soldering circuit boards, we used it to heat epoxy-molded IC's up to where the plastic turned soft so we could extract the die from the package without damaging it (much).  It easily got up to solder-melting temperature.  It was very reliable -- we used it for over 30 years with the same heating elements and controller.

You can get temperature-controlled heat guns for not much money these days.  I got one from HF that seems to work OK (although I haven't tried using it to assemble/dissasemble PCBs). Its controller puts out all kinds of nasty EMI though -- when I turn it on all the LED-based lights on that circuit start flickering like crazy!!

We eventually bought a small PCB rework station that also used hot air; and for some difficult jobs that needed a blast of heat from both sides of the board, we used a small butane soldering gun to heat the top side.  It had a catalyst grid in it so no flame came out the end, just very hot air.


----------



## graham-xrf

OK - given that only the sensor is of any interest, I can use my Aldi "workzone" digital settable hot air gun, set to (say) 300C+, and just cook it from the underside. As the solder melts, off it comes, and cools in air.

I do like your toaster idea, because I have the suitable PID controller and some N-Type thermocouples. Infra-red bulbs are not a lot different to toaster spring-spiral wires hung in air, so capable of quick response to a temperature profile recipe. Not the same as the thermal delay from heater elements wound on porcelain.

One needs a fan to come on to accelerate cooling, or even just to be wasting some heat all the time, so the controller can keep the temperature on the profile. Last time I meddled with this stuff, though on a bigger scale, I needed a thermocouple in the middle of the heater elements, and another coupled to the workpiece. Operated in cascade, with one control loop feeding the other, to allow the workpiece to "catch up" without putting a in huge pulse of stored energy, and avoid the elements basically at maximum during the heat-up. Cascade control is a bit OTT for this stuff.

Hot air gun then - but then we come to the new situation of having to get the new electronics built. I am thinking that gets done with soldering iron, and maybe no components smaller than 0805. The mind has just imagined this with 1206  
I can manage 0603 with a bit of a struggle. Anything 0402 requires I buy extras  to cover the "oops-ping - poof - and it's never seen again" situation!


----------



## homebrewed

I use 0603's but that's under a stereomicroscope and using SMT flat-tipped tweezers to handle them.  Yesterday I finally got around to stuffing my signal-conditioning board and managed to do it with losing just one of the 0603-format resistors.  I made the mistake of grabbing the resistor first and then fumbling around for the soldering iron, and squeezed the tweezers too hard.  Under the force the tips became non-parallel and the resistor vanished with a barely-audible "snap".  No Harry Potter-style apparating required, just ham-fisted me   .

When I ordered the SMT resistors for the board I stupidly ordered some 0201's for some of the resistors.  THOSE are about impossible to handle, not to mention they don't even come close to matching a 0603 footprint.  Fortunately I remembered I had an assortment book of 0603's I'd gotten for some pre-retirement work projects so I could go ahead with the assembly process.

One of my work-based designs required 0201's in order to minimize their parasitic capacitance.  It was for an active probe to measure RF signals on the internal nodes of IC's running upwards of 2.4GHz and I needed as low a parallel capacitance as possible.  I used a Mini-Circuits HEMT based amplifier for the gain.  Our technician who assembled that board really complained about the small size of those resistors!  I had initially thought that 1206's would have lower parallel capacitance due to the wider spacing between their terminals, but our circuit-modelling group did a FE analysis for me and showed that the the capacitance was lowest for 0201's.  Hence her pain.

Back to the signal conditioning board -- I haven't fired it up yet.   Hopefully this weekend.


----------



## graham-xrf

@homebrewed Hi Mark
*Re: ADCs data transfer - awkward choices*
I have been juggling ADCs for a whole now and one of the considerations is the data interface.
The full parallel interface would be a big bunch of wires , but no speed issues.  The lower cost ADC only uses SPI serial.

There are, of course, other things that affect choice. Trying for only 20 samples out of a 10uS time for a XRF pulse to rise and decay requires 2Msps.
Then for 16-bits in a surface mount package from Analog/Linear, yields *7* devices with prices ranging *£18.65* up to* £41.49* (all Mouser).

So - if one chooses (say) a AD4001 (lowest cost), which will only use SPI.
2Msps requires a *70MHz* SCK clock.
A Raspberry Pi 4 can, in theory, manage *125MHz*

I don't much fancy the chances with 4 loose wires in a bundle, and I don't know much about high speed SPI over a range more than the size of a PCB. I have done RS485, LVDS, CANbus, etc. This may be OK on a transmission line trace across a PCB.  Somewhat more awkward to get it between the measure head and the display, unless the Pi or whatever lives in the same box as the sensor.


----------



## graham-xrf

Yup - you have the same space-time anomaly like at my place. The one that moves about somewhere between near left foot, to out front past right shoulder. Anything tweezer-spring powered passing that zone is gone forever, never to be seen again!
Do tell about your signal conditioning board.

I have started ordering proto 2 ADC's, op-amps, and various bits. The lowest cost option will require an external reference, but has the differential drivers built in, saving more op-amps. Actually building stuff right now is awkward, and a bit chaotic, but that's mostly my fault. With tree stumps gone, I have been spending time outside with my new eBay Huepar laser level kit, getting the positions figured out, and some profiles in place. It will need a tracked vehicle digger, hard core, steel, etc.. I think the USA expression is "pulled the trigger on it". Essentially, I called in the same construction firm that I have used before, and their head guy will be visiting this week. Until that outhouse is built, things are only going to get worse in my garage, before it gets better.

Related to your mention of Mini-Circuits HEMT, some mini-circuits product includes things like DC-2GHz amplifiers. It had me thinking that a RF pHEMT with 0.4dB noise figuremight serve for the first device along with that exceptional  op-amp circuit. I perished that thought straight away! When a transistor has a whole lot of gain at GHz, it's got even more at audio, and it's quite hard to shut it down with feedback without it turning into a burping RF oscillator. They used to call it "squegging" or "motorboating", but mostly, all you know is the poor transistor is expiring in heat because it's doing stuff at a frequency the scope can't see. Low frequency stuff using high frequency bits still needs really careful attention to layout, and stability.

I have simulated that low noise FET circuit, and it's great at *0.95nV/√Hz*, compared to *4.3nV/√Hz *for the straightforward TIA op-amps. The higher level is likely "good enough", without needing a op-amp loop to control FET bias. I still have ordered some of those 1990's style low noise audio JFETs, just because less than $5 bucks gets you ten, and I might still want to play if there is a spare op-amp left in a quad-pack.

Shot noise is "low frequency" only in the sense that it happens at a low rate. When it does happen, the waveforms are fast enough to walk right in to circuits limited at low frequency. Regardless, I am tempted to have the gain stages also be filters. A band-pass starting at about 115Hz would inherently limit 50/60Hz pickup. At the other end, rolling off at 200kHz or so would lose a lot of the white noise that jangles the sample numbers. This would be at the price of phase delay. Not taken to extremes of "pulse stretching", but maybe OK to lose a bit of fuzz off the trace.

While I am trying to be minimalist with this, a few extra passives seems not to excessive.


----------



## homebrewed

graham-xrf said:


> @homebrewed Hi Mark
> *Re: ADCs data transfer - awkward choices*
> I have been juggling ADCs for a whole now and one of the considerations is the data interface.
> The full parallel interface would be a big bunch of wires , but no speed issues.  The lower cost ADC only uses SPI serial.
> 
> There are, of course, other things that affect choice. Trying for only 20 samples out of a 10uS time for a XRF pulse to rise and decay requires 2Msps.
> Then for 16-bits in a surface mount package from Analog/Linear, yields *7* devices with prices ranging *£18.65* up to* £41.49* (all Mouser).
> 
> So - if one chooses (say) a AD4001 (lowest cost), which will only use SPI.
> 2Msps requires a *70MHz* SCK clock.
> A Raspberry Pi 4 can, in theory, manage *125MHz*
> 
> I don't much fancy the chances with 4 loose wires in a bundle, and I don't know much about high speed SPI over a range more than the size of a PCB. I have done RS485, LVDS, CANbus, etc. This may be OK on a transmission line trace across a PCB.  Somewhat more awkward to get it between the measure head and the display, unless the Pi or whatever lives in the same box as the sensor.



Yes, at those clock rates you're looking at a controlled impedance situation.  Even the Teensy audio codec board has to employ a series damping resistor on its clock line, and it's running a lot slower than your ADC will.  Even with controlled-impedance lines, at some point the prop delay will cause problems since the data is aligned to the (delayed) clock edges the ADC sees.

Regarding things like phase delay, I'm thinking it doesn't matter too much, else the Theremino MCA wouldn't work.  It uses a highly modified pulse and still outputs reasonable spectra.


----------



## homebrewed

graham-xrf said:


> With tree stumps gone, I have been spending time outside with my new eBay Huepar laser level kit, getting the positions figured out, and some profiles in place. It will need a tracked vehicle digger, hard core, steel, etc.. I think the USA expression is "pulled the trigger on it". Essentially, I called in the same construction firm that I have used before, and their head guy will be visiting this week. Until that outhouse is built, things are only going to get worse in my garage, before it gets better.


Good luck with your project!  It sounds like it's going to be a really NICE outhouse   .  Our barn-rehab project is to the point that we're talking about what color of wood stain to use on it (although I still have a couple of studs that need to be rebuilt).  The rainy season has arrived so we have plenty of time to make that decision.


----------



## homebrewed

@graham-xrf  I've been searching around for low-noise JFETs that are actually available (for a different project) and found some you might be interested in.   The ones I found on Mouser have just so-so input capacitance for what I want, but might be OK for a TIA:

IF1330, 1nV/sqrt(Hz), Cin ~ 10pF, $3.90 in singles
2N5397, 3nV/sqrt(Hz), Cin ~5pF, $11.73
2N6550:  .9nV/sqrt(Hz), Cin ~30pF, $11.94.

For comparison, the LTC6268-10, which has a 4GHz GBW, is specified to have En = 4nV/sqrt(Hz) and .45pF input C.  Its price is comparable to the more expensive JFETs.


----------



## graham-xrf

Thanks Mark.
It adds to my list of low noise FETs. There are essentially two circuit strategies. One is to use a low noise high GBW op-amp direct in the most simple design style, but split into stages to have the first TIA gain about 200,000 to 220,000. This for noise about 3nV/√Hz to about 6nV/√Hz

The other way is is use the low-noise FET enhanced front-ends along with a low noise op-amp. An example is the 2.4GHz GBW circuit using *IFN147*.
The difference is that straight TIA op-amps off noise in range 2 -10 nV/√Hz. The FET front-end types offer 0.8nV/√Hz to about 1.5nV/√Hz.

The IFN147 from Mouser is is the TO-18-3 sealed can, and is a whole *£15-93*. We can have a whole nice dual TIA op-amp for that much!
Interesting that when looking for the 2SK147, the Mouser search finds SMP147, definitely called a P-channel JFET, but the datasheet brings up InterFET's IFN147 again, shown a N-channel FET. Maybe it was a web page mistake!

2SK2145's are duals with lower capacitance, and similar noise figure, are only £0.51, but they have lower transconductance.
*IF1330's* you suggest would do just fine. Strange that the Mouser search brings up a *IF1320* datasheet. I wonder if keeping the part in sync with the datasheet just a problem at Mouser?

For my first shot, I am trying to keep things simple, and as few components as possible.  I was aware of LTC6268/6269. Same data sheet, different price, because the LTC6269 is a _dual_ op-amp costing £10.44. Given the first stage has more than 56dB power gain, the noise figure ceases to be a problem, and 4.3nV/√Hz is, I think, low enough to be below the other noises anyway. One does then need at least another op-amp, and it can be lower cost type. If more are needed to implement noise filtering, ADC driving, reference buffering, whatever, it could be a quad.

Alternatively, using one of the quad to be the bias loop control with the discrete FET circuit would be another good solution.


----------



## graham-xrf

I am finding that suitable low noise references  cost about $9 + the extra circuits and passives to implement them.
Also, the need to have either a low impedance differential driver to feed some ADCs vs those with pseudo-differential input add the cost of op-amps outside the ACD. There are some Lineear Technology ADCs with onboard references and interfaces that work out competitively to having that stuff outside the ADC, I like the simplicity. Very nearly down to only 2 or 3 main components.


----------



## graham-xrf

@homebrewed  : *Re: LTSpice extreme simulations*
Mark - not all of the devices from Analog/LinearTech have spice macromodels, so I was pleased the most recent update hugely expanded the library.

I do stumble often when running into weird situations, like when a .noise simulation command suddenly starts behaving as if what is in it is all wrong, even though I can see the very text, and I keep filling out the values in the entry window, or editing the line directly. So I try ultra simple test circuits, just to get it back to sense. That led me to look at the netlist of the macro-model of an op-amp, and further, to the .lib model.

I never knew that LTSpice has programmed the internal tools for equation-implemented models, (avoiding simulating with sub-circuits primitives) to the extent you can play a CD signal, or a generator signal, .wav file directly into your amplifier LTSpice simulation, and display the waveforms, and "listen to the quality" playing back the wav file.

It gets a bit out of my league, but check this out --> *LT Spice with Mike Engelhardt, 6/6*
*https://www.youtube.com/watch?v=d8DqWvMYyWg*


----------



## homebrewed

Graham, refresh my memory.  Are you running LTSpice under Linux/WINE?  The reason I'm asking is that I'd like to use the recent version with the expanded library -- but I'm having problems installing the upgrade.  The installation program apparently wants to install a 32 bit version (my current version of LTSpice is 64 bit).  I can't use the built-in "sync" function, due to permission issue differences between Windows and linux so I have to run their installation program; and that's when I get the 32/64 incompatibility error.


----------



## graham-xrf

homebrewed said:


> Graham, refresh my memory.  Are you running LTSpice under Linux/WINE?  The reason I'm asking is that I'd like to use the recent version with the expanded library -- but I'm having problems installing the upgrade.  The installation program apparently wants to install a 32 bit version (my current version of LTSpice is 64 bit).  I can't use the built-in "sync" function, due to permission issue differences between Windows and linux so I have to run their installation program; and that's when I get the 32/64 incompatibility error.


I have Linux Mint 19.3 64-Bit, and I run LT-Spice using Wine + winetricks, as normal from the repository.
I confirm that the version is *LTspice XVII(x64) (17.0.18.0)* from *October 27 2020*

The wine installation is on drive_c in the usual way. It's the default place synaptic installs to.
You can see the file paths in the pictures.

I do have a windows7 PC and a Windows8. They hardly ever get switched on. Neither has mouse, nor keyboard. Access is via NoMachine on LAN, and they do not have access to the internet. Sorry - but I became disconnected from Windows years ago.






It does end up in .wine/drive_c/Program Files/LTC/LTspiceXVII. I am not sure if the "LTC" was my save-as or not.

I don't actually keep my collection of LT/Spice tryouts down in .wine folder on virtual drive_c.
I just put them in my home folder, but they could just as easily be alongside the LTSpice examples folder in drive_c.




Looking closer at versions..
	

		
			
		

		
	




I can see the 64-bit dll's in there, and also the 64-bit _*XVIIx64.exe*_
I am not sure of XVIIx86.exe, whether it is needed, or is an artifact from a previous install.

I update from within a running LTSpice, at *Tools --> Sync Release*
it all just happens automagically, and suddenly, you have oodledoodles of new Analog Devices, and LinearTech models available.

*Permissions*
On a pure Windows Machine, you should be able to have the update.

If your Windows is in a virtualbox, or you're running Windows, and Linux is in the virtualbox, I guess it might get complicated to pass the permissions. The stuff I do tends to strain LTSpice to extremes sometimes, but I never put up with a long simulation. If that starts happening, you have to look at what forced silly timesteps. For me, so far, at worst, about 10 seconds is all I need. Nearly all the bits are macromodels.

I do hope this helps. My update went dead easy.
It occurs to me you might need a small adjustment to firewall - or "windows firewall" to allow update of the program.




Let me know how it goes


----------



## homebrewed

What version of Windows are you emulating under Wine?


----------



## homebrewed

I figured out what my problem was.  I recently updated my computer to a newer linux distro (Ubuntu 20.04LTS) and apparently the wine32 binaries weren't part of the update.  After I installed them, the LTSpice install/upgrade program worked fine.


----------



## graham-xrf

homebrewed said:


> What version of Windows are you emulating under Wine?


As I understand it, Wine is _not_ an "emulator" at all. It works at a much lower level than that, providing an environment that can run Windows executables, and deliver the results in it's own environment. It is called a "compatibility layer". The x86 code for the programs is run in the CPU at full speed under Wine, as if they were in a Windows environment - but without the environment being there.
Wine relies on POSIX environments like MacOS, Linux, BSD, and maybe Android.

Wine does not simulate Windows code. Instead, it translates Windows program calls (API calls) into equivalent POSIX calls as they happen, and has arrangements to land the outputs into the Linux desktop.

Not all Windows  programs can be run in Wine like this. Some are too interleaved with some Windows "services" dependencies. I do not like that anything I do with a program, like the number of times I use it, and when, and where I am at the time, be information that is blabbed anywhere! Not to another program, nor anythiing be uploaded. I will not allow "Telemetry", nor "Cortana", do their thing. Avoiding the keylogger was one of the reasons I banned internet access for Windows machines. They are rarely used. For general computing, I abandoned Windows entirely.

Programs running under Wine do not have a mechanism to do that stuff, and the fact a program can run under Wine is a kind of badge of merit indicator that it is only doing what it is supposed to.

I suppose, in theory, one could run a whole Windows install under Wine. It would be bound to fail, but also, why would anyone want to do that? The whole point of Wine is to directly run programs usually installed into a Windows, without needing the Windows.


----------



## rwm

Just so y'all know I am still watching patiently. I am out of my depth on circuit design. Carry on!
Robert


----------



## graham-xrf

@rwm :
I now have a circuit in mind, and I have started ordering parts. Leaving out actual circuits, I can say what the design considerations are.

After considerable fooling about with simulation computations, I have explored most operational amplifier combinations, and it turns out that the combination of op-amps and low noise FET circuit Linear Technology circuit published earlier has no equal. We are trying to capture a very tiny charge, and amplify it without messing it up. I based my circuit on that, but used my own gain distribution.

My basic scheme is to mount the radioactive (smoke detector) bits in a circle, set around a tube with the sensor up the middle in a lead tube shield. The end of the tube is in lead, and the sources are angled in such a way that they cannot illuminate the detector, but do maximally irradiate the stuff under test.

I choose to separate gain stages into three, with a gain distribution that allows to see all the way to the noise floor, while having sufficient preserved bandwidth to reasonably capture a detected X-ray event that lasts up to 10 microseconds. If this were a radiation ticks counter, it could count up to 500,000 ticks per second without a pulse smearing into another - but that is not what we are after. The rise and fall of the pulse, over the time it lasts, is a count of the energy in the X-Ray, and that is what we want to have reasonably accurate, so as to put detail resolution in what we get.

Usually, in designing amplifiers, one uses voltages and currents. Currents can be amps, or milliamps, or microamps. Very rarely does one find oneself using pico-amps, and femto-amps, but it happens with this stuff. I discovered that some calculations involved only a few thousand electrons, up to about half a million or so.

The three stages gives opportunity to build in some filtering to reject 50/60Hz power line pickup, and wideband noise. Everything about it is to have exceptional low noise. I chose a 16-bit ADC (Analog to Digital Converter) to sample the pulse, aiming for 20 samples during a 10uS pulse event. That is 2 million per second. I chose it for it's low cost, and that it has already built-in much of the additional driver amplifiers we would have had to construct externally. This one needs an external reference, so it gets a precision bandgap 4.096V low-noise reference.

The ultimate in low noise would use battery power for the front stages, but I am mindful that a popular build would be to have the gadget on the end of a USB cable, stealing power from the USB, with the display/computing device being a smartphone with app. I might possibly keep battery power for the front end amplifiers, and let the USB supply power to the digital stuff.

The first implementation will not be to a phone. For that to happen, there has to be some little chip with the gadget that can locally do the data collection, and "speak USB". Mine has a quite powerful little credit-card sized Raspberry Pi computer right there with it. It needs to ship the data in using three short wires, and a 70MHz clock. It's a $55 bucks thing, but it is a full blown 2GHz computer that can directly run the open source PyMCA software provided by CERN (think Large Hadron Collider). It also has 2 x 4K video displays.

-->_* Raspberry Pi 4*_

I never thought I would be ever attempting learning radiation physics, and trying to press this into life. It is possible that I will still fall flat on my duff. The time I have to play with it has to be shared with other pressing stuff to be done at home, and I do get a bit distracted with my lathe. Any HM user wanting one will have to at least figure out how to turn some shield bits in lead, and be able to epoxy a small circuit board into place. There is lots of room for folk who want to get up innovative arrangements of their own.

HM-XRF may end up able to do more than identifying alloys. You could get curious about what is actually in all manner of stuff. The whole principle of it is to ignore the main radiation coming from the smoke-detector source, that being alpha particles (helium nucli). Am241 also emits a gamma radiation of 59keV which is enough to get an X-ray glow out of most metals we would be interested in. We have to think ahead on the physical construction. All paths from the radiation sources must not encounter any atoms on any materials that can make unwanted responses, not even glue! That is why it has to be lead, and even that will have a couple of characteristic responses we have to figure out how to ignore!

I will try to post a few (simplified, speculative) CAD pictures soon, and then folks can start proposing their alternatives. Right now, I only have some primitives not yet even positioned correctly, and sans the lead. Mark has already fired up the SparkFun Pocket Geiger 5, and explored what that version does. I won't bother, because I am going for extracting the only part on it I want - the photodiode.


----------



## rwm

Thank you for the summary!
R


----------



## homebrewed

I'm curious regarding what JFET you have decided to use for the TIA.   Also, are you going to use a cascode topology to minimize the Miller capacitance, or is that a non-issue in this application?

Your physical arrangement of americium capsules and lead is pretty close to what I've been thinking about.  I don't think the Am241 capsules have to point directly at the object under test because the 60Kev x-rays are uniformly emitted in all directions.  Ones that are emitted into the body of the capsule (or lead shielding) are absorbed.  It probably is more important to get them as close as possible to the sample as possible, so your idea of removing the small bit that actually has the Am241 would be optimal in this regard (but see my last paragraph below).  Drill or punch a 14 mm diameter hole in your lead sheet (the smallest diameter a 10 x 10 mm square would go through) and arrange the emitters in a circle around the hole, but not overhanging it.  That arrangement will provide a relatively high gamma-ray flux for exciting XRF without the need of making or forming a hemispherical mounting surface.  Placing the detector as close as possible to the opposite side of the hole will give us the least attenuation due to inverse-square considerations, and none of the primary 60Kev gammas will make it to the detector.

My one concern regarding messing around with the Am241 capsules is inadvertently releasing some americium particles.  Ingesting an alpha and gamma-ray emitter doesn't sound like a good idea to me.  The extraction would have to be surrounded by all sorts of caveats to avoid possible legal problems down the road.  "Don't really do this, it is presented for educational purposes only" and so on.


----------



## homebrewed

I powered up my signal conditioning board today to see how it works.  No problems, just the expected relatively-poor offset drift in the 100X gain mode.  I also connected it up to my pocketgeiger and confirmed that the signal path is OK.

I went back to Graham's teardown of the Am241 capsule and belatedly realized that my previous "live" test of the pocketgeiger had the capsule turned backwards so it's not surprising that the count rate was rather low.  My capsules are fairly easy to disassemble so I did that to one of them and checked what the count rate was.  Much higher.  This was with the copper shield still in place, so I expect the count rate to almost double when I replace it with aluminum foil.  I bought a metal HF "ammo box" awhile back to put noise-sensitive circuits inside it so that's available if need be.

I'd be happier if the pocketgeiger's noise level was lower.  I'm thinking about replacing the LMC662 with an LTC6269.  At 25C its bias current is as low as the LMC662 but it's quieter.


----------



## graham-xrf

Hi Mark
Firstly - do tell what it is on your signal conditioning board?

Yes indeed, the *LTC6269* is what I settled on also, and it can be used for a TIA directly. It works way better if the Rf is made 510K//2.2pf, and followed by another inverting stage of gain 180, using 180K and 1K. The noise is *4.3nV/√Hz*.

If the FET circuit were adopted, so the other half of the LTC6269 is used for the FET bias loop, the noise goes somewhere very low, allegedly *900pV/√Hz*, but I think lower. I was after something that would range to the noise floor. On a output signal (biggest) of 4V, then 90dB down is 126uV. On those numbers, one does not need the FET circuit at all. The LTC6269 in 2 stages should be enough.

Of course, the Pocket Geiger's 66Mohm TIA  followed by a stage gain of 100 is just ridiculous, but since the pin-out of the LMC662 seems standard, can we simply "adapt the Pocket Geiger 5 circuit board, and duck the need to make another board altogether? I say this because a differential driver , which can also have some noise filtering functions, might go in the place of U3A and U3B, no longer as comparators, can easily drive a relatively short shielded twisted pair to a A/D converter mounted right at the computer, so making SPI at high speed somewhat easier.

LM662 cannot do this! It has a GBW of 1.4MHz, a noise of 22nV/√Hz, a Vos of 3mV. About the only thing that looks good is the 2fA input bias current.

*About the FETs*
The IFN 147 is the InterFET name for the old *2SK147* except they market it from Mouser under the code *SMP147* for £5.86, or £4.72 each for 10.
The very old datasheet has the very same simulation parameters. The reverse transfer capacitance is a whole 15pF.

The whole bunch of FETs from Linear systems, *LSK389* (dual), *LSK170*(single) etc are all lower capacitance Ciss (20pF-25pF) and Crss (5pF-5.5pF) Reverse Transfer Capacitance, which would make the higher frequency devices than IFN147. I left off checking out all Linear Systems stuff because of the purchase terms, and because of importation difficulties.

The gain-bandwidth product of the FET+ one LT1806 TIA opamp is 2.4GHz. I do not propose to put as much as 1Megohm in the first feedback loop. I settled for 270K to 510K, then followed by another op-amp stage with gain 180. The FETS are basically audio devices, and I realized just about any low noise FET would do, the better if one used a VHF or UHF low noise FET.

In extremes, even one of those low noise microwave FETs with 28K (NF=0.4dB) could be great, but expensive. The problem is how to use local feedback to knobble it's ability to have gain beyond UHF without having it become a superior loud audio square-wave oscillator!

In simulation, I used the LSK389, only because the model was conveniently already there in LTSpice, but I knew one could easily use any of a whole lot of others. I was looking at some costing less than £1. My simulation norm was a photodiode current pulse (Iph) delivered as a 100nS pause, then exponential function rise in 100nS, and a 200nS dwell as the charge goes over the hump, partly into 230pF diode capacitance, while being leaked by the 40Mohm diode bulk resistance, and pulsing into the amplifier. Then a 500nS exponential function fall with a tail extending to 10uS.
Iph could be from 500pA to 5nA, as a starting guess. If as high as 20nA, we need less gain.

Using these (audio-ish)  FETs,  the 4V output pulse is peak-delayed by about 2uS, and is "stretched" to about 14uS. It can do better. I just stopped tweaking. I may have to lower the gain if 5nA is too little. At the low end, I was using 500pA. At this stage, I ceased to worry about FETs . I would need a reminder where is the cascode circuit example if you think we need to go there. Crss less than 2pF is probably find-able in a FET. Nearly all discrete FETs around now seem hail from last century, even if they were recently made. I may have a little trawl for more low cost UHF FETS, but I will have to edit in my own .MODEL properties.

*A little noise spreadsheet*
It is a trivial calculation, but help yourself to the noise temperature spreadsheet. I expect you have LibreOffice Calc. Hmm wait up..
It seems .ODS, and .XLSX are not allowed extensions. I had to use .ZIP.
- - - - - - - - - - - -

*The Illumination Geometry*
About the photons being emitted in all directions is understood. The source only has to be sunk that tiny bit, or the sensor if you like, so that a sideways photon, unable to manage more than a right angle, cannot hit the sensor by refraction. A tiny "lip extension" on the tube around the sensor is enough, allowing then most of the hemisphere of radiation to play into the space, without wasting any being too far up a lead setting.

In my design, the axes of the radiation sources is not as in the image of the post #460. They are tilted to aim at the centre where the test metal is. The angle depends on the distance to the metal, and the radius of the ring of sources, but maximum effect is when that radius equals the height to the test stuff, and the angle is 45°. This choice is modified by how big a lump of lead we are willing to put up with. It is OK to make it all of something else, plastic even, but lined with lead, say 2mm or 3mm.

*Re: Extraction of the Radioactive Sources*
OK - getting down and dirty with it. I have already extracted one down to the stage of looking like those in the CAD image. The dimensions are not made up. That was real measured. We cannot rely on common sense, but we can easily find a one-liner, or a URL for a user to get some warnings. We can include with a warning not to eat the thing, nor let one fall into becoming playthings for children. So long as you don't ingest it, the risk is pretty much zero. Of course, we are not letting free the Am241 pellet. It always remains in it's little metal disc mounting.

I used a small file to take out the 3 outermost press-deform (peen?) fixings from the sides. For convenience, I post again the three most relevant images, one of them modified to show the file cut line. I think no matter what brand of smoke detector, the way these things are held down is always much the same. Everything about keeping hold of radioactive sources gets to very fundamental principles of shapes. Glues are never used.
To that end, we may have to pay attention to how we fix them in our gadget.




I put the narrow edge of the file down onto outer disc, and filed away the 3 peened over spots. I admit it is a bit disconcerting to be filing away on a radioactive thing plonked down onto a green cutting mat held down with the fingers. In the end it was easier to to hold it on left forefinger and keep filing. It does not take long.

From the side


I thought to take a side-cutter snips and cut across, and I nearly fouled up, not thinking that it would have to cut through the bigger disc of the setting, around the back. But then, I realized one could use the big cutters just to get a grab on it, and bend the outer metal curled around to just force it to let go. The radioactive pellet mounting dropped free.

From the back



After a minute or so, one's technique and options improve with practice. You could probably mangle the outer metal enough without filing, but if you don't want to have it ping away somewhere, then file away the squeeze-downs. It only takes a few minutes. I did it dirty, but one could put it over a hole drilled in some metal, large end down, and then punch or press it out.  While I did not actually have my finger skin in direct contact with the Am241 thing in the middle, I got as close as 1mm or so.

Tip:
DO NOT stash the smoke detector pellets in the same bag as Thorium gas mantles, nestling right up against each other!
I don't know for sure what happens, but I think that gets close to making third substances. I cannot imagine we have anything close to breeder stuff here, so we have to ask @RJSakowski


----------



## graham-xrf

Hi Mark
Did I, at any stage, gather you had a preference for parallel loading ADC?

I have been trawling mouser.co.uk
The very filtered-down choices are:
*AD4000*. In stock in 4 days. *£21.67*
Pros: It has pseudo differential input with fast settling drivers built-in, saving 2 external op-amps.
          The price is sort of OK. You need to look to USA pricing. e.g. This one is *$28.43 *in a MSOP (RM10) package.

Cons: It speaks SPI only, needing 70MHz clocking, on 3 wires, and best lives right up close to computer kit.
           It needs an external low noise Vref, and likely separate conditioned supply regulator (which might be a need for any)
           I thought 4.096V, supplied by a low noise 5V LDO regulator that is used for the op-amps as well
- - - - - - - - - - - - 
*AD4001* is a bit lower cost. *£18.65* or *$24.46* in USA
It is just like the AD4000, except for one extra con, in that it needs a ADC differential driver - meaning 2 op-amps + noise filter parts.
AD4807-4 at £4.82 is OK for this role, and leaves spare op-amps for TIA signal conditioning.

- - - - - - - - - - - - -
*LTC2370-16IMS*   at *£35.99* It seems only the industrial temperature version is in stock. *$47.21*
Pros: It has pseudo-differential input with internal drivers, tempered by the recommendation to use a buffer anyway
          It clocks conversion internally, with no pipeline latency. 76uV at LSB. 94dB SNR @2kHz impressive.
Cons: It requires an external low noise reference
           It does SPI only, should one prefer parallel.
           It is waaay too expensive (for me).
- - - - - - - - - - - - - 
*AD7622BSTZ* costing *£29.68* in UK, or for USA, it's *$47.21* in singles.
Pros: It has onboard 2.048V buffered reference onboard, saving lots of low noise external regulator and bandgap reference.
          It does both SPI and parallel 16-bit data ofload as a mode choice. One can play with either if high-speed serial is awkward in software dev.
          I says SPI/ QSPI/MICROWIRE/DSP compatible. Except SPI, I don't have experience of these
          It has 92.5dB SNR, and has no pipeline delay (I think it has a buffer register).

Cons: It still needs the external differential fast-settling driver.
           It is still expensive, but this time the internal reference feature and parallel data may offset the extra circuit hassle.
- - - - - - - - - - - - - -

I was thinking the AD4000 would be an OK choice provided one can program to deal with 70MHz clocked serial data.
I am thinking to get a LTC2370-16, and also a AD4000, for development.
While I wait for this stuff to arrive, I may have another go at the physical build, and dig out the remaining Am241 sources.

- - - - - - - - - - - - - - -
*Re: The home front:*
The contractor visited yesterday afternoon. He knows exactly what I want, and made some suggestions. In this, there was a little "project creep".
*Rules*
The regulations, and boundary rules apply, being as I am in a National Park/ Site of Scenic Beauty / part Sites of Special Scientific Interest.
The outbuilding can be 5m to 5.5m long, and 3.5m to 3.8m wide. In USA-speak, that is about *18ft x 12ft.*
The height to internal ceiling can be standard 2.5m or so, and total height not more than 4m. That allows a roof pitch of 35° to 40°.
It is to be on 150mm steel reinforced concrete, with the hardstand extended to put a surround of 1.2m of the same patio paving blocks.
It will have 50mm wall battens inside, with Celotex polyurethane insulation, and ply over (good to hang tools on).
*Insulated*
The floor is likely 35mm chipboard on 50mm bearers, and insulation under, and damp membrane. If I need machine hard points, I cut through for pucks with chemi-bolts.
He proposes 150 x 50 joists with 150mm insulation, and boarding for a storage up top, like a closed mezzanine if you like.
The whole lot will use up the remaining tiles I have that match the main house, but I have to get more.
*Power*
For 240V 1ph, I will be getting 50m x 6mm2 or maybe 10mm2 SWA armoured cable for direct burial, along with 25mm blue polythene (farm style) water supply.
*Water*
25mm supply from house. There will be a drain soakaway, but I cannot put any foul or poisoned stuff in that. Workshop poisons have to be taken away separately. We have gutters + water butts for garden use.

So, insulated, with window views to South and South-West. Out back there, it looks directly onto farm fields. It has mini patio-style surround, partly shrouded by flowers, shrubs, fruit trees, whatever, designed to "blend in". Then for inside, a mix of garage/garden tool overspill, + machine(s) & lab/hobby/man cave space. By many HM standards, I suppose it might be considered "a bit small", but it is bigger than the half a garage. Not really a "shed", but new build in a National Park just has to be made that bit classier, and not look like it was thrown together from a load of palettes and corrugated iron. It is waaay more expensive than my first idea, but if I am going to play with the stuff I do, there is little choice. The little silver lining is the possibility that I can offset some of this stuff, and the machinery in it, against tax. It's a "development lab" full of RF instruments and scientific development stuff for X-Ray Fluorescent materals identification, and "Nuclear Instrumentation Science".


----------



## homebrewed

From an earlier question:  my signal conditioning board uses an LMC662 and a TL072 to provide selectable gains of 1, 10 and 100.  I really only need the LMC662 for the input amplifier, which has a capacitively-coupled input with a low pass corner around .1Hz.  Probably overkill.  It looks to me like most of the noise coming out of my board is what's coming out of the pocketgeiger board, so there probably isn't much to be gained by replacing those amplifiers with more expensive, lower noise types.

Regarding your question about serial or parallel-output ADCs, I really have no preference.  It is mostly dictated by what kind of interface the processor board has got. A DSP chip with some built-in ADC interface features might be ideal for this, but some like the MSP430 launchpad don't directly support 16 bit I/O (at least, not by my superficial reading of the data sheet).  I think the processor for the Teensy4 line can, but the board designer didn't lay it out to support a contiguous set of 16 bit I/O's.  

So in general, the serial data approach seems to be more widely available, but more problematic due to the faster serial clock and data signals.  While looking into this problem, I found a good article here that offers an elegant solution, but only if your microcontroller board can support two SPI channels, one acting as a master and the other as a slave.  The master channel would be used to set up the ADC and the slave channel would receive the data.  Clock and data delays in the slave channel remain synchronized because they travel the same distance back to the processor.  I note that the master's SCK basically is turned around at the ADC end so there would be a few additional nS of delay if you need to buffer it.  However, that could be matched by buffering the data coming out of the ADC as well.  You could even go the LVDS route if you want to.

Your workshop sounds like it will turn out pretty nice.  What national park will be your machining backdrop?


----------



## graham-xrf

Is it that the noise coming out of the pocketgeiger board comes from stuff unrelated to the amplifiers? How?
If that is so, disconnect the noisy stuff from having a role.

Regarding the amplifier section.
It need not be blighted by anything else.  Change out the LMC662 for almost anything with a higher GBW.
The capacitively coupled concept between the diode and the TIA does not have the RC roll-off you may be thinking about.
The capacitor is a near short-circuit to charge surges from the photodiode. No electrons cross, but their piled-up field does.
The shunt bulk resistance 40Meg, is not part of of an RC network pole. What arrives in the diode is new energy carriers, and the way this splurge of electron changes fields, and works as a charge amplifier is not the same as a low-pass filter. The feedback forces that a voltage change on the capacitor at the input is simply not allowed to happen. The million plus gain of the op-amp will swing the output so that, via the feedback resistor, all the electrons that deigned to move the voltage by charging the coupling capacitor are defeated.

Surely a low pass at 0.1Hz would not be able to show a pulse doing it's up 'n down in 10uS.

This is not like having an input resistor, and a feedback resistor, to get a voltage gain of Rf/Rin. There is no Rin.
The gain of that stage is equal to the value of the feedback resistor, The gain-bandwidth product of pocketgeiger would be fractional Hz, which is why I don't understand how it works, other than that some other component, like the capacitor across the Rf is acting as a sort of integrator.

Even with LMC662 granted the relief of Rf = 510K, the bandwidth is only 2.74Hz, unless it is doing something integration-like with the Cf
Changing out to LTC6269, and setting gain to about half a million, say 510K would give a bandwidth of 660KHz, and amplify what noise there is to a level where it cannot anymore be challenged by noise from other stuff. In effect, the S/N ratio becomes preserved, "locked in"

The best value for the coupling capacitor is about 1nF. Larger values can work OK ish, but the soak-up of the exchanging electrons starts to blunt the signal. Less than about 1nF gets a fairly close following of the pulse, but at lower amplitude as seen on the amplifier output. The voltage used for reverse bias had better be super-super clean noise free. That way, the only noise comes from the bias current carriers, and the little thermal noise.

The slew rate of the LMC662, and it's noise, is, for me, an outright deal-breaker. Even if you leave it in there, you will get a much better outcome if you take out the 22Meg resistors, and put 470K or 510K there. The noise from the reverse bias current lowers lots if you set the bias to 4V or so. The increase in diode capacitance is not too much of  problem. Then, use the second stage to make up the gain going for about 180 to 200 or so. Then put a 1-pole RC filter between the output and the ADC.

Probably the biggest single thing you can do, still using the SparkFun PCB, is to change out the LMC662, alter the gain, take care of rail powers if you need to, and  and altering the gain of the second stage.
That, anyway, is what I expended too much time with LTSpice to find out, and is why I will be using something else.

- - - - - - - - - - - - - - - - - -
For ADCs, the more expensive (£29) ADC AD7622 can offload 16-bit parallel chunks. If a Teensy4 can accept 16-bit chunks twice every microsecond, then you get full speed.
- - - - - - - - - - - - - - - - - -
This is the South Downs National Park, and pretty much similar to what I see. The crop just planted a few days ago is winter wheat.
-->  *South Downs National Park*


----------



## graham-xrf

Heh Heh.. The first little batch from mouser would hardly be heard shaking about in a small envelope, but it came to £62.33 before VAT. At least they waived the shipping charge. 

A passing question.. A gamma coming out of Am241, encountering one's thumb, would pass right through and out the other side, not likely encountering anything - right?? 

Where are our nuke experts? Gotta find one soon.


----------



## homebrewed

graham-xrf said:


> Surely a low pass at 0.1Hz would not be able to show a pulse doing it's up 'n down in 10uS.


The .1Hz corner is my somewhat paranoid response to the Theremino design, which works real hard to minimize pulse undershoot.  They claim the undershoot messes up the peak-voltage measurement.  I debated over going to an entirely DC-coupled approach to avoid this, or go with a very low roll-on frequency to minimize the undershoot.  I went with the latter just for simplicity's sake.  

Simulating the pocket-geiger circuit with variations of the .1uf interstage capacitor really highlighted the undershoot.  Dropping the capacitor to 1nF resulted in significant undershoot.  Increasing it to 1uf greatly reduced it, but will drop the roll-on frequency.  The pocketgeiger designers may have chosen .1uf in an attempt to reduce low frequency noise, but they should have done that by going with a better amplifier.



graham-xrf said:


> This is the South Downs National Park, and pretty much similar to what I see. The crop just planted a few days ago is winter wheat.
> --> *South Downs National Park*


The landscape looks a lot like some areas in the dryer (eastern) part of Oregon.  Very pretty.  Not a bad view while you're making swarf .



graham-xrf said:


> A passing question.. A gamma coming out of Am241, encountering one's thumb, would pass right through and out the other side, not likely encountering anything - right??


I'd think that a 60Kev photon wouldn't find much in a thumb to impede it, but let's see.  The most significant absorber would be the calcium phosphate A.K.A. bone.  Calcium's u/p @60Kev is .66 and phosphorous' is half that.   Calcium phosphate = Ca3(PO4)2 so it has a 3/5 concentration ratio.  If the thumb bone is about 1cm thick, the calcium thickness equivalent would be .6cm.  Calcium's density is given as 1.5g/cm^3 so for calcium (u/p)*p  ~1.  The transmitted intensity then is calculated as I = Izero * exp(-.6) = Izero* .55, so about half the gammas would make it through the thumb -- if the phosphorous wasn't present.  Since it is, it absorbs some, too; but in addition to a lower absorptivity, its concentration is lower as well.  Taking a guess based on these considerations, maybe about 45% of the incident gammas would exit a thumb.


----------



## rwm

60 KeV is around the KV used for medical extremity radiography so I would expect significant absorption. 55% seems reasonable, maybe higher. The photon flux from your source is pretty low however.
In imaging the patient dose generally goes down as the KV goes up since more photons reach the image receptor. One other difference is the 60KeV represents a monochromatic beam. In imaging that would be the peak KV so the average energy is about 2/3rd.
R


----------



## graham-xrf

Hi Mark
Lets go with the undershoot first.
I can only guess that with the op-amp you are using, the long phase change, and way-behind slew rate, and maybe what it takes to get the capacitor across the feedback resistor to change it's mind about which direction it is charging, is what is responsible for the undershoot.

The voltage only undershoots because the op-amp is driving it there, because it is too slow in responding to the new information at the input that the pulse is over. If the circuit was fast enough, it would refuse to undershoot. Also, if 66MEG is still in there, consider just little currents are coming back through the feedback to persuade the inverting input not to allow an overshoot. Lose the 66MEG, no matter what op-amp you use!

You don't have to mess with the coupling capacitor, nor consider DC coupling, to not have overshoot. Aside from the extremely necessary property that it allows us to bias the diode at will, it also can limit the slowest surges of shot noise.

See what happens in TIA-Amp3-dev. This circuit is incomplete. It does not yet have the last gain/filtering stage, nor the differential driver with white noise filter, but it is enough to show 800mV of output that started from 10nA pulse (I guessed that might be a maximum).

Note that the op-amp in the top left corner is just a temporary simulation convenience to set the power supply rails. I was trying out how close the "Rail-to-Rail" could get.




Notice that the current pulse 10nA stimulus did not persuade the actual current to get any higher than 8.6nA, because some got leaked into the 40Meg, and some tried to charge C1. That's OK. It all still works!

One can increase the C2, and see the delay increase. Decreased to 0.5pF, it finds the best peaking, and closest tracking of the pulse. I don't really want to put two 1pF in series, and that was a bit close to oscillation anyway. Reducing the Rf to 510K also makes it track closer, but I did not care that the signal would be 1 or 2 microseconds "late". I did care that it would not have late feedback overshoot, which it does not. I believe everything about struggling with overshoot, and elaborate tricks to establish a "zero" are unnecessary. When the pulse dies to zero, so should our amplifier!

- - - - - - - - - - - - -
Yep - I do like the views. When I first moved here, my place was a disheveled bungalow with asbestos roof and derelict outbuilding at the sh**ty end of the village. So I built another place more or less around it, and demolished the middle. I knew the Telegraph house on the hill was a listed semaphore historic building, as was the cottage opposite. Over time, I found I was living in a sought-after des res spot.

- - - - - - - - - - - - -
Your last calculation worries me a bit.
A gamma energetic enough to get X-rays glows out of a chunk of metal, might do damage to a DNA protein, and persuade it to start replicating itself. Come to that, when we have medical X-Rays, these come as billions of photons, with energies, I think, low end is about 25keV. A 60keV "gamma" is in the range we would call "harder X-Rays". Only from ignorance, I will try and avoid too much "thumb gamma", but it happens when extract the Am241 from the electrode tag disc.

While we are on the subject of these gammas, may I assume that 2mm (about 5/64") of lead is easily enough to be a "shield" for the photodiode, and outer skirt? In the design, the lead shield includes behind the sensor. It has two holes to let through the wires to reach the circuit board.

One of the things I think about is whether one can turn a 2mm thick flange in lead.


----------



## graham-xrf

rwm said:


> 60 KeV is around the KV used for medical extremity radiography so I would expect significant absorption. 55% seems reasonable, maybe higher. The photon flux from your source is pretty low however.
> In imaging the patient dose generally goes down as the KV goes up since more photons reach the image receptor. One other difference is the 60KeV represents a monochromatic beam. In imaging that would be the peak KV so the average energy is about 2/3rd.
> R


Hi Robert.
Thanks for that.
When I did get to operate a hospital X-ray machine, the energy of the photons was decided by the voltage, and the flux intensity (how many photons/sec) was controlled by the filament current. I had not thought that if the kV was increased, the image receptor would see more because they went through instead of getting stopped in the patient.

Of course, our flux is tiny, to the extent that I cannot use responsivity formulae for PIN diode carriers that depend on it. We do not get photons/sec/area. Instead, we get a photon hit every now and then at a rate of Hz only. Each hit releases only one X-Ray.

Maybe Mark can say roughly how many pulses/sec happen (when the Am241 carrier is turned the right way around).


----------



## homebrewed

graham-xrf said:


> I can only guess that with the op-amp you are using, the long phase change, and way-behind slew rate, and maybe what it takes to get the capacitor across the feedback resistor to change it's mind about which direction it is charging, is what is responsible for the undershoot.



I'm afraid you are over-thinking it.  The slow pulses used by Theremino-style MCAs aren't going to produce slew rate related problems like that.  It's all about charge conservation and doesn't require an active circuit in order to demonstrate the problem.  I've inserted a simulation of the RC coupling circuit to show what I mean:




However, in the overall scheme of things, I'm not sure this really is a problem.  As long as the peak voltage passes through the RC network accurately, why should it matter if it then has some undershoot??  Time to re-read the Theremino stuff I guess.


----------



## homebrewed

graham-xrf said:


> Maybe Mark can say roughly how many pulses/sec happen (when the Am241 carrier is turned the right way around).



On average, I see somewhere between 1-4 reasonably well-formed pulses per second.  This is the capsule facing the correct direction, with the copper shield in place.  Now I can see why we want multiple Am241 capsules.  A set of 8 should produce something like 8-32 CPS, all else being equal.  The count rate seems to be lower than I would have expected, based on the info in the Theremino-MCA literature.  Maybe the copper shield is absorbing more than I think.

On the subject of machining lead, I'm going to try using my knockout hole punch set -- this -- to make the aperture.  The first hole in grabby/sticky lead will probably be alright, but subsequent ones could be overly exciting.  The lead shielding doesn't need to be hermetic, the pieces just need to overlap enough to block unwanted x-rays....so the shielding box may be assembled using duct tape and/or silicon glue (pretty much like my home-made spectrometer).  After all, the first setup is to demonstrate proof of concept, not design a commercial piece of kit.  That's reserved for Version 2  . 

I'm hoping that the shielding can also be used to shield the pocketgeiger's detector and amplifier from line noise, so I can get rid of the copper-foil shield altogether.


----------



## graham-xrf

homebrewed said:


> I'm afraid you are over-thinking it.  The slow pulses used by Theremino-style MCAs aren't going to produce slew rate related problems like that.  It's all about charge conservation and doesn't require an active circuit in order to demonstrate the problem.  I've inserted a simulation of the RC coupling circuit to show what I mean:
> 
> However, in the overall scheme of things, I'm not sure this really is a problem.  As long as the peak voltage passes through the RC network accurately, why should it matter if it then has some undershoot??  Time to re-read the Theremino stuff I guess.



Thanks for counting the rate. I have 6 sources, but I am wondering whether 8 or 12 would be better. I think even with that many, we can hardly call this thing "ragingly radioactive"!

- - - - - - - - - - - - - - - -
Undershoot need not happen, unless you inadvertently measure within a feedback loop. I believe it does matter. OK - call me hardball, but I set out to measure the pulse, and find it's energy, pretty much exactly! I was quite turned off by the Thermino smudge that had a very tenuous relationship with the event that caused it.

Putting a pulse through a capacitor, and letting the other side settle at something related to the average value of the pulse shape is not something I thought would be OK if the attempt was to measure the energy (area sum).

PocketGeiger 5 was worse - and also in it's way better. It was never for XRF measuring. It was a pulse counter.

Re "overshoot".
OK  I do understand that the overshoot pulse, and what caused it, is a slow event. Your initial pulse is also very long. We know from the scintillator that the entire event is over in 4uS to 10uS

I think that what is going on in the example is the initial (very long) exponential pulse starts charging the capacitor, racing the 10k resistor intent on discharging it, and the resistor is the short-term loser. As the exponential starts reverses direction, it is again the winner, but this time against a partly charged capacitor. This is much the same as feeding a square wave into a capacitor, and noting that the waveform on the other end is still a square wave, but going both positive and negative, about a DC value which is the average of the waveform shape.

If your simulation time is set to something longer, eventually all returns to zero. Here is your circuit with the capacitor current monitored.




You can see that the current reverses (for a while) at about 60uS

If there is a place in Geiger  circuit where that is happening, we don't have to put up with it, and we don't have to mess with a series capacitor to have our way. At the charge summing point, we do not have a 10K resistor. We have instead is a op-amp that should be very insistent on forcing the voltage to be within a few uVof the positive input at GND - except this one isn't. We get to monitor the op-amp output efforts to bring this about.

I can show this (apparent undershoot current) on the LTC6269 circuit at speed. It requires two plots, to allow the scale of the small value to be seen. This one plots the photodiode current from the carriers released (green trace), and the current through the capacitor C3 (yellow trace).

Also the voltage at the non-inverting input (red trace). That is a less meaningful thing to be doing, because voltages inside a feedback loop can swing harshly all over the place as the amp tries to correct the stimulus, but you do see exactly the same "undershoot" going below 4.6uV at about 1.2uS



When the op-amp output at op1 is plotted, you see the real signal, with no undershoot.




When we get to op2, you have more gain (blue trace), there it is, with no shenanigans. The red trace scale is now overwhelmed, and has to plot near zero.

Overthinking it?
I don't know. When I think something through, I burn it until I satisfactorily understand it. "Overthinking" is not really a concept I get, nor recognize as "a thing". If it exists, then "overthinking" is still not the same as "wrong thinking". So maybe I do that.
I see less problem in "overthinking" anything than, shall we say "underthinking it"


----------



## homebrewed

While reviewing the LT6268/9 DS I realized it won't be a drop-in replacement for the pocketgeiger's LMC662 because the LT626X abs max for Vcc-Vee = 5.1V.  The LDO on the board outputs 9V, but there is a pin-compatible 5 volt version available.  I don't know if the comparators can go that low, but it doesn't matter in this application.


----------



## graham-xrf

I saw those issues - but I was into major destruction anyway. I never thought to use those supplies anyway. Reluctantly, the convenience of a USB (or Raspberry's) 5V supply, cleaned up with little common mode chokes and filters, feeding a low noise LDO for around 4.7V, and a reference at 4.096V, seemed to be a plan.

Another variant tried for 3.3V from a battery cell. I never considered the 9V for anything, and whatever voltage comes out of the switcher gets binned, along with the switcher components. It promises to work just fine using the positive supply for bias, with lower dark current noise. Even with 2V bias, and a big capacitance, it still works.

Swiftly glancing at it - do I see comparator pin-outs are actually compatible with standard op-amps?
That is a open invitation to replace the comparators with a op-amp pair, and cut and lash up circuits around it. For me, that allows a differential driver which includes noise filtering, and can even supply some gain.

I now see there is some development value in parts of that little circuit board, but for me, the question is marginal. Except I got distracted into something at the time, the board very nearly got the heatgun treatment to get the photodiode off, and the hot remains dropped into the trash!

One thing I have confirmed is Pin 7 of U3B does indeed go to a junction of R18 and C16, and the other side of C16 is on GND.
I don't think it is a fumble. It was intentional, even if plain wrong! If C16 was supposed to be on the other side of R18, then 1/RC = 452693.5 
In this circuit, that would be ambition indeed!

I get it that 470R in a wire at a audio jack was to squash the ringing from a comparator transition.
I am open to suggestions about what the capacitor was ever supposed to do.
Maybe the heatgun is again under consideration.


----------



## homebrewed

graham-xrf said:


> I saw those issues - but I was into major destruction anyway. I never thought to use those supplies anyway. Reluctantly, the convenience of a USB (or Raspberry's) 5V supply, cleaned up with little common mode chokes and filters, feeding a low noise LDO for around 4.7V, and a reference at 4.096V, seemed to be a plan.
> 
> Another variant tried for 3.3V from a battery cell. I never considered the 9V for anything, and whatever voltage comes out of the switcher gets binned, along with the switcher components. It promises to work just fine using the positive supply for bias, with lower dark current noise. Even with 2V bias, and a big capacitance, it still works.
> 
> Swiftly glancing at it - do I see comparator pin-outs are actually compatible with standard op-amps?
> That is a open invitation to replace the comparators with a op-amp pair, and cut and lash up circuits around it. For me, that allows a differential driver which includes noise filtering, and can even supply some gain.
> 
> I now see there is some development value in parts of that little circuit board, but for me, the question is marginal. Except I got distracted into something at the time, the board very nearly got the heatgun treatment to get the photodiode off, and the hot remains dropped into the trash!
> 
> One thing I have confirmed is Pin 7 of U3B does indeed go to a junction of R18 and C16, and the other side of C16 is on GND.
> I don't think it is a fumble. It was intentional, even if plain wrong! If C16 was supposed to be on the other side of R18, then 1/RC = 452693.5
> In this circuit, that would be ambition indeed!
> 
> I get it that 470R in a wire at a audio jack was to squash the ringing from a comparator transition.
> I am open to suggestions about what the capacitor was ever supposed to do.
> Maybe the heatgun is again under consideration.



I'm holding off on the transplant-surgery approach until I see just how broken the pocketgeiger is w/regard to an XRF application.  I've got my suspicions though.  The similar pinout for comparators vs amplifiers probably is no accident -- I'm willing to bet that the first "comparators" WERE op-amps.  I've certainly used 'em for that in the past, at least for low-speed things; but they aren't very nice if you want to interface them to digital circuitry.

Re-using the pocketgeiger board does have some value if we consider that other interested folks may not have the resources or experience we do w/regard to circuit surgery.  Just something to keep in mind.

R18/C16 may be there to slow the comparator's output down a little, or to tame an oscillation problem; or to deal with something on the receiver end of that line.  The LM393's output is open-collector so the capacitor will produce a relatively slow transition from "0" to "1" and a relatively fast transition from "1" to "0" when the output transistor turns on.  If we consider it as a voltage reset circuit, maybe it's some sort of pulse-pileup detection scheme?  Missing pulse detector??  A simple one-shot pulse stretcher (my vote is for this one)??  If so, the design is a bit more elegant than first thought.  Which of these really depends on what sort of pullup circuit is on the receiver end.  Arduino digital inputs can be configured to place a 20K pullup resistor on them, so the effective time constant is much longer, 94uS.  That's long enough for a simple polling loop to detect a "0" pulse, assuming you don't want to write an ISR to do it.  I also had wondered why the main signal comparator was wired to produce a negative-going transition when radiation was detected, and that's probably why.  This approach would establish an upper limit to the count rate, beyond which the apparent count rate saturates.  A cell phone would likely have a different pullup and most certainly a different polling rate so I have no idea how all this translates to a cell phone app/hardware. 

I had initially wondered how the comparator outputs could be compatible with an Arduino's digital inputs, since the pocketgeiger's internal supply voltage is 9V...until I realized that the comparator outputs are open-collector.  I'm embarrassed I didn't figure that one out sooner.


----------



## homebrewed

I just bought a set of 10mmx10mm metal blocks to use as references for calibrating the MCA S/W.  They are aimed at folks who want to collect elemental samples, but (if pure) will work fine for this application as well.  The blocks are:  iron, chromium, zinc, cadmium and titanium.  With the exception of cadmium, that pretty much spans the range of energies expected for ferrous alloys.  Amazon, $32.95.


----------



## homebrewed

I had another thought regarding the mechanical portion of the XRF.  Folks may recall a discussion about using energy filters to improve the resolving power of the system, with the most useful being a thin sheet of manganese or iron.  For this to work, the sheet cannot be exposed to the primary 60Kev gammas from the Am241, or the spectrum will be "contaminated" by a manganese or iron peak.  For convenience, it must be relatively easy to swap out filters -- suggesting a kind of filter holder on the outside of the lead shield -- but, obviously, it still must be shielded from the gammas.

Also regarding the energy filters, I did some math to see if there is an optimum thickness for the filter in order to achieve the best effective resolution -- in the case of a manganese filter, to distinguish iron and cobalt.  The filter preferentially absorbs the cobalt peak.  It turns out that the ratio of iron to cobalt counts improves without limit as the thickness of the filter increases -- at the expense of lower and lower count rates.  So there IS an optimum, and it is a balance between count rate and energy resolution.  This can be messed with some, by using more Am241 sources to increase the primary gamma flux.  So I don't have an actual number for that ideal thickness.


----------



## graham-xrf

I have not yet given thought to filter discrimination tricks to mask the unwanteds, but what you say does trigger a thought.

In messing with the geometry, I tried to minimize photon routes from lead shielding surfaces that could arrive at the sensor. If the outer tube is large enough radius, then the photon routes at the diode are shadowed to all except the test piece, and the surface under it. That might be something low density, thick enough, and made of stuff that we can't get a glow from. I was thinking a bit of polystyrene insulation might do. Anything will do, so long as it's all carbon and hydrogen and maybe chlorine (PVC). PTFE is nice. Flourine X-rays are too low to care!

If we do not have the test piece sat on a sheet of lead, the lead peaks go away The diode only sees the back of it's tube lead shield, not direct top surfaces that saw a 59keV photon arrive.

The lead, if excited, is capable of delivering L-shell *Lα1 = 10.55keV*, and *Lβ1 = 12.61keV*, which is right in the middle of energies we would collect.

The values for lead are:
For Pb
K shell --> Kα1 = 74.9694       Kβ1 = 84.936
L shell --> Lα1 = 10.5515        Lβ1 = 12.6137

The energy is not high enough to get a glow from the K-shell, but we would see the lead there from L-shell responses. It may not matter, because, out  of your list of test metals, only zinc comes close with 9.57keV. If we have preserved our pulse shapes well enough, we should still be able to see the separate peak.

The obvious question is - if we do have lead responses, are there any filtering tricks one can use to let the wanted X-rays build up count, to tip the scales against the lead response?

*Going where I have not yet fully understood it yet.*
On the getting of calibration pure elements, I suppose I may have to gather some. On calibration, one can have software setups to deliberately spread the X-axis buckets over a more limited range, to "zoom in", using calibration elements nearer to what is suspected to be in the alloy.

e.g. Setting the "zoom" to have more buckets devoted to collecting energies in range 2-8keV, the cadmium L-shell would have handy 3.1keV and 3,3keV responses. We would have ignored the 23.1keV and 26.1keV. Even at the low 2% probability of getting a diode response at 3keV, we may see it if we wait some seconds (minutes??)

Do tell what Amazon search term you used?
In my design, there is now provision for inserting a disc of metal "filter" up  the shadow tube to be over the sensor, where Am241 energy cannot directly see it.


----------



## graham-xrf

The Mouser electronics hardware has arrived!
We shall see what this stuff can do.


----------



## homebrewed

graham-xrf said:


> Do tell what Amazon search term you used?



I was searching for "Manganese metal" (to use as an energy filter) in Amazon's "industrial and scientific" subsection and came across the set of cubes.  To save you some hunting around, here's a link to the ones I bought:  metal cubes.

I still haven't found an affordable source for thin manganese sheet.  You can get it in powdered form, which may turn out to be about the only choice.  Mix it with a binder and cast it.  Getting good uniformity of both density and thickness would be the tricky part.  Another idea would be to make a solution of a manganese salt, like MnSO4 or MnCl2, and use that.


----------



## graham-xrf

homebrewed said:


> Mix it with a binder and cast it.  Getting good uniformity of both density and thickness would be the tricky part.  Another idea would be to make a solution of a manganese salt, like MnSO4 or MnCl2, and use that.


I get it that for filter purposes, you want something of uniform thickness. A salt in solution is problematic. I find liquids anywhere hard to control.

Thanks for the Amazon link.
I see that on amazon.co.uk search, there are sets for educational density testing purposes. One set is for 12 cubes for £31.29 (£41.57) which got a 4 star rating because the cube's sizes were slightly mismatched. Also, one of them is "marble" and one is "perspex".

--> *Set of 12*

Also, it's a chancer scammer's paradise. You have to look carefully to be sure the description says it's a _set_.
One of them manages to choose a price + postage, which when added together, equal the legit product price, and the description is very wordy, designed to obfuscate, and calling the color "10mm Cube Bismuth". Even though the picture shows a bunch of 8 of them, you only get one!

--> *Misleading scam description cubes*

I think the educational sets may generally be a better deal than the ones aimed at periodic element table collectors. I guess they could get more expensive if precision machined and laser etched or engraved with Periodic Table info.

- - - - - - - - - - - - 

I have to now devote more time to getting things set up for the coming building operations. I have made up the profile stakes and boards, and I have to set them up on the site. Also, I have to do major organize and tidy up, de-clutter, and relocate a whole lot of stuff. I am not so good at that.   

Also, I have to put the woodwork hat on, and move over to routing the frame jambs and installing the fire door into the garage + more other domestic stuff than I want to know about.


----------



## homebrewed

The element samples arrived today:


----------



## graham-xrf

Biggest-Ass Photodetectors!

I don't exactly know how this works, but it seems to be a huge lump of liquid scintillator, surrounded by a bonkers spherical array of photo-detectors.
I don't care it's PMTs or PIN diodes, that lot looks expensive!


----------



## homebrewed

I don't recall hearing about that particular neutrino detector.  Neutrino detectors typically do use large numbers of huge PMTs, along with what amounts to a massively-large liquid scintillator.

On our current subject, I found I already have some aluminum guilding leaf (left over from a work-related experiment).  So while I was ordering some stuff from Mouser for a different project, I added a small quantity of conductive ink to stick it down over the hole I cut in the copper shield to expose the detector and LMC662.  It's considerably thinner than kitchen-style aluminum foil so it should work pretty good for passing low-energy x-rays while shielding the detector from powerline noise.

On the subject of avoiding the 10.55Kev signal from lead, I had a thought that might be worth exploring.  A composite shield, made of a fairly thick aluminum sheet ~1cm will completely absorb 10.55Kev.  Since that much aluminum only reduces the primary 60Kev gammas by about 50%, back it with a lead sheet. The 10.55Kev's it sends back through the aluminum are absorbed.  This way, only the relatively poorly-detected aluminum peak at 1.5Kev will make it to the detector.  And of those, only the top 30 microns will contribute a significant number of those photons.....the rest get absorbed in the bulk of the aluminum.  But guess what:  the 10.55Kev photons that will cause the fluorescence @1.5Kev are reduced by a factor of 1/3E-31 before they get to that top 30 microns!  I think that will pretty much take care of everything but the 60Kev-->1.5Kev conversion at the surface of the aluminum, and it's a long way from the energy range we're interested in.

The relatively high absorptivity of ferrous metals at ~6Kev means that we're only going to be sensing the surface of the sample down to a few tens of microns, no matter what.  That's just baked into the cake, so to speak.


----------



## graham-xrf

The filtering is interesting. I think we aught to consider whether we care if there are responses for lead in the middle of responses for the stuff we are trying to test. I had a quick look at the energies in the elements list, looking for any that could get masked by the lead. 10.55keV and 12.6keV. If those are there, we know to ignore them.
*
A software digital filter?*
To some extent, my notion may be completely stumped by the bucket resolution we can achieve. To be able to have sufficient measurement accuracy in counting up the samples for the duration of a pulse event, so that we know buckets values "near", but not exactly "on" the lead signals is what I am thinking about. So long as the counts are consistent enough for there to be clearly distinct buckets for non-lead things, we could implement a "software filter", and simply remove the 10.55keV and 12.61keV buckets from the results.
*
Even test for lead in alloys?*
Getting more fine-tuned, it might be possible to establish a base count in calibration of the lead buckets that are always there, known to be coming from the shielding. Then, if there is lead in the sample, or maybe an alloy known to have lead in it, we subtract the base line count values, and might be left with counts revealing the lead content in the tested sample or surface.  These, of course, are proportionally scaled to the test duration calibration. This sounds fine in theory. One hopes that our measurement is not so noisy and messed up that we cannot separate them.

High L-shell values combined with specific signatures near lead allow a logic to take hold. e.g.Iridium has a value at 10.7keV. Unless we can resolve a bucket 10.61keV as being separate, we would not know. Bismuth, next to lead has a 10.8keV response, so might not be seen, except it also has a 13.0keV. I doubt we would ever encounter Actinium, or if we did, we are in a big mess!

Going back down the list, everything  lower number than Iridium is unambiguous, the L-shell becoming feeble near Molybdenum, but Moly's K-shell comes to the rescue. Arsenic has a response at 10.54keV which might have it lost among lead, but the K-beta shows it up at 11.72keV.

- - - - - - - - - - - - - -
The 662 will be off shortly, and replaced. This leads to a decision about my lead shield holding the Americium pellets. I had imagined it as having the circuit board in the tube behind, which meant the sensor needed to be set at right angles to the end of the PCB, possibly on it's own board being simply the cut off end of the Geiger board. This notion was driven by thinking the final gadget would need it's own board anyway.

Staying with the notion of using, in part, a modified Geiger board means it sticks out at right angles out of what would have been the tube behind the shield. So at least for the first lash-up, I will do something like that. I took the copper screen off, because the PCB will be in a metal enclosure anyway.

Are we saying that under the lead skirt outer shield, 60Hz interference can still get in?


----------



## homebrewed

graham-xrf said:


> Are we saying that under the lead skirt outer shield, 60Hz interference can still get in?



I'd have to say that we don't know yet.  Gain at 60Hz will be high, and there will be a hole in the lead shield that may allow some electrical noise in.  I'm just being proactive when it comes to keeping noise out, particularly since noise is going to be our enemy when it comes to energy resolution.


----------



## graham-xrf

homebrewed said:


> I'd have to say that we don't know yet.  Gain at 60Hz will be high, and there will be a hole in the lead shield that may allow some electrical noise in.  I'm just being proactive when it comes to keeping noise out, particularly since noise is going to be our enemy when it comes to energy resolution.


Pre-emptively, the second gain stage can be configured to deep-notch 50Hz or 60Hz with a resistor selected tuning option.
That could be a case of bolting the stable door after the horse has gone!
I agree that stopping the 60Hz before it gets into stage #1 is the best way.

Screening, and paying attention to common mode current paths can get electric field pickup below the noise floor. Magnetic pickup can be minimized by limiting the area of the pickup loop, which is pretty small anyway, at the diode connections. If the conductors are brought close together before they go to the amplifier, and guard rings are used, that might help. I am unsure whether a piece of mu-metal under the diode would help, but the mind imagines the interfering power line field taking the preferential route through the metal, and failing to couple to the diode connect conductors.

A piece of mu-metal, placed under the diode, held under the copper tape even, if you retain it should work. I don't think you need the copper tape if the circuit is in a metal box. It was only the expedient because the Geiger was in the little plastic case.


----------



## homebrewed

On a whim I fired up my de-shielded pocket geiger.  Unsurprisingly, lots of AC pickup.  I haven't replaced the LMC662 with a better device yet, but I have gotten a 5V LDO to replace the 9V version that came on the board.  The original is in an SOT23-5 package so it's best to replace the original with one from the same family.  Simulations don't reveal a problem running the LMC662  LTC6269 well beyond its abs-max supply voltage, but that's not surprising.  Many SPICE device models aren't designed to catch that.

On a slightly different subject, I've been looking into making my own fluxgate magnetometer (for a completely different project) and came across a product that could be very useful if we find it necessary to fall back to a scintillator/PMT approach.  It's a magnetic shielding tape that is claimed to not suffer from degradation of permeability if it's bent or formed.  Not cheap, but it could be useful if you have some odd mechanical configuration you need to shield:  This.  Unlike permalloy, the product contains a lot of cobalt rather than nickel.  Maybe it also could be used as a standard to aid in the XRF spectrometer analysis.  It wouldn't be useful as an energy filter because it (likely) would only be useful to help separate nickel and copper peaks.

I've been wanting to make the lead shield to do some experiments but right now my mill (which I would use to make the aperture hole for the detector) is need of repair.  That's due to a mistake I made in a modification to the mill's Y axis; but I should have the items necessary to address that pretty soon.

Edit some time later:  struck out "LMC662" and corrected.


----------



## graham-xrf

I look forward to messing about more with the XRF, Right now, most of anything I would be doing as interest projects are temporarily boxed up. The throughput on building related stuff has made the garage more or less unusable. The final straw was dragging in the crate with the mill drill!
I spent yesterday exploiting the let-up in the rain to get out there with the laser level (handy thing), and with my stakes and profile planks, setting out the foundations and surrounds for the outbuilding.

As I recall, in simulations, I did get significant performance differences between using the LTC662, and the LTC6269.
Beyond that now. The 662 has been lifted off the PCB. It yielded to the Polish coil wire trick. This has to be a lash-up. It would be great if in a final design, the diode could be mounted at right angles to the PCB, so all could go down a metal tube, with a little lead insert at the end. The shielding would be inherent.

*TIA Amplifier Design*
If a low bandwidth TIA is built having extreme high Rf, then most FET input op-amps end up performing a bit similar in simulation. In my simulations of "event" pulse current injections, I deliberately spread the gain, trading lower first stage gain for bandwidth, so I could capture the pulse area integral with sampling. I went against some of the aims of directly putting current electrons into a summing input of an op-amp with hundreds of MegOhm Rf. All this, while trying to keep the noise down.

In conventional TIA design, there is a noise factor benefit in simply making the feedback resistor as high as possible. The transimpedance gain (Rf) increases faster than the Johnson-Nyquist thermal noise.

Thermal Noise = √(4*k*T*B*Rf).   Gain = Rf.
Signal/Noise improves by √Rf

This, I think, is why we get TIA circuits with 400MegOhm, and 1GigOhm feedback resistors. The 66MegOhm in the Geiger 5 seems relatively low by comparison. Here is where we get to what we want it to do. For detection and measuring of low level light, this instrumentation is OK. When it comes to detecting pulses, where we care also about the real amplitude and duration of the pulse, we depart from photovoltaic. We change technology to PIN. We use a bias to lower capacitance. We trade off noise contributions. We exploit the extremely low offset voltages and extremely  low bias currents in the modern op-amps.

I was finally getting consistency, and feeling better about the simulations, but to get there, I had to first test LTSpice in artificial, simplistic setups, and set the tolerances, and convergence, to make it credible when counting femto-amps. LTSpice had been tweaked to speed simulation of switcher power supply chips.

The shunt resistance of our PIN diode is 40MegOhm. That is "low" compared to common photovoltaic photodiodes. After going all around the houses with simulations, like you, I got to the point where I needed to try it out. I will push the TIA first stage gain as far as I can, consistent with not losing the pulse integration area information, because that is the one property that discriminates the material that caused it. The amplifiers need to be oriented to keeping some of the nature of the pulse, rather than just counting the fact they happened.

We can put up with the pulse being distorted from passing through bandwidth limited circuits, so long as different sized pulses can remain recognizably different in calibration. We cannot have local circuit energy storage artifacts, such as waveform response overshoots, contaminating this information. That is why the pulse circuits I was happy with do not have these overshoots.

If you haven't come across it already, I attached a 1994 application note from Burr-Brown before it joined with Texas Instruments. Figure 2 amplifier has  *Rf = 1GigOhm*. The photovoltaic circuit Figure 3 uses *400MegOhm*.  The "wider bandwidth" 100kHz circuit has to use *Rf = 1MegOhm*.
In the circuits I was interested in, I used *510K* up to about *1MegOhm.*

The OPA128 was an electrometer grade amplifier. Very good in it's day, but only 1MHz GBW. The specifications cannot match things like LTC6269.
 - - - - - - - - - - - - - - -
We should do OK messing with butchered Geiger 5 boards for development.


----------



## graham-xrf

Playing with the Pi4
On first lash-up, it's only the Pi4 hooked to the A/D converter via SPI.
The general scheme is the Pi4 is much like the one right next to me running the web server with NGINX.
We already know that a whole lot of phone "apps" are just links to a web page. This is a similar idea.

Basically, the Pi4 does everything, and is with the TIA amp kit. It also hosts a web page with the plots in real time.
It's on Wi-Fi. It's on BlueTooth. It can be on a LAN with an IP address. It can even be the other side of the planet.
With zero extra software, any smartphone with a browser can see and interact with the plots.

I am hooking up  Pi4 Model B to a skeleton lash-up AD7622BSTZ A-to-D converter to shift at least 20 chunks of 16-bit samples in a 10uS period.

I very much wanted to have it as a sensor with a bunch of electronics, and a phone, as an available choice for interested folks. There is nothing at all wrong with alternative displays, like a WiFi connected laptop, or using one of the Pi4-B HDMI display connectors to a monitor, and mouse + keyboard. Direct to Pi4 would likely be the way I do it. For those using a phone to display, the web page has buttons and inputs to control it.

Maybe a full Pi4-B with maxed out memory is overkill, but the ease with which it can be a web server is what convinced me.


----------



## homebrewed

graham-xrf said:


> Playing with the Pi4
> On first lash-up, it's only the Pi4 hooked to the A/D converter via SPI.
> The general scheme is the Pi4 is much like the one right next to me running the web server with NGINX.
> We already know that a whole lot of phone "apps" are just links to a web page. This is a similar idea.
> 
> Basically, the Pi4 does everything, and is with the TIA amp kit. It also hosts a web page with the plots in real time.
> It's on Wi-Fi. It's on BlueTooth. It can be on a LAN with an IP address. It can even be the other side of the planet.
> With zero extra software, any smartphone with a browser can see and interact with the plots.
> 
> I am hooking up  Pi4 Model B to a skeleton lash-up AD7622BSTZ A-to-D converter to shift at least 20 chunks of 16-bit samples in a 10uS period.
> 
> I very much wanted to have it as a sensor with a bunch of electronics, and a phone, as an available choice for interested folks. There is nothing at all wrong with alternative displays, like a WiFi connected laptop, or using one of the Pi4-B HDMI display connectors to a monitor, and mouse + keyboard. Direct to Pi4 would likely be the way I do it. For those using a phone to display, the web page has buttons and inputs to control it.
> 
> Maybe a full Pi4-B with maxed out memory is overkill, but the ease with which it can be a web server is what convinced me.


That sounds pretty sweet, especially for the price -- and you have a number of options on how to implement the user interface.

I think my first attempts will use my Teensy for the front end ADC and peak detector.  It will send the data via its USB to an old Dell laptop running a pared-down version of linux.  On that end, a bit of code written in plain-vanilla C will partition the peak data into bins -- that's the MCA core -- and output a csv file I can post-process and display with a spreadsheet.  In addition to the MCA function, the C program will handle the setup stuff for Teensy -- start/stop acquisition, sample rate, etc.  Not in the least portable....not in a physical way, anyhow.  You will be ahead of the curve in that regard.

If the massively-filtered pulse approach doesn't work out, the same basic setup still can be used, but the front end -- TIA and ADC -- will be different.  Since the Teensy will just output the peak voltage values, the data rate going to the back end will be the same regardless -- it's just the number of clean pulses culled out of the raw ones coming from the detector.


----------



## graham-xrf

homebrewed said:


> That sounds pretty sweet, especially for the price -- and you have a number of options on how to implement the user interface.
> 
> I think my first attempts will use my Teensy for the front end ADC and peak detector.  It will send the data via its USB to an old Dell laptop running a pared-down version of linux.  On that end, a bit of code written in plain-vanilla C will partition the peak data into bins -- that's the MCA core -- and output a csv file I can post-process and display with a spreadsheet.  In addition to the MCA function, the C program will handle the setup stuff for Teensy -- start/stop acquisition, sample rate, etc.  Not in the least portable....not in a physical way, anyhow.  You will be ahead of the curve in that regard.
> 
> If the massively-filtered pulse approach doesn't work out, the same basic setup still can be used, but the front end -- TIA and ADC -- will be different.  Since the Teensy will just output the peak voltage values, the data rate going to the back end will be the same regardless -- it's just the number of clean pulses culled out of the raw ones coming from the detector.


The Teensy is fine, and the slowed up distorted pulse can also work OK, so long as the pulse varies a bit with the energy that caused it, and can be "recognized" in a calibration. At this stage, goodies like phone display are not important. We gather that stuff up at the end.

It's just that I have, somewhat by accident, and partly by rabbit-hole suck-in, managed to maintain the undistorted theoretical pulse as a high resolution sampling. I am tempted to wind the resolution discrimination up as far as it will go, but that is all - just tempted, not acting on it! The A/D could allow 40 samples in a 10uS shot, and the number of totalizer buckets can be as many as we can find statistically separated sets of.

There is, of course, all sorts of smarts filtering to have it do sensible actions when confronted with pulses very short, pulses very long, three pulses in 15uS, a huge energy pulse that did not come from an X-Ray, 50/60Hz, a set of numbers so untypical, it "knows" the sample is not there, etc.
I am in two sections here. One is all about the A/D sampling via SDR, and making that bulletproof. The other is about what is upstream of the ADC. Polish coil-wire trick may have worked just fine in removing the LTC662. Getting the LTC6269 to stay put long enough get soldered in it's place is a bit more fraught. Maybe i had too much coffee. I think I have to break out the binocular illuminated inspection/assembly (low power microscope) thingy, currently in storage.


----------



## homebrewed

graham-xrf said:


> Getting the LTC6269 to stay put long enough get soldered in it's place is a bit more fraught. Maybe i had too much coffee. I think I have to break out the binocular illuminated inspection/assembly (low power microscope) thingy, currently in storage.



My stereomicroscope never goes into storage, just because it makes working on stuff like that SO much easier.  Not to mention pulling nasty metal swarf splinters out of fingers.

Correct me if I'm wrong but it sounds like you're initially going to repurpose the pocketgeiger by simply replacing the LTC662 and Rf?  I'd thought you had removed the X100-7 for your own board but perhaps not.


----------



## graham-xrf

homebrewed said:


> My stereomicroscope never goes into storage, just because it makes working on stuff like that SO much easier.  Not to mention pulling nasty metal swarf splinters out of fingers.
> 
> Correct me if I'm wrong but it sounds like you're initially going to repurpose the pocketgeiger by simply replacing the LTC662 and Rf?  I'd thought you had removed the X100-7 for your own board but perhaps not.


I had thought my final TIA circuit is just too different to keep the pocketgeiger board. An arrangement with sensor mounted at right angles to a PCB, at it's narrow end, would allow the whole thing to fit in a metal shielding tube, (so no metal tape), and the radiation illuminated region being circular, so having a turned lead shield that mounts the Am241 sources in little drilled recesses, arranged all around. These can be angled to shroud signal returns from stuff made of lead. They squirt all directions at once, but only controlled apertures count. It seems the geometry may have such a shape, where the photons that get loose, and hit lead in various places do not have a lead target x-ray glow path into the diode.

I use the pocketgeiger board as a lazy temporary convenient breadboad lash-up. It mounts the diode, and and a first stage. The value of finding a way to keep a re-worked version of it, if it can be done, is not lost on me. Keep in mind that you and I may be able to bring out the stereomicroscope, and modify PCBs, but a lot of folks who would love to have one, just can't do it. That is where an dedicated board may make sense. I also thought that most folk wanting one, would love to machine up the tube and shields, and so get invested it it being partly their own work.

A final physical arrangement _could h_ave the sensor mounted on the PCB, as like pocketgeiger, but it forces the circuit board to stick out sideways through the lead shield, and ruins the symmetry of a circular array of sources blasting away at the test surface. I think my choice end product would be a diode, with the piece of board under it, cut free of the pocketgeiger PCB, and fixed at right angles onto a new amplifier PCB. If it proves to be possible to build a decent amplifier on a somewhat modified pocketgeiger PCB, I suppose that coud be a big advantage. No need to make more PCBs.

It is _much_ easier to carry a amplified buffered pulse signal up to a ADC mounted at the Pi4, instead of trying to run up to 70MHz SPI signals up a cable. This time, having a Pi4 more or less in the same box shield, and relying on network solves most of the 50/60Hz interference coupling.

On question that comes to mind is, can there be (useful) signature energy groups from stuff other than metal alloys?

[Edit: Thanks for the swarf splinters suggestion. It would not have worked on my last encounter with showers of broken off wiggly wires flung free of a rotating wire brush in my Makita drill to end up somewhere on the garage floor. Later, heading through side door to fetch something out of garage, but only wearing sock on the feet. The wire went into my foot pad roughly between big toe and the toe next to it. probably about 9mm in, and the end disappeared. No amount of magnifier will let you see under the foot. The fix involved help from others, and pointy scalpel blades, and made my eyes water! ]


----------



## graham-xrf

Yay - getting help from No.1 Son (satellite engineering software developer) working up the AD7622 ADC into life.


----------



## homebrewed

graham-xrf said:


> Yay - getting help from No.1 Son (satellite engineering software developer) working up the AD7622 ADC into life.




Oh, and Merry Christmas!


----------



## graham-xrf

@homebrewed :
Thanks, and for you too, and all other survivors of this thread.


----------



## homebrewed

graham-xrf said:


> @homebrewed :
> Thanks, and for you too, and all other survivors of this thread.
> 
> View attachment 348572


Hehe.  Yeah, 50 pages and counting.  I wonder what the record is? Not that's a particularly laudable accomplishment, perhaps a testament to prolix conversations!


----------



## graham-xrf

Pi and dead bug construction happening as a matrix proto board "hat". I have some LQFP "universal" little PCB coming (£1.86 for two on eBay).
I might just stand on on my GPIO "hat", or maybe hold it on with a dob of hot-melt.

This part is only for the ADC. The amplified, buffered, relatively bomb-proof TIA signal is not MHz, so can be brought to the ADC.

OK on the 50 posts. All that reflects is that we are talking about the design, letting it all hang out - but yes, it is an unusual thread. When we get our first plots, we can drop a short posting in the forum under an new title, teasing the curious.

An off-the-wall question.. I have no idea (yet) whether anything unusual is happening, but would we expect some increased counts just because the Am241 sources that have been pulled out of their metal smoke chambers, are in the same jar as about 10 Thorium gas mantles?


----------



## rwm

"An off-the-wall question.. I have no idea (yet) whether anything unusual is happening, but would we expect some increased counts just because the Am241 sources that have been pulled out of their metal smoke chambers, are in the same jar as about 10 Thorium gas mantles? "

What is the theory behind that? 

Robert


----------



## graham-xrf

rwm said:


> "An off-the-wall question.. I have no idea (yet) whether anything unusual is happening, but would we expect some increased counts just because the Am241 sources that have been pulled out of their metal smoke chambers, are in the same jar as about 10 Thorium gas mantles? "
> 
> What is the theory behind that?
> 
> Robert


The decay product of Thorium is Radium (I think). Anyway, when you put a gamma source (Like Am241) together with Thorium, I think it possible the interaction can breed stuff one does not want - but I don't know. The infamous David Hahn put smoke detector sources, thorium, luminous clock dial paint, and various other stuff rolled up together in foil in a potting shed, which did begin radiating about 1000x background, and was steadily increasing. He tried to separate it, leaving the Am241 in the shed with the dial paint. and packed the rest into his car trunk. At that stage, he got nabbed by the police. The radiation which had started out from smoke detectors was measurable outside the house and along the street. There was a whole cleanup incident. Hahn died young, and there are lots of articles about it.

Of course, he had put together everything radioactive he could get hold of, all in a foil ball held together with duck tape. Nothing like the small amounts of stuff I have in the jar, which is basically 8 radioactive sources of Am241 and 10 thorium mantles. The Am241 is mostly an alpha radiation source, but it also does gamma, which is the radiation we use to get the XRF gadget to work.

https://unbelievable-facts.com/2018/12/david-hahn.html
https://harpers.org/archive/1998/11/the-radioactive-boy-scout/


----------



## graham-xrf

This is going to a bit of a challenge!


----------



## homebrewed

Couple things.  First, unless any of the radioactives emit neutrons, there will be no radio-activation.  Gammas irradiating nuclei won't do it. 

I confess to some confusion here because, according to Wikipedia, in sufficient quantities Am241 could make a bomb but I haven't seen anything to suggest any of its decay routes emit a neutron so I don't understand how that is possible.  Perhaps an Americium fission weapon needs a "primer" of some other fissile to make it go bang??  That said, the quantities we're talking about for XRF are far below what's needed for neutron activation anyway.  Fugetaboudit.

Second, regarding the blue/pink dots, that's not an issue unless you are going to heat the entire IC package to solder-melt temperature (dead-bug assembly isn't there).  And if you are, just bake the part at some temperature below 100C awhile, pull it out of your oven and immediately solder it down.  2 hours' baking time at 80C will do just fine.  The conversion of absorbed moisture into steam is an issue with larger packages, especially if they have an exposed paddle (typically used for heat sinking) so that's why the monitor cards are packaged with this kind of device.

BTW, if you're reflowing multi-layer PCBs I strongly suggest baking them out beforehand, too. I've seen problems that suggested they had delaminated internally, causing through-hole vias to become open or intermittent.  Debugging something like that can be a real PITA so don't go there.

I have direct experience on what can happen to large IC packages if they're not baked before solder reflow.  It caused havoc on a Tektronix production line and initiated a huge investigation into all kinds of possible mechanisms, all but one of which turned out to be a waste of time and money.  THAT episode is the reason I advocate baking IC's out before reflowing them.  It became part of the standard procedure we used for re-mounting customer returns on eval boards.  Some in the lab didn't bother baking out the eval boards, but I always did.  Why court disaster if you can avoid it?


----------



## graham-xrf

While I still have some way to go on nuclear engineering, and I do get it that neutrons can just waltz into the middle of an atom without a big force to overcome, I can figure we don't have many to worry about. It's just that, when I don't know, I ask.

I find out that the name "Americium" was dreamed up partly motivated by being in the same group right after Europium.  Discovered at the same time as Curium, which is right next to it in the Table Periodic,  it was supposed to be an improvement on the provisional names _*"Pandemonium"*_ and _*"Delirium"*_. I have to say, I would have been perfectly OK with the provisional names! 

I hear you about baking the chips. Here that would involve a sneak into the kitchen. I don't have a little "oven". My only recent thoughts in that direction was thinking to bring together some 1mm Molybdenum wire, a  PID controller and some N-Type thermocouples together with a earthenware pipe and some insulation. I was thinking up to 1250C, but I suppose such could be persuaded to sit at 80C.

I had thought perhaps using solder paste, as if for re-flow, but not doing the re-flow. Instead, just gently heat the pins from the top with a soldering iron bit. It sounds as if one should bake out the chip anyway.

Re: Messing with the Pi. Getting it to read and write to the pins is now done and working OK. This not using any of the usual libraries, and definitely not anyone's Python code. The chip can run at 2Ms/sec in turbo mode, but we are thinking to use "normal" mode at up to 1.5Ms/sec, because there is no minimum time to a next sample. I have to wait a day or two for the LQFP experimenter boards to mount the expensive little thing. They were clearly invented in response to the basic need to connect something made exceptionally small to a fault, to end up with terminals us mortals can see, and solder a wire to.


----------



## homebrewed

One of those little, cheap toaster ovens may be in my future, if I do more circuit boards.  Thermocouples and controllers are pretty cheap these days.


----------



## rwm

Alpha particle bombardment can cause fission and proton number changes. 
Apparently Thorium is fissionable under alpha particle bombardment. This would produce some dangerous byproducts. I suspect the conversion rate would be quite low but I guess this is the perceived risk.
Robert


----------



## homebrewed

rwm said:


> Alpha particle bombardment can cause fission and proton number changes.
> Apparently Thorium is fissionable under alpha particle bombardment. This would produce some dangerous byproducts. I suspect the conversion rate would be quite low but I guess this is the perceived risk.
> Robert


The only reference I found regarding alphas causing fission on Thorium indicated it took ~30+MEV alphas to do it.  The alphas emitted by Americium are about 1/6th that energy.  So for most elements the risk is low from that particular route.  However, if Am241 is combined with Beryllium it CAN generate neutrons via alpha capture in the Be neucleus.  Apparently because Be has a large capture cross section for alphas.

The Wikipedia article on Americium indicated that Am214 will spontaneously fission with the release of a neutron, at 1.2 atoms/second-gram.  Since we're talking about micro-curies here, that particular route isn't very risky, either.  However, this does explain why Am241 could be used to make a bomb, if you've got a whole bunch of it.  And I mean a whole lot: without any neutron reflectors you'd need a sphere 50+ Kg to reach critcal mass, 19+ cm in diameter.  No secrets here, I got all that off the 'net.

I think the most significant danger is the alpha particles themselves if the Am241 is ingested.  So it's necessary to be very careful when extracting the little disks from smoke detector sources.


----------



## rwm

Yeah I saw that article too. I didn't realize the Am alpha was only 5 MeV at the time. I agree that for any alpha emitter the big issue is inhalation/ingestion. Back to the regularly scheduled programming...
Robert


----------



## homebrewed

rwm said:


> Yeah I saw that article too. I didn't realize the Am alpha was only 5 MeV at the time. I agree that for any alpha emitter the big issue is inhalation/ingestion. Back to the regularly scheduled programming...
> Robert


I learned some things when I researched your concern so it's all good anyway


----------



## homebrewed

Sort of an "oh pshaw" moment yesterday.  I pulled the LMC662 off my pocketgeiger to replace it with a LTC6269 to lower the noise floor of the thing when I (belatedly) discovered that the replacement has a different footprint!  Aargh.

I didn't purchase the LTC6269 for this project but for something else so didn't think about that when I started modding the pocketgeiger.  Time to order the right one....


----------



## homebrewed

Unfortunately, the LTC6269 isn't available in the SO-8 package.  Making and installing an adapter board would be a pain and pretty messy so I did some browsing through Analog.com's list of low-noise amplifiers to find a reasonable substitute, and I think I found one.  It's not near as fast as the LTC6269, but since the pocketgeiger circuit is designed to be slow as a turtle anyway I don't think that is a big issue.  It's the AD8646, and, noise-wise on the low frequency end it looks better than the 6269 (and far better than the LMC662). It isn't in my LTSpice library but there is a spice macro-model available for it.  Simulations looked good.  Plus it actually is cheaper than the LTC6269, and DigiKey has it in stock!


----------



## graham-xrf

homebrewed said:


> Unfortunately, the LTC6269 isn't available in the SO-8 package.  Making and installing an adapter board would be a pain and pretty messy so I did some browsing through Analog.com's list of low-noise amplifiers to find a reasonable substitute, and I think I found one.  It's not near as fast as the LTC6269, but since the pocketgeiger circuit is designed to be slow as a turtle anyway I don't think that is a big issue.  It's the AD8646, and, noise-wise on the low frequency end it looks better than the 6269 (and far better than the LMC662). It isn't in my LTSpice library but there is a spice macro-model available for it.  Simulations looked good.  Plus it actually is cheaper than the LTC6269, and DigiKey has it in stock!


I did realize that the pinouts were the same, but that the package sizes were different.
Just look on eBay for MSOP circuit boards. There are all manner of little adapter boards to convert to "bigger" formats, though I suspect the conversions are usually up to DIP size, but I haven't looked hard yet. I had not planned on using the PocketGeiger PCB unless I could conveniently hack it.
*
Points about using the LTC6269.*
It is not just about the lower input noise figure. I chose the speed, in combination with the input noise characteristics, the input offset voltage, the input current and gain, used in conjunction with (some) bias in the PIN diode. The bandwidth was of the greatest importance!

The general design aim was to use a gain in the first stage sufficient to put put the signal/noise ratio beyond the point it could be assaulted by anything we would get up to downstream. 30dB would be more than enough. I went for 40dB to 50dB, trying to pile on as much gain as possile in that stage short of  compromising the bandwidth. The gain in the next stage would then multiply that.

The LTC6269, it has sufficient gain-bandwidth product to deliver this while reliably amplifying a radiation pulse detection event. The multiplication gain required to deliver into A/D conversion, also provides for drivers, filters, etc. as needed. This can be provided in stage(s) without hurting the noise figure. It did seem to me that the LTC6269 could nearly do the whole job by itself, but I was prepared to use one more package (*LT1807CS8*)
as necessary, to interface with ADCs. Some had built-in differential drivers, others not. I wanted that the design did not have stored energy overshootsleading to all the games to re-establish q measurement base line
- - - - - - - - - - - - - -

I get it that one wants to be able to try and use the PocketGeiger board, and from there comes the motivation to find a op-amp in a package that fits. What I could not do is use a poorer op-amp, on the grounds it has the bigger package, and compromise the rest of the design. The rest of the comparators on the PocketGeiger board do not convert to op-amps layouts easily anyway, so I did not seek to use them in the longer term. To use the footprint, if at all you can, seek an op-amp with the high speed.

Indeed, if you can find a speedy op-amp in SO8, with reasonable low noise, I would try to hack the PocketGeiger.

Right now, I am viewing the A/D converter with similar concerns. I would love to have it that almost any enthusiast from HM would have a reasonable chance to DIY with enough instructions and a PCB source, and I reckon packages with 0.5mm pin pitch are not helpful!


----------



## graham-xrf

I know I got side-tracked into other parts of the design, but I can report that the web page interface to smartphone worked. The (early trivial test) was seeing the Raspberry Pi4 program displaying a GPIO status changing as I was meddling with pins - but displayed on the phone laying about nearby, because the phone can see the WiFi, and hence the Raspberry Pi's XRF web page display. Of course, one will be able to interact with the web page, just like one can with any, but here, the Pi4 would be accepting information from the connected user.


----------



## rwm

This thread needs more pictures!
R


----------



## graham-xrf

rwm said:


> This thread needs more pictures!
> R


Agreed - but also, this thread is, during the crucial discovery phase, mostly a open design discussion. I will try and post more pics, but hopefully of meaningful stuff. I am not a fan of "unboxing" videos, but for some stills, I think it's OK, and agree they can mark progress. The last picture I posted on Saturday. if zoomed up, does cause us to swallow hard! Mark is right. Maybe we have to look for something of realistic size.

Before I start trading off on the performance, I did want to try and push the limits of resolution and accuracy, but I am well aware that actual experience of X-ray detection events might well involve a re-spin of the front end. I am hopeful that we won't encounter some of the stuff that drove the development of the PocketGeiger to places I didn't like. I do have, in the back, my PMT tube and scintillator resource, which is fun, but I think not for the average HM member hoping to put together a little kit, turn up a shield, adapt and construct some sort of casing, download some software, and reach for his phone.

With a different front-end circuit, the PMT tube can use the same samplers and software.

You can bet that if this gadget starts delivering XRF identification spectra, it will feed a new thread, presenting the outcome.


----------



## graham-xrf

homebrewed said:


> Sort of an "oh pshaw" moment yesterday.  I pulled the LMC662 off my pocketgeiger to replace it with a LTC6269 to lower the noise floor of the thing when I (belatedly) discovered that the replacement has a different footprint!  Aargh.
> 
> I didn't purchase the LTC6269 for this project but for something else so didn't think about that when I started modding the pocketgeiger.  Time to order the right one....


Whoops! Can one get a LTC6269 in a bigger package?

By any chance, have you come across these guys - 5 PCBs for $2.00
--> *JLCPCB*
They also supply boards with the components fitted.


----------



## homebrewed

graham-xrf said:


> Whoops! Can one get a LTC6269 in a bigger package?
> 
> By any chance, have you come across these guys - 5 PCBs for $2.00
> --> *JLCPCB*
> They also supply boards with the components fitted.
> View attachment 349309



Yup, I'm using JLCPCB.  FYI, in my experience if you request some colors other than the defaults your PCB may take a couple more days to be fabbed.  I haven't used their board-stuffing service yet because the components I've used so far can be hand soldered.  A friend of mine is using laser-cut stencils in a 3D printed holder to put down solder paste to solder down his parts and reports good results.  If you get Gerbers from your PCB design S/W you can send the solder mask layers to folks who will make you a stencil for not a lot of money.

Unfortunately the LTC6269 doesn't appear to be available in the SOIC-8 package so I couldn't use it.  However, the AD8646 is pretty close in terms of its noise performance, and actually is noticeably better when it comes to flicker noise -- in the .1-10Hz band the LTC6269 is spec'd to have in the neighborhood of 13uVp-p noise while the AD8646 outputs 2.3uV.  The LTC6269 clearly is meant for high speed applications because the voltage noise specification is for 100KHz.  Their noise current specs are about the same, in the fA region.  

Amplifiers with BJT front ends can get down to a few nV/sqrt(hz) or less, and tens of nV noise in the .1-10Hz region but their noise currents can't compete with JFETs.  However, if you're building a TIA with Rf's in the 1Mohm region that shouldn't be an issue.  Amplifier GBW may be the main issue when it comes to choices there.

I got some AD8646 units and installed one on the pocketgeiger (they were delivered yesterday).  My initial evaluation suggests that the noise floor isn't much better than the LMC662 so most of the noise probably is coming from the detector itself.  The bias voltage to the detector is filtered by a 100K/1uF low-pass filter, which would appear to be pretty good (with a 10Hz cutoff frequency) but it's just a 1 pole filter.  Circuit gain is very high so it's possible that some switching noise is present in the output.  The bias voltage is brought out to a pad on the back of the board so it would be fairly easy to add more C if need be.  I guess I need to try that.

I had removed the copper shield around the detector and amplifier so I could swap out the amplifier and voltage regulator, so I reestablished the shielding by using a combination of copper foil and aluminum guilding.  Installing the copper foil was easy, the aluminum guilding was anything but.  It took several tries to discover the various things that could (and did) go wrong -- all the way from cutting the guilding to size without turning it into a wad of useless foil, to figuring out how to tape it down in place.  It's incredibly easy to tear, and is attracted to even the faintest electrically charged surface or object.  I didn't want to use double-sticky tape or zip-grip because those are nonconductive, and it DID need to have good electrical connection to circuit ground, so for temporary use I was going with tape.  Inside a lead box this may be a non-issue -- we shall see!

A lot of the noise coming out the the modified pocketgeiger is higher-frequency so another option would be to add a low-pass filter block to my signal conditioning board.  The Teensy Audio library has a 4-pole state-variable filter so that's yet another possibility, plus it would be a "piece of pie" to change the filter parameters (quote taken from the movie Space Odyssey 2010).  I'd want to implement a Butterworth filter characteristic to get the least amount of phase distortion.  Come to think of it, the audio library also has an FFT function so I could check for systematic noise, too....or to help tweak the filter characteristics.


----------



## graham-xrf

Thanks for the update. I watch with interest. Here, I have soldered down the AD7622 A/D converter on 0.5mm pitch LFQP. I managed OK, but this is not something I would expect many others to do. Easily the most awkward was getting the package into position under assembly microscope, for which mine has too much magnification to see the whole package. I used the sharp point on re-shaped paper clip, with base end held down under a handy nearby Vee-block. The ease with which even a slight touch to a pin can bend it sideways I knew about, and tried to avoid. It's now down, and I will be adding the rest of the components soon.

Re: The AD8646. I get it that you chose it because of noise figure. The only thing I see there is the 24MHz Gain-Bandwidth product, and 74°phase margin. To get the Signal/Noise ratio locked in from the first stage gain will require about 30dB. Getting as much gain in at the first stage as possible to lock in the noise performance is traded against the ability to reproduce and measure the area under a pulse that has 100kHz to 400kHz components, and needs a slew rate and settling time not to have overshoot when returning to zero.

There is, of course, a wide disparity in impedance for power ratios, but loosely, trying for a first stage gain of 50,000 we would have a bandwidth of only 480Hz. That is why I used the LTC6269, regardless the size for the first stage.  Are we sure we cannot find a bigger package op-amp with a GBW product (say) about, or more than 200MHz?
- - - - - - - - - -
At home, things are damn difficult. I happen to be in the South-East of England, and in a unprecedented total legal lock-down. Where we are tonight is 20,000 new infections, and 1000+ deaths/day from the new highly contagious strain. For the 60M size of our population, its about as bad or worse than most other countries. About 1 in 50 are infectious, and in some situations, more than that. Pretty much unless you have been in shielding quarantine with someone else for days, you have to act as if anyone you encounter has already got it.

I had thought to settle in playing with the XRF circuit board, which is code-speak for finding all, and somewhat sorting my stash of SMD components, but fate intervened. A water leak at a dishwasher inlet had been doing it's damage for some days unknown before we discovered it. I had to move out all the kitchen white goods, take up the flooring, and found the substrate floorboards soaked through. Once I found and fixed the leak (replaced fitting), I sort of put together the kitchen again in camping mode without top flooring. My wife has bought a de-humidifier to help dry out the place, but it's a stop-gap. Replacing the floor and tiling it to fit up effectively a new kitchen is now planned.


----------



## homebrewed

Sorry to hear about your situation regarding Covid.  Hopefully the vaccine will begin to contain its spread.  Also sorry to hear about your plumbing problem, those can cause a lot of damage.  We've had a couple of water related problems at our place too, and, like you, one of them was caused by an appliance (a front-load washing machine).  Fortunately I caught on to that one pretty quickly so we didn't get any damage to the floor or subfloor.  The floor in the utility room is slate, a decision we've been thanking ourselves for.

Regarding my use of the AD8646, I did worry about its lower speed and how that might affect the pulse response.  Simulations looked OK (and converged quickly, so it didn't appear that there was a stability problem), so I went ahead and ordered a few.  I made the mistake of replacing the 9V LDO with the 5V version before I discovered the problem with the LTC6269, so I also was looking for an amplifier that can run with a 5V supply.  That limited my choices right there.

Regarding an adapter board for the LTC6269, it looked like it was going to be difficult to reliably solder it down -- it can't be any larger than the 8 SOIC footprint.  And I wasn't particularly excited about the idea of soldering 8 teeny wires to the IC footprints on the board.  Hence the search for something with decent noise specs that comes in the 8 SOIC package.


----------



## graham-xrf

For me, the adapter board(s) are purely a temporary hack to get a prototype lash-up working. My apologies for the crappy out of focus picture, but this is the AD7622 ADC mounted on one of those "universal" quad flatpack mounting boards. Maybe it's a good thing the focus is not great, because the soldering, while absolutely fine as joints, does not have the re-flow uniformity. I did it with a soldering iron.




I think one can get similar things for op-amps. I have in the back of my mind that a purpose-designed PCB will be needed anyway, but for now, I have a way. The whole subject is having me re-think, and perhaps try again, looking for suitable large-package parts that electronics experimenters can get their fingers around, and maybe even folk who have never done it before can attempt (with enough instructions and pictures). We have come quite far simplifying the thing (think back to PMTs).


----------



## homebrewed

Update:

I have started working on an enclosure for my XRF setup.  The main reason is that I need to remove most of the copper shielding foil in order to replace some of the ceramic capacitors with better film capacitors -- so I will need an enclosure to eliminate EMI.  One of the capacitors is the 1uF cap in the final bias voltage RC filter so the capacitor has to have >25V operating voltage.  This makes for a rather large capacitor, but what the heck.

The other cap I want to replace is the .1uf interstage coupling capacitor in order to extend the low frequency response.  Pulses coming out of the detector are pretty slow anyway so I don't want to reduce pulse amplitude any more than necessary.  That one will be 1uF, too.

The enclosure will be a box with a partition in it, with a hole drilled/bored in it for the XRF photons.  One side of the box will contain the detector and signal conditioning board, held in place by vertical rails; and the other side will contain the Am241 sources and sample.  That end of the box will be removable, probably a lead sheet captured by two grooves on either side.  This way the entire source/detector volume is shielded so no super-delicate aluminum guilding foil is needed to shield the detector from ambient electrical noise.  I have enough material for the base but need to order more for the sides and top of the box.  I will use .25" thick plate, extreme overkill for shielding purposes; but that will make it easier to drill/tap holes to assemble everything.  Hey, the skin depth of 60Hz in aluminum isn't that much so it will cut down on magnetic coupling, too.....

I will line the box with lead sheet to keep those 60Kev x-rays in their place.  I think I have enough.  .25" of aluminum will also absorb a substantial portion of the x-rays. 

Also, one small update regarding my SPICE model for the detector.  I had noticed that my simulations predicted a much shorter pulse width than what I was really seeing.  Additional investigation revealed that I had misread the schematic, placing a 1pF capacitor in the second amp's feedback loop -- but it really is 10pF.  Only an order of magnitude error .  Simulations look more realistic now.

The section on mechanicals make this more appropriate for a machining forum.  Wasn't it about time?


----------



## rwm

Definitely do NOT understand all the technical details of the circuit design. Once it is complete, I hope you will 'splain the circuit design in a broader respect so that those of us without training can understand some of it? 
Still watching.
Robert


----------



## graham-xrf

I also have some "mechanicals in the brew.
I had thought about the upset of unwanted AC fields getting into the (very) high gain low noise amplifier, but it seems that if one plonks the open end against the metal to be tested, that sufficiently stops it. The "optics" circular array of sources, slightly recessed into their lead drilled pockets, all set at an angle pointing inwards (like a ER32 collet end angle) is such that no emission from the lead can "see" around corners so as to reach the sensor.
Samples smaller than the circular aperture can be tested by placing them on some aluminum cooking foil, and placing the sensor head over it. There is some (low) count from aluminum 1.48keV and 1.55keV that is barely possible, but if the sensor can see it at all, we still know where it came from. If the idea fails, I will adopt Mark's split box.

The conical lead shield shape is there ostensibly to stop the Am241 gamma from getting out, but it occurs to me that one could turn the thing out of aluminum, and settle for some thin discs of lead cut or punched out of 2mm lead sheet, and a piece of sheet "rolled up" to butt on the split, pushed up the aluminum outer tube.

I have got 3 parts to this project part not quite done. I have made a daughter board fitted to the Raspberry Pi, carrying the A/D converter, and a display scheme that plots onto a web page on the Pi. You can see it from a PC, or a direct connected monitor, or a smartphone browser, or any screen that can be on it's network. In theory, if the Raspberry Pi is also running it's server connected to an ISP domain (like mine), you can see it from anywhere, but the limited usefulness of such a stunt is obvious!

The next part is the low noise amplifier electronics, with low impedance buffer. This part is right on the back of the sensor, and drives a screened cable pair to computer box.

The last part is the tube sensor head mechanical assembly. While I am trying to keep this kit as simple as possible, I also want it to be a serious performer. HM members wanting a kit would have the plans for the tube, lead bits, etc. and would need to purchase a Raspberry Pi. Then, plug a pre-assembled PCB kit of A/D converter daughter board. For getting the tiny electronics soldered, it is not a thing one would expect most users to do. We are open to suggestions as to a small casing and power supply for the Pi. Mine is running off a USB charger. Voltages used for the low noise parts are conditioned by in-circuit regulators and filter components.

The little amplifier electronics PCB is similarly a preassembled part of the kit, connected to the cut off end of a Geiger 5 board containing the diode.
- - - - - - - - - - - - -
Right now, I am coming up to my "big day" when I am to be shot full of AstraZenica's best, (stage 1). I am also madly making (wood) chips, and the occasional smell of table saw and scorched router end wafts about. The sound of hammer drill Makita doing 8mm fixings into concrete as well. My fire door, with it's exact specification frame clearances and intumescent strips is all happening. I can pick up and move a normal door, but a fire door is a very different story!  Oof - but they are really heavy!

I will post some more visual stuff as soon as I can.


----------



## homebrewed

You're making good progress if you already have your ADC going.  Nice!


----------



## homebrewed

I got the aluminum in for making my enclosure, and have started cutting it down into the rough sizes I need.  As part of the enclosure, I need to drill/bore an aperture in one end for the x-rays to enter.  

One thing I (belatedly) thought about was the fact that I need to place the Am241 disks around the aperture, to "illuminate" the sample with 60Kev gammas.  The detector is 10x10mm so it needs a ~.56" diameter aperture to avoid any vignetting, which would reduce the count rate.  My preliminary enclosure design uses 2.5" wide end plates so that's not a problem.  However,  can I fit up to 8 disks around that size of aperture?

To answer that, I did some internet searching and found a formula that looked close to what I need -- but it was cast in terms of the distance from the center of the hole to the centers of the surrounding disks (so the disks would intrude into the aperture hole).  Changing the formula by adding the disk radius to the desired aperture hole radius, I came up with a formula that I could use to test my enclosure design.  I measured the radius of the little Am241 disks to be about .238".  From there, I used the formula to determine where they needed to be placed in order to fit up to 8 around the aperture, and that came to R=.384".  This is the distance from the center of the aperture to the nearest edge of the disk.  This is .768", larger than .56" -- so I can fit 8 around the aperture without any of them extending into the aperture hole.  Also, the aperture center-to-disk-outer-radius comes to a little less than .86", so the disks will fit quite comfortably on the 2.5" wide end plate.

So to sum up:  The aperture hole is .560" in diameter.  8 of my Am241 disks should fit around the aperture without intruding into the aperture hole.

However, I also am going to draw this up to verify the result.  I want to find the same result using two different paths to get there.  If there's a significant discrepancy, it's time to reexamine my assumptions!


----------



## homebrewed

I wrote a simple openSCAD program to test the emitter/aperture geometry and it looks like the numbers I got work OK -- see below:



If anyone wants the openSCAD code, just let me know.  I wrote it so it is easy to play with the geometry.


----------



## graham-xrf

*The Single-Ended Illumination Optics Concept*
Using a aluminium ring just tall enough to block sideways radiation, and exploiting the fact the radiation can't go around corners.
Here we get an idea of some bits users will need to machine up out of aluminium (OK - spell check - aluminum).

*The optics principle*
Unlike light rays, the 60KeV coming out of Am241 sprays anywhere, all directions at once, and only some of it is useful. What happens here is all 60KeV hits only aluminum, or lead-backed aluminum. The 55° tilt angle sets the height above the sample, and the cone is blocked by the iris. Only XRF from aluminum, or the test sample can be seen, and the responses from aluminum are too low to be significant.




This scheme is a radiation source carrier, and a sensor/amplifier mounting all in one.
It requires a aluminium machined shape like this..




The Am241 radiation sources (from smoke detectors) are interference fit pressed into the little pockets. They do not have to be pushed in deep. They can have a small lead disc inserted first. Any X-Rays from their steel carrier, and indeed anything the 60kV photons hit, other than the test sample, cannot get back to the photodiode.



Here is a part structure illustration, showing the sensor.

There are all sorts of ways to mount the amplifier PCB. In my circuit, the little white PCB from the PocketGeiger 5 is not useful beyond being the photodiode carrier, so the idea is to leave it soldered to the PCB, but cut away the part not under the photodiode, and mount it at right angles to the low noise high gain electronics PCB. It's a bit home-made, but the hot melt glue was a cheap and quick solution.




There are more tubes needed. I was looking to find sizes that could readily be cut from standard aluminium pipe, but failing.
Also - more 2mm aluminium, that being the 100mm square piece the tube is put up against. Aluminium will only glow at two energies. One is at 1.487KeV and the other is at 1.557KeV.  Both of these would be at only 1% to 2% efficiency, but if their count is seen, it will be a known artifact, and counts at those energies could be subtracted from the plots by software anyway.



The thought occurs that the entire plot without sample present could be counted, then subtracted from the plot when the real material is present. in the same way that dark current noise is removed from CCD images.




The rear tube "handle" cover cab be reduced in diameter - perhaps carved from a piece of aluminium scaffold pole, or trade display stand, or sartorial lounge lighting stand.

*Lead bits*
A disc of lead under each Am241 source, to stop gammas making it back into the electronics. To stop cosmic incoming, perhaps a lead ring layer around the optical shield, to stop direct sideways gamma making it to the sensor. A lead bucket lining in the machined pocket would do the same thing. Those determined to stop even incoming cosmic stuff can wrap a thin lead sheet around the Outer Stand-off Tube

*Magnetics*
Not shown is the Mu-Metal shield box around the amplifier PCB. We keep this small, so it is affordable

In use, it is stood over the 100mm square aluminum plate, which would have the test sample on it. Alternatively, on bigger stuff, the probe is simply put up against it.

*Dev items*
The whole computing end can be done with the *$35* Raspberry Pi Model 3B. It has 1GB of RAM, and is a 1.4GHz 64-Bit little thing, used here because the Pi4J Java library works with it. This one is apparently a current best seller!

Pi4J software library is still being updated for Raspberry Pi4 models. The development hack-up of matrix board was to get the ADC connected. On that Raspberry Pi, under piece of buff perf board, is a little fan and heatsink. Final add-on GPIO daughter board with the sampling electronics would not have all that stuff under it.

Keep in mind that the display is any phone or PC that has a web page browser - because this one plots it's display in real time to a web page in it's own memory space. If you can network to it, you can see it, and interact with it. This part, at least, already works. It can also run a web server (nginX) if need be. It has WiFi and BlueTooth built-in, and has a EtherNet connector. It also has a monitor display and USB for mouse and keyboard, if you want direct dedicated operation.




The project kit box has accumulated quite a little pile of stuff - all development aids..




I have left out quite a lot. There may well be good suggestions. Please do!


----------



## homebrewed

graham-xrf said:


> There may well be good suggestions.



If it turns out that using energy filters will be needed to improve the system's ability to distinguish different ferrous elements, it might be desirable to design-in a rotary shutter to switch in different filters.  It could be done manually as well, but, again, it would be nice to have something set up to make it easy.  I had a darkroom projector which had a slot that could accept different filters (typically to use in combination with variable contrast printing papers) and that made it very easy to use them.  It was all manual, but, hey, the projector was made in the 70's.


----------



## rwm

"The thought occurs that the entire plot without sample present could be counted, then subtracted from the plot when the real material is present. in the same way that dark current noise is removed from CCD images." 
I like this idea. Very clever.
Homebrewed- can you elaborate on the need for filters? How and why would that work? 
Robert


----------



## graham-xrf

homebrewed said:


> If it turns out that using energy filters will be needed to improve the system's ability to distinguish different ferrous elements, it might be desirable to design-in a rotary shutter to switch in different filters.  It could be done manually as well, but, again, it would be nice to have something set up to make it easy.  I had a darkroom projector which had a slot that could accept different filters (typically to use in combination with variable contrast printing papers) and that made it very easy to use them.  It was all manual, but, hey, the projector was made in the 70's.


This does not present a problem. The scatter-gun optics of 60KeV photons mean the arrival angles are not critical, but here, I take it you mean the 60KeV has to hit the sample before the emanated X-Rays have to go through the filter. Convenient if the filter was transparent to gamma, one could put the filter over the sample. More tidy, and smaller, is to have a filter disc to push onto the iris tube, or up the tube, right in front of the sensor. If glued into it's carrier, one needs to make sure the glue elements do not see any 60KeV - or otherwise stay with it peened into fundamental materials.

@rwm -  Hi Robert. The filters trick is Mark's. As I understand it, one can put discs of various materials that will absorb or be transparent to ranges of energies corresponding to various alloy elements as a way of identifying them, and the proportions present. You might also suppress the iron signal, and see what's left.

There is also a "software" version of this. If the return pulse energies are sampled accurately enough, and with sufficient repeatability, the energy step between the count accumulator buckets can be set for higher resolution, and even plotted "spread out" over a smaller range, hopefully to show the alloy peaks as separates, and even allow a compute of their percentage as scaled by 100% being the total count of all element's buckets seen. One might simply set the counts of various known energy buckets to be zero, which is a brutal subtraction filter, to allow identification of the other stuff in there.

A rotary filter changer would be very fancy. Keeping it simple by putting a filter in by hand might be OK.


----------



## homebrewed

The energy filter scheme isn't my idea -- like most things, someone else thought of it long ago.  It's based on an abrupt change in the absorption curve of a material, as shown here:


If we choose a material that has an absorption edge between x-rays coming from two elements that are otherwise difficult to distinguish, this abrupt change can be used to improve the effective resolution of the system.  In the case for Mn, it can be used to help distinguish iron from cobalt.  It turns out that by using the same adjacency relationship (on the periodic table) of using Mn to help analyze Fe and Co, we can use an iron filter to help distinguish Co and Ni, and so on -- at least, in the ferrous materials.  I haven't looked to see if this works for nonferrous elements.

The ability to separate peaks using energy filters improves as the thickness of the filter increases:  but the overall count rate also decreases, so there's a limit to how much improvement can be achieved in a practical application.  A combination of filtering plus the use of pure reference metal spectra (to subtract from the unknown's spectrum) may be the best approach.  But until we have a few operating XRF systems we really don't know, do we.

Regarding the use of an automated approach to swap in different filters, I was getting WAY ahead of what needs to happen first.   Something like that would be desirable for a commercial product but overkill for a hobbyist-level thingie.  Scratch that suggestion.


----------



## rwm

I don't know if we mentioned it before but that absorption edge is frequently referred to as the "K edge." So the filter would effectively subtract out some of the counts from the lower eV materials photons?
Robert


----------



## graham-xrf

Even if the count is lowered through a filter, the X-rays that do make it through are undiminished. They will still end up in the Fe or Co buckets. We can use an absorber as thick as practical. We might only have to wait more seconds if the filter is present, and the software can change the time of the test sample duration based on the fact a particular filter is there.

.. Calibrated by using a piece of Kosher (??) iron with and without the filter - maybe!

If one suspects there may be a particular element in the alloy, but at a low count - or even if the identification algorithm sees a combination that suggests the element should be present to complete a high probability identification, then all buckets _except_ for the energy range corresponding can be shut down, and the guessed at element "looked for".

I think I shall increase the number of sources to 8, because I think more is better, and the octagon version of tilted pockets is easier to drill.

Can anyone suggest a machining procedure for my version of a sensor head. Given the "all directions" nature of 60KeV gamma, would it not just be simpler to drill the pockets parallel to the axis, and still have it work OK?  I was trying for a sensor head as compact as possible. Some of my first thoughts had it about the diameter of a paint can. This kit can work OK, for larger sample shapes, with a push-on funnel-type tube extension.

I wonder how it would do with a container of liquid as a test object?
Does not X-Ray energy signatures also work for chemical groups - or is that a strictly infra-red thing?
Would having a alternative connectable sensor head with a small filament lamp source, and a IR detector photodiode, but retaining a switched-in version of the electronics and software parameters have it change it's spots into becoming a FTIR substances analyzer?

(Sorry - I caught the "getting WAY ahead" bug   )
[Edit: Also not sure one can have Kosher, Halal, or any other kind of religiously approved Iron ]


----------



## rwm

Your head design is elegant, but I do not think the sides need to be angled in concave fashion. As you note, the photons are emitted in all directions. I think flat would work just fine and simplify machining. I would keep them as close to the center radially as possible to excite the smallest area of the test sample with the largest number of gammas. 
I don't think xray signatures would work like IR spectroscopy but you could identify elements in solution. It will be interesting to test with iron, silver or copper solutions.
Robert


----------



## graham-xrf

rwm said:


> Your head design is elegant, but I do not think the sides need to be angled in concave fashion. As you note, the photons are emitted in all directions. I think flat would work just fine and simplify machining. I would keep them as close to the center radially as possible to excite the smallest area of the test sample with the largest number of gammas.
> I don't think xray signatures would work like IR spectroscopy but you could identify elements in solution. It will be interesting to test with iron, silver or copper solutions.
> Robert


OK - I will post a changed design soon. Right now, I am also up to my ears in domestic stuff, but I am feeling much more positive since I got vaxed. Shot full of what turned out to be Pfizer's best biotech is definitely the way to pick up the mood. I still have to wait for the second, and the easing of restrictions before I can take care of a bad case of "lockdown hair".

I have in mind to move the A/D converter on, then make up some kind of lash-up head to fully develop the low noise amplifier signal conditioning. I know which amplifier I want, but I am seeking something perhaps nearly as good, but available in a package size that gives us a chance for electronics assembly. If we can get the bits big enough, and the assembly instructions expansive enough, it might bring the making of this stuff to the point where many folk who would not usually attempt to put together electronic stuff be able to "have a go".


----------



## rwm

At some point you guys need to change the thread title to Shop Built XRF! Maybe after the first successful sample test? This thread will get sent all over the internet and have a million hits. Just look at the views on my Oil Can thread.
I am def gonna build this when you finish working it out.
I also got my Pfizer doses a few weeks ago. I am still being somewhat careful since my wife can't get vaccinated.
Robert


----------



## graham-xrf

Don't get me distracted..
(I also want an oil can!)


----------



## homebrewed

Solutions should work fine, just will produce a lower count rate depending on the concentration of the solute.  The container walls will introduce some attenuation of the XRF photons.  In terms of hazard implications I'd stay away from the use of solutions to analyze ferrous alloys.  While Cr+6 is a widely-known hazard, cobalt is not without its problems; and it's best to avoid contact with nickel salts as well.  They're fairly innocuous in their metallic state so don't feel the need to find a different hobby


----------



## homebrewed

I'm wondering about including a mu-metal shield in the enclosure design.  If we're committed to an all solid-state detector system it shouldn't be necessary.  The Al tube will be a fine EMI shield on its own.  

If a scintillator+PMT approach is to be an option, then, yes, mu-metal will be needed for that.


----------



## graham-xrf

homebrewed said:


> I'm wondering about including a mu-metal shield in the enclosure design.  If we're committed to an all solid-state detector system it shouldn't be necessary.  The Al tube will be a fine EMI shield on its own.
> 
> If a scintillator+PMT approach is to be an option, then, yes, mu-metal will be needed for that.


OK - I agree. We can keep one in mind if need be, but not include it for now.
I am thinking also of the divided box. It has some advantages.

*Simplified Digression about Electromagnetics*
Let us have a bit for HM members who are not into RF engineering.
I knew that the complete aluminum covering would stop all real electric fields. That alone also shuts off all incoming radiated EM (meaning electromagnetic)  fields, but won't hold out against  LF (low frequency like 60Hz mains frequency) magnetic fields. These come from house wiring, power lines, etc. Do NOT expect to use this gadget while someone is welding in the shop!

For those who don't know the difference, a (very) condensed explanation is that EM fields are like light. They are the same stuff as light. They propagate at the speed of light. They are provoked into life only by _changing_ real electric or magnetic fields, which we often optimize with antenna structures, but in fact, all the house wiring is acting as less efficient antennas.

To get a real electric field to change needs movement of electrons, which is an electric current, which in turn is accompanied be the making of a magnetic field. All currents make magnetic fields around the wires! If you manage to vary one kind of field, you will generate some of the other. Electromagnetic (light-like) fields are stopped completely by the aluminum shielding, which makes what is known as a Faraday Cage. You cannot make an electric field inside a conducting surface that will still exist outside the surface, and vice versa. The electronics inside the metal covers will be completely screened from EM stuff. I know we call the light-like radiation "electromagnetic", but that is only because of the varying fields we use to make it. It's not the kind of thing that would twitch a compass needle.

That still leaves the ability of 60Hz _magnetics_ from house wiring and power lines (like the cord to your beer refrigerator) to just waltz right in, and start inducing unwanted sine-wave power line noise into the (very) sensitive low noise amplifier electronics. This is more of a problem for photo-multiplier tubes, which have an electron beam that is very readily messed up by magnetic stuff, but less so for solid state kit. For this gadget, the only vulnerable parts are the connections from the photodiode to the amplifier, and if we have them close together, to minimize the loop current area, then not much can happen to to couple in unwanted 50/60Hz noise.

*50/60Hz suppression*
I say that hopefully, but given that we have multi-stage electronics gain, we can, if need be, make one of the stages also reject 50/60Hz, reducing it by a factor of perhaps about 1000. To start with, I am making the amplifier straight - no suppression. If it works, then OK. Otherwise, AC mains filters get included.

*Filters*
I am completely sold on having the ability to mount physical elements discrimination filters. The next CAD will show them as push-on tubes that fit over the aperture to the photodiode.

[Somewhere, on this floor, are 0603 decoupling capacitors that will only ever have a future involving a vacuum cleaner!    ]


----------



## homebrewed

graham-xrf said:


> I knew that the complete aluminum covering would stop all real electric fields. That alone also shuts off all incoming radiated EM (meaning electromagnetic) fields, but won't hold out against LF (low frequency like 60Hz mains frequency) magnetic fields. These come from house wiring, power lines, etc. Do NOT expect to use this gadget while someone is welding in the shop!


The skin depth of 60Hz magnetic waves in aluminum is about 10mm (based on a calculator I found here.  The use of thick-walled aluminum tubes as shielding has been shown to permit earth-field NMR spectroscopy, where the proton precession frequency is low enough that 60Hz magnetics from the mains is the primary noise source.  Copper is more conductive so its skin depth is about 8.4mm but it's much more expensive.  Aluminum wins this one.

I'm just being a contrarian -- for XRF, a standard Al box would make a fine shield for EM waves.  My main thing is making the mechanicals robust enough to attach lead sheets where I want them, and stay there if (when?) I drop it on the floor.

I agree that allowing for up to 8 sources is a good idea.  My sketches use that number; and I've got 'em in hand (well, in the building anyway).


----------



## rwm

If I put my cell phone in a 1/8" aluminum box it will still ring? Why is this not shielded?
Robert


----------



## graham-xrf

rwm said:


> If I put my cell phone in a 1/8" aluminum box it will still ring? Why is this not shielded?
> Robert


There is something wrong with the experiment - or the box, or it's conductive lid to the box.

I have regularly had to find the noise floor reference of a spectrum analyzer with low noise front-end amplifier within a metre or so of a 150W transmit feed with gain. That is a signal orders of magnitude higher than any cell phone could expect to see. I could block it with cooking foil !

There are _no_ exceptions to this science. Instrumentation shielding drops a signal to the point the only "voltages" left are the thermal agitation of the molecules vibrating in the first stage semiconductor device. The conducting nature of the box forces a physics boundary condition of short circuit conducting metal that an incoming electric field (voltage) cannot overcome, nor continue to exist in without spectacularly huge currents.

This same property is what makes antenna structures and communication waveguides even possible in the first place.


----------



## rwm

Would a barely visible air gap at the lid be enough to allow RF leakage? I also tried to shield it with an aluminum potato chip bag WITHOUT success.
R


----------



## graham-xrf

rwm said:


> Would a barely visible air gap at the lid be enough to allow RF leakage? I also tried to shield it with an aluminum potato chip bag WITHOUT success.
> R


Yes indeed. It is the length of the air gap that counts. Not so much the width. An overlap can stop it, but normally, when we say shielding, we mean the conductor surrounds it completely.

My (now older) HTC phone innards is in a completely milled out aluminum case. So how does it have an antenna? On the back face, top and bottom, there is a thin plastic slot, and also all the way around the thin edge. They use parts of the case itself. 

A "gap" that is the right length, can become a resonant slot antenna structure, efficiently receiving, and re-transmitting external RF into the inside. This is not the same thing as a straightforward field leak through a gap. I do assure you that if you wrap the can in foil, ensuring you straddle the gap, you will stop the RF.

If the phone still rings, it must be using Spock-Kirk Star Trek Tri-corder technology!  Either that, or I have a whole career navigated in ignorance!


----------



## rwm

That makes sense. Thanks. I was confused about this. What about Faraday cages built with open mesh? 
R


----------



## graham-xrf

rwm said:


> That makes sense. Thanks. I was confused about this. What about Faraday cages built with open mesh?
> R


The mesh size of the "squares", and the wavelength of field trying to get through are related.
Check out the door of the microwave oven. To get the 850W or so into the mug of coffee, at relatively low magnetron efficiency into a arbirtrary cube oven cavity, badly mismatched into random dielectric (food) means the initial field is in kW range. Yet the EMC seal and the mesh in the window keeps us safe. That is because the size of the mesh does not allow a whole half-wavelength of any field to do anything except warm up the wires.

A long slot poor connection leaks to some degree, depending on the wavelength. A mesh does not! A mesh screen is enough to greatly attenuate a field, bringing it to safety. That is not the same as reducing it to the point a sensitive receiver cannot respond to the remnant. A complete conductor always stops it dead!

Take a look at a DSN antenna. Notice the outer parts are a grid you could stick your arm through. The central part is continuous conductor. The outer parts are for when the dish is used at lower frequencies. The dish gain goes up with the square of the wavelength, and even becomes awkward to point at extreme gains, so it's OK to use the smaller central section for the higher frequencies, which would not reflect off the outer region mesh. The reflection off the "grid" part is still near 100% for the bands it is intended for.


----------



## homebrewed

Like Graham, some things have delayed my work on an XRF setup.  A trashed-out rental, damaged by drug-addled tenants, has required some serious work.  And, unfortunately, some serious money to address.  In the (few) spare moments I have right now I've been working on the enclosure/shield for the detector and signal conditioning boards, but it's been slow going.  

Some information I recently found suggests that the noise coming out of the detector diode can be greatly reduced by going to a zero-bias mode, something to experiment with when I have more time.  In that situation it will behave more like an x-ray "solar cell".  Dropping the noise floor, if it can be done without significantly lowering its sensitivity to x-ray photons, would be a good step forward.

On the bright side, my wife and I have received our second Covid vaccination.  Takes some of the stress out and permits the thought of visiting family members we haven't seen in over a year.


----------



## graham-xrf

Mark - so sorry you have to deal with fixing up damage like that!
I can feel OK by things like storm damage, or natural events, even the consequences of my own mistakes, but damage from other humans behaving badly brings resentment, anger, and sadness.
I too am looking at some XRF stuff, the partly assembled ADC lash-up, which recently shared with adventures in layout fluid. Unfortunately both have to stay put in the face of tax accounts and house structure repairs/changes.

Bias noise was something I feared. Reverse biased diodes have always been an excellent source of noise, especially zeners, and especially avalanche types. A multi-doped PIN photo-diode would have some potential for noise. Some noise diodes are guaranteed to have loud wide-band Gaussian white noise up to many GHz. From what you say about it, I will likely arrange bias to be variable, and maybe include some filtering to take out the noise at bandwidths above what we need to reproduce the pulse .

I have had vaccination #1. The second will be due in about 4 weeks, but already I feel much safer. A couple of days back, there were zero COVID deaths in Scotland, and zero in London, with only 7 patients in ICU. Theis does not mean "its over", because any one infected fool in a society that has decided they are back to life in 2019 just starts a whole new wave, and you have to go back to the beginning, as has happened in France.

We now know that those vaccinated not only can survive better. It seems COVID never really gets started in them. Not only do they not get ill, they also are not infectious, and cannot pass it on! I'm pleased you got there. Removing that background stress really does make a difference to one's life!


----------



## graham-xrf

Yay! I have had notification to book my second vaccination.


----------



## homebrewed

While searching around for information on PIN diodes as radiation detectors I came across this. Suggests we're not totally nuts (maybe).

I also found that Mouser carries a number of large-area PIN diodes, including a through-hole version of the X100-7 (although its P/N is given as a PS100R-7).  It runs about $107.  The PC50-7-TO8 is 50mm^2 and costs $62.86, but it would be necessary to remove the glass window.  I think that would be possible, by making a special pot chuck to hold it in your lathe and cut off the top portion where the window is.  The diode would be very sensitive to light so it probably would not be suitable for a portable XRF system.


----------



## rwm

Any body still working on this?
R


----------



## graham-xrf

rwm said:


> Any body still working on this?
> R


Yes indeed! This is one of my best interests. For a while, it has to go behind quite a lot of other stuff. My life got kind of complicated through 2020, mostly changes forced from the COVID thing. At the same time, I took on construction of a new outbuilding workshop. Even now, most of my electronics/chemistry stuff is in wraps, but I have acquired a binocular microscope of the right power to help handle those tiny parts. I had expected that, now I have retired, there would be time and space to do more of what I please. I have found that to have that happen, one has to clear down all that stuff one had left to "do later", and then start actively directing life towards one's favourite project.

I have sought to find a A/D converter that comes in a package somewhat larger, to make it easier for hand PCB assembly, but unfortunately, the chips that really do the trick well come in packages with 0.5mm pin pitch. The one I have mounted to the little computer is of that sort.

Right now, most of us still have to become experts at observing sparks, and the best we get from that is a binary choice guess at the metal hardness, with some small clues if there is high carbon content. Heat treatable hardening alloys remain a big guess, unless one keeps known steel marked and labeled from the beginning, including off-cuts. Who can afford a hardness tester, like as shown off by Stefan Gotteswinter? I know I can assume parts of ex-brake discs are cast-able semi-steel, and I can tell which bits among my stash are titanium, but for me, there is no substitute for really knowing what stuff is some random chunk of steel..

Between Mark and myself, I think we have already wrung out the viable circuits, and it remains to press home actual experimental construction. I have an ADC mounted on a Raspberry Pi, and I can poll it with crude single test code snippets. Mark has being doing rather more in digging up alternative photo-diodes choices, but we have both purchased the kit that comes with one fitted. One of my major aims is to have an outcome that can be readily be acquired and put together by almost any HM member, as low cost and convenient as possible, with all software simply downloadable. There would be an element of machining or ad-hoc fabrication with hand tools. If at all possible, I am trying for ready-assembled electronics. Some of the chips I would use can be had already mounted on PCBs as "evalulation" kits.

Another major chunk needed in the end is a whole lot of information. From circuit design, and descriptions, through the whole process of putting it together, and how to test it.  There has to be, at least, some sort of manual, or collection of PDFs with pictures. Any folk here who actually make one may be able to throw in a few pictures.

Hang in there Robert - we will definitely be getting back to this.


----------



## homebrewed

rwm said:


> Any body still working on this?
> R


Yes, but slowly due to our rental rehab that is still going on (hopefully to be concluded soon), plus general summer-time distractions.  Toward that, I've continued making my aluminum enclosure to (1) keep 60Hz noise out of my now-unshielded detector and (2) keep 60Kev gamma rays inside it.  The box has two partitions, separated with another aluminum plate that will have a hole milled in it to allow the fluorescence photons to strike the detector.  The hole will be ringed with my Am241 sources.  The opposite exterior wall is hinged and will be held closed with a clasp, used to install samples for analysis.

I still need to come up with a mounting scheme for my detector and signal-conditioning board.  It probably will be a couple of nylon plates with grooves milled in them to hold the boards in place.  It would have been smart to make my signal conditioning board the same size as the detector board but I wasn't thinking that far ahead .  

Here's a photo of my enclosure-in-progress, partially disassembled to show most of what I mentioned above:



The clasp (sitting on top of the enclosure) was purchased at a local hardware store.


----------



## homebrewed

Regarding Graham's comment about my looking at alternate detectors, I'm just thinking about the possibility that the large-area PIN detectors we have will turn out to be just too noisy to give us anywhere near the energy resolution we need.  There may be ways to improve it, by reducing the dark current (by reducing or eliminating the bias voltage), but we really won't know until we have some lashups to play with.  I can just about guarantee that the first working version won't come up to snuff.

I didn't mention it in my previous response, but I also bought myself a nice birthday present this summer that should come in handy.  It's a "real" lunchbox-style DSO, 2 channel 1GSPS/100MHz BW 'scope.  Made by Hantek.  My little hand-held 'scope is pretty limited in bandwidth (and functionality), plus the connectors are quite fragile -- nowhere near as robust as BNC's or SMA's.  I'm always afraid I'll bugger up the connectors so I never disconnect the probes on that one.  The thing that put me over the edge was the need for an external trigger to debug some Ardunino I2C bit-bang code, and the hand-held doesn't have that.

I've been lusting after a NanoVNA but can't justify it (quite) yet.  If I come up with a PCB design that needs 50 ohm striplines....well, the pocketbook will quickly open....


----------



## WobblyHand

@graham-xrf I'd recommend you look at using hot air soldering for fine pitch stuff.  For the longest time I put off SMT stuff.  I bought some solder paste and a hot air gun.  Works a treat.  Bought the hot air gun off AliExpress.  Was very inexpensive for its capabilities.  If you have some components that are sensitive to heat,  they also have low temperature lead free solder paste.  If only making one or two boards, just use a sharpened toothpick to dab some on.  Or get a narrow gauge blunted hypodermic needle and syringe. Also works well.  I've also bought SMT to through hole adapter boards.  Then you can use the "more modern" parts with the tiny footprints.


----------



## Boswell

I have had good luck using a toaster oven as a reflow oven.  The board shop I use will provide a solder stencil at no extra cost. Took some practice to get the temp cycle right but any issues can usually be fixed with a hot air gun or a fine point on the soldering iron. The nice thing about reflow is that it is fast.  I can put several in the oven depending on the size of the boards. I used to avoid surface mount components and now I find that I am working to avoid thru-hole components.


----------



## WobblyHand

Some toaster ovens don't get hot enough for lead free so one does have to watch out for that.  If you get stencils, that's great, they are much, much better than doing it by hand.  Simplified version: Line up the stencil. Squeegee the paste on, lift the stencil, place the components and pop it in the oven.  In anycase, lead or lead free, don't ever use the toaster oven again for food!


----------



## graham-xrf

WobblyHand said:


> Some toaster ovens don't get hot enough for lead free so one does have to watch out for that.  If you get stencils, that's great, they are much, much better than doing it by hand.  Simplified version: Line up the stencil. Squeegee the paste on, lift the stencil, place the components and pop it in the oven.  In anycase, lead or lead free, don't ever use the toaster oven again for food!


OK - a heater of some better sort has long been on the cards. Anyway, at my place, if I even look like I am about to use the oven for anything other than food, I get the steel glare from the good lady!

For the XRF experiment, I used an adapter like those shown in the picture. The large one on the left mounts quad flatpacks of all sizes, in either 0.5mm or 0.8mm pitch depending which side of the board you use. For £1.37 with free 3-day postage, it seemed obvious to take advantage.


----------



## WobblyHand

If you plan to process whole boards I'd go with an oven.  Especially if you can find one in a second hand shop.  I use a hot air gun for stuff like this.  Solder paste is quite forgiving.  You can even smear it over all the pads without being very careful.  The solder melts and flows on the pads first.  It tends to ball when on the FR4.  If you get a short use a sharpened toothpick to brush it away.  A fine blade works ok as well.  Since you have a stereo microscope it will be easy.  Much easier than manipulating a soldering iron, wire solder and hoping the part doesn't move!


----------



## homebrewed

A friend of mine uses 3D-printed stencil holders to align boards and stencils, and a hot air gun to solder components down.  He got the stencil holder design from Thingverse.  

I bought a cheap (ding and scratch) analog toaster oven from Amazon to do reflow and "light" metallurgical things like annealing brass and home-wound springs.  It cost me less than $30 AND I got free shipping.  I'm not a Prime member, either.  Like some other (ahem) projects, the reflow oven mod is "in progress".

One thing I like about using the toaster oven is that it's relatively easy to implement temperature/time profiles with them:  DIY reflow oven.  A ~100C pre-bake eliminates my concerns about delaminating parts due to the so-called "popcorn effect", where absorbed moisture turns into steam inside the package, expands and breaks bond wires.  Don't think this is just a theoretical possibility, it's a real issue, especially for larger IC's!


----------



## homebrewed

One thing I didn't mention about the toaster oven mod is that it uses a bang-bang controller -- basically, the toaster oven is turned on and off using a relay shield.  You don't even need to replace the power cord.  That's why it is necessary to use an analog toaster oven.  To repurpose a digital toaster oven you would have to bypass all the electronics and directly control the heater elements.  If doing so, I'd make sure to include a mechanical thermal cutout switch in case something goes wrong with either the relay control or S/W (I did much the same thing to turn a slow-cooker into a sous-vide setup) .  It would be a lot easier to just find yourself an analog toaster oven.....


----------



## WobblyHand

homebrewed said:


> One thing I didn't mention about the toaster oven mod is that it uses a bang-bang controller -- basically, the toaster oven is turned on and off using a relay shield.  You don't even need to replace the power cord.  That's why it is necessary to use an analog toaster oven.  To repurpose a digital toaster oven you would have to bypass all the electronics and directly control the heater elements.  If doing so, I'd make sure to include a mechanical thermal cutout switch in case something goes wrong with either the relay control or S/W (I did much the same thing to turn a slow-cooker into a sous-vide setup) .  It would be a lot easier to just find yourself an analog toaster oven.....


That's why I recommend an old toaster from a 2nd hand shop.  Or an old hand me down.  Far more likely to be "old school" analog.
Here are the melting points of various lead free solders


So it would be good for the oven to go over 230C.  

Trick I learned.  If you have trouble removing a part, use a little low temp solder paste on it.  It will lower the melting point and stay liquid longer. Clean up the pads with solderwick, or what ever you use, and put the normal paste down and resolder.  My version of ChipQuik.  A little syringe of 15 gms lasts a pretty long time.  Far beyond the expiration date.  The only bad thing is the needles get clogged after time.  I just replace the needle.  I use a 28 or 30 gauge needle, if I recall correctly.  A 20 gauge will spew solder paste everywhere.  A 20 or larger is fine if you are squeegeeing.  For individual pads, the smaller needle is better.


----------



## homebrewed

Some progress, at least as far as the hardware goes:




This is an array of eight AM241 sources, epoxied around the aperture behind which will be the 100mm^2 detector.  Yes they're ugly and canted this way and that, but since I don't have any lenses to focus the x-rays anyway they'll do .  Having 8 of these things shooting 60Kev xrays out made me pretty uncomfortable, so most of the time the source plate is inside a .125 inch thick lead shield.

I milled 8 recesses in a bolt hole pattern to help place the sources.  I had the thought that milling the holes deep enough, then using the tabs to tilt them toward the sample volume, would maximize the x-ray flux -- but the end result wasn't quite as nice as I'd hoped.  The x-ray emission pattern is pretty broad so I don't think it is a big deal.

I debated over installing all 8, since I'm not really sure what the count rate will be -- but if it's too high I can make some lead shields to block some of the sources.  This is a PROTOTYPE so by the time it is producing decent results (if ever) it could well resemble a porcupine.  Or (most likely) a real Rube Goldberg assemblage.

For a sense of scale, the aluminum plate is 2.5 inches wide and 4 inches tall. It's .25" thick so the 60Kev x-rays emitted from the backs of the sources should be pretty severely attenuated -- my spreadsheet indicates that a little less than 1% of the x-rays would make it out.  If that turns out to be too much, I left enough room on the other side to place another shield -- lead, aluminum, whatever.  Another sheet of .25" thick aluminum would drop the intensity to 1% of 1%, i.e., .01%.  In the mud.

Some might worry a bit about x-rays from the screws that are used to hold the box together and mount the latch.  However, the aperture acts like a collimator to restrict the detector's field of view -- so all it should "see" is aluminum.  Since the x-rays from aluminum are expected to only be in the 1Kev range, that's not a problem -- that energy range is at the very low end of the detector's sensitivity curve.


----------



## rwm

This great progress!!! Yes, given the broad angle of emission I don't think the angle is important.


----------



## homebrewed

I've also been thinking about the S/W part, that's at least as important as the mechanical bits.  I have a Teensy4.0 processor board, which has pretty respectable performance..  A 600MHz clock.  A 12 bit ADC, with about a 2MSPS sample rate at its maximum.  It has a floating point coprocessor and also has a number of DSP functions, like 16-bit FFT's (although I don't think I will need that capability).  It can be programmed using the Arduino IDE.

I have an old Dell Latitude D600 that I've been using in my "lab" for programming other Arduino boards, but I found that the old S/W setup wasn't able to support the Teensyduino environment.  Mostly because its installed flavor of linux was just too old.  Several of the Teensyduino functions required un-available libraries so I needed to take a different tact.  The D600 is only good for a 32-bit OS, so I installed the 32-bit version of Lubuntu 18.04 and it works with Teensyduino, but the old laptop's CPU is really struggling.  I think I can get this to work, but now it's time to outline the approach.

The basic idea is to monitor the digitized input stream and trigger processing when a peak signal exceeds some yet-to-be-determined threshold.  A circular buffer will be needed to get a substantial number of pre-peak-value samples, in order to perform a polynomial least-squares fit to the incoming data.  I think a least-squares fit scheme is a good approach because it should do a good job of rejecting noise on a per-pulse basis.  Once the polynomial fit is done, the next step is to look at the goodness of fit to the data.  The idea here is to determine if the pulse is the result of a single x-ray photon or that plus the overlap of a second one.  The peak around a single-photon pulse can be fairly accurately modeled by a simple second order polynomial fit, but if a second photon arrives too soon the peak value won't be accurate.

From what I've seen, most simple multi-channel analyzers just use the peak value -- so things like pulse overlap (or system noise) will reduce the energy resolution of the XRF system.  The Theremino approach does use some type of pulse rejection scheme, which could be much like the scheme I'm planning on using.


----------



## homebrewed

The electronics are installed, see below for an exploded view.  I need to wire up a matching connector for power and routing the detector signal to my processor board.  Since I'm planning on using the Teensy's USB port to transfer the data to my laptop, I didn't put it inside the box.  It wouldn't be too difficult to connect up a little graphics display to the Teensy -- that would eliminate the need for a laptop.  I will consider that IF this thing actually works.




The boards are mounted using a couple of aluminum pieces.  I milled slots and epoxied the edge of each board into a slot.  The aluminum holders are drilled/tapped (#6-32) to attach them to the base.  I had to rotate my signal-conditioning board a little bit to avoid a mechanical interference problem with the connector, which is a 6-pin DIN style.  It's a nice way to go because one of the pins on the back of the connector is connected to the body.  Makes it easy to ground the box.  This is important because the unshielded 10x10mm diode is a fantastic EMI detector.

If I get an iron peak due to the latch's mounting screw I'll use a brass screw.

There also are a couple of holes in the base that are on-axis with the hole in my x-ray source plate (shown in post #567).  I will turn a post out of aluminum rod and use it to support samples.  The post will be fixed in place with a screw.  I'm not sure what the coverage will be from my Am241 sources so I built in a couple of options with that in mind.   If the post is ~1 inch in diameter, the screw won't contribute anything to the XRF spectrum so I can use a flat-head steel screw and not worry about it.

The signal conditioning board requires +/- 10V and the Pocket Geiger needs +5.  I've got enough bench supplies to run both so I should be getting some pulses pretty soon now.  On to the S/W....as soon as I ohm out the connections to make certain I've got everything hooked up right.  It would be a real shame to smoke the pocket geiger or signal conditioning board at this stage.


----------



## homebrewed

If anyone else takes a similar route as far as making an enclosure, I have a little word of warning.  Extruded aluminum plates appear to be slightly bowed.  This caused some problems when drilling/tapping holes to assemble the thing -- centering the holes on the thickness didn't mean that they were all in similar locations, in a 3-D sense.  I found it necessary to make a set of transfer punches out of some set screws.  Using precision cast aluminum would have made it a lot easier, but at a considerably higher cost.

If I make another one of these I probably will take a different route, probably a thicker top and bottom with bent aluminum for the sides.  The thinner aluminum will be much more forgiving of tolerance variations.  If a scintillator is found to be the way to go, the enclosure could be made light tight using black silicone caulk.


----------



## Weldingrod1

One suggestion: shielding is always easier nearer the source! So, putting metal tubes or a plate with holes drilled the direction you want X Rays will radically reduce your off axis leakage for very little additional weight. My one X-ray patent talks about this trick:
US7639781B2


Sent from my SM-G892A using Tapatalk


----------



## homebrewed

I'm kind of jumping the gun a bit by looking at some software issues.  As I've mentioned before, I think that using a least-squares fitting routine can help to reduce the impact of noise on the system -- it's not possible to average multiple pulses to average out noise, so any noise mitigation scheme has to be based on analysis of each pulse.  The idea is to perform a second-degree least-squares curve fit of data around the pulse peak.  It is very easy to determine the maximum value of a second degree polynomial, which looks to be pretty accurate to represent a Gaussian pulse around its peak.  Hopefully the impact of noise will be reduced by the same sqrt(N) factor observed for other kinds of signal averaging.

The problem I'm finding is that most curve-fitting programs aren't very efficient in terms of execution speed.  They calculate terms multiple times rather than re-using calculated data.  Many also were written to be very generic, to solve for arbitrary-length polynomials.  While these shortcomings are OK if you just want to determine ONE polynomial that fits some data you have, an XRF system can generate many pulses per second.  So an inefficient least-squares solver could become a major limitation when it comes to getting a decent data rate throughput.

All this could change once I start getting real pulses to analyze so, once again, probably jumping the gun.


----------



## WobblyHand

If the peak is approximately gaussian, I'd use a parabolic estimator.  In particular, the one in this parabolic estimator link.  The link shows the derivation.  The equations are compact.  At the bottom of the page there is a link to the matlab implementation.  Of course, one doesn't need matlab to do the math.  The estimator finds the peak and it's location based on three samples.  I've used this in radar work.  Hope this helps.


----------



## homebrewed

WobblyHand said:


> If the peak is approximately gaussian, I'd use a parabolic estimator.  In particular, the one in this parabolic estimator link.  The link shows the derivation.  The equations are compact.  At the bottom of the page there is a link to the matlab implementation.  Of course, one doesn't need matlab to do the math.  The estimator finds the peak and it's location based on three samples.  I've used this in radar work.  Hope this helps.


I agree that a parabolic (second-degree polynomial) fit works fairly well around the peak of a gaussian.  But I want substantially more than 3 samples, on the theory that as the number of samples increases, the impact of noise (which is most assuredly present) decreases.  My guess is the effective SNR is inversely proportional to the square-root of the number of samples.  This means that at some point I should run into diminishing returns relative to the processing overhead.  The other aspect is that a second-order polynomial only works well right around the peak of a gaussian pulse.  So using a larger portion of the real pulse will introduce an error -- although error from this source should be consistent and possibly calibrated-away.   It would be interesting to generate a gaussian pulse and see how well the polynomial fit works with it.

I have written some C code to test the idea.  I add a random value to "pure" data, perform a least-squares fit to 20 points of the noisy data (centered around the peak), and then use the polynomial coefficients to solve for the peak value (this is trivial if it's a second-degree polynomial).  The peak value obtained in this fashion is noticeably more accurate than just selecting the maximum value in the noisy data.  But the "fitted peak" doesn't have zero error relative to the noiseless data.

I'm not providing actual numbers because the data I'm playing with may not correspond very well to the actual situation.


----------



## WobblyHand

From reading your previous post (the one I had responded to) it wasn't obvious [to me] what the issue was.  I got "curve fitting" and "computationally complex".  From that I jumped to simple parabolic estimator.   Sorry to have over simplified both the problem and solution.  Extracting single pulse information is "sort of hard" especially at low signal to noise ratios.  (SNR)  Speaking of which, what are the single pulse SNR's expected to be?  Are you trying to estimate the energy?  Power, or something else?  What is the information that you are trying to extract?  

Just as an FYI, the parabolic estimator works very well with values in dB's.  That means that the surrounding samples (samples on either side of the peak) may not even be close in magnitude, yet it finds the peak and amplitude.  I've used it on radar FFTs (in dBs) to estimate target parameters.


----------



## graham-xrf

One may be able to sidestep almost all the calculation, provided the shape of the pulse is regular.
In theory the energy is the integrated area under the pulse waveform.

In my scheme, I sum 20 samples in about 13mS to get the value for the bucket sample, because the A/D conversion is just about fast enough to do that without getting crazy expensive. But.. there may not be a need to press home an exact integration. Basically, a higher energy pulse simply has a bigger peak, and the photon has the good grace not to "get weaker" on the way to the detector. The X-ray photon is already the smallest packet there can be. We may as well associate that peak with an element.

Before committing a value to a bucket, there is the phenomenon of pulses being augmented by other pulses happening before the decay duration is over. Their currents do sum. The strategy is to have the scheme recognize the fact. The only practical way is to is to gate the input once triggered, for the known period of a pulse, and reject any out of range. Maybe even forget the gating, and simply reject values that do not fall within an amplitude window corresponding to an element, this being found empirically.

I have looked through the energies from the possible elements, and I can't see any that would produce a combination that could not easily be rejected.

It may be that all one needs is an accurate, and RF speed fast, peak detector operating in a triggered window, and ignoring the full integration. The software need only discover a stored peak to be in a valid element range to identify the element bucket, and increment the bucket count. The idea here is that past implementations have relied on extremely crude pulse counting on very poorly filtered sample remnants, and still managed to identify elements buckets.

I have not had opportunity to try some of these notions, but if some signal processing can bypass a whole ton of software, I like it!  Also, with such semi-analog approach, the (accurate) answer delivers at the speed of electrons, and can outrun any software depending on sampling, and then sorting those same signals.

Yes - I know. This is just my 2c, and many times I can get it wrong. I am envious that Mark has already got to the hardware. My home circumstances have temporarily derailed all this fun stuff.


----------



## homebrewed

WobblyHand said:


> From reading your previous post (the one I had responded to) it wasn't obvious [to me] what the issue was.  I got "curve fitting" and "computationally complex".  From that I jumped to simple parabolic estimator.   Sorry to have over simplified both the problem and solution.  Extracting single pulse information is "sort of hard" especially at low signal to noise ratios.  (SNR)  Speaking of which, what are the single pulse SNR's expected to be?  Are you trying to estimate the energy?  Power, or something else?  What is the information that you are trying to extract?
> 
> Just as an FYI, the parabolic estimator works very well with values in dB's.  That means that the surrounding samples (samples on either side of the peak) may not even be close in magnitude, yet it finds the peak and amplitude.  I've used it on radar FFTs (in dBs) to estimate target parameters.


I hadn't thought about doing basically a log conversion.  Given what we're trying to do -- basically determine the relative energy of an x-ray photon as accurately as possible on the cheap -- the log of the signal probably won't work.  

The idea is that elements will fluoresce when irradiated with x-rays, and the energy of the emitted photons is characteristic for each element.  We use a proportional detector -- a semiconductor diode or a scintillator -- to output a pulse whose height is proportional to the x-ray energy.  The pulse height is converted to an index into an array, and that array element is incremented by one.  Over time the array builds up a list of counts that when plotted will show the type and concentration of elements present in a sample.  The title of this very lengthy thread is "needing more than a spark test", so the intent is to come up with a DIY way to determine the composition of alloys a scrapyard scrounger might encounter. 

The x-ray source used to excite the fluorescence comes from radioactive smoke detector sources.  They emit 60Kev gamma rays, but their fluence (A.K.A. brightness) is pretty low.  A .25" thick aluminum plate will attenuate 60Kev gammas by 99% and that's what I'm using for an enclosure.  The x-rays emitted by elements of interest like iron, chromium and nickel are around 6Kev, which are even more strongly absorbed by the aluminum.

We've occasionally departed into some rather deep discussions on things like circuit design, PCB assembly ideas and the like:  but so far we haven't been taken to task by the moderators.  Anyway, they probably are amused by this small group of weirdos .


----------



## homebrewed

graham-xrf said:


> One may be able to sidestep almost all the calculation, provided the shape of the pulse is regular.
> In theory the energy is the integrated area under the pulse waveform.
> 
> In my scheme, I sum 20 samples in about 13mS to get the value for the bucket sample, because the A/D conversion is just about fast enough to do that without getting crazy expensive. But.. there may not be a need to press home an exact integration. Basically, a higher energy pulse simply has a bigger peak, and the photon has the good grace not to "get weaker" on the way to the detector. The X-ray photon is already the smallest packet there can be. We may as well associate that peak with an element.
> 
> Before committing a value to a bucket, there is the phenomenon of pulses being augmented by other pulses happening before the decay duration is over. Their currents do sum. The strategy is to have the scheme recognize the fact. The only practical way is to is to gate the input once triggered, for the known period of a pulse, and reject any out of range. Maybe even forget the gating, and simply reject values that do not fall within an amplitude window corresponding to an element, this being found empirically.
> 
> I have looked through the energies from the possible elements, and I can't see any that would produce a combination that could not easily be rejected.
> 
> It may be that all one needs is an accurate, and RF speed fast, peak detector operating in a triggered window, and ignoring the full integration. The software need only discover a stored peak to be in a valid element range to identify the element bucket, and increment the bucket count. The idea here is that past implementations have relied on extremely crude pulse counting on very poorly filtered sample remnants, and still managed to identify elements buckets.
> 
> I have not had opportunity to try some of these notions, but if some signal processing can bypass a whole ton of software, I like it!  Also, with such semi-analog approach, the (accurate) answer delivers at the speed of electrons, and can outrun any software depending on sampling, and then sorting those same signals.
> 
> Yes - I know. This is just my 2c, and many times I can get it wrong. I am envious that Mark has already got to the hardware. My home circumstances have temporarily derailed all this fun stuff.


The hardware isn't quite there yet but getting close .  Hopefully Zeno isn't waiting at the other end of the bridge!

My concern regarding the need for more sophisticated signal processing is totally based on what I've seen coming out of the rather poorly-designed Pocket Geiger. Lotsa noise, which will surely degrade the energy resolution we get.   If that can be improved, perhaps by going to a zero-bias-voltage approach, a relatively simple peak detector might just do the trick.

I have to say that the Pocket Geiger wasn't designed for this kind of application.  It really IS meant to be a relatively inexpensive geiger counter, so why should we be surprised that it's not ideal for what WE want?  If need be, we can (like Graham) just harvest the detector -- it actually is cheaper to buy the entire Pocket Geiger than the detector from Digikey or Mouser!

Hopefully, once some data starts coming out of a lashup or two we can zero-in on an approach that is feasible for the ambitious H-M member.


----------



## WobblyHand

If I understand correctly the source is a radioactive element emitting low energy X-rays?  And these sources emit photons at random times, if I remember correctly.  How does one count two photons that occur so closely that the smeared out scintillator response blurs them together? Is it possible to work in the spectral (fourier) domain rather than the time domain?  That way you don't need crazy fast circuitry, correct?  

Is the fluorescence in the visible spectrum?  The lines emitted are unique to the chemical makeup?  How do you determine the power in each frequency? Are you making a sort of spectral analysis tool?  Like a diffraction grating coupled with a frequency insensitive detector?  Or a fourier spectrometer - much more sensitive, but a lot harder to make!


----------



## rwm

At the risk of preempting Homebrewed: Photon emission is random although you can adjust the flux buy altering the amount of Am that you use to excite the subject material.(or moving it further away.)  If the signal photons are too close together in time they will cause anomalous data. A way to reject these is needed and some ideas have been thrown out. The fluorescence is not in the visible light range; it is low energy x-ray around 6KeV. I was hoping a simple peak detector would do the trick, but apparently the electronic hardware noise complicates this. That is above my pay grade.

Post 578 is an excellent summary!

Also Graham's simple approach in post 577 seems very appealing.


----------



## WobblyHand

rwm said:


> At the risk of preempting Homebrewed: Photon emission is random although you can adjust the flux buy altering the amount of Am that you use to excite the subject material.(or moving it further away.)  If the signal photons are too close together in time they will cause anomalous data. A way to reject these is needed and some ideas have been thrown out. The fluorescence is not in the visible light range; it is low energy x-ray around 6KeV. I was hoping a simple peak detector would do the trick, but apparently the electronic hardware noise complicates this. That is above my pay grade.
> 
> Post 578 is an excellent summary!
> 
> Also Graham's simple approach in post 577 seems very appealing.


Thanks for the additional explanation.  Low energy x-rays as the fluorescence does complicate things.  Makes simple optical approaches hard.  Reading some more, I find that one solution for gamma ray spectrometry is to make a multichannel analyzer.  This sorts out all the bins according to energy.  Is this the basic approach?  I haven't found a detailed explanation of how to deal with pile-up, or the reception of multiple photons within a short time period, ie. within a time constant of the analog front end.  No matter what, that needs to be dealt with, as it is certain to happen.  How do similar implementations reject near coincident photons?

Further reading reveals that the detector resolution can be a limitation.  Is the detector chosen sufficient to resolve the emission spectra for the use case?  (Somewhat common materials one wishes to identify?)  Gee, sorry to ask 100's of questions.  It's hard plowing through a 59 page thread.  Seems that there's a lot of interesting processing (or visual interpretation) going on to reject "clutter" or uninteresting features like back scattering, and even effects from the enclosure.  Looks like a fun project.


----------



## rwm

You are asking all the right questions! Some of these have been partially hashed out. Welcome aboard.
Seems that Graham wants to get low noise data and throw out peaks that don't make sense. Homebrewed wants to analyze the $hit out of the data as fast as possible. Who is correct?! Such suspense...


----------



## WobblyHand

rwm said:


> You are asking all the right questions! Some of these have been partially hashed out. Welcome aboard.
> Seems that Graham wants to get low noise data and throw out peaks that don't make sense. Homebrewed wants to analyze the $hit out of the data as fast as possible. Who is correct?! Such suspense...


I apologize for not rereading the thread.  I have started plowing through some of it.  A few of my questions were answered in the beginning.  It's not clear what has been settled in both their approaches.  (Detector choices, PMT or not, etc.)  Tossing data in the beginning can result in throwing out the very information one needs.  (I've seen that happen.)  It's hard to know, in advance, what's good and bad.  So preserve the ADC samples! However, if one runs several hypotheses simultaneously, that can give good results.  Certainly going to be interesting attempting identification - it seems easy in principle, but often is hard in practice.  Has anyone thought about how to calibrate this instrument?

I do think, at least initially, the processing should be done on a higher power platform (PC) until things are sorted out.  Get the samples transferred to a PC and play there - it's far more efficient (from a development perspective) than on a micro/arduino platform.  Once the algorithm is determined, then port it back to the platform (if it fits).  If it doesn't fit, one either needs a different algorithm (at the expense of something) or a more capable computation engine, or a better/different method of data collection.


----------



## graham-xrf

OK - a few random thoughts..

Hi @WobblyHand  - a newer fellow curious about what is going on here, welcome!
Although I originated the sentiment in the title, @homebrewed is the relative mainspring. I had not considered that moderators might want to rule our explorations out of order for being somehow non "hobby-machinist", so in our defence, I cite the motivations.

Having a chunk of steel, likely acquired via some route other than purchased from a source with the composition guaranteed, is a problem!
One might want to know if it is potentially hardenable, or maybe free-machining by having some lead in it. We really do want to know if the bit of cast iron is semi-steel, or hardly better than pig-iron weights. We would like to know if the stuff is a heat-hardenable alloy, or a carbon steel, and so on.

Doing something like this has me had me thinking about how one might even turn or drill lead, and how to fabricate the enclosure. Everything about trying to make this gadget in a way that lots of HM members might manage to get together is about something we believe they would find useful. On the way, we become educated in some practical nuclear physics, right down to the numbers. We have weeded out the wishy-washy stuff. The thread is now hardball about the science, and we have appreciated and set out what it takes to get this data.

I do agree the thread is huge, and it would take someone with more than average perseverance and interest to trawl the whole thing, but that journey details our learning curve. At this stage, we freely discuss atomic absorption spectra with all that already under our belts. We should perhaps pause a bit, and periodically throw in summaries, and potted explanations, so new readers not so immersed in it, can take advantage.

I hesitate to try for "Needing more than a spark test (2)". That's hiking the generation number like a trash Hollywood sequel, but it would at least re-start the number of pages.
-------
Thinking about the energies we want to detect, there is the question - can we reliably detect lead? Can we even detect Carbon? Nice to know, because that is such an important ingredient. It's presence is most of what allows the spark test to work. From where we started, with the pocket-Geiger, we have the excerpts of energies in a couple of PDFs.

Lead is atomic number 82. Check it out on the second PDF, but also display the first, to get at the top line column titles.
There is no chance a incoming 60KeV gamma can get the K-shell electrons in lead (Pb) to emit anything. 74.9KeV is just too much, and 84.9KeV is worse!
But look, the L-shell electrons need only 10.5KeV, and 12.6KeV to shift, and that is right where our detector can work! See those two together, and you suspect lead.

So ask, can one tell if it is contaminated by Rhenium, Osmium, Iridium, Platinum, or Gold? Sure you can. Consider first the likelihoods. Then consider the resolution of our proposed gadget. Much of the design philosophy I went for was not to settle for a smudged pulse. It needed to be good enough, and have a measurement accurate enough, to try and separate these.

Think through all the common metals and stuff in our steels. Cr, Mo, S, Mn, Fe, Zn, and so on. It's clear that not-very-good analysis, with poorer resolution might persuade is that what we thought was lead might be sulphur, This is why we need the bucket statistics to be _smart_! Also, the resolution as high as we can get it. A lot of the software around struggles with getting around stuff like baseline shift, phase delay, pulse stretching and the like. My approach is a bit hardball. DC coupled, or clamped, with high enough bandwidth and low enough noise to make such "smart" guesswork unnecessary, if I can make it so.

One thing I had not considered is how little of our steels are all from ore. Except for perhaps a Katana blade, or special purpose steels, recycled scrap in the mix now has become an alloy with a proportion from all sorts of steel, and has been becoming steadily more radioactive. So long as it's not noise, this might even be an advantage. If it makes the steels glow X-Rays, that's OK  I don't expect we will ever be bothered by our steels ever "getting warmer" 

Consider the important carbon. Only 6 electrons, and all of them in the K-shell. Only a feeble 227eV will it yield. The sensor we hijack from the pocket-Geiger kit will only have absorption probability around 3% for that. Even so, it is not zero, and if we have a low enough noise floor, we can scale the measure to account for the sensor. Then again - why bother? So long as the count is characteristic of the element in calibration with that sensor, the element is identified. It's bucket is incremented, and the display will show it there, regardless the info came from a small signal.
It's true the axis of the display plot may need to be scaled to account for the sensor curve, or maybe a logarithmic expansion to some base to exaggerate the low levels could be useful, but the key thing is - we can perhaps detect carbon. It becomes a thing about very low noise amplifier detection technology, which fortunately these days, is actually reasonably affordable.

As for the processing, it takes more than a little Arduino, but a 55 bucks Raspberry Pi can stomp on it! Very high speed DSP, and suchlike are not needed if one is happy to capture the pulse(s) with high speed analog stuff, and analyze at leisure. It just means you have to wait more seconds for the counts to build up. Mark has actually experimented with how often the scintillations happen.


----------



## WobblyHand

I'm up to page 4 now...  You guys have covered a lot of ground!  

Nonetheless, are you you trying to identify 1144 from 1018?  Or just aluminum (aluminium  ) from lead.  There seems to be a lot of potential backscatter and junk, that might interfere with alloy determination.  Quantitative analysis is usually harder than we think.  The idea is pretty interesting, that's why I have started reading from the beginning.  It will take a while to catch up.  When I do, I'm not sure I can help that much, but my background is EE and radar (signal processing).


----------



## graham-xrf

WobblyHand said:


> I'm up to page 4 now...  You guys have covered a lot of ground!
> 
> Nonetheless, are you you trying to identify 1144 from 1018?  Or just aluminum (aluminium  ) from lead.  There seems to be a lot of potential backscatter and junk, that might interfere with alloy determination.  Quantitative analysis is usually harder than we think.  The idea is pretty interesting, that's why I have started reading from the beginning.  It will take a while to catch up.  When I do, I'm not sure I can help that much, but my background is EE and radar (signal processing).


My scheme envisages having a lookup database to display the probable metal alloy type from the analysis of the peaks in the bucket count histogram. At least - that is the ambition. There will be a fun stage where one sets about making a calibration set of results of the pure elements alone, with some novel ideas on how to get a reading. This includes making up solutions, and getting those little cubes of pure stuff used by Periodic Table collectors, etc).

Once the traces of the calibration (pure) are available, then move on to showing it various types of steel, either known from the beginning, or identified because you can see the proportions of elements. That plot can be a "calibration signature" for the particular steel - like 1144, or 4140.
It's a bit of a software smart trick to have the computer do enough correlation, or statistical stuff to be able to suggest what it is, with perhaps a % probability. Possibly display the calibration material plot over the test metal plot, but in a different colour.

Initially, I expect I will be using a physic (chemistry??) textbook, along with some metallurgy data, to figure what the metal is. (Hoping!!


----------



## homebrewed

WobblyHand said:


> If I understand correctly the source is a radioactive element emitting low energy X-rays?  And these sources emit photons at random times, if I remember correctly.  How does one count two photons that occur so closely that the smeared out scintillator response blurs them together? Is it possible to work in the spectral (fourier) domain rather than the time domain?  That way you don't need crazy fast circuitry, correct?
> 
> Is the fluorescence in the visible spectrum?  The lines emitted are unique to the chemical makeup?  How do you determine the power in each frequency? Are you making a sort of spectral analysis tool?  Like a diffraction grating coupled with a frequency insensitive detector?  Or a fourier spectrometer - much more sensitive, but a lot harder to make!


You're right, pulse overlap is a source of inaccuracy.  Since radioactive decay is a random event, there's no way to prevent a certain number of pulses occurring too close together, so  the best approach is to reject pulses whose shape is wrong -- clearly, pulse overlap (in terms of the bandwidth of the acquisition system) will result in a non-gaussian shaped curve.  My scheme will hopefully detect this by looking at the goodness of the 2nd-order polynomial fit.  

I've read some papers that describe attempts to analyze pulses in the frequency domain but the approach doesn't appear to have gotten much traction in terms of real-world applications.  As far as requiring fast circuitry, there is an open-source XRF system (done by the Italian Theremino group) that uses a computer sound card to perform the acquisition.  With the right pulse-shaping circuitry and S/W their approach produces some pretty good results, despite the relatively low sample rate.

The fluorescence is not in the visible spectrum.  It is in the x-ray spectrum as well, but at a lower energy than the incident 60,000 electron-volt photon. In the vicinity of 6,000 electron-volts. For some perspective, the energy of a violet (visible) photon is between 2.75 - 3.26 electron-volts.   A difference of several orders of magnitude.

The emitted spectral lines are characteristic to the element.  They do not depend on the oxidation state of the element.  If you've got a compound all you will see is a spectrum that is a weighted sum of the individual elements in the compound.  This is not the same as NMR spectroscopy, where the spectrum IS shifted by the chemical bonds that are present.

The spectrometer we're working on is known as an energy-dispersive detector.  It outputs a pulse whose height is proportional to the x-ray photon that strikes it.  The x-ray photon doesn't make it out alive .  Ideally, 100% of its energy is absorbed by the detector.  It is possible to make an x-ray spectrometer that uses a type of diffraction grating -- but the x-ray wavelength is too short for conventional grating technology.  Instead, a crystal is used.  The regular spacing of the atoms in the crystal lattice acts as a diffraction grating.  The disadvantage of this type of spectrometer is that it only detects one wavelength at a time, so a very slow scan through the wavelengths is necessary.  It also is much less sensitive than an energy dispersive detector.  I am unaware of ANYONE who has made a DIY version of a wavelength-dispersive spectrometer. 

I also am unaware of a fourier-transform spectrometer (similar to an FTIR) that works in this wavelength range.  The challenges of making such a thing would be monumental.  The wavelengths of interest are less than 1 nano-meter.....so the mechanical system would have to be better than that!


----------



## homebrewed

Yes, 59 pages is a bit of a steep slope to climb!  But that includes quite a bit of, for lack of a better phrase, thrashing around looking for the best approach.  And it's clear that there still is some gentlemanly disagreement on what that might be!  It's all fun, if it's the kind of thing that rocks your boat.  I like it because it uses quite a wide range of knowledge and technologies.  You can see that both Graham and I have some knowledge regarding electronics; and that is a huge leg up in this case.  We will try to make things as clear as possible to those who may not be quite so far along in that realm.  As I like to say, there should be no differences between us created by hoarding knowledge, only those given to us by Nature and Nurture.

Back to the more mundane issue of calibration, it is absolutely necessary to have some pure elemental samples.  We can't generate a calibration curve by using first principles.  Or at least I can't


----------



## graham-xrf

homebrewed said:


> The spectrometer we're working on is known as an energy-dispersive detector.  It outputs a pulse whose height is proportional to the x-ray photon that strikes it.  The x-ray photon doesn't make it out alive .  Ideally, 100% of its energy is absorbed by the detector.


This is a point on which I looked hard for what is known. I know when the photon arrives, it might miss. Most of what is inside of what we think is solid hard stuff is mostly empty space. There is a probability of collision involved. If it misses, there is more to hit beyond. If the stuff is thin enough, it can go right through. It's higher energy X-rays stuff (Gamma), after all! 

If it hits, it excites the element electrons into a higher energy state. They don't stay that way. They drop back into their "normal" state. The amount they took in to get to the excited state is released as a fluorescence photon, having a new wavelength determined by the energy change involved, and Planck's constant. It comes out as X-Rays.

So - what happens to the excess?
A 60KeV photon hitting iron (Fe) uses up only 6.4KeV and 7.6KeV to excite the K-shell, and presumably, at the same time, uses up another 705eV and 718eV getting the L-shell electrons into a higher state. That total is 15.4KeV, leaving another 44.57KeV yet to do anything.

Does the leftover energy simply excite the same atom electrons another couple of times until it can't quite manage a last K-shell event?
Does the remainder go on to keep working the same atom L-shell up and down again and again until even that runs out?
The wavelengths are getting pretty long for the small energies. Would that be into infra-red?
Does it end up shaking the atom about somewhat, as in it "warms the stuff up" a bit?

Does it not happen that way at all? Does the remainder 44.57KeV keep going to strike some other atom instead?
------------------------
All of the above is about the fluorescence scintillation. The next bit is about what happens in the photodiode detector.

Although I have trawled many videos about what happens in photodiodes, particularly from the advanced set of lectures from a Indian university, I have not seen a clear explanation of exactly how a arriving photon turns into a current amid the conduction band carriers in a material. All the equations are about a energy flux of lots of photons. There is an efficiency involved. We do not get a current of energy equal to 100% of the incoming. Some of it, I think, ends up as heat.

In our design, we have a transimpedance amplifier capable of seeing a current started by only _one_ photon, which is then amplified.
A whole bunch of other noise currents will be amplified along with it. Some of it is thermal generated, but I don't propose cryogenic amplifier design. Some is induced from outside fields, but we can shield it from such interference by design. We even can deny magnetic interference, and we can get up to circuit design tricks that can cancel differential noise, and avoid common mode noise. In the end, this will be about signal to noise ratio, and the only way to preserve that, locked in, is to start with extreme low noise amplification with very high gain, so that any noise from later stages is dwarfed by comparison to our (amplified) original noise.

I am pretty sure that we will run into pulse and real signal situations we did not anticipate, meaning the difference between theory and practice. We just have to give it our best shot. You are doing all the right things to anticipate most everything. The aluminium plates I had first thought was overkill, but I revise my opinion.


----------



## homebrewed

graham-xrf said:


> This is a point on which I looked hard for what is known. I know when the photon arrives, it might miss. Most of what is inside of what we think is solid hard stuff is mostly empty space. There is a probability of collision involved. If it misses, there is more to hit beyond. If the stuff is thin enough, it can go right through. It's higher energy X-rays stuff (Gamma), after all!
> 
> If it hits, it excites the element electrons into a higher energy state. They don't stay that way. They drop back into their "normal" state. The amount they took in to get to the excited state is released as a fluorescence photon, having a new wavelength determined by the energy change involved, and Planck's constant. It comes out as X-Rays.
> 
> So - what happens to the excess?
> A 60KeV photon hitting iron (Fe) uses up only 6.4KeV and 7.6KeV to excite the K-shell, and presumably, at the same time, uses up another 705eV and 718eV getting the L-shell electrons into a higher state. That total is 15.4KeV, leaving another 44.57KeV yet to do anything.
> 
> Does the leftover energy simply excite the same atom electrons another couple of times until it can't quite manage a last K-shell event?
> Does the remainder go on to keep working the same atom L-shell up and down again and again until even that runs out?
> The wavelengths are getting pretty long for the small energies. Would that be into infra-red?
> Does it end up shaking the atom about somewhat, as in it "warms the stuff up" a bit?
> 
> Does it not happen that way at all? Does the remainder 44.57KeV keep going to strike some other atom instead?
> ------------------------
> All of the above is about the fluorescence scintillation. The next bit is about what happens in the photodiode detector.
> 
> Although I have trawled many videos about what happens in photodiodes, particularly from the advanced set of lectures from a Indian university, I have not seen a clear explanation of exactly how a arriving photon turns into a current amid the conduction band carriers in a material. All the equations are about a energy flux of lots of photons. There is an efficiency involved. We do not get a current of energy equal to 100% of the incoming. Some of it, I think, ends up as heat.
> 
> In our design, we have a transimpedance amplifier capable of seeing a current started by only _one_ photon, which is then amplified.
> A whole bunch of other noise currents will be amplified along with it. Some of it is thermal generated, but I don't propose cryogenic amplifier design. Some is induced from outside fields, but we can shield it from such interference by design. We even can deny magnetic interference, and we can get up to circuit design tricks that can cancel differential noise, and avoid common mode noise. In the end, this will be about signal to noise ratio, and the only way to preserve that, locked in, is to start with extreme low noise amplification with very high gain, so that any noise from later stages is dwarfed by comparison to our (amplified) original noise.
> 
> I am pretty sure that we will run into pulse and real signal situations we did not anticipate, meaning the difference between theory and practice. We just have to give it our best shot. You are doing all the right things to anticipate most everything. The aluminium plates I had first thought was overkill, but I revise my opinion.


You have some good comments here.  I'm thinking that the incident photons do experience a sequential drop in energy as they excite fluorescence in atoms they hit and also pump carriers into the conduction band that eventually contribute to the current pulse height.  The fluorescence x-rays also do their bit to add to the current pulse, but since they can't excite any more fluorescence x-rays all they can do is move carriers up into the conduction band.  So in a fast cascade the incident photon is converted into back-radiated fluorescence photons, hole-electron pairs and heat (phonons).  For detection efficiency we mostly want hole-electron pairs.

The energy needed to get a carrier into the conduction band of doped silicon is pretty low, down in the single electron-volt range so it should be possible to suck most of the energy out of any spare x-ray photons flying around the crystal lattice.


----------



## graham-xrf

@homebrewed  - Thanks much for some more physics insight. I tried to take in as much as I could from my "YouTube education" binge, but there came a point where I overloaded.

*Pulse pattern recognition*
Then I started to get practical. A simple discrimination strategy is to note the pulse duration characteristic from the PIN diode in recovering and recombination. For the X100-7 salvage diode, the largest energy pulses decay back in about 10-mS to 13mS. A new (good) pulse from the same element, arriving as late as 9mS will make an "extended" duration total pulse, but will have a near-repeated amplitude. The whole smeared pulse would be about 20mS. Maybe several pulses would make a very long smear, but we count from a peak.

The next case is where we have a second pulse arriving within the 13mS window. It might be a smaller one. It smears the pulse to (say) 20mS or more. We still see one good measurable peak.

So what if the next one within the window happens to be a bigger pulse? This is actually OK. It ruins the measure of the first pulse that started it all. It also has it's own measure ruined, because we get a summed new peak looking like something impossible, or maybe unfortunately spoofing a false positive on a third element. If it happens to land so exactly timed coincidental to make a false pulse, then it will be rejected for being stupidly too high, or at worst, will falsely increment the bucket for a third element, but so rarely it will not make a significant showing.

Therefore, I think we might get a quite good result using a ridiculously crude and simple discrimination filter. A pulse qualifies if it happens within a 13mS window, or perhaps more subtly, within a 10mS window after the peak.

Add to that, if a pulse amplitude is beyond a maximum for the highest energy pulse from Tungsten (W -> 59.3KeV), plus a little bit, then it is a combination coincidence, so gets rejected. There are, of course, some combinations of lower energy pulses that can spoof a higher energy pulse, but they would also have to happen within 10mS of a single peak. Most would get rejected, and the coincidence ones would happen very rarely, so have low bucket counts.

The filter also rejects various kinds of interference noise. The low side threshold would be set to exclude noise, and the s/n noise ratio we hope to get such that a 220eV pulse is still seen. Such a discriminator is a brutal simple thing, and it might extend the "gather samples" period, but it might also perform as well as, or better than a ton of software smarts in pulse pattern recognition, software compensations, and other good stuff.

It may also just be wishful thinking on my part.
For this reason, I urge you to continue your smart software approach.


----------



## rwm

I like it Graham.


----------



## homebrewed

I get it:   "it should be as simple as possible, but no simpler" .  It makes for an elegant design and I'm all in favor of that!


----------



## rwm

Can you do a primitive mock up and see what the pulses look like in terms of pulse rate, decay rate, number of random summed events etc? Could you look at this with an oscilloscope and get any idea?


----------



## homebrewed

rwm said:


> Can you do a primitive mock up and see what the pulses look like in terms of pulse rate, decay rate, number of random summed events etc? Could you look at this with an oscilloscope and get any idea?


Acquiring some raw data will be the first step for me.  I will sample the output with nothing in the sample chamber (other than the unavoidable aluminum enclosure) and get some basic statistics -- exactly what you're talking about.  Aluminum's XRF signal is at about 1.5Kev, 'way down in the detector's sensitivity range, so I expect mostly background stuff.

I also have a number of pure elemental samples I can use for calibration and reality-check purposes.  That's where I expect to see pulse overlap issues arise.  Thanksgiving activities have delayed things a bit, but I _think_ I'm pretty close to firing the whole thing up in an EMI-free environment.  Basically, wiring up a connector and double-checking it so I don't let any of the magic smoke out.

I'm hoping the 12-bit A/D on my Teensy4.0 will be adequate for the job.  It maxes out at about 2MSPS, although at that sample rate its ENOB is closer to 10 bits.  The pulses coming out of my signal conditioning circuit are pretty slow so I may be able to do some averaging to increase the effective number of bits (that's what ENOB stands for).


----------



## homebrewed

For anyone who is thinking about going down the Teensy route for an XRF system, my additional investigations into ADC performance vs. Teensy versions indicate that Teensy 3.6 may be a better choice.  Even though its system clock is slower, its ADC resolution and sample rate are better than 4.0 or 4.1.  3.6 has a built-in FPU just like 4.x so doing stuff like polynomial fits will still be pretty speedy.  For some reason the 3.6 is a bit more expensive than 4.0 (but still less than $30USD).

Since I have a Teensy 4.0 I will go ahead and see how well it works.  Since I'm using the Arduino IDE it would be easy enough to recompile my code for a 3.6 if I find it necessary to use one.

To keep from overdriving the Teensy's ADC I've decided I need to add a diode clamp to the output of my signal conditioning board.  My board can output up to +10V, well above the Teensy's  3.3V max.  I'll tap into the Teensy's 3.3V supply for the clamp -- it's brought out to a pin so no need for yet another power supply or voltage regulator.


----------



## homebrewed

I finally had some time to fire up my XRF setup to get a preliminary idea of how it's working.  Nothing special, just the 'scope looking at pulses.  It appears that my enclosure is keeping 60Hz noise out just fine, but I discovered the switching regulator on the PocketGeiger is injecting a fair amount of noise into the transconductance amplifier (or perhaps into my signal conditioning board, which is nearby).  This may have been another reason for having that copper shield on the board -- the 10x10mm detector appears to be a great antenna, in addition to being an x-ray detector.

The noise is not due to an oscillation problem in my signal conditioning board, because it goes away when I turn the pocket geiger off.

 Some experimentation is needed to see if I can put some shielding around the switcher/inductor, or if I just need to bite the bullet and use another external supply to run the detector board.  I threw the copper shielding away but I have some copper sheet I can cut and form.  The main thing is to avoid shorting anything out, while not covering the detector.

One potentially big advantage of using an external supply is the option of easily varying the bias voltage on the detector.  The detector diode's dark current is a substantial noise contribution, and it strongly depends on the bias voltage.  This alone is enough to make me lean toward an external power supply.

This is one of the reasons I've been calling my setup a "test bench" -- it's to identify and wring out all the issues that invariably come up in a project like this.


----------



## graham-xrf

Hi Mark - and good on ya! Great that you are trying out the diode. I have been reviving ambitions about it, and two nights ago I was sorting out what the good lady calls "all that radioactive crap"  For a little longer, XRF is still has to be the project behind a few other things, but even now, every bit of unknown metal I see is crying out for it!

*Re: the switcher inductor noise*
You can Faraday shield it without creating a shorted turn, by using some Kapton tape in a foil capacitive overlap. Pot-core type  inductors keep all the local magnetic fields trapped in the high permeability ferrite that surrounds everything, but even a small one of those is probably too big as a single component for that size board.

Even if the switcher inductor were perfectly shielded by a deity, that it exists on the same circuit board as the transconductance amplifier means that all the ways it can pollute the signal, beyond by radiative (near fields) across the airspace between it and conductors affected, are all still present. It injects it's waveform into every PCB trace, especially the common-mode return.

When trying for low noise amplification at the kind of gain we are using, layout more like the style used in electrometers or pH meters is probably appropriate, except this time, we throw in the need for reasonable bandwidth as well. I think that if the voltage must be created with any kind of switcher, then first, it gets banished from the board. It can be software-settable, but however it is made it should be filtered, and post-switcher final regulated, where the regulator has sufficient bandwidth to follow the pulsations, and regulate them away. Fortunately, this can be done with one low noise op-amp. The trip to the amplifier can be by screened twisted pair, with the screen grounded at only one end.

Then, before it gives any life to the transconductance circuit, add a common-mode filter (tiny toroid), and a balanced filter (two more tiny toroids + capacitor), and a final storage capacitor at the amplifier board. If you get the amplifier signal clean enough, just measuring it may need some care. I would use two probes to a scope, in differential setup, with channels summed, one inverted, and the gains balanced to null the signal of the scope test square wave.


----------



## homebrewed

graham-xrf said:


> Hi Mark - and good on ya! Great that you are trying out the diode. I have been reviving ambitions about it, and two nights ago I was sorting out what the good lady calls "all that radioactive crap"  For a little longer, XRF is still has to be the project behind a few other things, but even now, every bit of unknown metal I see is crying out for it!
> 
> *Re: the switcher inductor noise*
> You can Faraday shield it without creating a shorted turn, by using some Kapton tape in a foil capacitive overlap. Pot-core type  inductors keep all the local magnetic fields trapped in the high permeability ferrite that surrounds everything, but even a small one of those is probably too big as a single component for that size board.
> 
> Even if the switcher inductor were perfectly shielded by a deity, that it exists on the same circuit board as the transconductance amplifier means that all the ways it can pollute the signal, beyond by radiative (near fields) across the airspace between it and conductors affected, are all still present. It injects it's waveform into every PCB trace, especially the common-mode return.
> 
> When trying for low noise amplification at the kind of gain we are using, layout more like the style used in electrometers or pH meters is probably appropriate, except this time, we throw in the need for reasonable bandwidth as well. I think that if the voltage must be created with any kind of switcher, then first, it gets banished from the board. It can be software-settable, but however it is made it should be filtered, and post-switcher final regulated, where the regulator has sufficient bandwidth to follow the pulsations, and regulate them away. Fortunately, this can be done with one low noise op-amp. The trip to the amplifier can be by screened twisted pair, with the screen grounded at only one end.
> 
> Then, before it gives any life to the transconductance circuit, add a common-mode filter (tiny toroid), and a balanced filter (two more tiny toroids + capacitor), and a final storage capacitor at the amplifier board. If you get the amplifier signal clean enough, just measuring it may need some care. I would use two probes to a scope, in differential setup, with channels summed, one inverted, and the gains balanced to null the signal of the scope test square wave.


I don't think the switcher's inductor is a toroid or pot core.  It looks like a plain old solenoid style, which should be great at broadcasting its mag field.  A thick-enough layer of copper can attenuate that (but enough???).  I also note that the designers of the PocketGeiger put a lot of bypass caps near the chip, prompting me to suspect that they ran into noise problems due to switcher transient currents on the Vcc trace.

It's likely that the PocketGeiger will get a pair of external power supplies but I will at least explore the possibility of adding shielding to get rid of the switching noise.  

Right now it looks to me like most of the circuit noise is coming from the switcher rather than the diode dark current.  So it's well worth the effort to address this.

Oh, and BTW, Happy Holidays!

Mark


----------



## graham-xrf

Getting a copper entirely around the inductor, but in a way that avoids a shorted turn, will stop any antenna-type E-Field. I have done this using a ground plane under all of a small PSU circuit, and bringing the metal shield sides up from it, but when completing the "box" over the top, I used two "lids", one folded over the top of the other, but with a thin sticky tape between them. The remaining two ends got the same treatment. In appearance, it was a untidy homemade bodge-up, but it made a Faraday "cage". The overlapping sufaces with sticky tape between them completed the Faraday cage by the capacitance acting as an AC short-circuit. It's very difficult for the field trapped in the thin dielectric between two coppers that are DC shorted together, to make any external electric near field to affect anything, much less to start any real farfield EM propagation.

Alternating magnetic near-fields cannot escape a truly shorted Faraday cage (shorted turn effect), but they can escape far and wide if the cage is not truly shorted, like the inductor shield I describe. The magnetic near field can inductively couple to traces, and add in their noise. Fascinating (to me) is how they can still get a true RF propagation going, including generating a new electric far-field. The electric near-field component may be trapped in the shield overlap, but the magnetic component can still get out and make a true RF radiation happen. That is how direction-finding shielded Goniometer's, and communication magloops work as antennas.

At the dimensions of the PCB, it's all so close in terms of wavelengths that only near-fields can be coupling this noise into the traces. Moving the entire switcher away, and having a a piece of mu-metal, and maybe some ferrite in the design of the sense head assembly, should approach having the noise reduce to only that of thermal, diode, and amplifier front-end that we already know about.

I have to agree. It is simply obvious that the solution to switcher noise is to move it away, and filter the noise. For the purposes of your experiment, it may be faster and easier just to use a battery or two hooked up. You know the final circuit will have the PSU live elsewhere (and be a clean one) anyway!

Thanks for the seasonal wishes, and likewise for yourself.


----------



## homebrewed

Some good comments there!  Over the years I've had to deal with unwanted contributions from my measurement system (most troublesome, vibration-prone coax).  This is just more of the same and yet another reason to start with a testbed kind of setup.  It's just as valuable to determine what doesn't work as what does......


----------



## graham-xrf

I get that   I just want a better hit rate than this guy..

     “I have not failed. I've just found 10,000 ways that won't work.”  
―    Thomas A. Edison


----------



## rwm

Would your external power supply be linear instead of switching?


----------



## homebrewed

rwm said:


> Would your external power supply be linear instead of switching?


Yes indeed!  I'm thinking about a separate power supply board to produce all the required voltages.  Linear regulator IC's in the 78xx/79xx family are cheap and easy to wire up, even with my old eyes.  The main thing is to remember that Vin and Gnd are swapped when you go from a positive regulator to a negative regulator   The circuitry draws so little current I don't think I will even need heat sinks on them.


----------



## graham-xrf

rwm said:


> Would your external power supply be linear instead of switching?


Good question!
In theory, it could be either. In practice, it might well be switcher-derived, then followed by linear noise clean-up.

Part of "clean-up", in addition to the usual noise filtering, can include a final linear low drop-out regulator stage designed to have the output only a little below  the switcher-type input. This final regulator is itself low noise, and has very high bandwidth, fast enough to "follow" all the noise, and regulate it away. Very important is how clean the reference is, and how clean is the bottom end common mode return route. If the 0V for the reference just casually connects to the switcher 0V, it can simply import a mad racket onto the thing you are trying to keep clean.

Paying attention to the return current paths back to the common star point, and not allowing the linear regulator reference to be bounced around by switcher common mode noise, gives a clean instrumentation grade supply. The same attention has to apply to A/D converters, and their references. The bad scene there is the low-order bits being jangled around, sampling random noise on top of the signal you want.

The tricks need not be expensive, nor too elaborate. If the amplifier does not need big currents, then something as simple as putting two resistors into it's energy route, and shunting them with a capacitor for energy storage, in parallel with a smaller value high frequency capacitor to deliver transients, can wipe out quite severe noise. I prefer to have the noise as low as possible at the start, and then include the clean-up anyway.


----------



## graham-xrf

homebrewed said:


> Yes indeed!  I'm thinking about a separate power supply board to produce all the required voltages.  Linear regulator IC's in the 78xx/79xx family are cheap and easy to wire up, even with my old eyes.  The main thing is to remember that Vin and Gnd are swapped when you go from a positive regulator to a negative regulator   The circuitry draws so little current I don't think I will even need heat sinks on them.


78xx and 79xx certainly are cheap and plentiful.
Cautions. Any that get to their voltage by using a diode in their common return, may have noise issues. Linear they are, so they at least do not have switcher flyback noise. I know the 78xx series has been going since 1972, and is still the hobbyist's favourite.  There have since been some sporting the same number in their code, that have had some improvements. There are now low cost low noise regulators that may be a better choice.

Mark is right about the low current and not needing heatsinks. Earlier on in this thread, one of our simulation circuits had a low noise op-amp provide the 0V regulated return to be forced exactly halfway between the offered supply voltage, so generating a dual-rail power supply to allow inverted waveform gain stages.


----------



## homebrewed

Like numerous amplifiers claimed to be "low noise" but aren't, I've found quite a few "low noise" regulators that actually don't look particularly good, with noise voltages in the hundreds of micro-volts (according to their data sheets).  Thank goodness decent amplifiers have good power supply rejection!  That said, poor design around good amplifiers equals a waste of money.


----------



## homebrewed

Wrapping the PocketGeiger with a grounded copper-foil shield didn't do much as far as getting rid of the switcher noise.  I suspected it wouldn't, but it was worth trying.

The noise level from that source is high enough to boot the thing out as a viable XRF detector so there's no question it has to be addressed.  The DIN connector I'm using has one spare pin so that's where the diode bias voltage will come in.

There was one interesting positive result from this experiment.  The design of my enclosure allows me to remove the Am241 sources without messing up the electrical shielding, so I did that just to avoid exposure to the (admittedly low) x-ray dose.  As a result, the background pulse count went down to zero.  Apparently there are enough x-rays making it through the .25" thick aluminum for the detector to pick them up.  So before I re-install my X-ray source "plate", I will back it with a layer of lead shielding.

So the executive summary is:  No switchers in the box!!!  And more shielding between the Am241 sources and detector is needed. Not all negative results, per Graham's Edison quote.


----------



## graham-xrf

So there you have it.
X-rays can just waltz through a quarter inch of aluminum! That does surprise me.
It well explains why those photomultiplier tubes can have an aluminum wall construction by the photocathode.

Re: Only one pin spare. OK - try it. It may be all we need.
Here my thoughts were that the pin's purpose is the diode bias voltage. The current is tiny, and competes with the currents caused by the X-ray photons. If that current return path has to share with larger currents from other circuitry on the PCB, then the clean bias supply carries noise voltages added in from what it collected in by the resistances, and inductances in that path, and they then get amplified.

This is a purist design point. At present, II also have only one pin. In my scheme, the ADC is not on that board. Instead, it gets high level amplified low impedance analogs sent to it down via the cable. The amplifiers and stuff on the board are low current things, unlikely to build much unwanteds, except across lead inductance. These are pulses. They make transient currents. That is where I reasoned the bias supply should be clean, noise free, isolated, and absolute. It can bias the diode, and that is all. This is why I considered using a small battery.

Forgive that my thoughts are a bit like kibbutz from the sidelines for now. I am extremely curious as to the state of these real signals from real X-Rays. For average HM users, this must seem like tortuous obsession nerd stuff, but I consider where you are at is real progress!  

Happy Christmas all!


----------



## homebrewed

I'm chagrined to report I made a dumb-ass math error in my attenuation calculation for a .25" thick aluminum plate.  The absorption factors are all in centimeters, but I used the thickness in mm.  Duh.  So instead of just 1% of the primary gammas getting through, it's 60%.  No wonder my detector was outputting pulses in the absence of a "real" sample.

It's definitely time to get out that sheet of lead I got awhile back!  I have more on order, too.  Even a 1/16" layer reduces the gamma flux by a factor of .0001 times.  And I DID get the units right this time 

So for any other folks who have a number of little disks of Am241 lying around, take heed and don't depend on an aluminum enclosure to keep all the gammas inside.  Right?  Right!


----------



## Weldingrod1

On the quiet regulator front, the usual 78 and 79 regulators are kind of short of gain at switch frequencies, and dont do s good job attenuating them. 
Start with a dumb transformer/rectifier/capacitor if you want quiet! Then regulate...

Sent from my SM-G892A using Tapatalk


----------



## graham-xrf

Weldingrod1 said:


> On the quiet regulator front, the usual 78 and 79 regulators are kind of short of gain at switch frequencies, and dont do s good job attenuating them.
> Start with a dumb transformer/rectifier/capacitor if you want quiet! Then regulate...
> 
> Sent from my SM-G892A using Tapatalk


You are so right about 78 and 79 regulators. They may linear regulate, but they rely on downstream capacitors to deliver transient currents.

Re: transformer, rectifier, etc. Yes indeed, except for me, the transformer is a tiny thing in a ferrite pot core, and the AC frequency is MHz, and the noise filter is not just a storage capacitor that will ripple as it delivers energy. The key thing is that the energy is transferred magnetically across a transformer, so the 0V from the secondary side is isolated, and can be used, pristine-clean.

Then, using one of the ultra low noise op-amps, with GHz gain-bandwidth product, we use it for a uncompromising regulator where we need to.


----------



## graham-xrf

Even a 1/16" layer _reduces_ the gamma flux by a factor of 0.0001 _10,000_ 
You were not really wrong - this is about UK cultural semantics!

I do that all the time  , only much worse! On this forum, the demographic is such that inches are widely used, and I slip up between using 2.54 (for cm) and 25.4 (for mm). I mess up on mils, and mills and microns and "thous", and "tenths", and millionths. I have had to surrepticiously edit postings before someone called me out on it.

One thing I can't really relate to is Fahrenheit degrees. I have a little calculator app that subtracts 32, and then does x 5/9. I think the reason there is 180 degrees between freezing and boiling might be because the guy couldn't afford another instrument maker, so he re-purposed a school protractor!  - maybe


----------



## homebrewed

graham-xrf said:


> One thing I can't really relate to is Fahrenheit degrees. I have a little calculator app that subtracts 32, and then does x 5/9. I think the reason there is 180 degrees between freezing and boiling might be because the guy couldn't afford another instrument maker, so he re-purposed a school protractor! - maybe


The origins of the Fahrenheit scale are a mite peculiar by today's standards.  0F was defined by the freezing point of a particular brine solution, and 100F was defined by some mythical human's body temperature.  Nowadays it, like Centigrade, is based on 32F being the freezing point of water and 212 being the boiling point.  Of water, not a human being 

On the other hand, while 0C is pretty well defined by the freezing point of pure, gas-free water, the boiling point depends on the altitude.  So there could have been some variation for 100C....at least, until someone figured out the altitude thing.

Then there's the Kelvin scale.  0 Kelvin is unreachable, and the step size is the same as  the Centigrade scale. 

I loved one of the sentences in the Wikipedia article regarding the origin of the Fahrenheit scale:  "In the United Kingdom, degrees Fahrenheit figures are sometimes used in newspaper headlines to sensationalize heatwaves."

Back to XRF, I think I don't need to add a sixth connection to my DIN connector.  The pocketgeiger design makes it easy to use an external bias voltage in place of the switcher-generated voltage, and the on-board LDO can still be used to run the amplifiers.  I'll mark up a schematic and attach it to another post to show how that can work.


----------



## homebrewed

I've attached a marked-up copy of the PocketGeiger schematic.  The +10 supply voltage is the same voltage used for my signal-conditioning board, so that frees up the connector pin formerly used to run all of the pocketgeiger circuitry.  The switcher is removed, but the +10 still has a path through the inductor and a Schottky diode to get to the LDO regulator.  This gets the amplifiers up and running.  BTW, I swapped out the LMC662 for a different amplifier, which has a maximum 5V supply limit so the LDO also was replaced with a 5V version.  As a result it has plenty of headroom to operate.

The connector pin that WAS used to run the pocketgeiger now can be repurposed as the diode bias-voltage input.  I'm leaving the low-pass filter network in place, to ease the requirements on the bias voltage supply.

In addition to getting rid of the switcher noise, now I can experiment with varying the bias voltage.  Oh boy, another knob to tweak


----------



## homebrewed

This week has been sort of a "snow week" so I had some time to work on a number of project, including the XRF system.  Regarding the latter, I modified my PocketGeiger board per the scheme I outlined in message #616, immediately preceding this one.  I double and triple-checked the connections because connecting +26V to the wrong place would definitely cause some damage.  I still need to make a lead shield to isolate the detector from the back-emitted gammas from my Am241 capsules, but my setup was complete enough to check the system noise and capture some background pulses due to cosmic rays and random counts from the environment.

Here's a pulse showing that the boost switching regulator noise has been eliminated.  The baseline noise level isn't too bad, either.  For the first time in quite awhile I'm more optimistic than pessimistic regarding the diode detector as a viable proportional detector.




The signal amplitude isn't too bad, either:  the above waveform was acquired with my signal-conditioning board's X1 gain setting.  It's clear that the X100 gain setting won't be usable, but that's OK -- the gain settings were a shot in the dark anyway!  The pulse shown isn't the largest, nor the smallest I've captured so far, but I don't know what pulse amplitudes I'll get from iron, cobalt, nickel etc.  Hopefully that WILL be known pretty soon!

FWIW, I haven't altered the the PocketGeiger's analog signal chain other than replacing the amplifiers, so its frequency response is unaltered from a stock unit.....aside from any considerations regarding possible differences in the amplifier's GBW product.


----------



## homebrewed

I wasn't clear in my previous post that my Am241 sources were NOT in the box.  So the only counts were from background radiation.


----------



## homebrewed

Also FWIW, I didn't observe a substantial difference in the baseline noise level when I varied the detector bias voltage from 10V to 25V.  This is an interesting result, suggesting the main contribution to noise is NOT the detector's dark current, since it should change quite a bit between 10 and 25V.  I haven't characterized the detector's sensitivity vs. bias voltage, either.

I suspect the detector sensitivity won't change much, as long as the applied bias voltage is enough to sweep the generated carriers out of the PIN junction before many of them recombine.  I should see what a zero-volt bias does, I guess; but I really need a known elemental sample to do this kind of characterization.  Looking at random background pulses is an exercise in futility in this regard.

Setting the trigger source to the AC mains didn't reveal much, if any, 60Hz noise.  With .25 inch-thick walls, my enclosure should be able to keep out a lot of 60Hz mag-field noise in addition to all of the E-field noise, so no surprise there.


----------



## graham-xrf

homebrewed said:


> Also FWIW, I didn't observe a substantial difference in the baseline noise level when I varied the detector bias voltage from 10V to 25V.  This is an interesting result, suggesting the main contribution to noise is NOT the detector's dark current, since it should change quite a bit between 10 and 25V.  I haven't characterized the detector's sensitivity vs. bias voltage, either.
> 
> I suspect the detector sensitivity won't change much, as long as the applied bias voltage is enough to sweep the generated carriers out of the PIN junction before many of them recombine.  I should see what a zero-volt bias does, I guess; but I really need a known elemental sample to do this kind of characterization.  Looking at random background pulses is an exercise in futility in this regard.
> 
> Setting the trigger source to the AC mains didn't reveal much, if any, 60Hz noise.  With .25 inch-thick walls, my enclosure should be able to keep out a lot of 60Hz mag-field noise in addition to all of the E-field noise, so no surprise there.


Yes - just maybe.. and I say if it works, it works, then go for it!
I do love the pulse you have. I bet you had a bit of a "celebration"!

*Indulging my deeper thoughts..*
Carefully considered, I still think we only know where where we are when we can distinguish, and even perhaps measure, the dark current, and hence know the smallest energy which photons we might have an interest in would have to exceed, just to make themselves known. The dream wish is to see the contribution from Carbon, which would make a current of the same order as the diode noise when biased around 2V. [Carbon Kα1 = 0.3KeV]. Going for 2V bias comes at the cost of a whole 150pF to be charged and discharged, which would become the dominant "component" of what determines the pulse shape. This is assuming the other parts of the amplifier circuit do not also limit the response as to mask it.

10V bias drops the capacitance to 80pF, but raises the dark current to about 2nA. This is only worth doing if the bandwidth of the amplifier can benefit from it. For detecting the lower energies, perhaps 3V is a reasonable compromise. Zero bias puts the dark current at 600pA, but with a madly large capacitance of about 0.5nF in shunt. In a high impedance circuit like this, that is almost a "smoothing capacitor". We have to wonder whether we still believe the content of any pulses produced.

You still have the Pocket-Geiger circuit as a test-bed, although having changed the op-amp. One would hope to see the total of all known noise currents that really do have to be there. If the noise figure of the entire front end transconductance amplifier is higher than the diode dark current noise, you would simply not see the dark current, which is not the same thing as finding it to be insignificant. If it sticks up more than about 2dB above the racket, we can get at it. The key thing is, not to make extra racket! Changing the feedback resistor to something much lower, and then piling on the gain in later stages, should tell you something, even if some of that gain is in the oscilloscope front end.

One thing I am not entirely clear on. When we see the value of "Dark current" plotted vs Reverse Bias in the X100-7 specification, is that a all a DC current? If it is, then we have to separate the DC from the noise component in the spec. We can somewhat bias away to reduce the capacitance, knowing that the noisy current is 6.1e-14 A/√Hz. That spec is for 12V bias. For 250kHz bandwidth, this makes about 15nA, which is somewhat too high. This is why I think 3V bias is better, or 2V if we can get away with it, and have an amplifier that won't spoil it.

Theoretically, the currents into the transconductance amplifier might be:
1. The thermal noise in the molecules bashing about in the first gain stage semiconductor within the op-amp itself - ie. it's own noise figure.
2. The noise going into the amplifier input via the feedback resistor - figure 4kTBR.
3. The noise already present on the injected bias current, added to the diode dark current noise.
4. Finally, the "noise" we do want to see - that of carriers provoked into conduction by a photon.

--------------------------------------
Not to misunderstand.. take all the stuff above as just one's passing thoughts when messing with this thing, and I do get it that we are not designing an instrumentation module for NASA to place on Mars. It may be that all of those niceties listed above are out of reach for us, but we can still get meaningful useful amplitude and duration pulses out of a practical test getup!

I think I may be just about as stoked about this result as you are!


----------



## homebrewed

With just a little work it should be possible to get a handle on the dark current.  Solder a wire to the TIA's output terminal and bring it out.  We don't exactly know what the derived ground reference is since it's produced by 3 series-connected resistors connected between Vcc and Gnd but we can get close enough for some ballpark figuring.


----------



## homebrewed

The dark current is a DC current, not shot current.  Its major component has to be thermally-generated carriers, the Is (I-sub-s) component of ye olde diode equation:  Id = Is *exp(Vd/(kT)).  When reverse-biased Vd is negative so the exponent rapidly declines to Is.  You can see this is mostly true because the reverse current vs Vd curve is approximately linear on the lin-log plot shown on the data sheet.   

If taken close to its breakdown voltage you will get avalanche multiplication and the curve will start to bend up.  For a PIN diode this probably is not a good thing --  so-called "hot carriers" can generate traps which enhance the recombination of photogenerated carriers.  If taken too far, the detector's efficiency could be severely degraded.  Similar to what happens to a bipolar transistor's gain if its emitter-base junction is taken into reverse breakdown.

I-sub-s is proportional to the diode area so it's no surprise that this gigantic diode has a fairly high dark current.  It also sez that we can't do much about it, unless we cool it with a Peltier.  Don't laugh, I'd already considered that possibility.....and I happen to have a couple on hand....

On a slightly different subject, I thought the baseline noise had a suspicious look to it -- it's quite fixed in its max/min range, not what I expect from noise.  So I just shorted the 'scope probe to ground, and guess what -- the baseline noise level stayed about the same.  This could be an artifact of the display's limited vertical resolution of 480 pixels, rather than digitizer noise.  I can download a csv of the captured waveform and examine it to see if that's the case.  

It also would be a good idea to see if the waveform on either side of the peak really is accurately modeled by a least-squares second-order polynomial fit, since that's the crux of my MCA.  Being able to average over multiple samples of the waveform should significantly improve the effective SNR, which, in turn, should improve the energy resolution of the XRF system.

I'm still learning things about my 'scope.  The input configuration for each channel allows you to specify if its input comes from a 1X, 10X or 100X probe.  The scope isn't smart enough to figure that out by itself, so I was misteakenly (sic) using my 1X probe in the 10X setting.  So the vertical scale shown above is off by a factor of 10 -- the pulse height really is 90 millivolts, not 900.   My signal conditioning board may come in handy anyway!


----------



## graham-xrf

Re: Scope probe measuring. You would be looking at the pulse at the output of the transimpedance amplifier. It should be OK to use a scope probe at the X1 setting. The output impedance of the amplifier should be low enough to drive the 1Meg Ohm of the scope probe, and it's 20pF (or so) capacitance. No need to use X10, with it's signal attenuation.

The DC component of the diode current is removed OK by the series AC input capacitor to the current junction. The photon pulse will be able to wiggle the current input, along with any other racket able to go through the capacitor. Any other amplifier input DC offset can be dialed out with bias on the positive input. I would have thought your signal conditioning board is pretty much essential.

My experience with Peltier coolers was all about their low efficiency. I was trying to cool CCD imagers to lose the dark noise colour patterning when they got hot, mostly because of the incandescent lighting on the same assembly. The Peltier metals are highly conductive shunts. To get one end cool, you need an elaborate construction on the other side to suck that heat away into a heatsink, and by far the most heat having to be removed is the self-heating done to run the Peltier current in the first place, then plus a bit more to make the cooling happen. Generally they were awkward, complicated, inefficient things. I was running substantial powers, like 10W and 20W, to cool a CCD.

While we certainly can get the dark current shot noise, and other wideband noise lower by cooling, it seems possible to get the design to work without needing cryogenics. If the smallest energy pulse we want to see is sufficiently above the noise to see it, that is good enough.


----------



## homebrewed

I have attached a spreadsheet with the raw csv data and a chart showing the pulse, which occurs near the middle of the data.  Some of the "fuzz" I'm seeing may well be digitizer noise so there is a possibility of some improvement with a better ADC.

I'm concerned about the count rate I'm seeing.  It's low, far lower than I would expect with that many Am241 sources (1-2 counts per second).  I may need to cobble together a simple electrometer to verify the current generated by the alpha particles, if any.  Another approach would be to get my hands on some pitchblende and see what the pocketgeiger thinks of that.


----------



## graham-xrf

The noise wobbles are, I think, constant and random, showing up better on the slower, more horizontal parts of the pulse. Definitely the lower order bits are being jangled. The causes could be many. Disconnecting the diode, or just shorting it out, so long as what you do does not offer a way for noise to couple in, is a reasonable test.

Another is to disconnect all from the ADC, except a low resistance across the input. The "zero" point at the ADC common is the usual very awkward place where the sampling gets bumped. If an ADC is to measure a voltage, then using differential inputs with equal resistances is best, and the power to the digital parts of the ADC must not share the return common with the analog input return. In effect, it has a digital supply, and a separate analog one. The bottom connects at one point only at the ADC chip.

In practical builds, I have found it near impossible to make the least significant bits of an ADC go completely silent. On 16-bit ADCs, when trying hard, the usual zero has still counts of 40 to 120 remaining. Supposedly, with the ADCs I have, the spec says more than 90dB measure range. I would have to check out a Analog Devices reference circuit to find out how they do that. I think doing stuff like making sure even the energy transfer in reading the digital outputs might be limited by resistors.

Basically, doing various gross things to try and make the base line go silent is the first step.


----------



## homebrewed

I did an experiment today, varying the detector bias voltage between 9V (the minimum-possible before some internal diodes in the PocketGeiger take over and clamp the voltage) and 40V, the maximum my bench supply can output.  The detector's specified minimum breakdown voltage is 50V so I felt safe doing this.  At the low end, I started to see some distorted pulses , and perhaps a  slight reduction in the already-low count rate.   Above 15 volts or so, the pulse shape and count rate stayed pretty constant.

As a part of troubleshooting the low count rate I've decided that I need a way to get a handle on how active my Am241 sources really are.  After all, they're from China.  I found an open-source ionization type radiation detector that uses a pair of Darlington-connected transistors here.  The final design, which can be found on github, uses an obsolete IC to drive a thermometer type display to give a rough indication of the input radiation flux -- so I have laid out my own version that will just output an analog voltage I can measure  by various means:  a DVM, or some processor board that has an ADC.

The Darlington transistors are still available on Digikey, although it appears to me that they are nothing special.  At the low collector current this design uses, the current gain still is around 1E4 (I found some that look to have hfe's in the 50K region at the same Ic).  The collector load resistors are 10M so the overall gain is pretty high, approximately 10^11.  I like the design because it uses a second Darlington to provide a certain amount of temperature compensation.

One additional "nice" aspect of the design is that I found a decent instrumentation amplifier that doesn't cost an arm and a leg


----------



## rwm

homebrewed said:


> As a part of troubleshooting the low count rate I've decided that I need a way to get a handle on how active my Am241 sources really are.  After all, they're from China.


Even Chinese radiation is of poor quality? LOL.
R


----------



## graham-xrf

rwm said:


> Even Chinese radiation is of poor quality? LOL.
> R


 I got that too!

For this stuff, we are not measuring a flux intensity, we are measuring the amplitude of a detected photon.
Chinese poor quality radiation might be from a Am241 chunk so tiny, the counts don't happen so often, but even a Chinese can't change the half-life, nor the energy height of the X-Ray pulse.

That said, I kinda knew what Mark meant


----------



## rwm

I feel like they could make defective neutrons that could weigh less...


----------



## homebrewed

I've been doing more analysis regarding the low count rate on my XRF prototype.  I removed the lead shield/aperture I made that goes between the Am241 sources and detector and confirmed that the count rate jumped up by a substantial amount.  So the sources definitely are not bogus (that was the concern I indicated, indirectly, in a previous post).

Since the sources and detector are on opposite sides of my aluminum aperture plate, I know that they are generating gamma rays -- plugging the aperture hole made no difference in the count rate, so the counts are not due to alpha particles being reflected back through the aperture hole (if such a thing is even possible).  The counts have to be from gamma rays.  Besides, alphas wouldn't make it through the epoxy on top of the detector.

Another (remote) possibility was that the sources contain a different isotope that's emitting gammas that are significantly lower in energy than the 59Kev ones from Am241.  To get a rough idea of the gamma energy, I placed a .25mm thick piece of copper over the detector.  My calculations indicate that about 30% of 59Kev gamma rays would be absorbed by that thickness.  I don't have a great pulse counting setup, basically slowing the 'scope's timebase down and then counting the pulses I see in a particular sweep; but it appears I'm seeing a count-rate reduction that is in the right ballpark.

So.  I've shown there's no functional problem with the PocketGeiger and signal conditioning boards, and my smoke detector sources probably ARE active and contain Am241.  You might think that there's a problem with the geometry of my setup but I've checked the alignment of the aperture hole (and hole in my lead plate) and they look OK.  It's hard to believe that 8 sources can't produce more than .1 to .5 counts per second, but I guess I need to do some calculations to  determine what percentage of gammas will strike my sample, and from there how many of the fluorescence x-rays will make it to the detector.  It will be a low percentage, but my results are far from what the Theremino folks have reported, with count rates in the 100's of counts per second.  Time to revisit their physical setup, I suppose.

Another theory is that my detector's sensitivity in the ~6Kev range where vanadium, chromium, manganese, iron, cobalt and nickel emit XRF photons, is much lower than advertised.   The data sheet indicates that the detector's sensitivity at 60Kev is about 3%, compared to about 100% @10Kev, so it's suspicious that I'm seeing a pretty high count rate coming directly from my Am241 sources.

Looking over my periodic table, I see that tin's k-alpha line is at 25Kev, about 3X the energy of the iron-sequence of elements.  60-40 solder might be an interesting alloy to try.  Another is Tungsten, whose k-alpha line is 58Kev.  That might be too close to 59Kev to get many fluorescence photons.  I also have a mineral sample of barite (barium sulfate).  Barium's k-alpha line is 32Kev.  I'll try the barite and a roll of 60/40 solder to see if I get an increased pulse count.  I've got some carbide inserts I can try as well, but they're pretty small.


----------



## rwm

I do not have a clear understanding of the problem? Are you saying you have too low of a count rate with a target sample in place? I would expect the count rate to be very low with no fluorescing target.
Can you post some pics of your setup so we can see the geometry?


----------



## graham-xrf

@rwm Rob speculating about Chinese lightweight neutrons  is thankfully not it, but messing with what we have at this level, is getting close to that region of what happens with matter and energy being known (to me) as "wierd sh*t".  We cannot really know the photon is even there until the current comes into existence, and if it encounters diffraction edges and gaps, we maybe end up doing our fractured version of the double slit experiment?

*Looking to why the "low" count.*
Starting from the diode, we have the X100-7 data sheet.
The probability of a 60keV incoming X-ray doing something other than passing straight through is shown as near 3%.
We can't know what X-ray source was used to test the diode, but we keep in mind that the graph is about probability in a 10mmx10mm area. To get the 0.03 number, the tester must have known the flux onto that area. However many glows we can make coming out of stuff the Am241 is pounding on (every now and then), and also direct from the Am241 speck of oxide, they are going to be going all over the place.

By our mechanical surrounds, we have it that most of "all over the place" means encountering shielding, where it wastes itself, except for some extremely  rare photon that might eventually make it to the other end of the galaxy. We can only work with those that are kind enough to  make it to our detector, and some get lucky enough to encounter some diode stuff. Those will be 3% of photons in a 100mm^2 area fraction of a sphere area 4π*r^2. I thought r=50mm, or about a couple of inches, if we were trying to get something to happen from direct 60keV. One could, I suppose, put up to maybe four Am241 sources right down onto the diode

Putting aside, for the present, all the glow X-rays it might splatter when it encounters metals, consider first the direct 60keV stuff we hope to see. In my sketch from post #35, the Am241 is denied any opportunity to have it's 60keV photons make it to the diode, but suppose we change things to allow it.

*Calculating the pulses*
Since 1978, the average amount of Am241 Oxide in a smoke detector changed from 3 microCuries to 1 microCurie. This is equivalent to 37,000 decays per second. Those be numbers are for smoke detectors in USA.
According to Wikipedia, 85% of those decays are 5.486MeV alpha, 13% is 5.443MeV of (something), and 5.338MeV for the remaining 2%.
Umm.. that adds up to 100%. Where are the 59.5409keV Gammas? Where are the 13.9keV, 17.8keV and 26.4keV other bits?
Out of the 37,00 decays, is it going to be "*hardly any*"??

37,000 per second is 37kBq.

*PDF jackpot!*
I am still reading it, and unfortunately, I have to go to attend something else.
From just a quick look,  this guy's germanium detector was 10mm diameter.
His source was 3.7E9 Bq. That is 100,000 times stronger than the smoke detector.
His source was a whole ring, instead of six spots.
His detector area was *78.5mm^2*. The X100-7 diode is *100mm^2*
His collection time was 2000 seconds, ie. three minutes more than half an hour.



He was getting about 19 counts per second direct from the Am241
While looking at Zinc, 49.1KeV, counting at 3 or 4 per second, he was getting about 3 per second from Am241.
While looking at Molybdenum, he was getting 4 to 5 counts per second from Am241.

We do _know_ that the pocket-geiger was used to do this trick. Something must be wrong!
Please help me check, and reconcile the numbers, because at this rate, with *6 smoke detectors*, we would have to wait *13.8 hours* to see one count originating from the Am241?? This is very roughly speaking. Detector area, strike probability, aperture fraction etc. not included yet.
There is a gross error somewhere. We should be able to predict quite closely the counts we see. We should be able to tell if the smoke detector is doing anything at all, We should see other pulse events also, like some background we can see, and stop with shielding.

Maybe his germanium detector, when this was done,  has a much lower detect efficiency than a X100-7 diode??

We have to look for more papers. Maybe there is a typo about the Bequerels from Amersham International source.


----------



## rwm

I could be wrong about this but let me throw this out. I think the 59 Kev gamma actually comes from Np during decay. When Am241 gives off an alpha to become Np the Np is in an excited state and immediately gives off the 59Kev gamma. Also, when measuring activity, I think they typically measure the gamma emission. So 1 Bq equals one gamma per second or 2.703×10−11 Ci. Therefore 1 micro curie would be 3.7 x 10 E7 Bq? Check my math.
Also, I would put the target as close as possible. Say use an R of 1 or 2 cm.

Edit: Yeah the math is wrong. 1 micro Ci is only 3.7 x 10E4. Graham already did the math in his post anyway. Still that is a decent count rate even if we only capture 3% of a fraction of a sphere.
R


----------



## graham-xrf

rwm said:


> I could be wrong about this but let me throw this out. I think the 59 Kev gamma actually comes from Np during decay. When Am241 gives off an alpha to become Np the Np is in an excited state and immediately gives off the 59Kev gamma. Also, when measuring activity, I think they typically measure the gamma emission. So 1 Bq equals one gamma per second or 2.703×10−11 Ci. Therefore 1 micro curie would be 3.7 x 10 E7 Bq? Check my math.
> Also, I would put the target as close as possible. Say use an R of 1 or 2 cm.


3.7 x 10^7 , or 3.7E+7, or just 3.7E7, however you want to write it, is the same as 37 x 10^6, which is 37E6 Bequerels (decays per second).
This is 100x the number I used.

Our problem is about our expectations when considering the C.S.Chong Malasian University paper.
He said his source was 3.7 x 10^9 Bq. That is 100,000 times greater!
I would doubt that a Am241 annular source from Amersham International would be no stronger than a smoke detector.
Therefore, we have a problem!
We need to calculate exactly what to expect. On the face of it, it does not look good.
BUT
If it was going to be so poor, how come the pocket-geiger works? What exactly is it counting?
We are not the first to try this. Others have, though using a scintillation photo-detector.

Yes, Am241 does decay to Neptunium, by alpha decay. It will be about 4% of the mass after about 30 years.
Neptunium is very long-lived. I think the Am241 decays to Neptunium, losing two Alphas (Helium nuclei), and delivers the big Gamma pulse in the process. I think the added up mass of the Neptunium, and the Helium is short of the mass of the Am241 that it started out with by 60KeV/c^2.


----------



## homebrewed

There's a significant difference between detector efficiency and count rate.  The fact that the detector's efficiency is just 3% of its max for a 60Kev photon doesn't mean it is only "seeing" 3% of them.  It means it's outputting current pulses that are 3% of its maximum possible amplitude.

I can vouch for this because my detector outputs many counts per second when it is directly exposed to my Am241 sources.  The count rate also is pretty high when my source-aperture plate is turned around, where the gammas have to go through the sources' steel substrates and .25 inches of aluminum!

I need to do a better job of characterizing the pulse height I'm getting from those 60Kev photons.  Using the efficiency curve, I should be able to predict the pulse amplitude for an Iron K-alpha.  If nothing else, I can check to see if there's a chance of overloading my electronics (the PocketGeiger and my signal conditioning board).  Just something else to eliminate in the path to finding out what's really going on here 

I will take a photo of my setup and post it when I have a chance.  This morning (PST, USA's west coast) is gonna be too busy, maybe this afternoon.


----------



## graham-xrf

homebrewed said:


> There's a significant difference between detector efficiency and count rate.  The fact that the detector's efficiency is just 3% of its max for a 60Kev photon doesn't mean it is only "seeing" 3% of them.  It means it's outputting current pulses that are 3% of its maximum possible amplitude.


I did not read it like that!
The Y-Axis is labeled "Absorption Probability", not efficiency


homebrewed said:


> I can vouch for this because my detector outputs many counts per second when it is directly exposed to my Am241 sources.  The count rate also is pretty high when my source-aperture plate is turned around, where the gammas have to go through the sources' steel substrates and .25 inches of aluminum!


That is a great relief, and corresponds to my expectations. 



homebrewed said:


> I need to do a better job of characterizing the pulse height I'm getting from those 60Kev photons.  Using the efficiency curve, I should be able to predict the pulse amplitude for an Iron K-alpha.  If nothing else, I can check to see if there's a chance of overloading my electronics (the PocketGeiger and my signal conditioning board).  Just something else to eliminate in the path to finding out what's really going on here
> 
> I will take a photo of my setup and post it when I have a chance.  This morning (PST, USA's west coast) is gonna be too busy, maybe this afternoon.


The one thing I have been striving for, for a long time, is to find exactly how much current pulse will happen, to be seen by the transconductance amplifier, when ONE photon makes it, (with a 3% probability unrelated to the energy it delivers to the circuit when it encounters a diode atom).

We have detector efficiency factors in the available equations, which only let one know the current from a FLUX, because we here are back to probabilities of a photon doing stuff. We are right back into quantum physics, and our problem is that we don't have a "flux" to put into the equations. We have single photon events.

We have the knowledge that when a photon DOES strike (with the certain probability) then the entire energy as released will end up as a current pulse. It might miss, but If it does do it's thing, we get 100% of it. I know we conventially count electrons per second as current, but in the circuit, the field energy is moved around the circuit at a large fraction of the speed of light, whereas a given electron might take hours, or weeks to go around.

From my previous calculations, (which could be seriously messed up), I figured we can expect a current pulse into the transconductance amplifier of around 10 nA peak, lasting for 13nS to 20nS, and that was from a approximately 400eV photon. I do have to go through these again, but clearly, we cannot reconcile the stuff from the Malasian university with our direct experience. Much relief


----------



## rwm

Graham- I think you may have replied before my edit. I did have a math error. Micro vs milli duh. Anyway it is hard to understand the CPS claimed in the paper. I do think it will be fine at the count rate we are seeing.
R


----------



## graham-xrf

rwm said:


> Graham- I think you may have replied before my edit. I did have a math error. Micro vs milli duh. Anyway it is hard to understand the CPS claimed in the paper. I do think it will be fine at the count rate we are seeing.
> R


Yep - feel OK about it 
Even so, I do not have a complete grip on getting design calculations right. I do also skip by factors of 1000
Counts per second when exposed to the source, is what I wanted to hear.
We have to give kudos to Mark. He is at the sharp end of all this.


----------



## homebrewed

Regarding absorption probability vs. efficiency, it gets complicated.  We want some sort of output pulse-height proportional to the photon energy, regardless if 100% of them are absorbed or 3% are.  So what is it, higher energy makes more carriers or higher energy is less-absorbed?  Both? Perhaps the latter statement is true, since the "efficiency" curve really is a curve with a single maximum.  But it should be obvious that the count rate is not useful when it comes to differentiating between iron and nickel.

I know I'm getting a fairly wide variation in pulse height, ranging from a few tens of millivolts to somewhere in the volt range.  I also know that specialized silicon, germanium and CZT detectors (the latter are the current darlings of the detector world) do output current pulses that are proportional to the photon energy, up to the point where the material's absorptivity fallof messes up the proportionality.  This fallof, by the way, also applies to scintillators -- they have a maxim-useful energy, mostly determined by how thick they are.


----------



## graham-xrf

I think you have got it right!
When you show the detector the Am241 source, you see a definite increase in numbers of pulses. We know where they come from!
You expect pulse height to be proportional to energy, and I think that may well be what you are seeing.
What emanates directly from Am241 is the *59.54keV*, and *26.4keV*, and *17.8keV,* and *13.9keV*, and there may be others.
The counts of these various photons is biased well in favor of the lower energy photons.
The 59.45keV photons may be more numerous to start with, but the diode admits 10x more of the fewer crowd.
*
About the number of counts - of various height*
The incoming that happen to be 59.54 signature gamma photons, then 3% of them. If some other energy, like 17.8keV, then 30% of those.
The count amounts will be following the absorption probability profile.
*
About the amplitude(s) of the pulses*
The energy from any given photon will entirely (100%) be given over to making it's corresponding size pulse - those that actually make it.
This has to be. The whole principle of the device depends on this being so.
The height of the pulse delivered cannot be randomly variable. The gain of the amplifier is fixed. A pulse is repeatable.

Capturing 100% of a photon is not like "100% efficiency". It is in the nature of a photon you get the whole quantum, or nothing.
How well the diode bulk material then delivers a current, vs how much it wastes in heat, etc.  _does_ involve an efficiency, of the kind that can reduce the size of the pulse. But it would not be a variable thing that modifies pulse sizes in a contrary way.

.. is what I think. I also think you are looking at a much better situation that you give it credit for!


----------



## rwm

I am getting excited about building one of these! After you guys do all the heavy lifting of course. I am still curious whether solid state or PMT is the best route. I would say if the diode can be made to work with the required spectral resolution it would be the winner.
R


----------



## homebrewed

I have attached a couple of photos showing my XRF setup.  One is from the source side that faces the sample we want to analyze.  The second is taken from the detector side.  The photos were taken at about a 45 degree angle down from horizontal, and that's why the source-side photo doesn't show the detector.  I used a flashlight to double-check the position of the detector relative to the aperture hole, and it does line up.






Also, I turned the source-side around to face the detector, in order to determine what the pulse height and the count rate are.  The pulse height is around 15 millivolts, low for sure -- but that's expected since 60Kev efficiency is just 3%.  Back-calculating the pulse height for a 100% efficiency pulse, we get about half a volt.  OK, not too bad.

The next thing I did was to try to estimate the count rate.  Since radioactive decay is a random event there was a wide variation, but I'm guesstimating anywhere from 40-70 counts per second.  This seems really low, given the 8 sources, each producing about .8 microCuries, roughly 30KBq.  But let's check that out.  The sources were placed about 5 inches away from the detector,  so the surface area of a sphere with a diameter of 254mm is 202682mm^2.  The detector is 100mm^2, so it should intercept about .0055 of the total photons emitted by the sources (240KBq, assuming about .8 uC/source). Therefore the detector should see something on the order of 1500 counts/second.  That's quite a difference from what I'm seeing.  Now I'm wondering (again) about the REAL activity of the sources I bought!


----------



## graham-xrf

Great pictures Mark 

About the only way the real activity of the sources you bought could be changed for the worse is if the amount of Am241 in them was reduced. Given the way these things are made, the cost of a "feeble" product would not be significantly different. To get smoke detectors to work, they need enough alpha ionizations to make a current through the air space in the chamber.

For almost all, it is 0.25micrograms, to 0.29 micrograms. The decay events rate in a 0.29 microgram version is 37,000 Bq.
As I understand it, every decay is accompanied by a set of photons, including the 60keV Gamma.
Within the diode material, the photon can miss the atomic cross-section entirely, or it might get to do it's photoelectric effect.

Where we are at odds here is about the 3%. Truly, the height the pulses you see are not altered at all by that. It is the NUMBER of them.
Expect that the probability of a diode response is *0.03* for the 60keV photons. It can be a full height big pulse, but fewer - not so often.
Then that, multiplied by the solid angle fraction of the sphere, which you have as *0.0055.  So 0.03 x 0.0055 =>  0.000165*
This alone brings the count rate to *6.105* per source (of the 60keV type, and also the 1.5keV type, if there were any).
With eight of them, you might get a total of *48 per second*.
There will be others, maybe some much bigger, but not from the sources.

The up and then down shape of the absorption probability curve only means that after one has the collection of counts, then one needs to divide by the probability corresponding to the energy of the bucket, to scale the value to properly represent the count that would have happened if the chances of catching all energy photons were equal. In effect, compensation to "level out" the curve.

The calibration to set a pulse height as belonging to a (say) 60keV photon is a post-processing thing. Thankfully, the pulse height vs photon energy relationship is directly proportional, in the linear range of an amplifier.

I am thinking your test setup is pretty uncompromising when it comes to excluding unwanted stuff.
It looks like your sources are still set in the ring of the ion chambers - I think.
I envisaged a much smaller arrangement, with the source discs removed from all the surrounding mounting and ion chamber connection metal
bits. To get them free, I had to file off the pressed peenings, so I could push them back from the ion chamber connection tag metal.

I had planned to place them in a close crowd, around the diode, but shielded, and unable to irradiate the diode directly.
For a radiation diode test, I think I might have temporarily taped or stuck some directly onto the face of the diode, or put a set of them together on the end of a aluminum test tab wand, all pointing the same way. For any who pick up on this thread late, I include pictures of how I got at the sources.


----------



## homebrewed

I have come around to agreeing with @graham-xrf 's comments regarding absorption probability, since his numbers are pretty consistent with my observations.  Thanks for the correction!

There is yet another statistical issue that acts to further reduce the count rate for the XRF photons, and that is the large difference between absorption in the 6Kev range (stuff from the sample) and the 60Kev primary photons.  Looking at iron, for instance, its u/p value is 84.4 at 6Kev and only 1.2 @60Kev.  So for the sample photons, 99% of them come from just the first 70 microns of iron -- anything emitted deeper than that is absorbed on the way back out.  But only 4% of the 60Kev photons are absorbed in 70 microns.  And it gets worse.  Of the 6Kev photons, only a fraction of them are intercepted by the detector.  So the count statistics are pretty low in that regard, as well.  To improve things as much as possible, it appears we want to accomplish two things:

1.  Minimize the distance between the 60Kev sources and sample; and
2.  Minimize the distance between the irradiated part of the sample and detector.

The simplest way to get both is to have the sources and detector facing each other, with a thin sheet of the sample in between them.  A 1mm thick sample of a ferrous alloy will absorb all but 39% of the primary photons, but this approach would allow us to place the sample very close to the detector.

Second-best might be a cylindrical arrangement of sources with the sample and detector placed along the central axis -- in this arrangement, we should be able to maximize the incident 60Kev flux on a sample and get the detector pretty close to the sample as well.

The fact that the silicon detector is only going to pick up about 3% of the primary photons can actually be used to advantage in these kinds of geometries.  Unlike a scintillator-based XRF system.  We might have a "lemon" of a detector so let's make lemonade!

The alternative would be to stick with the geometry that is used by the Theremino and Open Physics Lab folks and content ourselves with waiting a very long time to get decent spectra.  This approach would be most compatible with the "analyzer gun" style of XRF system, but holding it on the target for hours at a time would get pretty tiring.  However, I think their design could likely be optimized to take advantage of our detector's low count rate at 60Kev.   Graham's approach of removing all but the active part of the source would be a good step in that direction -- but it may not be necessary to go quite that far.  Just trim off one side of each so they can be moved in closer to the detector -- it doesn't matter if the larger parts overlap, as long as the little Americium-impregnated disk isn't covered.

Also, I've been thinking about Graham's idea of canting each source over to point to a "focus".  If the sources were a point source this wouldn't buy us anything, but that isn't the case.  See here for what I mean.  In addition, as the relative angle between the plane of the source and observer increases, the effective size of the source decreases, becoming more and more point-like so the 1/r^2 factor does finally kick in.  The bottom line is, I think that directly aiming the sources at the sample volume will produce an improvement in the incident flux of 60Kev x-rays.

My first/simplest alternative geometry will be fairly easy to try on my current setup, at least with a little bit of futzing around.  Well worth trying, anyway -- viewing it with the Edison approach in mind


----------



## graham-xrf

We progress 
I entirely agree about getting up close!

I do not believe that one need wait more than a couple of minutes to gather enough pulses for an identification.  10 seconds would be convenient. 4 minutes would test my patience. Realistic discoveries might require it hang about for more than that, but if so, I would be looking to have it speeded up somehow.

I don't think that the pocket-geiger has anything more to teach us.  There are no suitable words to express the feelings I got when we picked apart all aspects of the pocket-geiger design. Ever deepening  profound disappointment as more and more of what it was, what it did, and how it did it, was revealed in the tear-down. The one bright thing there was we had found an alternative detector that did not need high voltages.

On the subject of detectors, over time, we might still be on the look-out for others. We know that anything with rare earth transition metals in them are good at it. Tellurium, Cadmium, Selenium, Germanium, and generally most stuff that has been tried in photocathodes are likely to be good. We still want a low cost, convenient,  effective X-ray detector. We have settled on radioactive smoke detector sources to try and make this work, and that is probably the smart choice. The problem is, regardless the source is harmless provided you don't eat it, there is still pressure to use "other" smoke detector methods.

*Re: My first sources arrangement*
I do agree that pointing the source into a foil, with the detector the other side, could be a good way. That is how Rutherford discovered that his sheet of gold was mostly empty space, because the distance between gold atoms was about 8000 atoms-widths apart. For all sorts of reasons, I go with the back-scatter method. So long as your iron sample, or whatever is thicker than about 5 tenths, what comes back will be satisfactory. At this point, (and my apologies for being nit-picky here), I think if any 6keV photons arrive at the diode, the fraction intercepted will be about 95%.

I do like (and want), the lemon detector.  The thing is, photons can be diffracted a little, but will not go around corners, and 60keV photons have a wavelength so small, they won't get reflected. Instead, they go way deep into the atomic lattice, and whack on electron probability wave function stuff. We don't get even the 3% of 60keV back to the detector diode. We should get zero!
A small sample can be tested by putting it down on aluminium foil. Larger stuff is just by putting the assembly up against the thing being tested, or cutting a "window" into the foil, to get at rods and bars.

For convenience, I post the picture again here.



The "tilting" was conceived to minimize the wasted photons trying to excite against the lead wall. It has been pointed out to me that if the sources were all just simply pointing forward, and not at all down a shielding hole, then so long as there was a "ring" of lead surrounding the diode, no 60keV could make it to the diode, and we would still have a maximum irradiation of the sample. The winning comment was that it would also them be way easier to make! Still, I liked my superglue optimum angles mounting, BUT, as was also pointed out, all extraneous substances in there are "noise". So - interference pressed in, or punch-peened, or something, but no glue! Making parts of lead is a bit awkward, but most places we can use aluminium, and line with lead where we need to.

You progress really is motivating me to move my XRF on. Sadly, today was spent putting doing work on the house, and there is a whole lot yet to do!


----------



## homebrewed

I've done some "sketching" using OpenSCAD to see how much the geometry of our source/sample/detector can be improved, using some of the ideas I presented in my previous post.  I've attached a couple of renderings.  The renderings are to scale:

View from the source side:




And from the detector side, showing that the shield ring around the aperture completely blocks the primary x-rays:


If I'm reading the scale right, the sample can be placed about 1/2 inch above the source plate for maximum 60Kev illumination.  In this rendering, the detector is 1mm below the aperture plate, which is a .0625 inch thick lead plate (about 1.5mm thick)  The shielding ring also is formed from 1.5mm thick lead.  The sources are tipped at a 45 degree angle, which causes a small amount of shadowing due to the shield ring.  I think a higher angle will require a taller shield ring, which will block more 60Kev gammas so 45 degrees may be about optimal.  There is some interaction between the source tilt angle and how far away they have to be placed above the aperture plate (to avoid mechanical interference).  But if folks want to play around with the geometry, let me know and I will upload the OpenSCAD script.  No, the comments aren't real great but OpenSCAD runs so fast that it's easy to see how the geometry changes as you mess with angles etc.


----------



## homebrewed

After a bit more refinement, mostly to reflect a better measurement of the smaller Am241-laden disk, it appears that a 45 degree tilt of the sources (and attendant tweaks to the lead ring around the aperture) won't prevent many, if any, of the 60Kev gammas from striking the sample.

I've attached the OpenSCAD script I've written to explore the geometry.


----------



## homebrewed

homebrewed said:


> After a bit more refinement, mostly to reflect a better measurement of the smaller Am241-laden disk, it appears that a 45 degree tilt of the sources (and attendant tweaks to the lead ring around the aperture) won't prevent many, if any, of the 60Kev gammas from striking the sample.
> 
> I've attached the OpenSCAD script I've written to explore the geometry.


Hmph, it appears that this forum doesn't want folks to attach .scad files.  So I renamed it to .txt -- just download it and rename it back and you're good to go.  So much for anti-virus paranoia


----------



## graham-xrf

Firstly - about not being able to share OpenSCAD model .scad files. I think we should resort to @vtcnc with "_please help us out here_"!
It's OK to download a .scad file with extension .txt, because it really is a text file, and would not cause any problems to anyone opening it. They just get to see text. I have not used OpenSCAD before, but it is in the repository, version 2019.05, so I installed it.

1/2 inch is getting right up close, but I think you are right in the approach. I did wonder if one can get "too many" pulses?
Thinks..
Provided there is no "pulse stretching" from low bandwidth amplifier, a pulse duration is about 13uS to 20uS, but can be about 5uS if we are only after the peak, and can figure that a immediate next peak is a new pulse, taking the amplitude higher than it had a right to be. We might use software smarts to recognize the out-of-range pulse, and subtract the previous amplitude. The problem comes when the smeared pulse is still credible. For simplicity, I chose to reject all these.

So calculate..  If we allow (say) 15uS for a whole clean pulse, then we could have incoming photons at 66.666 kHz. I think that should be enough! 

*My original geometry sketch*
We seem to think alike. Mine was on FreeCAD, trying for the best illumination arcs. This attempt turns out not to be the best. My shield ring around the diode could be set further back. The position of the source pushed into it's shield hole should put the source right near the entry, spraying photons over about 170°. The pale blue normal misleads somewhat. There will be X-rays coming from the entire left side. The missing dimension out of view up top is 1.575 inches. Compared to yours, this one is relatively "roomy". Given your direct experience detecting pulses, I think I have to revise to come in closer for a more "concentrated" approach.



	

		
			
		

		
	
 .




We both have the same basic scheme, except yours goes to almost put the source right up against the sample. I think it's better. We are just going to have to solve whatever it takes to shape some lead. ??


----------



## graham-xrf

Various good suggestions have been made.
We can consider making it of copper, with pockets filled with lead for the sources, then drilled.
Copper delivers a feeble 277eV, below the diode capability.
The shielding only needs to be around the Am241 sources, a piece behind the diode, and a ring around the aperture to the front of the diode.

Various other comments about casting it also.
One option is 3D printing it, and then adding little lead plugs in the right places.

Aluminium is only just about detectable at 1.48keV, and 1.56keVwith 1% probability of absorption, but if it only provides pockets for carefully placed shielding bits, then it can be arranged that the structure contributes zero photons from aluminium structure. For aluminium in the test sample, or aluminum alloy being tested, a count of 10 out of 1000 might be OK.

Dare we try for magnesium? That's 1.25keV and 1.3keV.  Probability of absorption about 0.5%
I am still thinking this one through. I kind of wish the detector was just a teensy bit better for low energy photons.


----------



## homebrewed

graham-xrf said:


> 1/2 inch is getting right up close, but I think you are right in the approach. I did wonder if one can get "too many" pulses?


We can always cut down on the number of sources used.  I'm going with the worst-possible count rate, after seeing what my current setup is doing.  This sort of belated discovery is what a test bed is all about so I'm not at all surprised to find some flys in the soup!

Back to your first comment, I immediately created a trouble ticket asking for .scad files to be on the allowed-to-attach list.



graham-xrf said:


> We are just going to have to solve whatever it takes to shape some lead. ??



The "focusing ring" doesn't need to be made out of lead.  At least, I wasn't planning on it.  Turn a ring out of aluminum and glue it to the lead aperture plate.  Then glue down the pared-down source disks -- hot glue, silicone, epoxy, whatever.   BTW, the source disks don't have be round.  Cutting off chords to make a square will accomplish the desired effect, as long as the disk just fits inside it.  It should be possible to do this with relatively low risk of releasing Am241 but I still would do it outside while wearing a particle mask. 

The hole in the aperture plate I'm currently using wasn't all that difficult to do, but having some experience with "grabby" metals (brass, to be specific), to start the hole I used the largest drill I've got that has been dubbed so it drills brass OK.  Basically the two cutting edges on the drill flutes are knocked back with a stone so they have neutral rake.  That worked fine, but I did take it pretty slow, too.  Then I enlarged the hole using a tapered hand reamer.   Hey, some machining-related stuff!  Now we're good for another 65 pages of posts   

The drill modification is called Dubbing, and I did it with a 600-grit diamond stone.  Those drills are kept separate so they don't get used for things like steel and aluminum.

I'm thinking that the shield ring can be made out of a sheet of lead the right thickness, by cutting a strip and rolling it into a circle.  Additional messing around with my model indicates the shield ring only needs to be .180"/4.6mm high to completely shield the detector from the source gamma rays.  It should be at least 1/16"/1.5mm thick, so it really will be a short tube rather than a washer.  I wouldn't want to make it much thicker, else it will block some source gammas from the sample.  I'd just glue it to the aperture plate, too.  Gamma rays striking the bottom of the ring will still encounter the aperture plate so the ring doesn't have to sit perfectly flat on the plate.

Finally (for this post, anyway) I noticed a potential issue with the X100 detector with regard to oscillation.  I was fooling around with a small sheet of copper to see if I could get some copper XRF pulses to show up and when I got the sheet very close to the detector the PocketGeiger board started oscillating.  The detector is a big antenna sitting near two high-gain amplifiers, so introducing some capacitive coupling between them all got things going.  If you're going to be building up your own detector front end, that's something to consider.  Or if simply modifying a PocketGeiger like me.


----------



## graham-xrf

homebrewed said:


> Hey, some machining-related stuff!  Now we're good for another 65 pages of posts


That vtcnc raised a ticket for allowing .scad files means at least he is OK with the thread.
I have another going on the ways of making it of lead, and indeed other materials, including 3D printed fabrication with bits of lead here and there.


homebrewed said:


> I'm thinking that the shield ring can be made out of a sheet of lead the right thickness, by cutting a strip and rolling it into a circle.  Additional messing around with my model indicates the shield ring only needs to be .180"/4.6mm high to completely shield the detector from the source gamma rays.  It should be at least 1/16"/1.5mm thick, so it really will be a short tube rather than a washer.  I wouldn't want to make it much thicker, else it will block some source gammas from the sample.  I'd just glue it to the aperture plate, too.  Gamma rays striking the bottom of the ring will still encounter the aperture plate so the ring doesn't have to sit perfectly flat on the plate.


Similar to the several schemes I was trawling. It should be perfectly OK to make a groove for a ring of lead sheet. It's the sort of thing that can be shaped by hand with the aid of a Sharpie tube, or a loose drill (blunt end), and pressed into the groove.


homebrewed said:


> Finally (for this post, anyway) I noticed a potential issue with the X100 detector with regard to oscillation.  I was fooling around with a small sheet of copper to see if I could get some copper XRF pulses to show up and when I got the sheet very close to the detector the PocketGeiger board started oscillating.  The detector is a big antenna sitting near two high-gain amplifiers, so introducing some capacitive coupling between them all got things going.  If you're going to be building up your own detector front end, that's something to consider.  Or if simply modifying a PocketGeiger like me.


I get that - and I would not expect my amplifier to oscillate. It's gain is distributed anyway, and no fields can get at it. No capacitive couplings.

The first stage has high enough gain to preserve the S/N ratio, yet low enough to guarantee bandwidth, and preserve the pulse information down to the noise floor. The next stage brings the signal up to near the final signal to be sampled, but there is also a differential driver for the ADC capable of adding gain. This one doubles a 50Hz/60Hz notch filter. The robust signal is sent to the ADC with a shielded twisted pair, with separate analog reference. I would like to push the ADC to the limits of it's dynamic range, so that the least significant bits are rattling around reading noise that originated in the first amplifier front-end. That is the hope, anyway. The actual construction may fall short of that, when tried out, but it's where I aim for at the start.

For cost reasons, I have not given it some or the nicer features. Your scheme of software switchable gain range would be nice. Other than that there is a X100-7 diode on it, and one pad set that can take an op-amp, the pocket-geiger does not have much that I like. Given that it is a bit of a pain to de-solder the diode, I consider sawing that part off, and fixing it at right angles to the amplifier board, but I think, in the end, I remove it.


----------



## graham-xrf

@homebrewed :
Mark, I would be very interested in what might happen if you were able to get a 6" red coded thoriated TIG welding rod, and waved it in front of your detector. I realize you may not have TIG welding stuff handy, in which case there will come a point where I can try this myself.

I was looking at the decay chain of thorium, to radium, then back and forth via actinium, then about a minute being radon before rattling around and ending up as lead. I happen to have a bunch of thorium gas mantles (Chinese), and I know a welding rod is 2% thorium.


	

		
			
		

		
	
 . . .


----------



## graham-xrf

*Getting better counts*
Not that I want to be distracting too much from the present effort with Am241, but I was thinking about maybe changing, or augmenting the radioactive bombardment in a safe enough way.

*Thorium in gas mantles*
The stuff has higher energy gammas. I have about 10 of these, purchased around 2019 in a batch for not much,  but now, they are not made anymore, and getting rare. There is one eBay seller, selling singles at £6.00 (about $8 bucks) each, only 9 left, and when they are gone, that's it!

I am imagining a "trench of hot-melt" glue, or similar retaining method, the glue holding in thorium oxide. This to give a continuous ring, or two, or a great big wide & thick washer shape worth. It's radioactive area face around the diode, except the geometry does not allow any direct gamma into the diode. The gamma has to expend itself illuminating the test surface.

I imagine cutting a disc shape groove 3 or 4mm deep (say), then coat with release agent, and pack it with thorium mantle stuff. This is then potted with glue, or epoxy.  Fit the potted radioactive ring into the lead recess. Alternatively, if one wants the angled focus approach, make a bunch of ex-mantle thorium oxide slugs.

*Alternative Thorium from TIG Rods*
Screw the gas mantles! One can get a set of 10 TIG welding rods for £9.00 (about $12 bucks), of which 2% is thorium by weight.

I think about simply bending a thoriated TIG welding rod (red painted end identifier). A whole 2% of by weight it is straight up decaying thorium.
Without even (yet) suggesting separating the thorium from the tungsten steel, how about simply bending a short length of 2.4mm diameter TIG rod  into a ring, pressed into the angled annulus trench. Why not two, or three?

*Use the Am241 as well!*
Why not a ring, or two, or three, of 2.4mm diameter rods around the outside of the smoke detector Am241 slugs? Basically stick everything we can find that is radioactive, and easily obtained, into that space?

If the rods can be hammered flatter, one could have a increased exit area. Finally - not that I know how to do it, but I give consideration to the naughty thought of extracting the thorium. You can't heat it loose. It melts at 1755C! but I think only in a vacuum, or argon-inert thing.
I guess one could dissolve it in nitric acid, then do chemistry to drop out either the tungsten, or thorium. @RJSakowski will be telling us not to do this stuff.

*What can it do for us?*
Reading about the decay of thorium, and all it's daughter products, I see it has a whole mess of gammas coming out of it. They are energetic enough show us Tungsten, Osmium, Platinum, Gold, Mercury, and  the lead proportion in free machining steel. We would not be interested in any elements heavier than lead, but the array of gammas coming out of Thorium, starting from less than Am4241 60keV, and going up beyond 900keV, seems to good to ignore.

Treat all the above as a rambling notion. There could be all sorts of holes in such a plan, and I have not done enough reading to be certain of it's viability, but so far, it seems possible.


----------



## homebrewed

I don't have a thoriated TIG rod but I do have some thoriated tungsten wire that was used to make SEM hairpin emitters.  Now if I can just find it.... "dang, I remember seeing that SOMEWHERE around here".....

I'm still refining my aperture plate/focusing ring/shield ring design.  Correcting a math error allowed me to move the sources in quite a bit more than my initial design, while minimizing shadowing of the source-to-sample path due to the shield ring.  I also experimented with the notion of using a 1/8" thick lead aperture plate with the idea that it might allow me to get rid of the shield ring, but that made the overall geometry worse.

Something I'm wondering about are some differences between my Am241 sources.  Some look like the ones Graham has shown, with a peened-on central disk, but the majority look quite different.  This can be seen in the first photo of post #642 of this thread. Hopefully they're just a slightly different design (rather than lacking the desired Am241), but if so that impacts the focus ring and shield ring design -- the smaller peened-on disk actually permits an even-closer arrangement of the sources.  I suppose I should assume worst-case and design them to accommodate the larger active source area.

This discovery also makes me happy that I decided to go ahead and make an ionization-type radiation detector so I can check my sources.


----------



## graham-xrf

homebrewed said:


> I'm still refining my aperture plate/focusing ring/shield ring design.  Correcting a math error allowed me to move the sources in quite a bit more than my initial design, while minimizing shadowing of the source-to-sample path due to the shield ring.


Since gammas can't reflect (because of tiny wavelength), and can't go around corners, the shield ring need only be as high as the top of the diode body, and the radioactives on the other side of the ring need only be such that no gammas can see a straight line to the diode. There needs to be shield underneath the diode, or underneath the whole circuit, to drop out most of the external background noise. There will remain some you cannot stop.


homebrewed said:


> This discovery also makes me happy that I decided to go ahead and make an ionization-type radiation detector so I can check my sources.


For other readers of this thread..
This morning I bought one of these.. --> SBM-19 Geiger Tube for £33.60








						Russian GEIGER TUBE COUNTER SBM-19 SBM 19 NOS STS-6 sts6 Tested FREE SHIPPING  | eBay
					

Russian GEIGER TUBE COUNTER SBM-19 SBM 19 NOS Tested. Lot of 1 NOS NEW.



					www.ebay.com
				



It happens to be from Ukraine, from Russian cold war surplus. I know there is supposed to an ironic aspect to this.

There is another from Romania, at similar price when you include the shipping.








						SBM-19 SBM SOVIET GEIGER TUBE COUNTER NOS  TESTED!!! LOT OF 1   | eBay
					

BM-19 SBM RUSSIAN GEIGER TUBE COUNTER NOS. Working temperature: -60 to + 70 C. Load Resistance 5 - 10 MOhms. Sensitivity to gamma radiation Interelectrode Capacitance 10pF.



					www.ebay.com
				




The SBM-20 types look the same as SBM-19, and are more plentiful. They are much the same, but a bit less sensitive, although better for use in very high radiation before saturating. A single costs about $20 bucks with free shipping, or two for $38.








						NEW 2pcs SBM-20 SBM20 an STS5 SI22G M4011 Geiger Tube Counter Radiation Detector  | eBay
					

(STS-5, SI22G, M4011, J304 ) for ionizing radiation detection. Purpose of Use Geiger Muller Tube Counters SBM-20 / SBM20 / СБМ-20 (an. STS-5, SI22G, M4011, J304 ) are widely used for radiation detection.



					www.ebay.com
				




Both of these types are robust things that should work for longer than you have life left, unless beaten up by inappropriate circuit discharges. One only needs a tiny discharge current to get a count

[DO NOT get those marked "parts only" for about $11, nor the 10x pieces for $109]

There are a variety of uncased project modules without tubes, some with displays, in the range $45 to about $65
I see complete geiger counter units in little plastic cases and various bells & whistles seem to sell in the $80 to $125 range.

Folk who may, in the end, want to get an XRF analyzer together, do not actually need these things, unless they are interested. You may have your own ideas on how to make a (safe) radioactive racket, and some may be lucky enough to have good stuff in the rocks in their back yard!


----------



## RJSakowski

Due to that 14 billion year half life, you should see very little activity from the thorium.  In contrast, the AM241 has a half life of 14 years.


----------



## graham-xrf

RJSakowski said:


> Due to that 14 billion year half life, you should see very little activity from the thorium.  In contrast, the AM241 has a half life of 14 years.


I set that against being able to place grams of the stuff there, as against nanograms. On a YT video, I saw a pack of TIG rods placed on a Geiger counter. The background count went up from 80-100 at the start, to over 1000. I do agree that if it has been around so long, it cant be losing atoms often, but by my count, a gram or two has got way more than 14 billion decaying atoms for us to play with..

*Let me try..*
Avagadro's Number is* 6.022140857×10^23* atoms per mole.
There is the problem that the atoms are big fat heavy things, so a mole is *232.038* grams
(Please somebody weigh a TIG welding rod for me)
Going on it being nearly all Tungsten (98%) at 19.3g/cm^3 and 2% thorium at 11.7g/cm^3
A welding rod is 6" x 2.4mm (howzat for mixing units)? Volume is 15.24 x 0.24 =3.6576 cm^3
Weight of a 6" rod = (0.98 x 3.6576 x 19.3) + (0.02 x 3.6576 x 11.7) = *70.036 grams*
The welding rod should have (0.02 x 70.0357/232.038) x 6.022140857e+23  = *3.63530844446e+21* Thorium atoms in it

It takes *14.05 billion years* to lose half of them.
So 3.63530844446e+21/(2 x 14.05E9) = 129370407276 atoms decay per year.
There are 31536000 seconds in that year.
Dividing 129370407276 / 31536000 yields 4102.30870359
Our TIG welding rod should be losing a paltry *4102* atoms every second.
We would be using about 5" of it, so make that 3418 per second.
Probably only about a quarter of them would be in the direction we find useful, so about *854* per second.

I do agree that that is not much! The photons that come out are very energetic. Just not very often.
Is it worth trying to use Thorium to get a glow out of stuff?
Should we be maxing out on Am241 little things instead?
How many can we fit around the diode?

-----
Once a Thorium has decayed, it becomes Radium, which has half-life 5.7 years.
Radium goes on to Actinium, wasting half of itself in 6.1 hours going back into a lighter version of Thorium.
Lighter Thorium then has another try at becoming Radium (lighter version), but half is lost in 3,6 days.
Becoming Radon, half lasts 55 seconds, and in 140 millisecond, it's radioactive lead.
Not many minutes later, visiting Bismuth212, Polonium212, and Thallium 212, it ends up as lead shielding.


----------



## WobblyHand

graham-xrf said:


> I set that against being able to place grams of the stuff there, as against nanograms. On a YT video, I saw a pack of TIG rods placed on a Geiger counter. The background count went up from 80-100 at the start, to over 1000. I do agree that if it has been around so long, it cant be losing atoms often, but by my count, a gram or two has got way more than 14 billion decaying atoms for us to play with..
> 
> *Let me try..*
> Avagadro's Number is* 6.022140857×10^23* atoms per mole.
> There is the problem that the atoms are big fat heavy things, so a mole is *232.038* grams
> (Please somebody weigh a TIG welding rod for me)
> Going on it being nearly all Tungsten (98%) at 19.3g/cm^3 and 2% thorium at 11.7g/cm^3
> A welding rod is 6" x 2.4mm (howzat for mixing units)? Volume is 15.24 x 0.24 =3.6576 cm^3
> Weight of a rod = (0.98 x 3.6576 x 19.3) + (0.02 x 3.6576 x 11.7) = *70.036 grams*
> The welding rod should have (0.02 x 70.0357/232.038) x 6.022140857e+23  = *3.63530844446e+21* Thorium atoms in it
> 
> It takes *14.05 billion years* to lose half of them.
> So 3.63530844446e+21/(2 x 14.05E9) = 129370407276 atoms decay per year.
> There are 31536000 seconds in that year.
> Dividing 129370407276 / 31536000 yields 4102.30870359
> Our TIG welding rod should be losing a paltry *4102* atoms every second.
> We would be using about 5" of it, so make that 3418 per second.
> Probably only about a quarter of them would be in the direction we find useful, so about *854* per second.
> 
> I do agree that that is not much! The photons that come out are very energetic. Just not very often.
> Is it worth trying to use Thorium to get a glow out of stuff?
> Should we be maxing out on Am241 little things instead?
> How many can we fit around the diode?
> 
> -----
> Once a Thorium has decayed, it becomes Radium, which has half-life 5.7 years.
> Radium goes on to Actinium, wasting half of itself in 6.1 hours going back into a lighter version of Thorium.
> Lighter Thorium then has another try at becoming Radium (lighter version), but half is lost in 3,6 days.
> Becoming Radon, half lasts 55 seconds, and in 140 millisecond, it's radioactive lead.
> Not many minutes later, visiting Bismuth212, Polonium212, and Thallium 212, it ends up as lead shielding.


FYI TIG electrodes are 7" long (177.8mm).  Interesting we are counting atoms now!

Does the 4n thorium decay chain emit gammas?  The Wikipedia page only shows alpha and beta emission, but don't know if the chart is complete.  Edit: It appears that some of the particle emissions are accompanied by gamma radiation, but not shown.  Would be nice to see that chart.


----------



## graham-xrf

WobblyHand said:


> FYI TIG electrodes are 7" long (177.8mm).  Interesting we are counting atoms now!
> 
> Does the 4n thorium decay chain emit gammas?  The Wikipedia page only shows alpha and beta emission, but don't know if the chart is complete.


It was @RJSakowski mentioning the slow decay that had me have to check it out. There was no place I could easily discover what a welding rod would do. Sure - every time the Geiger ticks, we are counting the demise of an atom!

I was just after making this as easy to get together as possible, and the difficulty of ready access to safe isotopes without spending crazy money, or coming up with a design that won't have it's main ingredient available in the future was a concern.
*-----------------
From a Thorium gas mantle*
All the Thorium spectra plot I can find are crappy. I reworked the plot in post #653 and tried to make the X-axis lines clearer, and the blue Y-axis grid also. It's easy enough to  see the energy log scale along the top.

The first peak is plain old lead (that the Thorium has finally decayed to) being given a XRF glow at (I think) at 10.55 and 12.61 keV

The next big fat peak (I think) might be the 74.97keV and 84.93keV XRF main glow from the lead. This stuff happens to be stronger than the Am241 (59.5keV), so would set off XRF glows from lesser metals. I don't know what is firing this one up. When a Thorium does decide to decay, it loses alphas (heliums 4n), plus however large a photon is needed to represent the missing mass of the end products, compared to what was there before the decay.

The first actual proper labeled atom decay peak is the one at 239keV. This is the from the radioactive lead Pb212 remnant from previous decays.
It is a genuine gamma, half-life 10.6 hours, which is why, I suppose, it has a high count.

The next one looking like at 340keV is labeled Ac228, which would be coming from Actinium on it's way to becoming the lighter isotope of Thorium228. The decay is beta, which would be electrons if they slowed down, but they are going at such a high fraction of the speed of light, they have increased mass, which does stuff to atoms they hit.

The next one just to the left of 600keV is the decay of previously created Thallium, having come from Bismuth that happened from the lead Pb212 in the third peak mentioned earlier. These things have very short half-lives. However it happens, that beta will easily whack into anything it hits, and make the stuff glow X-Rays

The small peak at around to the right of 700keV is the Bismuth212 remnant becoming Polonium212, half of which becomes lead 300 nanoseconds later.

The bigger peak at about 850keV is another photon from Thallium208 becoming stable lead.

The last two highest energy peaks between 900keV and 1MeV are from the original decay from Radium into Actinium
You can tell from the count (Y-axis) that they may have high energy, but don't happen so often.


----------



## RJSakowski

The thorium decay is the rate limiting step in the decay chain. Any daughter products decay instantaneously as compared to the thorium.  That meaning that the concentration of any of the daughter product, other than the stable lead isotope, is essentially zero.My CRC Handbook of Chemistry and Physics, 43rd Ed. has a complete tabulation of all isotopes (known at the time) including their decay modes.  Here is an on line copy: https://edisciplinas.usp.br/pluginf...ook of Chemistry and Physics 95th Edition.pdf
You will find the table starting at section 11-2._  I _believe that radioactive decay follows the equation  N = N0(1 - exp(-at).  You can solve for a by setting t =1.0E10 years = 3.1E17 sec. and N = N0/2. Differentiating that equation will give you the decay rate in events/sec. It's late at night and my brain is somewhat foggy but I came up with a decay rate of arond 8,000 disintegrations/sec for your stated sample size. (The math needs checking.)_


----------



## homebrewed

I pretty much came to the same conclusion as RJ, given the _very_ long half life of the currently present Thorium isotope.  At this point there isn't anything left except the one that has a billions-of-years half life.  Presumably that means a relatively low decay rate 



graham-xrf said:


> Since gammas can't reflect (because of tiny wavelength), and can't go around corners, the shield ring need only be as high as the top of the diode body, and the radioactives on the other side of the ring need only be such that no gammas can see a straight line to the diode. There needs to be shield underneath the diode, or underneath the whole circuit, to drop out most of the external background noise. There will remain some you cannot stop.


I'm not sure what geometry you're assuming here.  I'm not sure we are on the same page because I don't understand why the shield ring only has to be as high as the diode body if the sources are canted toward the sample.

My scheme is based on using a highly modified PocketGeiger rather than a custom PCB with the detector on it, which may explain the differences between our two approaches.  This approach was shown with my OpenSCAD model, although some of the specifics were not quite right.  Key features are the lead aperture plate and tilted source disks, which will illuminate the detector with the primary gammas unless shielded by a shield ring on the source side of the plate.

Radiation from other sources, like cosmic rays, unstable isotopes in the construction materials etc. are something that all XRF measurement systems encounter.  Some inputs can be blocked to some extent, but not all.


----------



## graham-xrf

homebrewed said:


> I pretty much came to the same conclusion as RJ, given the _very_ long half life of the currently present Thorium isotope.  At this point there isn't anything left except the one that has a billions-of-years half life.  Presumably that means a relatively low decay rate


Yes. Using RJ's value *8kBq* from Thorium in rod is less than a quarter of the *37kBq* we get from just one Am241 smoke detector.
Including some Thorium may still be worthwhile, because what comes from it has high enough energy to be able to get responses from tungsten and the remaining interesting metals up to lead. This is why I was thinking of using it "as well as" rather than "instead of" Am241.

I do think that the daughter products have not somehow evaporated from the Thorium. They may hang around for a few years, or hours, or minutes, or milliseconds, but are being produced all the time. At any time, we have the backlog of most recently decayed by-products in there. Do I have this wrong?

Also, I thought to just use more rods. I wondered about getting the thorium out of (say) 20 rods, concentrated.

Lastly, I remembered the spectrum I was looking at was from Thorium gas mantle. The Thorium in welding rods is also beating on the Tungsten in them, delivering some 59.3keV,  67.2keV, 8.4keV, and 9.7keV, just not as often as what comes from Am241
-------
Also, big thanks to @RJSakowski for the book pdf link. It's the sort of reference that bring memories of one's educational era. The kind you end up having fallen asleep on with forehead amid the pages. I only have the hard copy 14th Edition 1974 _"Tables of Physical and Chemical Constants"_ by Kaye & Laby, when it was withdrawn from the local library and sold off cheap.



homebrewed said:


> I'm not sure what geometry you're assuming here.  I'm not sure we are on the same page because I don't understand why the shield ring only has to be as high as the diode body if the sources are canted toward the sample.


If the sources are each within "their little container" of lead, they can still irradiate over 180° half a sphere. If the top of the container is slightly higher than the source, that becomes a smaller angle, say about 170°. If they are placed, canted towards the sample, the rays can maybe still see the diode, albeit through the sides of it's plastic case. Putting a ring of shielding around the diode ensures it does not get hit by source photons.

The diagonal of the 16.5 x 14.5mm diode package is 22mm, and the top of the diode is 0.9mm from the PCB.
A shield ring 22mm ID, and 27mm OD, 1.5mm thick, or more generously, 2mm thick, placed around the diode body, maybe held there with glue, keeps the diode shielded. If zero photons can get to the diode even without the ring shield, then you don't need it at all. I think we both do understand keeping the diode in the shadow of shielding pretty well. I was just trying to shield the diode from all except what comes back from the sample, and adding a piece of lead under the diode further quietens the background.

You are right about the physical mounting of the diode. In my scheme, the diode is at right angles to the PCB, stood on one end.


----------



## graham-xrf

In view of the fact I have 4.5 litres of 36% hydrogen peroxide kept in a cupboard in a cold and very dark place (cellar) ..
and then I found  --> THIS --> *How to make thorium dioxide*
.. and allowing for the now fairly well known nature of me..
What do you suppose is going to happen next?


----------



## WobblyHand

graham-xrf said:


> I set that against being able to place grams of the stuff there, as against nanograms. On a YT video, I saw a pack of TIG rods placed on a Geiger counter. The background count went up from 80-100 at the start, to over 1000. I do agree that if it has been around so long, it cant be losing atoms often, but by my count, a gram or two has got way more than 14 billion decaying atoms for us to play with..
> 
> *Let me try..*
> Avagadro's Number is* 6.022140857×10^23* atoms per mole.
> There is the problem that the atoms are big fat heavy things, so a mole is *232.038* grams
> (Please somebody weigh a TIG welding rod for me)
> Going on it being nearly all Tungsten (98%) at 19.3g/cm^3 and 2% thorium at 11.7g/cm^3
> A welding rod is 6" x 2.4mm (howzat for mixing units)? Volume is 15.24 x 0.24 =3.6576 cm^3
> Weight of a 6" rod = (0.98 x 3.6576 x 19.3) + (0.02 x 3.6576 x 11.7) = *70.036 grams*
> The welding rod should have (0.02 x 70.0357/232.038) x 6.022140857e+23  = *3.63530844446e+21* Thorium atoms in it
> 
> It takes *14.05 billion years* to lose half of them.
> So 3.63530844446e+21/(2 x 14.05E9) = 129370407276 atoms decay per year.
> There are 31536000 seconds in that year.
> Dividing 129370407276 / 31536000 yields 4102.30870359
> Our TIG welding rod should be losing a paltry *4102* atoms every second.
> We would be using about 5" of it, so make that 3418 per second.
> Probably only about a quarter of them would be in the direction we find useful, so about *854* per second.
> 
> I do agree that that is not much! The photons that come out are very energetic. Just not very often.
> Is it worth trying to use Thorium to get a glow out of stuff?
> Should we be maxing out on Am241 little things instead?
> How many can we fit around the diode?
> 
> -----
> Once a Thorium has decayed, it becomes Radium, which has half-life 5.7 years.
> Radium goes on to Actinium, wasting half of itself in 6.1 hours going back into a lighter version of Thorium.
> Lighter Thorium then has another try at becoming Radium (lighter version), but half is lost in 3,6 days.
> Becoming Radon, half lasts 55 seconds, and in 140 millisecond, it's radioactive lead.
> Not many minutes later, visiting Bismuth212, Polonium212, and Thallium 212, it ends up as lead shielding.


Not trying to discourage anyone, but merely trying to keep us on a good course.  Assuming your methodology is correct, there are some math errors above. Your calculated volume of the rod is incorrect.  Maybe you mixed up units?  I get 0.6894 cubic cm volume for your mixed unit rod of 6" and 2.4mm _diameter_.  Volume is pi * r * r * h.  h = 6 in * 2.54 cm/in = 15.24 cm, r = 2.4 mm diameter */ 2* * 0.1 cm/mm = 0.12 cm.  Consequently the mass of the rod, and the number of decayed atoms is off. 

For a 6" rod, I get a rod mass of 13.201 gm and 1546 decays/second.  Using your approximation of 25% in the right direction gives me 386 decays/second.  This is assuming decays/sec is calculated properly.

As a sanity check, I went outside to the garage to grab a package of 2.4mm 2% ceriated TIG electrodes.  (It's -12C with a bit of a wind right now) Don't have any thorium rods.  Measured an electrode to be about 14.5 cm (it was used/ground to a point) and the measured mass was 12.2 gm. My calculated mass for this rod, using Cerium characteristics was 12.49 gm.  Considering that I wagged the length measurement due to the ground point, a 2.4% error is sufficient to _mostly_ validate my calculations.

Haven't gotten through RJs calculations just yet in programmatic form.  Attached is a python script with my calculations.  No doubt I may have made some errors myself, but, it's an attempt.  I've renamed it to thorium.txt.  If you have a python installation (and numpy) rename it to thorium.py and run it.


----------



## RJSakowski

Interesting.  What is the tungsten product from the reaction?  Most of the tungsten salts are insoluble in water which would imply that the tungsten is tied up in the precipitate, either as the dioxide or trioxide since no other anions are present.


----------



## WobblyHand

Differentiating the radiation decay equation, as recommended by @RJSakowski and using the number of Thorium atoms in a 6" long 2.4mm diameter 2% thoriated rod shows a total activity of 1072 Bq.  This is compared to 37000 Bq for a typical smoke detector.

In [60]: run thorium.py                                                                                         
Rod length [inches] 6
Rod diameter [mm] 2.4
Rod volume in cubic cm 0.6894
Rod mass in gm 13.201
No of Thorium atoms in rod 6.852397408070073e+20

Analytic # of Thorium decays per second 1071.98 [Bq]

Volume and mass calculation sanity check using 2% Ceriated TIG rod
------------------------------------------------------------------

Approx Ceriated rod length 14.5 [cm]
Ceriated TIG rod volume 0.656 [cm^3]
Calculated Ceriated rod mass 12.49 [gm]
Measured 2% Ceriated TIG rod mass 12.2 [gm]
Approx mass error 2.4 %

Latest version of thorium.py (renamed to thorium.txt)


----------



## graham-xrf

WobblyHand said:


> Not trying to discourage anyone, but merely trying to keep us on a good course.  Assuming your methodology is correct, there are some math errors above. Your calculated volume of the rod is incorrect.  Maybe you mixed up units?  I get 0.6894 cubic cm volume for your mixed unit rod of 6" and 2.4mm _diameter_.  Volume is pi * r * r * h.  h = 6 in * 2.54 cm/in = 15.24 cm, r = 2.4 mm diameter */ 2* * 0.1 cm/mm = 0.12 cm.  Consequently the mass of the rod, and the number of decayed atoms is off.
> 
> For a 6" rod, I get a rod mass of 13.201 gm and 1546 decays/second.  Using your approximation of 25% in the right direction gives me 386 decays/second.  This is assuming decays/sec is calculated properly.
> 
> As a sanity check, I went outside to the garage to grab a package of 2.4mm 2% ceriated TIG electrodes.  (It's -12C with a bit of a wind right now) Don't have any thorium rods.  Measured an electrode to be about 14.5 cm (it was used/ground to a point) and the measured mass was 12.2 gm. My calculated mass for this rod, using Cerium characteristics was 12.49 gm.  Considering that I wagged the length measurement due to the ground point, a 2.4% error is sufficient to _mostly_ validate my calculations.
> 
> Haven't gotten through RJs calculations just yet in programmatic form.  Attached is a python script with my calculations.  No doubt I may have made some errors myself, but, it's an attempt.  I've renamed it to thorium.txt.  If you have a python installation (and numpy) rename it to thorium.py and run it.



We are not discouraged, it's going to make the thread better!
It was late, and I was tired, and we now both get *0.68944 cubic cm*.
I am going to edit the posting with some fun strike-throughs and corrections 

One thing you might suspect is that if I actually mention the units, then you know I was aware of, and taking care of them.
What actually happened was messing up (π*D^2)/4, or π*r^2  if you like.
I also know that a new TIG rod is 7", but I went with 6".

Of that volume 2% is Thorium, and  98% is Tungsten
We know the densities are *19.3g/cm^3* for Tungsten, and *11.7g/cm^3* for Thorium.
so (0.98 x 0.68944 x 19.3) + (0.02 x 0.68944 x 11.7)
It has *13.0400* grams of Tungsten, and *0.161329* grams of Thorium => *13.201 total* (which is what you said).

Our paltry 0.161 grams of Thorium has (0.161329 ÷ 232.038) x 6.022140857e+23 => 4.1870123097e+20 atoms
Half of them (4.1870123097e+20 ÷ 2 ) = *2.09350615485e+20* got lost in 14.05 billion years.
(2.09350615485E+20 ÷ 14.05 E9) = 14900399679 are lost in 1 year (31536000 seconds)
We end up with a paltry *472* per second
Likely about a quarter to a third of them are heading in the right direction.
So, about *118* per second.

This is great!  We are all doing what engineers do! Each coming up with a different answer when doing the same calculation. 
We will get it right, I am sure!


----------



## homebrewed

When I was doing failure analysis on IC's we often had to remove tungsten as part of the deprocessing step -- it's used as a conductive protection layer between silicon and aluminum metallization.  We used 30% hydrogen peroxide with a small amount (~10%) of ammonium hydroxide.  The H2O2 oxidized the top layer of tungsten to tungsten oxide, and the NH4OH reacted to form ammonium tungstate, which is water soluble.  As a result the reaction proceeded fairly quickly.  It was a "nice" etch because the only thing it attacked was the tungsten barrier metal.  Selectivity is a Good Thing when you're deprocessing IC's.

Adding some ammonium hydroxide (or some other base like NaOH or KOH) to the peroxide being used to dissolve thoriated welding rods will speed things up, but only for a little while.  This is because the low pH also destabilizes the peroxide so it decomposes into water and oxygen.  If we mixed up too-large a batch of our tungsten etch the stuff would slowly decompose and also release heat.  The heat would cause it to decompose faster, then faster.....until it boiled.  Since we were doing this under a fume hood with PPE's that wasn't a disaster, just messy.  But I wouldn't want it to happen in my kitchen!

But there's a better way to dissolve tungsten.  I'm not recommending it as something anyone would really want to do, just as a thought experiment.  I don't want anyone inhaling thorium dioxide dust.  The peroxide is there as a source of monatomic oxygen to oxidize the tungsten.  An electrolytic cell with a NaOH solution as its electrolyte can do the same thing.  Make the tungsten rod the anode and use something like stainless steel or a carbon rod for the cathode and pass current through the cell.  Oxygen is (momentarily) liberated at the anode, oxidizes the tungsten, and then the tungsten oxide is dissolved by the NaOH.  This exposes fresh tungsten so the process can continue.

We used a similar process to sharpen our own probe tips for probing the nodes of IC's.  I designed and built a circuit to automate the process, based on a scheme used to sharpen STM tips.  When adjusted correctly, the circuit produced probe tips that still looked sharp at 100,000X magnification on our SEM (albeit not the most modern one out there).  Our SEM operator was skeptical when I told her that I doubted she would be able to  image the end of the probe in the SEM but she had to eat her words 

To produce the best probe tips I found it necessary to use potassium hydroxide at a concentration of about 8M so it was a strong and hazardous solution.  For the purposes of just dissolving tungsten it might be possible to use something a little less nasty like sodium carbonate A.K.A. washing soda.

The electrolytic cell also will release hydrogen at the cathode so the process shouldn't be done in an enclosed space.

According to Wikipedia, thorium dioxide is not soluble in alkali solutions so there's a chance that it will drop out of the tungsten as the rod is dissolved.  When googling thorium + salts all I found were references to molten-salt nuclear reactors, not quite the same thing.  But I wouldn't bet the farm on this -- there are a lot of unknowns (or perhaps known but classified) when it comes to these kinds of Strategic materials.

But, even if thorium were active enough in terms of decays/second, examination of its decay chain didn't reveal any fissions that result in gamma rays, just alpha and beta particles.  But I admit to a very cursory examination of the Wikipedia article on the subject.


----------



## WobblyHand

graham-xrf said:


> We are not discouraged, it's going to make the thread better!
> It was late, and I was tired, and we now both get *0.68944 cubic cm*.
> I am going to edit the posting with some fun strike-throughs and corrections
> 
> One thing you might suspect is that if I actually mention the units, then you know I was aware of, and taking care of them.
> What actually happened was messing up (π*D^2)/4, or π*r^2  if you like.
> I also know that a new TIG rod is 7", but I went with 6".
> 
> Of that volume 2% is Thorium, and  98% is Tungsten
> We know the densities are *19.3g/cm^3* for Tungsten, and *11.7g/cm^3* for Thorium.
> so (0.98 x 0.68944 x 19.3) + (0.02 x 0.68944 x 11.7)
> It has *13.0400* grams of Tungsten, and *0.161329* grams of Thorium => *13.201 total* (which is what you said).
> 
> Our paltry 0.161 grams of Thorium has (0.161329 ÷ 232.038) x 6.022140857e+23 => 4.1870123097e+20 atoms
> Half of them (4.1870123097e+20 ÷ 2 ) = *2.09350615485e+20* got lost in 14.05 billion years.
> (2.09350615485E+20 ÷ 14.05 E9) = 14900399679 are lost in 1 year (31536000 seconds)
> We end up with a paltry *472* per second
> Likely about a quarter to a third of them are heading in the right direction.
> So, about *118* per second.
> 
> This is great!  We are all doing what engineers do! Each coming up with a different answer when doing the same calculation.
> We will get it right, I am sure!


Good, found an error in my calculations.  Agree with the number of atoms now.  N = 4.187e20.  But my decay rate is 655 Bq.  Before the 25%.

I am using the decay rate found from solving what "a" is from the decay equation.  N = N0( 1 - exp(-at) ).  I come up with
a = ln(2)/(halflife[yrs] * num_sec_per_year [sec/yr]) = 1.5643809900134361e-18 [events per atom/sec]  ? guessing on the units

Therefore the activity rate A is: A = a * N [Bq],  I now get 655 [Bq].  At 25% --> 163 [Bq]
Reference: radioactive decay look at the section called rates.


----------



## WobblyHand

homebrewed said:


> But, even if thorium were active enough in terms of decays/second, examination of its decay chain didn't reveal any fissions that result in gamma rays, just alpha and beta particles. But I admit to a very cursory examination of the Wikipedia article on the subject.


RJ's reference shows 59 Kev gamma for thorium 232.  There's also 4.081 MeV alphas.  When high energy particles slam into objects, as they violently stop, they can give off X-rays.  The term is _bremsstrahlung_.  That's how x-ray tubes work.  Violent high energy collision of electrons into a target.  Edit: not sure if applicable to alphas, lots of references to beta+ and beta-.


----------



## WobblyHand

graham-xrf said:


> In view of the fact I have 4.5 litres of 36% hydrogen peroxide kept in a cupboard in a cold and very dark place (cellar) ..
> and then I found  --> THIS --> *How to make thorium dioxide*
> .. and allowing for the now fairly well known nature of me..
> What do you suppose is going to happen next?


Please give serious consideration to _not_ making your abode or surrounds a hazardous waste site.  As in think it all though at least 3 times before proceeding.  Not telling you to not do it, but, do be careful and think though any waste issues.


----------



## graham-xrf

WobblyHand said:


> Please give serious consideration to _not_ making your abode or surrounds a hazardous waste site.  As in think it all though at least 3 times before proceeding.  Not telling you to not do it, but, do be careful and think though any waste issues.


We think alike!
Definitely the post #669 from @homebrewed is serious real experience that I trust way more than a YT video done to Mozart. Real explanations given, so we know what happens to all the ingredients in there, would have had the ring of truth to it.

Also yes - the right way to do decay rates is by using the proper equations. It's an asymptotic exponential relationship.
---
For Mark:  Regarding whether the energy is alpha, beta, or gamma, I also need to get it clear in the mind what happens. I do know that these decays are accompanied by energy release, and here we get to, "the particle has got mass, so how come it behaves like a wave stuff"? Which is it?

We can see from measured spectra in #660 that there is high energy release all over the place, with the big fat *239keV* gamma coming from the Pb212 *Beta* decay near the end of the chain. The half-life of that lead is only 10.6 hours. The Bismuth half-life is only 61 minutes, also by Beta decay. The Polonium it makes loses half in 30 microseconds, by Alpha decay.

Consider the *Am241*. Most of it's decay is by Alpha. 
	

		
			
		

		
	



So what is that *59.5keV *Gamma all about? Is it in the momentum of the Helium nuclei?
As I understand it, it is the same as one gets in all radioactive processes. You add up the masses of what you started with. You add up the masses of all the stuff you ended up with. You subtract to find the mass that has "disappeared", and refer to Mr Einstein's contribution to figure out how much energy that was. The alpha particle can't even penetrate a piece of paper. But the process that accompanied it's creation releases electromagnetic radiation.

The other thing people should appreciate is that the wastes with incredibly long half-lives are usually not the dangerous ones. You can normally handle them, or their ores, so long as you don't eat them, or get their dust in your lungs. It is the daughter products with the short half-lives that are incredibly, dangerously, radioactive!


----------



## WobblyHand

Interestingly, *Th232* also gives off a 59.0 keV gamma, at least according to the the pdf handbook.


----------



## homebrewed

Back to my concerns that I got some defective smoke detector sources, I used my detector plus the preexisting lead aperture plate to check a few of them  They all appear to generate about the same number of counts/second so the sources are a mix of slightly different designs.

No need to build a separate radiation detector.

Now I have to think about whether to pull them off my now-deprecated source plate, trim and re-install; or just buy more sources and use them.  I used cheap 2-part epoxy to glue the sources down, which will soften if heated up to a couple hundred degrees C.  I don't have a hot plate but I do have a heat gun that should do the job.


----------



## graham-xrf

homebrewed said:


> Back to my concerns that I got some defective smoke detector sources, I used my detector plus the preexisting lead aperture plate to check a few of them  They all appear to generate about the same number of counts/second so the sources are a mix of slightly different designs.
> 
> No need to build a separate radiation detector.
> 
> Now I have to think about whether to pull them off my now-deprecated source plate, trim and re-install; or just buy more sources and use them.  I used cheap 2-part epoxy to glue the sources down, which will soften if heated up to a couple hundred degrees C.  I don't have a hot plate but I do have a heat gun that should do the job.


Epoxy stuff of all natures will yield to methylene chloride, also called dichloromethane, the ingredient in the more effective kind of industrial paint strippers. I got a can from eBay.  The liquid is not so available anymore, apparently in the same class as carbon tetrachloride.

It does not seem to work as a solvent, rather, it seems to break the bonds that let the epoxy hold itself together. I put an image intensifier potted unit containing the 6kV high voltage multiplier components into a drinks glass, poured in C2H4Cl2 , covered with a metal sheet. I left it a couple of days. The epoxy became like yellow flakes and powdery chunks, all the way into the middle.
I think the middle of the sources are an incredibly thin sheet of oxide sintered onto a metal foil, with other stuff overlaid. The little circles are punched out and fixed into the metal discs.

I think they should survive some heat, but you might test one with some paint stripper to see if it lets go.


----------



## homebrewed

I used my heat gun and once the aperture plate got hot enough they came off pretty easily.

Examination of one of the sources revealed a plain raised disk on the opposite side of the Am241-impregnated foil.  I saw a little gap between the larger carrier and disk, so I got an X-acto blade in between them and was able to pop the disk off, intact.  So it's not necessary to cut or grind away anything in order to get the smaller source disk off the carrier.

I checked the carrier with my detector and it did not pick up any counts above background.

Here's a photo showing the two pieces, source on the left and carrier on the right..  My little point-and-shoot doesn't take good closeups so I set up my tripod and took the photo through one of the eyepieces of my stereomicroscope.  It's a little finicky to set up but works OK.


----------



## graham-xrf

There are three outer peenings (swagings?) that held the source into the contact ring.
There are 5 pressings to hold the source onto the inner carrier, looking as if missing a sixth. 
That part is small enough that you will be able to put them lots closer, and have a more intense irradiation, and bigger counts.

On mine, the 3 peenings to the contact ring were so pressed over, they were never going to just bend away. I also tried a blade. In the end, I just carefully filed the overhang on them away, to make it possible to pop them free of the contact carrier. At the time, my fooling with a blade (Swann-Morton 25) had it snap, and things slipped, and there was blood!  

Also, it took a major tidy-up to find where the Am241 source ended up (floor)!

I am thinking that with the close-up design, maybe you don't need all eight of them. Maybe six is enough.

--------- 
I am now getting back to my amplifier and ADC. I am disappointed that the (powerful) little Raspberry Pi Zero 2W is just sold out from all outlets until April. I can use my Pi4 for development, but the £11.50 board has it's attractions.  It has the grunt to do the computing, drive it's own display, or do Wi-Fi, or Bluetooth, or USB to a computer or a smartphone.









						Raspberry Pi Zero 2 W – Raspberry Pi
					

Your tiny, tiny $15 computer



					www.raspberrypi.com
				




It seems all Pis have been in shortage since back in 2020, and now, despite making millions of them, the Raspberry Pi Zero 2W is almost always sold out. It's not just about supply chain holdups. It's basically driven by ever expanding demand.


----------



## homebrewed

I measured the "core" and it came to exactly .25"/6.4mm in diameter.  If they are tilted at a 45 degree angle, the "focus ring" has to be .177"/4.5mm high.

I'll use this information to come up with my final (sorta, kinda) focus ring+shield ring layout.  I'd been using .200" for the pared-down source diameter so my bits will need to be changed a little.


----------



## homebrewed

graham-xrf said:


> There are three outer peenings (swagings?) that held the source into the contact ring.
> There are 5 pressings to hold the source onto the inner carrier, looking as if missing a sixth.
> That part is small enough that you will be able to put them lots closer, and have a more intense irradiation, and bigger counts.
> 
> On mine, the 3 peenings to the contact ring were so pressed over, they were never going to just bend away. I also tried a blade. In the end, I just carefully filed the overhang on them away, to make it possible to pop them free of the contact carrier. At the time, my fooling with a blade (Swann-Morton 25) had it snap, and things slipped, and there was blood!
> 
> Also, it took a major tidy-up to find where the Am241 source ended up (floor)!
> 
> I am thinking that with the close-up design, maybe you don't need all eight of them. Maybe six is enough.
> 
> ---------
> I am now getting back to my amplifier and ADC. I am disappointed that the (powerful) little Raspberry Pi Zero 2W is just sold out from all outlets until April. I can use my Pi4 for development, but the £11.50 board has it's attractions.  It has the grunt to do the computing, drive it's own display, or do Wi-Fi, or Bluetooth, or USB to a computer or a smartphone.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Raspberry Pi Zero 2 W – Raspberry Pi
> 
> 
> Your tiny, tiny $15 computer
> 
> 
> 
> www.raspberrypi.com
> 
> 
> 
> 
> 
> It seems all Pis have been in shortage since back in 2020, and now, despite making millions of them, the Raspberry Pi Zero 2W is almost always sold out. It's not just about supply chain holdups. It's basically driven by ever expanding demand.


Oops!  Sorry to learn that the project has now earned one of the badges of "blood, sweat and tears".  Too bad that saying bad words doesn't count!

Thanks for sharing your experience.  It sounds like I should expect some recalcitrant sources.  

BTW, when I did it I held the carrier with tweezers so my fingers were safely out of range.  Needle-nosed pliers probably would work better.


----------



## rwm

Looks like you could drive that out of the carrier with the correct shop made punch and die?


----------



## homebrewed

rwm said:


> Looks like you could drive that out of the carrier with the correct shop made punch and die?


Yes, you probably could.  The steel used to make them appears to be pretty soft.  The actual bit of foil containing the Am241 is in a recess so it wouldn't be at risk.


----------



## homebrewed

Regarding my comment about the choices of material suitable for making the focus ring.  In retrospect I don't think acetal or Derlin would be good choices.  In my experience, glues don't bond well to them.  Since my aperture plate is made of lead, it really doesn't matter what material is used (in terms of the XRF performance).  It could be just about anything a hobbyist has the ability to accurately shape or print.  

I have some 6061 aluminum rod that has a large enough OD so I will just use that.  To prevent any unsupported overhang of the sources, the focus ring's OD should be a minimum of 1.035 inches.  With that, its height will just be (.707)*.250 = .177 inch/4.5mm.  1.035 inches is the minimum it should be -- it can be as large as will fit in the enclosure.

Having the sources a bit below the top surface of the focus ring would provide a bit of protection from samples inadvertently being shoved up against the ring.  A further refinement might be to make the focus ring deep enough so the focal point of the sources is coincident with the mouth of the ring.  So no guessing on how to place the sample for the highest count rate.  That is, if the count rate turns out to be an issue.

With this design, assuming that the sources are .250" in diameter, the "focal point" will be .455 inches above the aperture plate.  If the aperture plate is 1/16" thick and the detector is placed .080"/2mm behind the plate, the detector will be about .6 inches from the sample.  These numbers are consistent with my estimates obtained with my OpenSCAD model.

Once the focal point is known, we also know how tall the focus ring needs to be, .455 inches.  I'd bore one end of my rod to an ID of 1.035" and a depth of (.455-.177 = ,.278")  then flip it around, bore the remainder out to .681", and finally cut the 45 degree taper.  The ID of the focus ring is larger than the aperture plate hole because the shield ring has to fit in there.  This design is the one where the sample is placed in contact with the focus ring -- assuming the sample is larger than the mouth of the ring.

It might be tempting to decrease the focal point more to get everything even closer together, but this will increase the angle between the sample surface and incident x-rays, effectively reducing the flux density.  My gut feeling is that a source tilt of 45 degrees is about optimum, but at present I don't have any calculations to prove it.


----------



## graham-xrf

@homebrewed  Hi Mark.
I know it looks like we have a "focal point", and indeed the original diagram where I worked out the geometry makes it look like there is one, but in this case, I don't think there really is one in the way we would like. I imagine only the extremes of possible paths and the stuff that might get hit. Those X-rays that escape the shielding shadows will generally hit material everywhere outside of the shadows, and by tilting the sources to best get gamma irradiation at places directly under the diode should increase the count.

Then, when the material does deliver X-rays, again, they will start from everywhere there was material that could get a dose of gamma.  X-rays will scatter in all directions everywhere, but, if lots are directly under the diode, such that the diode size occupies lots of the available exit directions, they can't escape, and we increase the count.  Wow! It would be so great if we could use some kind of "lens" to concentrate and gather this stuff, but I cant think of there being a "focus" in the sense I wish for. Still, I do know what you mean.


----------



## graham-xrf

*Secondary excitations?*
Yeah - jumping the gun a bit, but I was thinking ahead, playing "what if"?
Suppose we put a sample of pure stuff in, one of your expensive cubes (say), and get a single bin of it's count. Looks OK.

That situation would obviously change with some alloy mixture. We should get some other bins, but we hope that the counts would show the proportions of the elements in the alloy, taken as fraction of the total. One expects that regardless the proportions, the mere presence of certain bins would usually be enough to identify the alloy.
BUT..
The gamma doing the radiating might not be equal-opportunity in hitting on atoms. Some might be "bigger", or something like that.
Then also, what if some of the the X-ray photons we would love to count happen to be of high enough energy to be more than some (low) L-shell energies or the other stuff in the sample. Our "count" photon gets diverted into falsely increasing the count of one of the other elements in the mix, instead of making it to our diode. (Hell, I can be such a pessimist sometimes!) 

Yeah, we likely have to build a set of "signature" responses for various common materials. This begs the question. Does one get the plot, and then look through a set of plots to then say "Ahh - that must be it"? Alternatively, do we aspire to give it such smarts that it comes up with the most probable plot by itself, overlaid onto the plot in a different colour, and a text box with the name of the alloy?  What did that Theremino thing do?


----------



## WobblyHand

Don't know about the Theremino.  How about Principal Component Analysis?  There's some python libraries that would run on your Pi.  Unfortunately, the principal components aren't guaranteed to line up with physical quantities, but they might.  Be fun to try.  Run Multiple hypotheses and pick the most probable?  

This is a problem that has been solved in commercial products, so we just need to dig for some papers, or ugh, glean stuff from marketing blather.


----------



## graham-xrf

WobblyHand said:


> Don't know about the Theremino.  How about Principal Component Analysis?  There's some python libraries that would run on your Pi.  Unfortunately, the principal components aren't guaranteed to line up with physical quantities, but they might.  Be fun to try.  Run Multiple hypotheses and pick the most probable?
> 
> This is a problem that has been solved in commercial products, so we just need to dig for some papers, or ugh, glean stuff from marketing blather.



Don't let's put too much into this aspect right now. I have yet to reap all the goodies from the CERN open source software. I am trying for my circuit board right now, and getting the ADC working in a trivial way, just doing the basics.


----------



## WobblyHand

graham-xrf said:


> Don't let's put too much into this aspect right now. I have yet to reap all the goodies from the CERN open source software. I am trying for my circuit board right now, and getting the ADC working in a trivial way, just doing the basics.


No worries!  Just throwing something up in the air.  Believe me, you are faaaaaaaaaaar ahead of me.  I haven't designed any circuit boards for this. Waiting for the dust to settle, as they say.  Haven't bought anything, just following along for the moment.  Really quietly cheering this along.

I'm sure you can get the ADC to sample.  I'd recommend it be either externally triggered or via DMA and an internal timer.  I had a devil of a time getting my homemade doppler chronograph running correctly until I hooked up the sampling trigger to a timed DMA process.  Otherwise I just lost sensitivity due to timing jitter.  Had to design and build a front end for it as well, with a 7 pole Chebychev analog active low pass filter, with low noise, since all the published schematics were hopelessly bad for aliasing.  It was tricky designing and testing it at home, since I no longer had access to expensive test equipment.  Had to make an Arduino swept tone generator to test out my filter.  The sweeper wasn't very good, but it was good enough for the characterization.

I haven't tried DMA sampling in an RPI, but in an M4 Arduino, it is certainly doable.  The 12 bit ADC is running continuously at 60 KHz sample rate with concurrent signal processing (FFT's and automatic target detection) and driving a small TFT display.  Took a while to get it to work to my design specs, but was a fun project.  You know, I ought to make a housing for this...

I'm sure this X-RF project will turn out well.  If there's anything I could help out with, let me know.


----------



## homebrewed

WobblyHand said:


> Don't know about the Theremino.  How about Principal Component Analysis?  There's some python libraries that would run on your Pi.  Unfortunately, the principal components aren't guaranteed to line up with physical quantities, but they might.  Be fun to try.  Run Multiple hypotheses and pick the most probable?
> 
> This is a problem that has been solved in commercial products, so we just need to dig for some papers, or ugh, glean stuff from marketing blather.


IIRC, PCA is one of the commonly-used methods to extract elemental information from spectra that exhibit a lot of overlap.  This is not a new or unexpected problem, all "proportional" x-ray detectors have some spread in the detected photon energy.  It's statistics.

Another approach is deconvolution, but it requires a consistent energy distribution (usually assumed to be a Gaussian distribution).

My scheme of using energy filters may also be helpful but we need to iron out the basic geometry, detector, electronics and MCA S/W first.


----------



## homebrewed

graham-xrf said:


> @homebrewed  Hi Mark.
> I know it looks like we have a "focal point", and indeed the original diagram where I worked out the geometry makes it look like there is one, but in this case, I don't think there really is one in the way we would like. I imagine only the extremes of possible paths and the stuff that might get hit. Those X-rays that escape the shielding shadows will generally hit material everywhere outside of the shadows, and by tilting the sources to best get gamma irradiation at places directly under the diode should increase the count.
> 
> Then, when the material does deliver X-rays, again, they will start from everywhere there was material that could get a dose of gamma.  X-rays will scatter in all directions everywhere, but, if lots are directly under the diode, such that the diode size occupies lots of the available exit directions, they can't escape, and we increase the count.  Wow! It would be so great if we could use some kind of "lens" to concentrate and gather this stuff, but I cant think of there being a "focus" in the sense I wish for. Still, I do know what you mean.


Yes, the name "focus ring" is misleading.  More correct might be something like  "director" ring, since it just positions the sources to obtain the highest possible fluence of the 60Kev primaries, consistent with the added requirements of shielding the detector from the same primaries and maximizing the number of XRF photons captured by the detector.  It doesn't increase the apparent brightness of the primary x-rays.

There _are_ devices that can focus x-rays.  One type is a grazing-incidence mirror, typically made with alternating layers of material to behave like a dielectric mirror, but at x-ray wavelengths.  High-z and low-z metal films are used in this case.  The other is a diffractive lens.  Both are far beyond the capabilities of hobbyist types to fabricate; and in the case of the diffractive lens, at least 50% of the x-rays never make it past the lens.  I also doubt we will ever find something like them on ebay


----------



## graham-xrf

*I think I found the way it actually works!* 
The X-ray photon hits the silicon PIN diode.
For silicon, every little 3.66  ± 0.03eV pulls an electron away from a silicon atom, creating a free electron that can move under the influence of electric fields. It leaves a "vacancy" in the silicon atom - a classic "hole" acting like a positive charge. It's an electron-hole pair. Left to itself, in something even slightly conducting, it will very rapidly re-combine, though possibly promiscuously.  (It finds a different -oh whatever..)

In regular diodes, just having P+ type holes material up against N- type electrons-to-spare material results in a brief current, and a depletion region where the electrons and holes found each other. Reverse bias can widen the region, and forward bias can narrow it, until it disappears, and diode conducts. In a PIN diode, there is a built-in intrinsic pure silicon layer between the P and the N. Any electron-hole pairs generated in this layer will extremely rapidly cross to the P and N layers. Except for some electron-hole pairs made by being shook up by heat, or encouraged to get pulled free by bias current, (ie. noise), every 3.66eV gets you an electron's worth.

*Current is not the flow of electrons*
Oh yes it is! Oh no it isn't!
Actually it's the latter. Electrons can take weeks to get around a circuit, and many may never do if the current is a reversing AC. Think if the power generator is pushing electrons from a windmill in the North Sea, and your light bulb is on the grid 100 miles inland. It is the effect of their fields is what transfers the energy. The analogy is a bunch of snooker balls in a line. Hit the the one on the end, and the one on the other end goes on it's way. So it is with our PIN diode.

So - let's say we whack our alloy with some 59.5keV from the smoke detector thingy, and it hits a molybdenum atom.



The L-shell is outermost, with electrons that are the easiest to get excited. It lets go some *2.29316keV*.
That one is going to deliver a pulse of 2293.16 ÷ 3.66 = 626.54 electron-hole pairs. Others too - but lets do this one.
Lets gloss over what is 0.54 of an electron  If that 626 electons moves in the circuit, it's a pathetic tiny current, and I would think somewhat too small to ever see against the other racket. Nor will all of them make it. There is an efficiency involved. Yet our X-100 specification sheet shows it has a 20% probability of making it.

OK then, just because it got lucky, and was among the 20%, that does not mean our circuit amplifier can see enough of it to give it gain, and offer at an ADC to be reliably have it's count put in a "2.29keV" bucket - does it?

So how much actual amps is 626 electrons?  Each one is 1.602176634E-19 coulombs.
626 of them is 1.602176634E-19 x 626 = 1.0029625728E-16 coulombs.
That load of charge makes a funny, roughly triangular pulse about 13uS long, the integrated area under being proportional to the electron-volts.
If current is Coulombs/Sec, and we use 1/2 base x height approximation, then it's  1/2 x 1.00296257288e-16 ÷ 13E-6
The answer is *3.86 pico-amps* !

That's disheartening!   I know it was a rough-and-ready calculation, but now, hopefully, someone can tell me where I messed it up.


----------



## graham-xrf

Now trying for something like 15fA/√Hz JFET augmented transimpedance amplifier!


----------



## homebrewed

Playing around with my LTSpice simulation, your numbers don't look too far out of line:  with 1e-16 coulombs delivered as a 10us triangular pulse I get a peak voltage of around 10mV.  Not inconsistent with what I see coming out of my PocketGeiger, with the exception of some giant pulses that may be due to something else like cosmic rays.


----------



## homebrewed

This kind of detection efficiency is not confined to solid state detectors.  A look at "high performance" scintillator crystals that have a good proportional response to x-rays showed that they generate something like 30-60 photons per Kev, so low-noise electronics are needed for them as well.

All this might seem discouraging but we already know that the Theremino and Open Physics Lab folks have done this kind of stuff.


----------



## graham-xrf

homebrewed said:


> This kind of detection efficiency is not confined to solid state detectors.  A look at "high performance" scintillator crystals that have a good proportional response to x-rays showed that they generate something like 30-60 photons per Kev, so low-noise electronics are needed for them as well.
> 
> All this might seem discouraging but we already know that the Theremino and Open Physics Lab folks have done this kind of stuff.


I can get in a flap sometimes 
One has to look carefully at datasheet, and appreciate the difference between a noise _voltage_ specification and a noise _current_ specification, and why both are important.
The *LTC6269* dual opamp I was after using has a voltage noise (1MHz) of only *4.3nV/√Hz*
It has a current noise (100kHz) of only *5.5fA/√Hz*
It has input capacitance of *450fF *
It has a bias current of *3fA*

Just as it is, without the front-end FET, that matches ultralow noise JFET IFN147 + opamps design from Linear Tech.
We should be able to see 3pA.

I got the LTC6269, not only because of the noise performance and gain-bandwidth product, but also because of the package being able to go straight onto the Pocket-Geiger board for experimentation. I forgave the high price (£10.42). Now, I will be going after my own amplifier PCB direct. I just can't do the stuff I want to on the Pocket-Geiger. Also, putting the diode on it,s own little board at right angles off one end edge of the amplifier makes it easier to swap out - like when we discover a different photodiode.

There are other low noise opamps, including one which has actual through-board pins!
I won't use through holes, but I am thinking to try one of the Linear Technology types that that come in small outline SO8, and SO16.
The layout I intend will have a guard ring, and a ground plane under the feedback resistor.
I think there are opamps costing in the range £3 to £6 that might well work just fine.
I have brought out my (somewhat older) digital scope. From "Hewlett Packard" before they became "Keysight".
It's a 54520A, dual channel 500MSa/sec 500 MHz thing.
We shall  see.


----------



## graham-xrf

@homebrewed  :
*Re: The Size of Components*
I am making some choices now, looking ahead so they don't come back and give me a hard time later.

So far, I have a main amplifier that has a tiny MSOP package. It happens to fit on one main place on the old Pocket Geiger board, and also the supplier, (Mouser) only keeps stock of MSOP and DFN-10 style parts of the LTC6869 Linear Technology amplifier.

The data sheet shows that is also manufactured with a SO8 package, which would be a whole lot easier to handle.
Recognizing that SO8 may be harder to come by, then regardless of the outlets for a SO8 package version, we have the option of just choosing an amplifier that is more available in SO8. It does not have to be the first I found, and if it was cheaper than the £10.40, so much the better.

This stuff would not matter if one was designing with the intention of commissioning the manufacture of lots of PCBs, pre-assembled by some robotic thing, but for us, we need to experiment with them with our big shaky fingers, and maybe help some folk get a few of them together. Thus I am trying for a build that uses SO size stuff, where I can. It's an intention really. The 16-bit ADC was inevitably in a 0.5mm pitch quad flatpack!

OK, OK, so you can guess that I spent a while closely searching the floor - again!


----------



## WobblyHand

graham-xrf said:


> @homebrewed  :
> *Re: The Size of Components*
> I am making some choices now, looking ahead so they don't come back and give me a hard time later.
> 
> So far, I have a main amplifier that has a tiny MSOP package. It happens to fit on one main place on the old Pocket Geiger board, and also the supplier, (Mouser) only keeps stock of MSOP and DFN-10 style parts of the LTC6869 Linear Technology amplifier.
> 
> The data sheet shows that is also manufactured with a SO8 package, which would be a whole lot easier to handle.
> Recognizing that SO8 may be harder to come by, then regardless of the outlets for a SO8 package version, we have the option of just choosing an amplifier that is more available in SO8. It does not have to be the first I found, and if it was cheaper than the £10.40, so much the better.
> 
> This stuff would not matter if one was designing with the intention of commissioning the manufacture of lots of PCBs, pre-assembled by some robotic thing, but for us, we need to experiment with them with our big shaky fingers, and maybe help some folk get a few of them together. Thus I am trying for a build that uses SO size stuff, where I can. It's an intention really. The 16-bit ADC was inevitably in a 0.5mm pitch quad flatpack!
> 
> OK, OK, so you can guess that I spent a while closely searching the floor - again!


@graham-xrf think you are making a fuss out of these component sizes.  I have used DFN-8 and MSOP-8 parts on adapter boards.  Using a stereo microscope so you can see what you are doing, put some tiny dabs of solder paste on the pads.  Position the part on top of the paste.  It doesn't have to be perfect to work, since the solder surface tension will align the part.  A little hot air, and you can breadboard the assembly as if it were a DIP.  It really isn't that hard, even with my wobbly hands.  The hot air need not be very forceful, in fact it is better if it is gentle.  It is surprisingly easy to do.  The hot air guns are rather inexpensive and great for this or repair work.

I, like you, would rather work with slightly bigger parts, but alas, they are hard to find.  Attempted to source some parts from all over the world, but they were unavailable.  Or, they said they had them and later cancelled my order after a month.  Adapter boards were my solution.  Not elegant, but functional.  Like you, I've spent a bit of time on the floor looking for parts that have flown off to who knows where.  Maybe 1/2 the time I find them.  I continue to look if they are one of a kind.


----------



## WobblyHand

Is this the basic circuit that you (two) have started from?


I presume you are using a different amplifiers?  (LTC6869? and ?)  Is anyone here sharing schematics, or are you keeping them private?  I have used LTSpice before, simulated my Chebychev active filter on it.  Did find it didn't do that well for dc offset issues.  Had to make changes in situ to get my filter to work.  (Saturation from multiple DC coupled stages.)  Made two different boards, each one needed tweaks to get them to work.

Have to ask a pointed question, will this basic x-rf machine be open source?  If it is, I'm very interested.  But it's hard to keep up with you since a lot of details are seemingly hard to find in this voluminous thread.  If you could point me to a schematic that is "a rough snapshot in time but mostly works", I'd appreciate it.  It would be fun to build up and try it out.


----------



## homebrewed

I've soldered QFN and DFN parts down using a hot plate.  As @WobblyHand has mentioned, surface tension does a pretty good job of aligning parts -- it's pretty cool to see the part scoot over and center itself once the solder melts.  I now have a toaster oven for the purpose, although I haven't used it for that yet.  It was much cheaper than a lab-grade hot plate, and at that point it was my dime, not my company's.

For hand-applying parts to boards, especially ones with leadless packages, I found it handy to add silk screen registration marks around their footprints -- it makes it a lot easier to place them near their final location.  That was back when I used expressPCB a lot.  They didn't have much in the way of footprints for QFN/DFN packages so I had to create them.  After that much effort it was a relatively minor thing to add registration marks, usually at the corners.

Nowadays I use EasyEDA for the PCB design and their associated PCB fab arm, JCPCB, for the boards.  Web-hosted and a pretty decent parts library.  They have an autorouter but I found it more annoying than useful.


----------



## homebrewed

WobblyHand said:


> Is this the basic circuit that you (two) have started from?
> View attachment 392587
> 
> I presume you are using a different amplifiers?  (LTC6869? and ?)  Is anyone here sharing schematics, or are you keeping them private?  I have used LTSpice before, simulated my Chebychev active filter on it.  Did find it didn't do that well for dc offset issues.  Had to make changes in situ to get my filter to work.  (Saturation from multiple DC coupled stages.)  Made two different boards, each one needed tweaks to get them to work.
> 
> Have to ask a pointed question, will this basic x-rf machine be open source?  If it is, I'm very interested.  But it's hard to keep up with you since a lot of details are seemingly hard to find in this voluminous thread.  If you could point me to a schematic that is "a rough snapshot in time but mostly works", I'd appreciate it.  It would be fun to build up and try it out.


Similar, but not exactly.  The starting point is the PocketGeiger, sold by Sparkfun.  It uses a 10x10 silicon PIN diode for the detector.  The bias voltage is higher, about 25V, generated by an on-board switcher.  For about $70 you get the detector and electronics.  If bought on its own from Digikey you will pay more than that for just the detector!


----------



## graham-xrf

WobblyHand said:


> @graham-xrf think you are making a fuss out of these component sizes.  I have used DFN-8 and MSOP-8 parts on adapter boards.  Using a stereo microscope so you can see what you are doing, put some tiny dabs of solder paste on the pads.  Position the part on top of the paste.  It doesn't have to be perfect to work, since the solder surface tension will align the part.  A little hot air, and you can breadboard the assembly as if it were a DIP.  It really isn't that hard, even with my wobbly hands.  The hot air need not be very forceful, in fact it is better if it is gentle.  It is surprisingly easy to do.  The hot air guns are rather inexpensive and great for this or repair work.
> 
> I, like you, would rather work with slightly bigger parts, but alas, they are hard to find.  Attempted to source some parts from all over the world, but they were unavailable.  Or, they said they had them and later cancelled my order after a month.  Adapter boards were my solution.  Not elegant, but functional.  Like you, I've spent a bit of time on the floor looking for parts that have flown off to who knows where.  Maybe 1/2 the time I find them.  I continue to look if they are one of a kind.


Sadly, you are right about the availability in bigger packages. Al lot of the best stuff is only available in those DFN packages that don'y have pins as such. OK then, if you think tiny dabs of solder paste and apply heat works OK, then we try that.


----------



## WobblyHand

graham-xrf said:


> OK then, if you think tiny dabs of solder paste and apply heat works OK, then we try that.


All I can say it works for me.  Having good hands free magnification is necessary.  Sometimes I need both hands to place the part just so.  I use a wood toothpick and tweezers, or two tweezers to move the part sometimes.  Why two?  I use one as a pivot point, and the other to tap in place.

I've never soldered DFN with an iron.  Just with hot air.  Here's a slightly misfocused pic of an LT6237 DFN-8 soldered on a DIP adapter using the method I described.  Was hard to keep the phone still enough!  There's not enough room on the package to put the part number on it, the manufacturer has to use a shorthand code.


----------



## homebrewed

Regarding the open-source question, I can't speak for Graham, but my intent is to make all of my contributions open-source.  Given the fact that so far the development has been on a publically-accessible forum, this just makes sense to me.  Especially since there are lots of members who have (by helping to fund the forum) indirectly supported this.


----------



## graham-xrf

WobblyHand said:


> Is this the basic circuit that you (two) have started from?





WobblyHand said:


> View attachment 392587


Op-Amp circuits always manage to look similar, even with subtleties.
Yes - we do have a trans-impedance amplifier. The one you posted is exactly What it says. It is a "detector". It counts pulses it makes, hence the differentiator, which basically signals a waveform has changed at some rate faster than usual. My TIA amplifier is different.

Back in the thread, we have had discussions and many simulations. None of it is "private", though it has occurred to me that if we make something ragingly successful, some oriental git will produce a version in a plastic box with nickel paint on the inside. I am open source.

Post #403 on page 41 shows us noise modeling.
Post #421 on page 43 shows Mark's first explorations of signal on the Pocket-Geiger board.
Post #425 was me simulating the front-end circuit gragment with an artificial photon current. Note the new gain distribution, and bandwidth sufficient to preserve the pulse shape, and hence its area energy analogue.
Here is the image..



I went for complete recovery of all the photon energy the diode would give up, it's amplitude, and it's duration, with an integrated area under it's curve either fully calculated, or (better), maybe high-speed peak-detect approximated, and it's amplitude captured. The intent is to be able to tell what mix of energies were in there, and apply some discrimination logic to assigning counts.

I went for as low noise as possible, with enough gain in the first stage to put the (amplified) noise beyond being increased by subsequent gain stages, so locking in the signal-to-noise ratio. The subsequent stages provide differential gain to drive the ADC, which is 16-bit, sampling fast enough to get the pulse captured. They can also incorporate a 50/60 Hz notch filter. In my circuit, I use every trick I can to shunt the noise, and avoid overshoots at zero. I will post the whole thing, when I have done making mistakes with it.


----------



## WobblyHand

homebrewed said:


> Similar, but not exactly.  The starting point is the PocketGeiger, sold by Sparkfun.  It uses a 10x10 silicon PIN diode for the detector.  The bias voltage is higher, about 25V, generated by an on-board switcher.  For about $70 you get the detector and electronics.  If bought on its own from Digikey you will pay more than that for just the detector!


Good tip on getting the PocketGeiger from Sparkfun.  Looking at the Sparkfun schematic, it appears nearly the same as the schematic I posted, with the first two amplifiers.  (Same part number!  Same basic idea.)  It is nice that they showed the resistors in series for the first stage, so it would reduce the capacitance.  The schematics differ in the output drive, being a comparator.  Actually there are two comparators, each with a different threshold.  One is filtered (the signal) with a fat cap across the comparator output (which isn't great practice) and the other without a cap (noise detections?).

What are you doing after the first two amplifiers?


----------



## homebrewed

The detector P/N:  X100-7.  I didn't find it on Digikey but Mouser carries it.  $110.47USD.  Interestingly, you can get it with a CsI(Tl) scintillator crystal attached to it for about $70 more.  However, if I was to take the scintillator route I probably would spring for a SiPM-based system.  Lots of gain with pretty low noise.


----------



## WobblyHand

graham-xrf said:


> Op-Amp circuits always manage to look similar, even with subtleties.
> Yes - we do have a trans-impedance amplifier. The one you posted is exactly What it says. It is a "detector". It counts pulses it makes, hence the differentiator, which basically signals a waveform has changed at some rate faster than usual. My TIA amplifier is different.
> 
> Back in the thread, we have had discussions and many simulations. None of it is "private", though it has occurred to me that if we make something ragingly successful, some oriental git will produce a version in a plastic box with nickel paint on the inside. I am open source.
> 
> Post #403 on page 41 shows us noise modeling.
> Post #421 on page 43 shows Mark's first explorations of signal on the Pocket-Geiger board.
> Post #425 was me simulating the front-end circuit gragment with an artificial photon current. Note the new gain distribution, and bandwidth sufficient to preserve the pulse shape, and hence its area energy analogue.
> Here is the image..
> View attachment 392590
> 
> 
> I went for complete recovery of all the photon energy the diode would give up, it's amplitude, and it's duration, with an integrated area under it's curve either fully calculated, or (better), maybe high-speed peak-detect approximated, and it's amplitude captured. The intent is to be able to tell what mix of energies were in there, and apply some discrimination logic to assigning counts.
> 
> I went for as low noise as possible, with enough gain in the first stage to put the (amplified) noise beyond being increased by subsequent gain stages, so locking in the signal-to-noise ratio. The subsequent stages provide differential gain to drive the ADC, which is 16-bit, sampling fast enough to get the pulse captured. They can also incorporate a 50/60 Hz notch filter. In my circuit, I use every trick I can to shunt the noise, and avoid overshoots at zero. I will post the whole thing, when I have done making mistakes with it.


Ah, thanks.  Was replying to @homebrewed while you were posting.  I'll take a look.  Hopefully I can get an updated version of LTSpice to work on my linux PC.  The work that I did on my 7 pole filter was on an earlier PC whose motherboard failed.


----------



## graham-xrf

WobblyHand said:


> Good tip on getting the PocketGeiger from Sparkfun.  Looking at the Sparkfun schematic, it appears nearly the same as the schematic I posted, with the first two amplifiers.  (Same part number!  Same basic idea.)  It is nice that they showed the resistors in series for the first stage, so it would reduce the capacitance.  The schematics differ in the output drive, being a comparator.  Actually there are two comparators, each with a different threshold.  One is filtered (the signal) with a fat cap across the comparator output (which isn't great practice) and the other without a cap (noise detections?).
> 
> What are you doing after the first two amplifiers?


I be mulling over what to do up the front end, and how to get a noise-less bias, and how not to contaminate instrumentation capable of detecting a single photon with racket from downstream circuits, including clocked computers.
Have a look at articles from Analog Devices expert ex-Trappist Monk (I kid you not)!

The need for a very high gain-bandwidth product comes from the need to pack as much gain as possible in the first stage. The higher the gain, the slower it goes. The pulses we need are past the peak in about 6uS, and descend back to zero by about 13uS - unless a new incoming pre-empts that.

My final circuit draws from this, and other, transimpedance photo-amplifiers.


----------



## homebrewed

WobblyHand said:


> Good tip on getting the PocketGeiger from Sparkfun.  Looking at the Sparkfun schematic, it appears nearly the same as the schematic I posted, with the first two amplifiers.  (Same part number!  Same basic idea.)  It is nice that they showed the resistors in series for the first stage, so it would reduce the capacitance.  The schematics differ in the output drive, being a comparator.  Actually there are two comparators, each with a different threshold.  One is filtered (the signal) with a fat cap across the comparator output (which isn't great practice) and the other without a cap (noise detections?).
> 
> What are you doing after the first two amplifiers?


The second amplifier's output is routed to one of a set of on-board test points so it's relatively easy to tap into the analog signal.  We need that to pick off the peak height of the pulse.  For XRF purposes, we aren't using the comparator outputs.

At present I'm attempting an approach based on the Theremino scheme, which performs some pretty severe filtering -- increasing the pulse width to 80-100uS.  Among other things, this permits the use of sound-card ADCs to acquire the data (although I'm first going to try using my Teensy4.0's ADC).  To improve the effective SNR of each pulse I'm going to perform a least-squares fit to the data around the peak -- using the Teensy to do that.  It has its own FPU and runs at 600MHz so it's no slouch.


----------



## WobblyHand

graham-xrf said:


> I be mulling over what to do up the front end, and how to get a noise-less bias, and how not to contaminate instrumentation capable of detecting a single photon with racket from downstream circuits, including clocked computers.
> Have a look ate articles from Analog Devices expert ex-Trappist Monk (I kid you not)!
> 
> The need for a very high gain-bandwidth product comes from the need to pack as much gain as possible in the first stage. The higher the gain, the slower it goes. The pulses we need are past the peak in about 6uS, and descend back to zero by about 13uS - unless a new incoming pre-empts that.
> 
> My final circuit draws from this, and other, transimpedance photo-amplifiers.


Haven't seen Mr. Brisebois   But, well aware of the challenges of analog pulse processing.  Had to do some work with an impulse like radar.  I've used GHz GBW OP amps for challenging designs.  Thanks for updating your schematics.  It has been illuminating.


----------



## graham-xrf

WobblyHand said:


> Hopefully I can get an updated version of LTSpice to work on my linux PC.  The work that I did on my 7 pole filter was on an earlier PC whose motherboard failed.


On my LinuxMint, I just installed Wine from the repository, and I threw in WineTricks.
Then I fetched LTspice64.exe from --> HERE
Right-click on it, and you get to "Open with Wine Windows Program Loader"
It makes a hidden .wine folder in your home folder.
Inside that, is an artificial drive_c
No need to do anything except agree to the install.
It will fetch the very latest of all Analog Devices and Linear Technology semiconductor products that have SPICE simulation models.
and .. it runs.

Be cautioned that we sometimes have to adjust the simulation current minimums, voltage ranges, and time increments to get it to not run into never-never land. Our circuits use femtoAmps. Sometimes, you have to put a resistance across a capacitance that is "not really there", just to prevent a divide-by-zero. Use 1E18 ohms. or something ridiculous!


----------



## WobblyHand

Gee, one can still get an IFN 147, but it's $17.23.  That's a problem with some of these old articles (21 years!), what was common then, may not be now.  

The LTC6269 is a good choice.


----------



## WobblyHand

graham-xrf said:


> On my LinuxMint, I just installed Wine from the repository, and I threw in WineTricks.
> Then I fetched LTspice64.exe from --> HERE
> Right-click on it, and you get to "Open with Wine Windows Program Loader"
> It makes a hidden .wine folder in your home folder.
> Inside that, is an artificial drive_c
> No need to do anything except agree to the install.
> It will fetch the very latest of all Analog Devices and Linear Technology semiconductor products that have SPICE simulation models.
> and .. it runs.
> 
> Be cautioned that we sometimes have to adjust the simulation current minimums, voltage ranges, and time increments to get it to not run into never-never land. Our circuits use femtoAmps. Sometimes, you have to put a resistance across a capacitance that is "not really there", just to prevent a divide-by-zero. Use 1E18 ohms. or something ridiculous!


Thanks.  Seems like the installation is similar to what I did years ago.  That's good.

_Hmm, installed wine and winetricks.  I'm not getting the option to open with wine at all.  No .wine directory in home.  Then I executed 
$ wine LTspice64.exe.  This did create the .wine directory.  Seems to want wine32 which is ridiculous.  And is recommending I add architecture i386 and update apt.  Ack, I don't want to pull in 32 bit crap, do I?  Seem to remember this from last time...  apt install wine32 wants to pull in 145MB. Is this what you had to do?_


		Code:
	

$ wine LTspice64.exe
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first.  as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first.  as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"
002b:err:module:__wine_process_init L"Z:\\home\\WobblyHand\\LTspice64.exe" not supported on this system


I've done Spice work before.  Familiar with playing with settings, especially for very fast transient simulations.  Can test your patience.  Recall modeling a step recovery diode to be able to make a very short impulse.


----------



## graham-xrf

WobblyHand said:


> Gee, one can still get an IFN 147, but it's $17.23.  That's a problem with some of these old articles (21 years!), what was common then, may not be now.
> 
> The LTC6269 is a good choice.


Would you believe a IFN147 was just a 2SK147 from Japan, slightly reworked to keep available replacements, decades ago, after production stopped? Then everybody got in on the act. You can get SMP147 from Mouser, and it does not cost 17 bucks!
You can get NSVJ3557SA3T1G, (Mouser code 863NSVJ3557SA3T1G) for £0.347. I bought 10

Regarding your adventures with Wine, That should not happen! There is something wrong. Please say you do not have a 32-bit system loaded onto a 64-bit computer! Installing Wine really should create the whole thing.

I happen to have LinuxMint (Mate edition). Right-clicking on anything brings up a list of options about what to do with it.
Like this -->

View attachment WineStart.mp4

It worked for me.


----------



## whitmore

graham-xrf said:


> I am trying for my circuit board right now, and getting the ADC working in a trivial way, just doing the basics.



The traditional pulse analysis uses a single-slope converter, i.e. a Wilkinson ADC; it generates a 
logic output that can trigger a short o'scope digitization, and has some dead time while the 
charge bleeds away.   At only a few dozen counts per second,  dead time won't be much of a problem;
any microcontroller-type CPU with counters completes the measurement, OR maybe that
o'scope can log a few thousand peaks for offline analysis.  I dislike most  of the DSO 
triggers, but if you get one to work, the Wilkinson scheme is still a good 
pulse stretcher/return-to-zero mechanism.  A multichannel 'scope with two different gains
set will improve resolution on low-level  pulses.


----------



## WobblyHand

Oh, I was wrong.  145MB of archives.  1.1GB additional disk space required for adding 32 bit stuff to my system!  That's *atrocious*.  Can this be right?  For *LTspice64.exe* to run on wine?


----------



## graham-xrf

whitmore said:


> The traditional pulse analysis uses a single-slope converter, i.e. a Wilkinson ADC; it generates a
> logic output that can trigger a short o'scope digitization, and has some dead time while the
> charge bleeds away.   At only a few dozen counts per second,  dead time won't be much of a problem;
> any microcontroller-type CPU with counters completes the measurement, OR maybe that
> o'scope can log a few thousand peaks for offline analysis.  I dislike most  of the DSO
> triggers, but if you get one to work, the Wilkinson scheme is still a good
> pulse stretcher/return-to-zero mechanism.  A multichannel 'scope with two different gains
> set will improve resolution on low-level  pulses.


Indeed, one of my circuits does use a trigger.
For the amount of radiation we can muster, the pulse rate is pretty slow. It would never strain any ADC for speed. That is not the reason we require high gain-bandwidth product stuff, nor why we try to get 20 samples across a pulse. A gain of 2 to 4 billion, and still looking at a 6uS rise time, is not so easy! The FET-augmented opamp does that. I went for a 500K gain in the first stage. You are right about the scope techniques. The trouble is, we need to end up with a gadget that measures without having a whole scope. Ideal is just a circuit board USB, or WiFi, or BlueTooth, or something, using a smartphone display.

It is the "pulse stretching" that masks the energy we are trying to represent. It's no problem if all we want to get is the count of arrivals, but the slowed down, low-pass filtered pulse loses much of the amplitude information that allows discrimination into allocating that energy into "bucket accumulator" counts. The necessary thing is to get the area under the roughly triangular pulse waveform, or some good approximation thereof, because Charge x Time integration = Energy

It may be that a stretched pulse, triggered, gated, with other incoming locked out until "reset", offered at a ADC might still have a good enough relationship to the photon electron-volts that arrived at the diode. Such was the Theremino. I was critical of, and I doubted the principle, and I did not like it! Thus, what I am trying is what makes sense to me.

Early on, I was excited about the prospect that a design like that, so simple, so easy, could deliver the kind of plots we all want. I was disappointed. Almost never has something I thought marginal in concept ever agreeably surprised me. I always want for it, and wish for it, and sometimes have my judgement temporarily clouded by it. If someone can make it do this stuff some "easier" way, I will be celebrating!


----------



## graham-xrf

WobblyHand said:


> Oh, I was wrong.  145MB of archives.  1.1GB additional disk space required for adding 32 bit stuff to my system!  That's *atrocious*.  Can this be right?  For *LTspice64.exe* to run on wine?


I didn't look at what happened with mine, but would agree.
Something is still in a mess. You should not be dealing with 32-bit anything. It was called LTspice64.exe for a reason!
LTspice64.exe is 56.3MB.

My entire .wine folder is 16,667 items totalling 2GB on disk. That gives one some perspective on the other OS that runs this stuff.
Within that, the LTC program folder is 113.4MB as installed.
The parts library in that is 6881 items using 55.6MB.

Chase this down, because it does not make sense!
1.1GB is carrying something "else" with it, possibly stuff you would not want.


----------



## graham-xrf

@homebrewed 
I checked out EasyEDA. Clearly it supports open source projects. I see it is web-based, so maybe not for me.
I have installed KiCad (also open source), and I am just getting used to it. It's kind of like Altium, but better.
I do agree about open source, and the facility we have from HM. Maybe we should try not to have this already infamous thread make 100 pages


----------



## homebrewed

WobblyHand said:


> Ah, thanks.  Was replying to @homebrewed while you were posting.  I'll take a look.  Hopefully I can get an updated version of LTSpice to work on my linux PC.  The work that I did on my 7 pole filter was on an earlier PC whose motherboard failed.


LTSpice works pretty good under Wine/Ubuntu.  The only small drawback is that you have to manually update it when a new version comes out.

My main quibble with LTSpice is that it sometimes fails to converge to a solution.  Sometimes changing a component value just a small amount will get it to converge so there's some funny business going on under the hood.  The program usually says something like the maximum time step is too small, but I really don't believe that's the problem.


----------



## WobblyHand

graham-xrf said:


> I didn't look at what happened with mine, but would agree.
> Something is still in a mess. You should not be dealing with 32-bit anything. It was called LTspice64.exe for a reason!
> LTspice64.exe is 56.3MB.
> 
> My entire .wine folder is 16,667 items totalling 2GB on disk. That gives one some perspective on the other OS that runs this stuff.
> Within that, the LTC program folder is 113.4MB as installed.
> The parts library in that is 6881 items using 55.6MB.
> 
> Chase this down, because it does not make sense!
> 1.1GB is carrying something "else" with it, possibly stuff you would not want.


Beats me what is going on.  Seems like there's an awful lot of crap that was necessary.  Can't find any notes out there about something like this.  I have wine 5.0 installed.  Something is badly configured, probably the packagers defaults.  Nonetheless, I have a copy of LTspice updated to Oct 2021, which is pretty good.  At least the library is up to date, which is better than my previous installation.  Wish there wasn't so much baggage needed!  My LTC folder is the same size as yours = 113MB.  .wine folder is 11,875 items, totalling 164MB.

Look and feel seems pretty dated.  But it is a darned good simulator, so I'll keep it for a bit.  Now I have to hunt down my old files...


----------



## graham-xrf

@WobblyHand  : LTSpice has added it's graphical input, and little tools to edit values, invoke runs, etc. Underneath, it still is the Spice engine. They have added some "commands" of their own that can live in the the netlist. There are expansive explanations on the internet about it's history, the differences between it, and other "Spices", and which tool can incorporate it. A long time ago, other simulation tools have also sought to leverage matrix solutions for electric networks. There are even EDA schematic tools that can add in various Spices to provide simulation feature to their suite.
I have seen a Python script that can take a LTSpice circuit, and have the circuit be drawn KiCad EDA suite.

More commonly, the expansive open source SPICE simulator is ngspice, which is invoked by tools like Qucs, gEDA, and KiCad.
LTSpice was offered free as a switched-mode power supply design aid, with example circuits already loaded into the library, all using the company's products. Of course, for it to do that, it would also work as a general purpose electrical network simulator, and there were decades of available Spice models. The hard way was to make the simulator fight through simulating equivalent sub-circuits, but of course, the huge speed was gained by using math function generated outputs from models, bypassing the sub-circuits

For most of us, even though we are not as often into switch-mode PSU circuits, we can use LTSpice to at least get a design checked out enough to risk purchase of parts, and a prototype. It is just serendipity that Linear Technology joined with Analog Devices, and so we get all the transistors and op-amps from both companies provioded in the LTSpice library


----------



## WobblyHand

I've used Pspice, Orcad, KiCad, gEDA, TI's TINA, LTspice and a few others.  Of all of them, I found Pspice easiest to use, especially adding or creating new models.  Of course, Pspice went away, consumed by Orcad, who was in turn eaten by Cadence.  Every generation of the program got harder and harder to use and exceedingly more expensive.  Cadence made it excruciatingly painful to work with them.   You had to prove you had your maintenance contract was current, before you could even look in their online reference materials.  Basically a paywall to even see the documentation.  Their web site was awful and designed to waste your time.  Miserable, wretched company. 

Gave it up for a while.  Finally found some little company that was called 5spice who had a spice program for a minor amount of money.  Used that for quite a few years.  If I had a question on the tool, I could send an email and get a coherent answer within a day.  Unfortunately, I think the gentleman stopped supporting the product in 2018.  Was a pity, as it was a very good value.

So LTspice, is a relative breath of fresh air.  It works, and isn't too hard to use.  If you need help, you can actually send a message to them and get a thoughtful answer, without waving around a paid multiple $1000 maintenance contract number.  As you noted, Analog Devices purchased Linear Technology, and just last year they bought Maxim.  So hopefully there will be even more parts added to the library.  One can add "foreign" models to the program without a horrible fuss.  So, LTspice is really quite good.  My only (minor) complaint are the fonts, which make it harder for these aging eyes to see.

Sorry for the sidetrack.  Back to circuits and housings and machining.
Edit: changed a company name.


----------



## homebrewed

I've found it is pretty easy to use third-party SPICE models in LTspice.  I got a model for the LMC662 so I could simulate the analog portion of the PocketGeiger and results look OK to me.  Of course, the accuracy of your results depends on the quality of the model.  I haven't tried a noise simulation so have nothing to say there.

Also, not all ADI amplifiers are in the LTspice library.  Not too surprising, considering how many devices they offer.  It will be interesting to see if program updates start to include Maxim parts.  I have a particular interest in that regard because I worked for Maxim up to October, 2016.  I worked in their failure analysis lab and got to work on a huge variety of devices -- analog, digital, RF, A/D, D/A, you name it.  Prior to that, I worked in the Tektronix FA lab.


----------



## WobblyHand

@graham-xrf tried modeling your circuit.  The second pulse param setting.  Seems to be taking forever.  Do you happen to know what you changed to get things to speed up?  A configuration setting, or an initial condition?  The sim is using quite a few cores, but I can't interpret how much longer to completion.  It's been many minutes, so I thought I'd ask.  I initially ran it with the shorter pulse, but cancelled the sim.  The pulse shape looks wrong, so I must have interpreted something incorrectly.

Hadn't seen that offset ground done that way before.  Did you change ground?  Sometimes that messes up spice.  Kind of just copied the schematic without much thought so see if I could get something out of it.  Going to require a bit more finesse than that, I can see!

It's a convergence/initial condition problem.  Tried a 10G to ground on the Iph side of the cap, but that isn't doing it.  Nor is adding cshunt=1e-15.
Gee, it's only been a year since I last simulated, forgetting things already . 

Kind of confused why the Pseudo-transient analysis is showing 132ms, so far, when I have the directive .tran 0 20u 0 20n.  Dang, hard to get back doing this stuff!  Going to have to try some simpler stuff first!  I need to get the pulse to work right, it isn't as expected.

Fixed the issue.  This version of spice does not like your schematic.  I changed the ground symbol to Vb, because it really is a bias voltage, and connected Vss to GND.  When I did that, the circuit converged.  Prior to that, I could even get a DC operating point.  I get a pulse now.  One thing concerns me is the DC operating point of the capacitive input to the first stage is a ridiculous 76kV.  This is due to the 2mA current source across a 40Meg resistor.  Guess this is part of your diode model, to get the right characteristics.


----------



## homebrewed

WobblyHand said:


> Good tip on getting the PocketGeiger from Sparkfun.  Looking at the Sparkfun schematic, it appears nearly the same as the schematic I posted, with the first two amplifiers.  (Same part number!  Same basic idea.)  It is nice that they showed the resistors in series for the first stage, so it would reduce the capacitance.  The schematics differ in the output drive, being a comparator.  Actually there are two comparators, each with a different threshold.  One is filtered (the signal) with a fat cap across the comparator output (which isn't great practice) and the other without a cap (noise detections?).
> 
> What are you doing after the first two amplifiers?


FYI, the comparators on the PocketGeiger are open-collector devices.  So the capacitor on the output really is a poor man's pulse stretcher.  It took me awhile to figure that one out.  Then it was a  moment....


----------



## homebrewed

WobblyHand said:


> @graham-xrf tried modeling your circuit.  The second pulse param setting.  Seems to be taking forever.  Do you happen to know what you changed to get things to speed up?  A configuration setting, or an initial condition?  The sim is using quite a few cores, but I can't interpret how much longer to completion.  It's been many minutes, so I thought I'd ask.  I initially ran it with the shorter pulse, but cancelled the sim.  The pulse shape looks wrong, so I must have interpreted something incorrectly.
> 
> Hadn't seen that offset ground done that way before.  Did you change ground?  Sometimes that messes up spice.  Kind of just copied the schematic without much thought so see if I could get something out of it.  Going to require a bit more finesse than that, I can see!
> 
> It's a convergence/initial condition problem.  Tried a 10G to ground on the Iph side of the cap, but that isn't doing it.  Nor is adding cshunt=1e-15.
> Gee, it's only been a year since I last simulated, forgetting things already .
> 
> Kind of confused why the Pseudo-transient analysis is showing 132ms, so far, when I have the directive .tran 0 20u 0 20n.  Dang, hard to get back doing this stuff!  Going to have to try some simpler stuff first!  I need to get the pulse to work right, it isn't as expected.


Not sure why your transient analysis is going out to 132ms either.  I'd guess you have some other time-related parameter that's messing up the simulation time.

Regarding convergence, using an opamp to generate Vcc/2 just throws more stuff at the simulator to solve.  For quick & dirty I just use another voltage source.  Not to say that this approach will solve your problem, but it's worth trying.


----------



## WobblyHand

homebrewed said:


> Not sure why your transient analysis is going out to 132ms either.  I'd guess you have some other time-related parameter that's messing up the simulation time.
> 
> Regarding convergence, using an opamp to generate Vcc/2 just throws more stuff at the simulator to solve.  For quick & dirty I just use another voltage source.  Not to say that this approach will solve your problem, but it's worth trying.


Was the misuse of "ground".  @graham-xrf had a tricky circuit whose _ground symbol _was attached to 0.4V.  My copy of spice didn't like it!  Caused all sorts of convergence issues.  Clues were the OPamp nodes were having singularity issues.  I just redid the circuit in a more conventional way and called this new voltage Vb and attached it to the nodes.  Then all was fine.  Equivalent circuit that spice thought was ok.  I get a pulse of roughly 60 mV for a 500pA exponential pulse similar to what Graham posted.  This was an exercise to get me back in the saddle.

I too, usually start out with a voltage source.  However, I have found when you do the real thing, with an op amp, you can run into surprises.  My radar frontend had this issue.  Had to simulate it so I could fix it.  Turns out it was a bad choice of op amp (TLV2461) for a simple voltage follower reference.  Used a better op amp, an AD8031 and it was a significantly better source.  Couldn't get the TLV2461 to behave well in circuit.  Sim showed it had issues.  Sim'd the AD8031 and with minor changes it was much better.  Real circuit works in practice, so I called that one a win.


----------



## graham-xrf

WobblyHand said:


> @graham-xrf tried modeling your circuit.  The second pulse param setting.  Seems to be taking forever.  Do you happen to know what you changed to get things to speed up?  A configuration setting, or an initial condition?  The sim is using quite a few cores, but I can't interpret how much longer to completion.  It's been many minutes, so I thought I'd ask.  I initially ran it with the shorter pulse, but cancelled the sim.  The pulse shape looks wrong, so I must have interpreted something incorrectly.
> 
> Hadn't seen that offset ground done that way before.  Did you change ground?  Sometimes that messes up spice.  Kind of just copied the schematic without much thought so see if I could get something out of it.  Going to require a bit more finesse than that, I can see!
> 
> It's a convergence/initial condition problem.  Tried a 10G to ground on the Iph side of the cap, but that isn't doing it.  Nor is adding cshunt=1e-15.
> Gee, it's only been a year since I last simulated, forgetting things already .
> 
> Kind of confused why the Pseudo-transient analysis is showing 132ms, so far, when I have the directive .tran 0 20u 0 20n.  Dang, hard to get back doing this stuff!  Going to have to try some simpler stuff first!  I need to get the pulse to work right, it isn't as expected.
> 
> Fixed the issue.  This version of spice does not like your schematic.  I changed the ground symbol to Vb, because it really is a bias voltage, and connected Vss to GND.  When I did that, the circuit converged.  Prior to that, I could even get a DC operating point.  I get a pulse now.  One thing concerns me is the DC operating point of the capacitive input to the first stage is a ridiculous 76kV.  This is due to the 2mA current source across a 40Meg resistor.  Guess this is part of your diode model, to get the right characteristics.


The thing about modeling circuits is that, like all apps that have to deliver real numbers, it requires meticulous attention to the handling of numbers, care in avoiding divide-by-zeros, and variable time-step convergence traps. Calculations (like ours) that span 12, or even 15 orders of magnitude, and have to use real numbers in the network matrices, without the benefit of human convenience compressions (like dBs), are a case in point. My most recent photon stimulation input circuit is only 20 pico

I have at least a couple that run into never-never land, probably calculating with tiny time steps in a futile attempt to get an answer to "converge", which it won't because the resolution is below the tolerance. I find that when I abort the calculation, there are my results anyway, Spice was banging about near zero!

Here's a tip:
For the session, use _*Tools -> Control Panel*_ , and open the "_*Compression*_" tab.
Set the Absolute Voltage tolerance from *1e-005 to 4e-008*
Set the Absolute Current tolerance from *1e-009 to 5e-011*
In my experience, the thing suddenly starts zipping along at some speit stopped getting stalled.
It pisses me off that those settings are not remembered between program invocations.

These fixes are somewhat gross, and not thought out. At least one I thought was stuck - did finally produce an answer.
Just because I am in a hurry, I don't do too much diagnosing why a particular SPICE run gets in a tangle.
I divide and conquer. I don't put the whole circuit in, having to recalculate waveforms of previous designed sections. Instead, I conjure up little math-derived substitution circuits.

When it is oscillating! I start it, I wait for 10 seconds, watching the time step, get impatient, press Esc, and put the probe on the output to discover it's oscillating like a multivibrator.

I will post some working (and problematic) simulations soon. They are .asc files. I am not sure is HM accepts those. If not, we send as .txt and rename them.


----------



## WobblyHand

graham-xrf said:


> The thing about modeling circuits is that, like all apps that have to deliver real numbers, it requires meticulous attention to the handling of numbers, care in avoiding divide-by-zeros, and variable time-step convergence traps. Calculations (like ours) that span 12, or even 15 orders of magnitude, and have to use real numbers in the network matrices, without the benefit of human convenience compressions (like dBs), are a case in point. My most recent photon stimulation input circuit is only 20 pico
> 
> I have at least a couple that run into never-never land, probably calculating with tiny time steps in a futile attempt to get an answer to "converge", which it won't because the resolution is below the tolerance. I find that when I abort the calculation, there are my results anyway, Spice was banging about near zero!
> 
> Here's a tip:
> For the session, use _*Tools -> Control Panel*_ , and open the "_*Compression*_" tab.
> Set the Absolute Voltage tolerance from *1e-005 to 4e-008*
> Set the Absolute Current tolerance from *1e-009 to 5e-011*
> In my experience, the thing suddenly starts zipping along at some speit stopped getting stalled.
> It pisses me off that those settings are not remembered between program invocations.
> 
> These fixes are somewhat gross, and not thought out. At least one I thought was stuck - did finally produce an answer.
> Just because I am in a hurry, I don't do too much diagnosing why a particular SPICE run gets in a tangle.
> I divide and conquer. I don't put the whole circuit in, having to recalculate waveforms of previous designed sections. Instead, I conjure up little math-derived substitution circuits.
> 
> When it is oscillating! I start it, I wait for 10 seconds, watching the time step, get impatient, press Esc, and put the probe on the output to discover it's oscillating like a multivibrator.
> 
> I will post some working (and problematic) simulations soon. They are .asc files. I am not sure is HM accepts those. If not, we send as .txt and rename them.


My copy of LTspice seems quirky.  The help file didn't install correctly.  I have the index and table of contents, but if I click or double click, the page is blank.  

If I set the resistor to 1Meg the simulation goes into simulate every ps mode.  But 1.0001Meg doesn't do that, nor 999.9k, they simulate in a second.  Got some bizarre saturation effects, but they went away when I changed the voltage divider ratio.  I have my bias for the LTC6269 at about 1.65V.  Seems to work ok.


----------



## whitmore

[about Wilkinson ADC]


graham-xrf said:


> It is the "pulse stretching" that masks the energy we are trying to represent. It's no problem if all we want to get is the count of arrivals, but the slowed down, low-pass filtered pulse loses much of the amplitude information that allows discrimination into allocating that energy into "bucket accumulator" counts. The necessary thing is to get the area under the roughly triangular pulse waveform, or some good approximation thereof, because Charge x Time integration = Energy



The Wilkinson scheme integrates charge during the pulse rise, so it does get half the area under the pulse; the fall time
is independent of the radiation received, depends instead on clearing stored charge out of the detector.
That trailing edge may not best serve the measurement purpose.   

As for pulse overlap, delay-line difference circuit was useful in cancelling out the
slow exponential decay characteristic.   It sounds elaborate, but just recognizes that exponential decay
is self-similar, the nanoseconds-ago value times one-plus-epsilon, subtracted from the 'now' value,
equals zero, i.e. no evidence of the old peak in the difference signal.  That kinda clobbers the
trailing edge for the measurement, of course.   We did it that way for accurate measurements anyhow.

Every two-meter Ethernet wire can give circa  32 nanoseconds of delay.


----------



## graham-xrf

WobblyHand said:


> My copy of LTspice seems quirky.  The help file didn't install correctly.  I have the index and table of contents, but if I click or double click, the page is blank.
> 
> If I set the resistor to 1Meg the simulation goes into simulate every ps mode.  But 1.0001Meg doesn't do that, nor 999.9k, they simulate in a second.  Got some bizarre saturation effects, but they went away when I changed the voltage divider ratio.  I have my bias for the LTC6269 at about 1.65V.  Seems to work ok.


OK - describing it as "quirky" seems fair. It has some quirks that I wish I could change, particularly the inability to navigate back up a directory tree when using "File -> Open". I rely on the quite long list of previously accessed files.

Between us, we can wring this thing out. I don't want to make another oscillator, and it need not have happened! In my recent previous life, dealing with a FET that still has 13dB gain at 12GHz, the gain at low frequencies (like 10MHz and down) is just so spectacular that you have to be real careful with layout, etc. Here, our transimpedance amplifier is going to take off at the least provocation. Using a guard ring, shielding from 50/60Hz magnetic and electrical influences, etc will all be standard. Beyond that, capacitance at the input, Diode bias, and a whole host of other factors have to be sort of right, or the attempts to build will get frustrating.

The venerable Bob Pease has things to say about these --> LINK Bob Pease Article re: Transimpedance
The book he refers to is attached (it's now freely available).

As a gross check, just to see how low we can go with currents, I found one can leave the LTSpice defaults alone, and still get it to work, (but not with everything I try).




This time, I include the LTSPice *.asc* file, except it is renamed with extension *.txt* , so that HM will let it upload.
*Rename* it to *TIA-Amp1x.asc*, and have a play.
Mouse over Iph, the photodiode generator, for the piece-wise defined current.
Get the probe on Vout2. See it needs more!
Want an osciillator, then start putting MegaOhms by R2.
Without the last two opamps, explore the effect of C2. I commented out the .STEP parameter.

Have a play. You can find out where I messed it up, and let me know. 
Beyond this, I am much interested in the delay-line pulse processing trick from @whitmore .
I am also looking at fast, accurate peak detectors. This is because if we can use these real fast analog tricks, we dodge a whole lot of computer needs.


----------



## WobblyHand

@graham-xrf 259 pages of reading!  Yet another rabbit hole to get lost in!  Thanks for the reference.

Got the schematic to run.  Frankly, I think an exponential pulse is perfectly suitable, as compared to the PWL one.  For one, an exponential pulse is a whole lot easier to edit!  Are you spreading out the gain to ask less of the parts?  Or is this a noise issue?

If I step the capacitance, it works as expected.  The lower the capacitance, the higher the peak from the first stage and the closer it is to the original. There's excess gain in this chain, so I can rail the output depending on the value of R2.  If I step param R2 form 1000k 4000k 500k, Vout1 is fine. No oscillation seen.  If one prevents interstage railing, everything is fine.  The negative supply is on the hairy edge, should be a bit more negative for headroom. 

Don't know what is concerning you, exactly.  Perhaps I'm totally missing the point.  This wouldn't surprise me one bit! 

Asking in excess of 40 dB of gain for U2 is a bit much, but, it seems to work, at least in simulation land.  The PWL current pulse is only 25pA high, is this this what you are expecting?  What do you expect for the dynamic range of pulses?  (Excluding cosmic rays!)  Your earlier posted circuit with two LTC6269 amplifiers ran over about 40 dB range in current pulse amplitudes. This new circuit will have worse dynamic range since there's so much gain!  I suspect that there will be a DC offset issue with all the gain, due to leakage or bias currents. 

Experienced very different behavior in my active filter between simulation and reality on DC offset.  My physical circuit was railed due to DC offset and high DC gain.  Had to hunt down and hand tweak the positive terminal resistors to get it back to center.  The simulation did not show this effect at all.  Indeed a simulation of actual values showed it wouldn't work, but it did work in practice.  So I had to keep two books, one for as simulated, and another marked up schematic, as built.  Simulators and models aren't perfect.  They get us close, most of the time, but then bench work is required.


----------



## graham-xrf

More tricky stuff as I tease out what this stuff takes to get the amplifier right.

*The (very) small quantities we have to deal with..*
I am not used to femto-Amps, and femto-Farads, and figuring what happens when as few as *1% of 379*, or as many as *2% of 25,238* electrons suddenly arrive on a reversed biased PIN diode. I want to figure out where the practical noise limitation is, to decide the gain stages. The number of electrons mentioned correspond to the lowest energy one might try for, from Magnesium *1.25360keV*, and from the lead shielding Pb *84.936keV*, assuming one had some Thorium along with the Am241 to get a gamma high enough to provoke lead.

We can get "higher" counts from lower energy stuff - like Copper. It's *8.04778keV* delivers *2438* electrons, at the part of the X-100-7 photodiode sensitivity where we get near 100% of them.

The *59.5keV* direct from a smoke detector Am241 provides a valuable calibration point. Each Am241 count delivers 18,0390 electrons. We have to allow the photodiode will only catch about 3% of them - so make that *540* electrons.

_[Edit: I had to put in the strike-through modifications. The percentages were about probability - how often a photon is intercepted. When it does, we do get the whole batch of electrons, not a percentage of them! ]_

These few electrons kind of "appear", and charge the capacitance of the photodiode. It's as if a capacitor were across a 40MegOhms resistor, and suddenly got some extra charge.
The capacitance could be (say) 60pF from 20V of bias, living with a dark current *3nA*.
The capacitance could also be (say) 85pF from 10V of bias, with dark current *2.5nA*
Go for lower dark current, capacitance is 150pF from 2V of bias, with dark current at about *1.5nA*
Zero bias lets the capacitance go ballistic as the depletion layer gets tiny. Dark current is *600pA*, but capacitance is 500pF - so no to that!

This trade-off is why one wants to have a bias voltage that can be varied. I was trying for the simplest possible arrangement of fewest components, already at the optimum value. Thus I want to figure how much noise comes from the dark current, and how much from the thermal. We already know that the noise from the amplifier input is 5.5fA/√Hz. but we want to shunt noise for frequencies lower than 100kHz. A LTC6269 will have a noise racket for 0.1Hz to 10Hz, of +/- 4uV wiggling on it's output. That's no problem if it's in the later stages. but if on the end of the first stage, that's not what we want.


----------



## WobblyHand

graham-xrf said:


> More tricky stuff as I tease out what this stuff takes to get the amplifier right.
> 
> *The (very) small quantities we have to deal with..*
> I am not used to femto-Amps, and femto-Farads, and figuring what happens when as few as *1% of 379*, or as many as *2% of 25,238* electrons suddenly arrive on a reversed biased PIN diode. I want to figure out where the practical noise limitation is, to decide the gain stages. The number of electrons mentioned correspond to the lowest energy one might try for, from Magnesium *1.25360keV*, and from the lead shielding Pb *84.936keV*, assuming one had some Thorium along with the Am241 to get a gamma high enough to provoke lead.
> 
> We can get "higher" counts from lower energy stuff - like Copper. It's *8.04778keV* delivers *2438* electrons, at the part of the X-100-7 photodiode sensitivity where we get near 100% of them.
> 
> The *59.5keV* direct from a smoke detector Am241 provides a valuable calibration point. Each Am241 count delivers 18,0390 electrons. We have to allow the photodiode will only catch about 3% of them - so make that *540* electrons.
> 
> These few electrons kind of "appear", and charge the capacitance of the photodiode. It's as if a capacitor were across a 40MegOhms resistor, and suddenly got some extra charge.
> The capacitance could be (say) 60pF from 20V of bias, living with a dark current *3nA*.
> The capacitance could also be (say) 85pF from 10V of bias, with dark current *2.5nA*
> Go for lower dark current, capacitance is 150pF from 2V of bias, with dark current at about *1.5nA*
> Zero bias lets the capacitance go ballistic as the depletion layer gets tiny. Dark current is *600pA*, but capacitance is 500pF - so no to that!
> 
> This trade-off is why one wants to have a bias voltage that can be varied. I was trying for the simplest possible arrangement of fewest components, already at the optimum value. Thus I want to figure how much noise comes from the dark current, and how much from the thermal. We already know that the noise from the amplifier input is 5.5fA/√Hz. but we want to shunt noise for frequencies lower than 100kHz. A LTC6269 will have a noise racket for 0.1Hz to 10Hz, of +/- 4uV wiggling on it's output. That's no problem if it's in the later stages. but if on the end of the first stage, thats not what we want.


If we stick to the simplistic model that you recently posted, I simulated varying Cd from 50pf to 500pf in 50pf steps (20dB) and saw a 2 dB reduction in output pulse amplitude.  860mV @ Cd=50pF, 636mV @ Cd=500pF.   That's not a whole heck of a lot.  I admittedly don't know much about these kinds of diodes, but, is the dark current that important in this circuit topology with AC coupling? 

I changed the DC dark current from 0 to 1nA, change is on the order of < 0.25% in pulse amplitude.  Got to read up on noise simulations, been a while since I've done one.


----------



## homebrewed

Practically speaking, the type of detector we're trying to use here limits the energy range we can "see", regardless of the amplifier chain design.  At lower energies the packaging starts to absorb incoming photons, and at higher energies the much-less-than 1mm width of the PIN junction means that very few are absorbed.  If 60Kev photons only have a 3% chance of being turned into hole-electron pairs inside the X100 diode, 80+Kev is even worse.

Fortunately, the X100 is most sensitive in the energy range we're mostly interested in.


----------



## graham-xrf

WobblyHand said:


> If we stick to the simplistic model that you recently posted, I simulated varying Cd from 50pf to 500pf in 50pf steps (20dB) and saw a 2 dB reduction in output pulse amplitude.  860mV @ Cd=50pF, 636mV @ Cd=500pF.   That's not a whole heck of a lot.  I admittedly don't know much about these kinds of diodes, but, is the dark current that important in this circuit topology with AC coupling?
> 
> I changed the DC dark current from 0 to 1nA, change is on the order of < 0.25% in pulse amplitude.  Got to read up on noise simulations, been a while since I've done one.


I did try to make it clear that the circuit I posted was not my TIA circuit, except in an indirect way. It was more about checking out LTSpice simulations. I do not have 4 opamps in a row like that, but what is there is useful as a passing test-bed. Try reducing the value of C3, to 100pF, or 10pF, and see the signal go away. Note that the 0V voltage source V3, my form of handy ammeter, shows a negative current pulse, only because of the way I connected it with the positive towards the op-amp.

For me, I wanted to avoid getting up to all sorts of arrangements to deal with pulses that overshoot below the base line, restoring zero, and getting any input offsets either insignificant, or compensated for,  forced the DC isolation capacitor, just like they do with PMTs.

I will post more on my design, and thinking soon. Mark's pulse-stretched amplifier has me intrigued. If he discovers  the pulses it makes do have amplitudes be a good analogue of X-Rays from metal samples, then it's a runner because it by-passes a forty bucks ADC.


----------



## WobblyHand

graham-xrf said:


> I did try to make it clear that the circuit I posted was not my TIA circuit, except in an indirect way. It was more about checking out LTSpice simulations. I do not have 4 opamps in a row like that, but what is there is useful as a passing test-bed. Try reducing the value of C3, to 100pF, or 10pF, and see the signal go away. Note that the 0V voltage source V3, my form of handy ammeter, shows a negative current pulse, only because of the way I connected it with the positive towards the op-amp.
> 
> For me, I wanted to avoid getting up to all sorts of arrangements to deal with pulses that overshoot below the base line, restoring zero, and getting any input offsets either insignificant, or compensated for,  forced the DC isolation capacitor, just like they do with PMTs.
> 
> I will post more on my design, and thinking soon. Mark's pulse-stretched amplifier has me intrigued. If he discovers  the pulses it makes do have amplitudes be a good analogue of X-Rays from metal samples, then it's a runner because it by-passes a forty bucks ADC.


Yes, I understood it wasn't your TIA circuit.  What was unclear was the actual point you were making by posting it!  Perhaps, that's due to our differing engineering styles, or that of being from one country or another.  Cultural style, is a term for it.  When one works for a multi-national company, one gets exposed to regional differences in approach to a problem.  

Now that you have pointed it out, it's a bit clearer.  Using ideal elements can be a helpful technique to isolate an issue.

Yes the whole point is to have some waveform with a characteristic that is proportional to what we would like to know, in our case, the number of signal electrons coming out of the detector.  Stretched waveforms can be fine, as long as they continue to be proportional to signal.


----------



## homebrewed

Looking at it from a theoretical standpoint, the Laplace Transform of A*f(t) = A*F(s).  By extension if we use a linear filter we know the output is proportional to the amplitude of the input.  That won't be a surprise to anyone who has spent any time at all in the vicinity of this thread.

I don't think it is a stretch to assume that the pulse height coming out of a TIA or charge amplifier being tickled by an x-ray generated event also is proportional to the total energy of the pulse, so I'm pretty confident that the amplitude of a stretched-out version of the pulse will be as well.   The pulse height of our low-pass filtered signal won't be anywhere near the height of an unfiltered pulse, but that's something that can easily be addressed with some post-filter amplification.


----------



## graham-xrf

WobblyHand said:


> Yes, I understood it wasn't your TIA circuit.  What was unclear was the actual point you were making by posting it!  Perhaps, that's due to our differing engineering styles, or that of being from one country or another.  Cultural style, is a term for it.  When one works for a multi-national company, one gets exposed to regional differences in approach to a problem.
> 
> Now that you have pointed it out, it's a bit clearer.  Using ideal elements can be a helpful technique to isolate an issue.
> 
> Yes the whole point is to have some waveform with a characteristic that is proportional to what we would like to know, in our case, the number of signal electrons coming out of the detector.  Stretched waveforms can be fine, as long as they continue to be proportional to signal.


Re: The circuit - I needed to reach for one - any one - that we could try in your LTSpice install, to see if it would run, or prang, or do something different to my experience with it. If you got the same result as me, then we would no longer be thinking your LTSpice was broken, or just different. The circuit was just one of many I  threw together, just to try out some something at the time, and discarded. I may have been trying to learn how some LTSpice feature was used. Maybe I should have tried a different one, but it was one of the few that actually still ran OK. The rest have been adjusted to death! Sorry if it was misleading.

*Re: Using contrived elements.*
Yes, I do that all the time. It's quite hard to model the arrival of a photon. Just because we have a bunch of charge that arrives, we do not yet have a "current" looking like the exponential SPICE source, or the piecewise linear make-believe. To get the photon electrons supply to become a  current, we need that charge to move in a certain time.

*Modeling the arrival of a photon*
I was thinking of using a pair of SPICE voltage-controlled switches driven by a pulse waveform, to charge a capacitor to exactly the amount of coulombs represented by some photon. Then, at the time for a pulse, the switch to the charging resistance opens, and the other switch closes, connecting that amount onto the photodiode expected capacitance, and 40M shunt resistance.  Basically the whole steady state X100-7 photodiode equivalent circuit, with it's bias and everything.

The switch contrivance that delivers the current transient can hardly help but change the charge on the input DC isolation capacitor, and so move electrons in the opamp transimpedance input.

Not limited by artificial, lossless SPICE switches, we can have more than one artificial photon, of various energies, arriving at different times. For us, one "biggest" photon, plus one "smallest" photon will do.  Then that might allow us to play with gain distribution, and even figure out how low we need go in the face of noise currents from other sources. It lets me know exactly how many stages I need, and how to drive the ADC.

I will soon go over my circuit, and the design thinking in it, and why I did what I did.


----------



## graham-xrf

homebrewed said:


> Looking at it from a theoretical standpoint, the Laplace Transform of A*f(t) = A*F(s).  By extension if we use a linear filter we know the output is proportional to the amplitude of the input.  That won't be a surprise to anyone who has spent any time at all in the vicinity of this thread.
> 
> I don't think it is a stretch to assume that the pulse height coming out of a TIA or charge amplifier being tickled by an x-ray generated event also is proportional to the total energy of the pulse, so I'm pretty confident that the amplitude of a stretched-out version of the pulse will be as well.   The pulse height of our low-pass filtered signal won't be anywhere near the height of an unfiltered pulse, but that's something that can easily be addressed with some post-filter amplification.


This relationship is something I am also convinced about, even though I thought it was strictly only true of square-wave pulses, and triangular ones comprised of two triangles put together. I like it because it saves a forty bucks ADC.
Area = 1/2 base x height. If we make the base longer, the height gets less. That's OK, because we can either start with more than we need, or give it some gain after, or a bit of both. 

As it happens, I already bought the ADC, so I decided to push it to to deliver to it's limit. Pulses from my TIA design can also be stretched with a filter afterward, if one decides to exploit the built-in audio channels in the computer end.

One thought I had about pulse stretching, was the need to block new incoming pulses while the filter is doing it's job. For this to work, we either trigger a window to keep the pulse exclusive, until it's over, or reject pulses that have too much content. This situation is also there, even without pulse stretching, but the shorter capture time leaves more for others to be captured, hopefully increasing the count. OR .. we just wait a bit longer for more count.


----------



## graham-xrf

*I had to edit post #734 !*
I keep getting this bit wrong. We do not reduce the number of electrons by any percentage of absorption probability.
We might, in the end, only get some percentage after circuit losses in the photodiode, but it's not that one.

When (say) a *59.5keV* photon delivers *18,0390* electrons, we get to use *all* of them!
The 3% refers to the probability of it happening in the first place.
3% is not an efficiency over how many are subsequently lost to become heat. It's an absorption probability!
My apologies about that.


----------



## homebrewed

graham-xrf said:


> This relationship is something I am also convinced about, even though I thought it was strictly only true of square-wave pulses, and triangular ones comprised of two triangles put together. I like it because it saves a forty bucks ADC.
> Area = 1/2 base x height. If we make the base longer, the height gets less. That's OK, because we can either start with more than we need, or give it some gain after, or a bit of both.
> 
> As it happens, I already bought the ADC, so I decided to push it to to deliver to it's limit. Pulses from my TIA design can also be stretched with a filter afterward, if one decides to exploit the built-in audio channels in the computer end.
> 
> One thought I had about pulse stretching, was the need to block new incoming pulses while the filter is doing it's job. For this to work, we either trigger a window to keep the pulse exclusive, until it's over, or reject pulses that have too much content. This situation is also there, even without pulse stretching, but the shorter capture time leaves more for others to be captured, hopefully increasing the count. OR .. we just wait a bit longer for more count.


Since square waves, triangle waves etc. can be represented by sums of sine waves they all should be subject to the same linearity relationship, i.e., L(f1(t) +f2(t)....) =L(f1(t) + L(f2(t) ....  where L() represents the Laplace transform.  Of course, the higher-frequency components will suffer greater attenuation through the LP filters.

The Theremino folks have stated that their approach does assume a relatively low count rate so the chances of pulse overlap are relatively low.  I haven't looked at how they do it, but they also claim to use software discrimination to reject poorly-formed pulses.  "Poorly formed" could be due to pulse overlap or noise pulses that mess up the peak-voltage determination.

I don't think your ADC has to be a writeoff, so to speak.  You get more bits of resolution compared to a Teensy's ADC.

I've finished turning my "focus ring" out of aluminum.  My initial sanity check was to see how it was fitting around my detector and for a moment I freaked out, because the corners of the package were covered by the ring.  However, it turns out that the package is significantly larger than 10 x 10mm, and I used the actual diode dimensions to calculate the focus ring's ID.

The next thing I need to make is a mandrel to form the lead shield ring.  I'll just use a leftover piece of Delrin rod for that.  My plan is to cut the ends of the lead strip at about a 45 degree angle so they will overlap, rather than a butt joint that might allow x-rays to slip through.


----------



## graham-xrf

*Re: Pulse information after filter distortion*
It's easy to see amplititude will have say in the area under the waveform. The reason I am wary is that the constant cannot reasonably be the same for any arbitrary waveform, even those made of a sum of sines and cosines. Fortunately, the pulse we get has good approximations that apply.

eg. The area under (say) half a sinewave is the duration x 1/√2 * peak_amplitude, or 0.707*Vpeak.
For a square wave, the average is half the peak.
For other waveforms, there are other crest factors, unless you have a true-rms multimeter.
In the case of our pulses, they all have pretty much the same shape, so therefore the same constant.

Thus we probably need not care that much about the pulse shape, because at calibration time, the pulse(s) amplitudes that repeatedly happen when shown a known metal, can simply be stored as being representative of it. 

*Do we only get one at a time? *
This is where I get to sheer ignorance about what happens. Suppose we have (say) some Tin  Sn50 . There are 4 energies of photons it might release.
1. Do these photons arrive somewhat separated in time?
2. Do they ever all hit the photodiode together?
3. Might they have gone off each in in their own separate directions?
4. Would we be waiting for photons of the various energies to arrive one at a time, with the other three going their own way?

I am guessing we only get one of them at any time, and we just have to keep waiting to build up a sufficient count of all of them.


----------



## whitmore

The delay line amplifier is a tricky item, but the modules that do it are available on eBay (and
in genuine four-or-five decade old technology) in the form of modules to fit
a NIM power crate.   There's a good overview of the workings in the ORTEC model 460 manual


----------



## WobblyHand

graham-xrf said:


> *Do we only get one at a time? *
> This is where I get to sheer ignorance about what happens. Suppose we have (say) some Tin Sn50 . There are 4 energies of photons it might release.
> 1. Do these photons arrive somewhat separated in time?
> 2. Do they ever all hit the photodiode together?
> 3. Might they have gone off each in in their own separate directions?
> 4. Would we be waiting for photons of the various energies to arrive one at a time, with the other three going their own way?


The decay itself is random.  So thinking there's any kind of sense or order to the released photons is folly.  So to answer these questions, I'd hazard a guess of:
1. Don't have to be separated.  Can be coincident (in the time frames we are concerned about).  Not likely, but could happen
2. This can happen - see random
3. Yes, it's possible - random direction scatter 
4. Possible, not likely.  Eventually the other energy photons from a different decay should show up, due to random direction scatter

There will be a pile up of pulses occasionally.  It is unavoidable.  So one needs to somehow recognize this and discard that pulse, or figure out a way to decompose or deconvolve the pulse into it's sub-pulses.  The deconvolution isn't easy.  By far it is easier to discard the piled up pulse and wait a longer time for more counts to accumulate.  If I were to bet, malformed pulse dropping is done in successful x-rf devices.


----------



## homebrewed

graham-xrf said:


> *Do we only get one at a time? *
> This is where I get to sheer ignorance about what happens. Suppose we have (say) some Tin Sn50 . There are 4 energies of photons it might release.
> 1. Do these photons arrive somewhat separated in time?
> 2. Do they ever all hit the photodiode together?
> 3. Might they have gone off each in in their own separate directions?
> 4. Would we be waiting for photons of the various energies to arrive one at a time, with the other three going their own way?
> 
> I am guessing we only get one of them at any time, and we just have to keep waiting to build up a sufficient count of all of them.


All x-ray lines whose energy is less than the incident gamma ray will be excited, but I don't think that one atom will emit all the lines at once.  Certainly, the sum total of emitted photon energies can't be greater than the incident photon energy.  So the various XRF photons aren't correlated in time or direction of emission.

But, statistically speaking, on occasion photons can arrive close enough in time to produce pulse overlap, regardless of how fast the detector and electronics are.  Therefore, some form of pulse culling is needed to get the best-possible energy resolution.


----------



## graham-xrf

homebrewed said:


> All x-ray lines whose energy is less than the incident gamma ray will be excited, but I don't think that one atom will emit all the lines at once.  Certainly, the sum total of emitted photon energies can't be greater than the incident photon energy.  So the various XRF photons aren't correlated in time or direction of emission.
> 
> But, statistically speaking, on occasion photons can arrive close enough in time to produce pulse overlap, regardless of how fast the detector and electronics are.  Therefore, some form of pulse culling is needed to get the best-possible energy resolution.


I was just getting paranoid about making basic mistakes - like the one about percentages. 

When the incoming photon happens to energize an atom, (I think) it is capable of giving it's energy to raise the level of more than one of the electrons shells, provided it is energetic enough.

The alternative is that if the energetic photon gives over any energy to any electron, it's ability to anything with the excess is gone. So the remainder cannot do anything other than jangle the atom to a higher temperature. It gets wasted! 

Basic questions by the ignorant, they may be, but they arrive in my head anyway!


----------



## homebrewed

According to the Wikipedia entry for X-ray fluorescence, the mechanism is as follows:  The incident photon excites an inner-shell electron and as a result it is ejected from the atom.  An outer-shell electron drops down into the lower orbital and emits another x-ray due to the energy change.  This secondary photon's energy is characteristic of the atom, and of which shell it came from.

If one electron is ejected from the atom, only one electron is needed to refill the vacancy and just one photon will be emitted as a result.  So far I haven't found any discussion regarding the possibility of a gamma ray ejecting more than one electron from a single atom.  That doesn't mean it can't happen -- unless there's some quantum-mechanical reason for it.  I note that photons, just like electrons, have momentum (p = E/c):  but can one photon "share" its momentum among multiple electrons?  Momentum has to be conserved......and it's a vector.....and what about the possibility of multiple electron-hopping events as the electron "hole" moves from orbital to orbital?  Now my head is starting to hurt 

But in a practical sense I don't think it is an issue.  There's no reason to believe that if multiple photons can come from a single atom that they all are emitted in the same direction, so "pileup" due to that is quite unlikely, if it's even possible.


----------



## WobblyHand

Pileup can occur simply if charge packets due to any cause are received within the _bandwidth_ of the detector circuit.  We don't need to know their source, or from which original x-ray it came from.  If two or more charge packets are received too close in time, then a malformed pulse will result.  If we can recognize it's malformed, it can be rejected, accepted or further processed.  In the case of a near coincident big and little pulse, it may be hard to separate them, or even recognize there were two pulses.  Just a real world condition that need to be handled in a graceful, predictable fashion.


----------



## graham-xrf

homebrewed said:


> According to the Wikipedia entry for X-ray fluorescence, the mechanism is as follows:  The incident photon excites an inner-shell electron and as a result it is ejected from the atom.  An outer-shell electron drops down into the lower orbital and emits another x-ray due to the energy change.  This secondary photon's energy is characteristic of the atom, and of which shell it came from.
> 
> If one electron is ejected from the atom, only one electron is needed to refill the vacancy and just one photon will be emitted as a result.  So far I haven't found any discussion regarding the possibility of a gamma ray ejecting more than one electron from a single atom.  That doesn't mean it can't happen -- unless there's some quantum-mechanical reason for it.  I note that photons, just like electrons, have momentum (p = E/c):  but can one photon "share" its momentum among multiple electrons?  Momentum has to be conserved......and it's a vector.....and what about the possibility of multiple electron-hopping events as the electron "hole" moves from orbital to orbital?  Now my head is starting to hurt
> 
> But in a practical sense I don't think it is an issue.  There's no reason to believe that if multiple photons can come from a single atom that they all are emitted in the same direction, so "pileup" due to that is quite unlikely, if it's even possible.


Thanks much for that.
I find it interesting that an inner shell electron gets hit first. I thought the outer shell electrons took the least energy to shake loose.

Don't worry about head-hurting stuff. The apparently temporary existence of the internal bits with 2/3 charges, up, down, strange, etc will take it to migrane level. Charmed quarks they may be, but the Quantum Standard Model, fairy story though it may be, is 10 decimal places accurate.

I did not think all the energies would be emitted in the same direction. I did just wonder if an excitation with more than enough energy to account for them all, would provoke the whole lot to come out, maybe not together, but all within a reasonable interval.

Head-hurting stuff would include..
Bell's Inequality.
The Delayed Choice Quantum Eraser - Sabine Hossenfelder
Young's Double-Slit Experiment. - (Lots and Lots of stuff on that).


----------



## homebrewed

WobblyHand said:


> Pileup can occur simply if charge packets due to any cause are received within the _bandwidth_ of the detector circuit.  We don't need to know their source, or from which original x-ray it came from.  If two or more charge packets are received too close in time, then a malformed pulse will result.  If we can recognize it's malformed, it can be rejected, accepted or further processed.  In the case of a near coincident big and little pulse, it may be hard to separate them, or even recognize there were two pulses.  Just a real world condition that need to be handled in a graceful, predictable fashion.


One of the simplest discriminators is based on pulse width.  Pulse overlap will most likely result in a wider-than-normal pulse.  Too wide?  Don't put it in an MCA bin.


----------



## WobblyHand

homebrewed said:


> One of the simplest discriminators is based on pulse width.  Pulse overlap will most likely result in a wider-than-normal pulse.  Too wide?  Don't put it in an MCA bin.


Yes, KISS is a good approach.  One can go mad searching for optimal solutions when far simpler "sub-optimal" solution is more than good enough.


----------



## graham-xrf

WobblyHand said:


> Yes, KISS is a good approach.  One can go mad searching for optimal solutions when far simpler "sub-optimal" solution is more than good enough.


That is also the one I was going for. Too high, or too wide, is grounds for rejection.
You can easily do it in software, but..

..  at least one of my circuit thoughts had a triggered one-shot, making a "validity" timeout, which was also a "newcomers" lockout. In there also was a high speed peak detector, with a hold-reset operated by the one-shot. Old-school analog!

Very little for the computer to do, until I realized letting the computer work the enable after it had safely saved the value was an obvious way to do it.


----------



## whitmore

graham-xrf said:


> Thanks much for that.
> I find it interesting that an inner shell electron gets hit first. I thought the outer shell electrons took the least energy to shake loose.


The rate for gamma absorption is highest for just-above-the-fluorescence energies; a quick look at photoelectric
cross sections shows big jumps in absorption at each inner-electron threshold energy, like here, in ironIron absorption of Xrays
The cliff-like jump (circa 7 keV) is at the eject-an-inner-shell electron energy.  There's a lot more outer-shells electrons, but 
by a factor of nearly ten, all the outer shell contributions are less than the inmost-shell interactions

You get the fluorescence output as the inner-shell void gets refilled.


----------



## graham-xrf

whitmore said:


> The rate for gamma absorption is highest for just-above-the-fluorescence energies; a quick look at photoelectric
> cross sections shows big jumps in absorption at each inner-electron threshold energy, like here, in ironIron absorption of Xrays
> The cliff-like jump (circa 7 keV) is at the eject-an-inner-shell electron energy.  There's a lot more outer-shells electrons, but
> by a factor of nearly ten, all the outer shell contributions are less than the inmost-shell interactions
> 
> You get the fluorescence output as the inner-shell void gets refilled.


Thanks for the explanation. There is a little pause, but the energized shells don't stay that way very long.

At a more prosaic level, and indeed more practical, I have two candidate circuits, and I am trying to press it to the point I can catch up a bit with Mark.  I was going after the current that would get injected into the transimpedance amplifier. Designing these things is tricky. Yesterday, I read most of a whole book about it. I needed some idea of what goes in, and what we want out.

Taking a few shortcuts, I try for turning the charges collected into currents. The pulse that comes from a photodiode, and the process that generates them in the depletion layer is very complicated, resulting in a summation of two current waveforms, one rather faster than the other. I just skipped the detail, and took a gross approach. I only need ball-part values to decide a gain.

Iron will deliver 4 energies, but only two are in a range the detector can do anything with. The last two are outside of the ability of the photodiode to respond to. We know that to create an electron-hole pair in silicon, it takes *3.66eV +/- 0.03eV*. They will try for recombination, and some are lost this way, but very few. There are other efficiency losses, but for a ball-park estimate, we can consider the first two energies.

6.40384keV would make 1749 electrons, so 2.8022E-16 Coulombs
7.05798keV would make 1928 electrons, so 3.08899E-16 Coulombs

*Now the quick 'n dirty estimate.*
Of course, these are only accumulations of charge. In order to become currents, they have to move their energy, (though not themselves) in a certain time, and we already know the rise-time is about 2uS, and the whole thing is over in about 13uS. If we consider that the most of it was in about 8uS, and pretend it was a square wave, then we get *35.02pA* and *38.6pA*. Then estimating what the amplitude would have been if that energy had been in a roughly triangular waveform, we are talking of peaks of around *70pA*, for roughly *7keV*. This is something to go on.

We look back to magnesium(*1.25keV*) and aluminium *1.48keV*. Now we are talking about *12pA*. That's near the bottom of what we can deal with. In most TIA amplifiers, it can get buried in noise, unless one designs carefully, but it looks like we can get close. I know this is sloppy, inexact, estimation, but it's all we need to make circuit decisions.

If we can ever get something from tungsten, it has to deliver 59.31keV from a 59.48keV Am241 excitation. Maybe?
The *16207* electrons is as much as *324pA*. That's still less than the approx 2.5nA dark current, but it is above the noise on that dark current.
We need a huge gain, but I am now more hopeful of this.


----------



## rwm

I suspect you will get Tungsten for the reasons Whitmore laid out.
R


----------



## graham-xrf

rwm said:


> I suspect you will get Tungsten for the reasons Whitmore laid out.
> R


Yes - I did see that. The thing that removes any confusion about responses from zinc would be the additional presence of any high energy 59keV response. Regardless that it's count will be low, if there is a smidgen of count there, then it's tungsten.

I was noting the closeness of *59.54keV* from our smoke detectors, as compared to W(74) tungsten x-ray emission  at *59.32keV*.
That is just barely enough to, in theory, get the _Kα_ charged up enough to deliver that one, but no others. I am thinking if it is "just above", then excitation is inevitable.

By the explanation in @whitmore 's link, our Am241 has not got enough kick to get any other tungsten L-shell energised. We get one peak only.  If we see a high energy peak there, regardless the low count, it's either tungsten, or some unshielded smoke detector direct from Am241. Zinc's K-shell energies are coincidentally close to tungsten's L-shell energies, but if we see any around that region at all, then there really is some zinc in there.

Now mulling over "dead-bug" prototype construction vs proto-PCB. I think I will be going PCB from the start. I allow I might have to mangle (er.. "modify") it somewhat, later down the line, but I will try and make it "development friendly".


----------



## homebrewed

As I've mentioned previously, I have been planning on determining a de-noised peak value by doing a least squares fit on the data around the peak.  A simple find-the-maximum function, whether it's done in S/W or H/W, is unavoidably affected by noise.  Noise is our enemy because it will broaden the spectrum and make it harder to distinguish elements like iron and cobalt.

However, I'm now thinking there's another approach that can produce even better noise rejection with less computational overhead than a least squares fit.  Just integrate the pulse, once we have decided it's a good one to use and stuff that value into an MCA bin.  We don't really need to know the peak value, as long as we use the same measurement approach on known pure elemental standards to calibrate the system.  If the noise is uncorrelated then our SNR should improve as sqrt(N), but without the need to calculate the polynomial coefficients and back-calculating the "actual" peak voltage.  We also can use more data points because the 2nd-order polynomial fit really is only valid around the peak value.  

The integration approach isn't trying to squeeze the data into any kind of "fit" box so all of the pulse can contribute to our output value.

The integration scheme also is much easier to understand than my tweaked least-squares fit code (even if I did try to comment the heck out of it).  That's a big plus right there 

An ADC and a circular buffer still would be a good front end for this approach because we can discriminate and then use the entire pulse for the integration.


----------



## homebrewed

Along with some semi-theoretical hand waving, I also have been working on making the focus and shield rings.  It's gotten a little iffy because my lathe started acting up in a manner that suggests the high/low transmission gears are failing.  So far so good, but I can tell they're going downhill pretty fast.  Replacement parts are on order.  Since I have to remove the spindle and at least one of the spindle bearings, I also will upgrade the lathe with angular contact bearings.

Anyway, the aluminum focus ring is done.  The shield ring is an interesting challenge because it's made out of lead, notoriously difficult to machine -- so I have avoided that approach.  Instead, I cut a ~.150" wide strip out of my 1/16" thick lead sheet using metal snips.  The ring needs to be .140" tall so I had to remove about .01 inch from the strip.  The sides of the strip weren't all that flat so that was an issue as well.  To address that, I got a 1 inch thick piece of HDPE from my scrap bin, about 3 x 5 inches on the other dimensions.  I faced one side with the biggest end mill I've got to get a nice smooth surface.  Then I turned it vertical so the 3 inch dimension was on the mill's X axis and, using a 1/16" slitting saw I cut several slots in the HDPE.  One was about .145" deep and the other was .140" deep.  Once that was done, I clamped the HDPE piece in my woodworking vise and inserted a 2.5" length of my lead strip in the .145" slot.  I used a file to flatten that side, then removed the strip, turned it over and inserted it in the .140" slot.  Again, I used the file to remove lead down to the top surface of the HDPE.  This approach gave me a smooth top and bottom for the shield ring.  I used HDPE because it is very abrasion resistant so it wasn't affected much, if at all, by the filing work.

I filed a 45 degree bevel on one end of the lead strip, then wound it around a Delrin mandrel I made on my (ailing) lathe.  The strip was longer than necessary so I used a single-edged razor blade to slice through the lead, doing my best to match the bevel angle on the other end.

The focus ring doesn't quite fit inside the focus ring so I need to refine it a little bit.  I'll do that with some small jewler's files I have.

Photos will be posted soon.  I want to use my DSLR, which can get a lot closer to subject and stay in focus -- but I need to charge the battery first.


----------



## homebrewed

I have some refinements to the geometry that might allow us to eliminate the shield ring altogether.  The idea is to move the detector a bit further away from the aperture plate, something on the order of .25 inch vs. .08 inch.  The detector will see a slightly lower count rate:  but that might be a good thing if we've got 8 Am241 sources blasting away about .5 inch away from the sample.

Apologies for the ongoing variations on this part of the system, but the changes are dictated by my observations and conclusions based on the construction process.  Hopefully all this will result in a much easier to fabricate XRF system, without giving up much in the process!


----------



## graham-xrf

Indeed yes. Integrate the pulse, because it is the area under the pulse that quite accurately represents energy.
I am less sure about that if the pulse were stretched, and there are several kinds of stretching scenario.

One is pulse duration were stretched, but the peak amplitude maintained, or restored by gain. I think this amounts to increasing the area by a constant. This is OK

Another is the pulse is stretched, and the amplitude drops, such that the area is maintained. When I think it through, that is just a version of the first, where one neglected to restore by adding gain. This should also be OK

Another is where the stretching was accompanied by nonlinear distortion that falsifies the area energy. All filters bring delay. A set of Bessel low-pass filters, with roll-offs above the highest frequency component gives a constant group delay. A tapped delay line, with tappings summed in various way can allow one to make all sorts. We don't want to be doing high speed digital FIR, echo-equalizers, feedback fllters, etc.
Even so, even with "distortion", so long as the nature of the distortion is constant, being equal-opportunity for all signals, then at calibration time, if what you are using is the integrated pulse, your scheme should be just fine.

A very accurate, and immediate, value could be sampled off the end of an analog integrator. Whether one uses an opamp with capacitor, or goes instead for having the computer add up the set of samples through the pulse with constant, short enough, time periods, both situations require the recognition of the start, and a decided end to the pulse.

Getting an opamp integrator needs the trigger to reset it, instead of having it pump up and down on the waveform. A software integrator needs have some way of deciding when is OK to have another count-up. Either way, it feels good!


----------



## homebrewed

graham-xrf said:


> Getting an opamp integrator needs the trigger to reset it, instead of having it pump up and down on the waveform. A software integrator needs have some way of deciding when is OK to have another count-up. Either way, it feels good!


It occurs to me that if we've got a pulse width discriminator we already have some sort of trigger circuit going.  The "start" signal could open an analog switch to allow the integrator to do its thing.  Depending on the elapsed time, the "stop" signal would either trigger an acquisition or, in effect, say "naah I don't think so" and reset the integrator to wait for a good pulse to come along.  This is some pretty minimal processing.  The only potential issue is that we can't prevent noise from perturbing the trigger points so there will be some unavoidable jitter in the timing.

The same basic flow _could_ be done with a speedy enough A/D-equipped microprocessor and in fact wouldn't need a fancy circular buffer.

There are some issues like charge injection from the analog switches getting into the integrator but that should be a relatively constant offset.  Anyway, well-designed analog switches have pretty low charge injection, on the order of pico-coulombs.  This wouldn't be a concern with a microprocessor based design but there are other factors, like latency, that could have an impact on a mostly-digital approach.


----------



## graham-xrf

I am thinking your scheme should be OK once one has a pretty stiff signal with a good S/N ratio already captured in the first amplifier.

Already built-in on the Pocket-Geiger is the LM393 that was used to make an output slam up (down??) as the amplified signal passed a threshold, and the other output has it happen at a different threshold, all set by R1, R2, R15, R16. Unless you have already cut and re-purposed the tracks layout, there might be the basis for a trigger monitor, such that if the signal rises above something significantly above zero, is taken to mean a real pulse is there, and the software starts a capture.

The cute dodge here is that if the ADC is always kept running, sampling the signal all the time into a FIFO stack of (say) 20 long, or however many you deem enough to get the resolution number of samples through the pulse you want, you can have the pre-trigger values anyway. The software fetches it's sample set starting from a point a few samples _before_ the trigger. You get the definite constant predictable solid trigger, and also get to fetch the pre-trigger values that were there a bit before it. They may not have been suitable for a reliable trigger, but they might be quite fine to improve the accuracy of the area count. This dodge may have to be applied post stretching. Of course, the whole scheme can be done entirely in the programming.

The returning "pulse is all over" signal might be a cheapskate way to tell you have a pulse overlap, so then know to discard the count. You could re-use the first trigger on it's way back. If the comparison is still up by the time the software has got to (stretched version) 13uS, or maybe 18uS worth, then that may be evidence of a smeared pulse that maybe overlapped and would be artificially extending the duration, and making a wrong integration count.

Getting an unrealistic high integration as evidence for rejection may be enough, but the uncompromising way is to limit the duration, and also know the pulse had subsided below a threshold at cut-off time.


----------



## homebrewed

graham-xrf said:


> I am thinking your scheme should be OK once one has a pretty stiff signal with a good S/N ratio already captured in the first amplifier.
> 
> Already built-in on the Pocket-Geiger is the LM393 that was used to make an output slam up (down??) as the amplified signal passed a threshold, and the other output has it happen at a different threshold, all set by R1, R2, R15, R16. Unless you have already cut and re-purposed the tracks layout, there might be the basis for a trigger monitor, such that if the signal rises above something significantly above zero, is taken to mean a real pulse is there, and the software starts a capture.
> 
> The cute dodge here is that if the ADC is always kept running, sampling the signal all the time into a FIFO stack of (say) 20 long, or however many you deem enough to get the resolution number of samples through the pulse you want, you can have the pre-trigger values anyway. The software fetches it's sample set starting from a point a few samples _before_ the trigger. You get the definite constant predictable solid trigger, and also get to fetch the pre-trigger values that were there a bit before it. They may not have been suitable for a reliable trigger, but they might be quite fine to improve the accuracy of the area count. This dodge may have to be applied post stretching. Of course, the whole scheme can be done entirely in the programming.
> 
> The returning "pulse is all over" signal might be a cheapskate way to tell you have a pulse overlap, so then know to discard the count. You could re-use the first trigger on it's way back. If the comparison is still up by the time the software has got to (stretched version) 13uS, or maybe 18uS worth, then that may be evidence of a smeared pulse that maybe overlapped and would be artificially extending the duration, and making a wrong integration count.
> 
> Getting an unrealistic high integration as evidence for rejection may be enough, but the uncompromising way is to limit the duration, and also know the pulse had subsided below a threshold at cut-off time.


I like the fact that we are moving toward a general framework for the MCA part.  Using the pocket geiger's on-board comparators for the trigger signal is a clever idea and certainly worth evaluating!  I haven't disable that part so can easily test the idea out.

But as a cautionary note it's important to keep in mind that we have no fully-functional front end yet.  I'm hoping to have a particular version of that going soon, but you never know what's going to come up.  Case in point:  I wasn't expecting to have to repair my lathe.  Hopefully I've been able to get past my immediate need for the lathe.  The bearings and transmission gears arrived yesterday....


----------



## graham-xrf

Oh boy! Bearings _and_ busted gears! 
Not unknown in this forum, but you will certainly have the sympathies of most folk here.

I still envy that your lathe is at least somewhat together. I had one lathe in pieces, and the other working OK until it too went into a mess. I won't be putting back the underneath drive in the way the previous owner bodge had it. Also, the whole angle-iron-based frame, with drawers is not really what I want to retain. When I say "angle iron", you would expect the sort a tad thicker than 5/32". In other places, it uses that 1/16" shelving stuff with perforations slots. If I can't weld up something somewhat improved, then even a stout wooden bench would work better. When I gave it a firm shove, I could see the movement relative to the wall! It now is to be re-located into my outhouse shop anyway, so I now want a better bench or stand under it.

Relentlessly, I keep having a stacked-up list of stuff I have to trawl through before I can get to play. My new-old-stock ex cold war surplus Geiger  tube arrived from Ukraine on Friday, and all I can do with it is stash it for now.

The last thing I needed was was a yell for help from my wife at the end of the drive, arriving back from a shopping trip. "We have a problem with the car"! No power steering, and big red "battery" symbol on the dash had to mean the alternator drive belt, which also turns the hydraulics pump, was kaput. It's is a old(ish) C-Class Mercedes Estate. It must have been a tough work-out for her trying to get it home. The belt was OK, but the tensioner roller, and it's bearing, and retainer cap were a tipped over wreck. I opted to have my favourite non-dealership Merc car service guy bring his recovery truck with the clever ramp thing that just loads the car on. I could have have set about fixing that sort of stuff myself. I have been fixing car engines since I was about 10, but this time, I let someone else do it - and he had the parts in stock!

I am going up the learning curve with KiCad. It's open source Schematic + PCB, but now so capable that in industry, it is becoming preferred to stuff like Altium.

I actually think that our XRF front-end is the one part where we do know what to do. If it is going to work at all, then these bits must obey the physics. There is not much we can do to make those atoms respond any better than the way they would always have done. Agreed, we can get cute with the geometry, in trying to arrange that any responses towards the diode don't have much place left to escape.

For any in the future who would like to try some of this, we, and they, have ever fewer ways of getting hold of anything that reasonably be used to irradiate the sample. About all that is left is smoke detectors. Am241 can only be man-made, a by-product of stuff going on in nuclear power stations, and even these type of detectors are being "phased out" where possible. There is no serious health risk, but they may nevertheless be retired from use as a prudent avoidance measure. I am considering using up the thorium gas mantles I have, packed into a circular trough, held in with epoxy. A chemistry adventure with TIG rods and peroxide may also happen.


----------



## graham-xrf

Check out the little instrument this guy was using. I think it's a straight spectrum energy monitor, as opposed to a materials identification thing, but I don't know.  What he does with the screen stylus to zoom expand on the peaks, and read off keV is fascinating.
Thorium Counter Top - Gamma Spectrum Analysis


----------



## rwm

This video shows more about how that works.






He says in the video that it will not measure below 40 KeV so it would not identify all the energies we need.


----------



## graham-xrf

rwm said:


> This video shows more about how that works.
> 
> 
> 
> 
> 
> 
> He says in the video that it will not measure below 40 KeV so it would not identify all the energies we need.


Hi Robert
Thanks for the extras 
I was just looking at the "features" he was getting with the stylus.
 As I understand it, most all the MCA programs all do have ability to expand the scale.


----------



## homebrewed

Just the transmission gears are on their way to going kaput.  But to change them out I have to remove the spindle, which includes the front bearing.  The stock bearings for the 7X lathes are just deep groove ball bearings so I'm taking advantage of the opportunity and will swap them out for angular contact bearings.  Tapered roller bearings would be better yet but unlike the AC bearings they're thicker than the originals, which requires some additional changes to the lathe -- positions of other gears change, spacers need to be redone etc.  So I decided to just go with the AC bearings.  That will get the lathe up & running sooner, and should be much better than the originals.

I don't have a press so I'm going to use all-thread and an assortment of bushings and metal plates to pull/reinstall the bearings off the spindle and the rear end of the headstock.  I may need to buy a longer gear/bearing puller to get the bearing off the spindle, but they're not all that expensive.  Harbor Freight has a set of 3 for about $40.

There are two sets of gears in the transmission -- one pair is on the spindle and the other pair is on an adjacent intermediate shaft.   The OEM replacements are plastic.  There is a metal gearset available but they're currently out of stock and won't be back in stock until mid March.  Since the first set of plastic gears lasted over 10 years I decided to just stick with the plastic gears.  They also are one fifth the price of the metal gears and ARE in stock.


----------



## graham-xrf

I have not had experience with angular contact bearings (yet), but I did check out Robin Renzetti's spindle rebuild. It seems angular contact are the ultimate for spindles, and they can also be obtained with pre-set preload built in. I thought taper rollers are the choice for things like wheel bearings. At least on wheels, one is supposed to take up all the play, and then "back off" some part of a turn, which allows for them to heat up. That is stuff I am just not sure about. You will find angular contact types are just excellent!


----------



## homebrewed

graham-xrf said:


> I have not had experience with angular contact bearings (yet), but I did check out Robin Renzetti's spindle rebuild. It seems angular contact are the ultimate for spindles, and they can also be obtained with pre-set preload built in. I thought taper rollers are the choice for things like wheel bearings. At least on wheels, one is supposed to take up all the play, and then "back off" some part of a turn, which allows for them to heat up. That is stuff I am just not sure about. You will find angular contact types are just excellent!


From what I've read concerning tapered roller bearings vs. angular contact bearings, 7x owners are about evenly divided in what they use for an upgrade.  Little Machine Shop sells all three types - that's including the deep groove version - so they aren't favoring one vs. the other.

The AC bearings LMS is selling have no shields, but the lathe hardware has something to serve that purpose.


----------



## graham-xrf

*Re: Easy Integration*
I know I am here getting into some old-school analog, but it seems to me that for us, extremely accurate real-time integration can be done with the same opamp integrator circuit as was (maybe still is) used to control missile guidance feedback loops, Saturn 5 rocket engine gimbals, LEM landers, etc. This is just another passing notion that I thought might eliminate a whole bunch of sampling and integrating software. All the program need do is listen to the trigger, fetch the answer from ADC, and reset the integrator. The number is ready to be used.

Sure - I do know that Moore's Law is reaching it's limit for for digital stuff [Ref: 1], because transistors are becoming nearly the same size as atoms, and analog computing is making a comeback , but this is much simpler stuff. An opamp integrator delivers at the speed of electrons, with infinite resolution on the time axis. If started by a trigger set a bit above the noise level, it will ride up to the value analogue of the photon energy in the pulse, effectively, the area under the curve. Follow it with an inverter buffer for a positive output. The circuit needs a FET analog reset switch for after the pulse is deemed to be over.







Opamp integrator is good for all amplified photon current pulses from TIA's, stretched or not. Yes, the final circuit will have a few more parts, there needing to be an enable-reset and all, but the bits are tiny and cost only cents. One of the simplest just uses a FET to short out the capacitor.

The low pF value capacitors seen across the feedback resistors in the Pocket Geiger amplifiers were there for stability. This is different, and such an integrator would come after the gain stages. Having a capacitor be the opamp main feedback, makes an integrator, and any resistor across it turns it into a low pass filter. For accurate computing, you make the resistance value so high it can't affect the computation, or you just don't need have any resistor there at all.  For the duration the pulses have, low leakage capacitors, and special substrate materials, etc. is just not needed.

There are, of course, dozens of integrator circuits described on the internet. Obviously, they were very popular!

[Ref 1:  *The Most Powerful Computers You've Never Heard Of* ]


----------



## homebrewed

Long ago one of the engineering classes I took was on control theory.  It included a lab, which used analog computers to simulate control systems.  You could combine integrators, differentiators, gain blocks, summers etc. using banana plugs.  Plots of the system response were done on chart recorders.  Not a digital computer in sight!  No calculators, either:  the class predated the now famous HP35.


----------



## graham-xrf

homebrewed said:


> Long ago one of the engineering classes I took was on control theory.  It included a lab, which used analog computers to simulate control systems.  You could combine integrators, differentiators, gain blocks, summers etc. using banana plugs.  Plots of the system response were done on chart recorders.  Not a digital computer in sight!  No calculators, either:  the class predated the now famous HP35.


Funny you should say that!  Since Christmas, I have a brand new HP35.


----------



## WobblyHand

Are you looking for an integrate and dump?  So you can reset the integrator?  How can we expect the average person to deal with charge injection of the dump/reset switch, or for that matter to make sure one isn't integrating on input offsets, or even dc bias?  An integrate and dump is an optimal circuit, but they are tricky in practice, especially for the less experienced.  Does our target audience have this expertise?  Not trying to rain on the parade, but merely trying to bring this back to technology that could be replicated en mass without having years of analog experience.  
Current (heh, bad pun,) path is fine for me, but suspect folks with less analog experience will get less than a satisfactory experience.  Circuits for the masses may have to include a lot of trimpots, or require resistor substitution boxes to prevent saturation, along with setup instructions.  Analog tweaking is becoming a lost art.

Sad to say, (as someone who likes analog stuff,) it may be a lot better if we digitize at a reasonable rate and do the heavy lifting in the software.  Lots easier to make a software change and host on your git site of choice.  Just my thoughts on this. What say you?


----------



## WobblyHand

graham-xrf said:


> Funny you should say that!  Since Christmas, I have a brand new HP35.


What do you do for batteries?  The LED displays tended to run down the batteries pretty quick.  I have an old HP45, with the leather case.  I'm not sure where the heck the charger is!  For general use, when not at a computer, or in the shop, I use a HP15C.  Three button cells, lasts for years, if not 10 years.  Long live RPN!


----------



## graham-xrf

WobblyHand said:


> Are you looking for an integrate and dump?  So you can reset the integrator?  How can we expect the average person to deal with charge injection of the dump/reset switch, or for that matter to make sure one isn't integrating on input offsets, or even dc bias?  An integrate and dump is an optimal circuit, but they are tricky in practice, especially for the less experienced.  Does our target audience have this expertise?  Not trying to rain on the parade, but merely trying to bring this back to technology that could be replicated en mass without having years of analog experience.
> Current (heh, bad pun,) path is fine for me, but suspect folks with less analog experience will get less than a satisfactory experience.  Circuits for the masses may have to include a lot of trimpots, or require resistor substitution boxes to prevent saturation, along with setup instructions.  Analog tweaking is becoming a lost art.
> 
> Sad to say, (as someone who likes analog stuff,) it may be a lot better if we digitize at a reasonable rate and do the heavy lifting in the software.  Lots easier to make a software change and host on your git site of choice.  Just my thoughts on this. What say you?


I get it about charge dump, and offsets and so on. I would not expect folk to have to work up an integrator circuit that is prone to that stuff. If I propose one, it would already have been tested. In my circuit, there are no DC bias issues. The base line of the amplitude is expected to be within microvolts of zero, basically from the input offset voltage, and even that I try to take care of. I don't want any stuff like clamp circuits for dc restoration, nor undershoot as it returns to zero. Also, not the arcane software approaches to "correct for" or "process out" stupid stuff like waveform baseline return overshoots. This is one of the motivations I have for using gain-bandwidth products sufficient to accurately reproduce the pulse shape. I see it at something precious, to be preserved until we get it measured.

We can use quite powerful digital approaches, but they require quite powerful digital computing. Analog integration seems a gorgeously simple alternative for a KISS approach that is also accurate. 300kHz shape-defining content in a waveform is easily within the capability of our 16-bit ADC's to deal with, and still OK for Raspberry Pi's, and smartphones, but one is pushing the limits.

In my kit, the ADC costs $40 bucks. Use about $2 worth of analog bits, and change the ADC for a slower one costing about £15, and pick up a sample every 15uS instead of every 500nS, and there is time to do a reset. I was just feeling out another way, trying to knock off cost here and there. It's bad enough the diode alone costs $65 if we get it on a Pocket-Geiger.

As it happens, my Raspberry Pi can easily add up ADC samples in a software integration, though it would be going a whole lot faster than working on stretched pulses. I am still tempted to try a hardware integrator, though you do correctly point out the temptation is to save some components, and write more code instead. I will end  up going the line of least resistance.


----------



## graham-xrf

WobblyHand said:


> What do you do for batteries?  The LED displays tended to run down the batteries pretty quick.  I have an old HP45, with the leather case.  I'm not sure where the heck the charger is!  For general use, when not at a computer, or in the shop, I use a HP15C.  Three button cells, lasts for years, if not 10 years.  Long live RPN!


So far - no real test yet. I did try to find out about battery life. It uses two CR032 button cells. User comments said it can work in anger for months. We shall see!


----------



## WobblyHand

graham-xrf said:


> I get it about charge dump, and offsets and so on. I would not expect folk to have to work up an integrator circuit that is prone to that stuff. If I propose one, it would already have been tested. In my circuit, there are no DC bias issues. The base line of the amplitude is expected to be within microvolts of zero, basically from the input offset voltage, and even that I try to take care of. I don't want any stuff like clamp circuits for dc restoration, nor undershoot as it returns to zero. Also, not the arcane software approaches to "correct for" or "process out" stupid stuff like waveform baseline return overshoots. This is one of the motivations I have for using gain-bandwidth products sufficient to accurately reproduce the pulse shape. I see it at something precious, to be preserved until we get it measured.
> 
> We can use quite powerful digital approaches, but they require quite powerful digital computing. Analog integration seems a gorgeously simple alternative for a KISS approach that is also accurate. 300kHz shape-defining content in a waveform is easily within the capability of our 16-bit ADC's to deal with, and still OK for Raspberry Pi's, and smartphones, but one is pushing the limits.
> 
> In my kit, the ADC costs $40 bucks. Use about $2 worth of analog bits, and change the ADC for a slower one costing about £15, and pick up a sample every 15uS instead of every 500nS, and there is time to do a reset. I was just feeling out another way, trying to knock of cost here and there. It's bad enough the diode alone costs $65 is we get it on a Pocket-Geiger.
> 
> As it happens, my Raspberry Pi can easily add up ADC samples in a software integration, though it would be going a whole lot faster than working on stretched pulses. I am still tempted to try a hardware integrator, though you do correctly point out the temptation is to save some components, and write more code instead. I will end  up going the line of least resistance.


I tend to agree with your feelings with baseline return overshoots and rubbish like that.  Have had awful times dealing with it.  When I had a chance at making changes, I eliminated those sorts of circuits.  

My concern is we build a few of these circuits (whatever they turn out to be) and they are ok.  But, we may see quite a few issues as they get built up in quantity.  I had high volume experience and saw this effect.  We used to say, "anyone can build a couple, but it takes skill to make millions".  (Lots of engineering!)  Or our participants will use products from different lots, (or manufacturers,) or inadvertently get counterfeit parts which maybe externally indistinguishable from real ones.  Causes a lot of heartache.  Any way to eliminate analog tweaking in this X-RF unit is probably a good idea.  

This is not to say that software never has problems!  Seen lots of issues.  But overall, it is usually faster and cheaper to scale up production of digital designs than analog ones.  That's why we see digital overtaking analog.


----------



## graham-xrf

WobblyHand said:


> We used to say, "anyone can build a couple, but it takes skill to make millions".


In this case, if anything like that starts to happen, and nowhere near millions, we would already have trouble. It being all open, we can rely on some (in China) to do a knock-off. For the relatively few folk at HM who might try one, we can help them, so long as we keep it simple and reasonably sure-fire.


WobblyHand said:


> (Lots of engineering!)  Or our participants will use products from different lots, (or manufacturers,) or inadvertently get counterfeit parts which maybe externally indistinguishable from real ones.  Causes a lot of heartache.  Any way to eliminate analog tweaking in this X-RF unit is probably a good idea.


I had not thought of counterfeits!  Anyway, regarding analog "tweaking", I do agree. Way back, when I first started working in (military) electronics, I would eliminate all multi-turn adjustments. Not even for offsets. It either had to have too little to care about, or the thing did software self-calibration every few minutes. Digitally controlled potentiometers were my thing.


WobblyHand said:


> This is not to say that software never has problems!  Seen lots of issues.  But overall, it is usually faster and cheaper to scale up production of digital designs than analog ones.  That's why we see digital overtaking analog.


The noise immunity - either it's on or it's off. It could not last, even at 12V CMOS.  There came a point where 5VTTL for computing was sucking the output of power stations, even when we went to LSTTL and FPGA arrays. Drop it to 3.3V, and then to 1.8V, and use MOSFET technology. So much closer to the noise!  Getting used to "eye height" displays. Sure, one can clearly see the point where going digital, with the profligate expenditure of bandwidth, gives the advantage.

On that very subject, is what the link in #773 was all about.
Derek Muller (Veritasium) is sponsored, but he is completely up front about who, and why.
The Most Powerful Computers You've Never Heard Of..


----------



## WobblyHand

graham-xrf said:


> In this case, if anything like that starts to happen, and nowhere near millions, we would already have trouble. It being all open, we can rely on some (in China) to do a knock-off. For the relatively few folk at HM who might try one, we can help them, so long as we keep it simple and reasonably sure-fire.
> 
> I had not thought of counterfeits!  Anyway, regarding analog "tweaking", I do agree. Way back, when I first started working in (military) electronics, I would eliminate all multi-turn adjustments. Not even for offsets. It either had to have too little to care about, or the thing did software self-calibration every few minutes. Digitally controlled potentiometers were my thing.
> 
> The noise immunity - either it's on or it's off. It could not last, even at 12V CMOS.  There came a point where 5VTTL for computing was sucking the output of power stations, even when we went to LSTTL and FPGA arrays. Drop it to 3.3V, and then to 1.8V, and use MOSFET technology. So much closer to the noise!  Getting used to "eye height" displays. Sure, one can clearly see the point where going digital, with the profligate expenditure of bandwidth, gives the advantage.
> 
> On that very subject, is what the link in #773 was all about.
> Derek Muller (Veritasium) is sponsored, but he is completely up front about who, and why.
> The Most Powerful Computers You've Never Heard Of..


Sure-fire, is what we need to make.

Got burned on some counterfeit parts.  Marked the same, but didn't meet offset and bias specs.  Besides that, they seemed ok.  Might have been rejects that someone scooped up, or actual counterfeits.  Genuine parts were much better behaved.  Circuit worked again!

Oh that video was a tease.  Lots of stuff, then quits just before showing the punch line.
The part about analog tide computing and Lord Kelvin's use of the new fangled Fourier stuff was interesting.


----------



## graham-xrf

WobblyHand said:


> What do you do for batteries?  The LED displays tended to run down the batteries pretty quick.  I have an old HP45, with the leather case.  I'm not sure where the heck the charger is!  For general use, when not at a computer, or in the shop, I use a HP15C.  Three button cells, lasts for years, if not 10 years.  Long live RPN!


I have seen DIY pages, showing how to dump the NiCads, and put in Nickel Metal Hydrides. I don't know if any opted for a single Lithium. On my ancient original HP25, I cut one side of the plastic retaining strip that sits between the AA's, and I found I could use alkalines. External charged Ni-MH could be slipped in, and the battery carrier put back.

There are folk who restore these, and they publish modifications circuits, not only for charging. There are videos on reworking HP45's, and HP67's. If all else fails, you can resort to a look-alike app on your smartphone. I always wanted the non-volatile feature of the successors to my LED HP25, but could not afford them. I was not so keen on the one with the magnetic strips programs store. I let it, and slide rules, etc. drift into past memories. Then I get the sweet Christmas present. HP35 became legend, and now I have one! 

You can get in depth stuff, circuit diagrams, etc from sites like this --> HP calculators LINK


----------



## homebrewed

Old lathes seem to be like old houses.  Once you start tearing into them you find other problems.  In my case, I discovered that my lathe's drive belt was literally hanging on by a thread.  Fortunately, it's easy to replace.  It's on order from LMS.

I've got the front bearing + spindle pulled.  Now to get the rear bearing off....


----------



## graham-xrf

*The tiny $15 Pi Zero 2W I wanted.. sold out!*
One may as well try for rocking horse poo!


It can do all one wants, although, with 512Mb of RAM, the kiddies who might try and load up Chromium and head for YouTube might be disappointed! Actually, it would do it if run in a less bloated browser.

It can do the scheme I suggested before, where one of these is back-to-back with the photodiode PCB, and of course, on the "user side" of the lead sheet shield. It would have a webserver, just like the one I already have on my Raspberry Pi mailer, where the output plots are running live on a web page. Any PC, or smartphone, that has a browser, could just display the page. The network is standard, and can be via WiFi, BlueTooth, EtherNet (via a little USB adaptor), or plug in a 1080p monitor direct into it's HDMI port.

From Farnell, the Pi Zero 2W are *£11.12* each, with a lead time of *120 days*, and request for quote for quantities more than one. I guess they might be thinking to ration them. The Pi Hut did that before, one per customer, and they still ran out!
[ Edit: Today from Farnell - all forms of Raspberry Pi 4, whether 2GB, 4GB, 8GB RAM - all sold out!  ]

For now, the stuff I have runs on any Pi, so it does not stop development. We shall see..
Hopefully, your real steel hardware is anticipating nice clean bits, fresh oil, superdooper bearings, and a belt that makes it feel like new..


----------



## homebrewed

Hardkernel.com has some SBC Linux boards that have pretty good performance.  I have three -- two C1's (no longer offered) and an 8-core job configured as a media server for our TV.  One of the C1's is used as a print server and the other is used for a home-brew call blocker.  They all have HDMI outputs and a bunch of GPIO's.  They all have either wireless or ethernet connectivity to our internal network so I can manage them remotely.

Regarding my lathe, I've got the old bearings pulled and the headstock modified to provide an access port for lubing the transmission gears.  The volume occupied by the transmission normally has no access unless the headstock is completely removed from the lathe bed.  An oversight, in my opinion.  Other owners have cut square holes on the top of the headstock and then added a plate to keep swarf (and tools) out of there, but I like my approach better.  In normal use the access hole I drilled is covered by the motor controller box so it's a very simple solution.  Just my style 

Now I can start putting the lathe back together.  My main concern now is pressing the bearings back into place without damaging them (along with not ending up with "extra" spacers, screws etc.).  I have my mill and a rotary table so I'm OK if I need to make something the right diameter to accomplish that.


----------



## WobblyHand

graham-xrf said:


> *The tiny $15 Pi Zero 2W I wanted.. sold out!*
> One may as well try for rocking horse poo!
> View attachment 394309
> 
> It can do all one wants, although, with 512Mb of RAM, the kiddies who might try and load up Chromium and head for YouTube might be disappointed! Actually, it would do it if run in a less bloated browser.
> 
> It can do the scheme I suggested before, where one of these is back-to-back with the photodiode PCB, and of course, on the "user side" of the lead sheet shield. It would have a webserver, just like the one I already have on my Raspberry Pi mailer, where the output plots are running live on a web page. Any PC, or smartphone, that has a browser, could just display the page. The network is standard, and can be via WiFi, BlueTooth, EtherNet (via a little USB adaptor), or plug in a 1080p monitor direct into it's HDMI port.
> 
> From Farnell, the Pi Zero 2W are *£11.12* each, with a lead time of *120 days*, and request for quote for quantities more than one. I guess they might be thinking to ration them. The Pi Hut did that before, one per customer, and they still ran out!
> [ Edit: Today from Farnell - all forms of Raspberry Pi 4, whether 2GB, 4GB, 8GB RAM - all sold out!  ]
> 
> For now, the stuff I have runs on any Pi, so it does not stop development. We shall see..
> Hopefully, your real steel hardware is anticipating nice clean bits, fresh oil, superdooper bearings, and a belt that makes it feel like new..


I was looking for the Launchpad board yesterday to make an electronic lead screw.  Nope.  TI has none.  The official distributors, Mouser and Digikey have 0.  Mouser says they may get some by 7/29/2022.  This is the chip shortage.  It's also all the little cheap peripheral chips that are in short supply.  They are often made on old process nodes, and the manufacturers have made 0 investments in those nodes, because there's miniscule payback for making cheap chips cheaper.  It's amazing how dependent we are on these cheap chips.  Our modern day opium.

So, use the Pi's that you have.  I have a few laying around, from an early one with a 26 pin connector, a couple of RPi2's a few RPI3's and some RPI4's.  None of the little ones.  They just don't quite have enough memory to make it easy to get things done.  Have an RPi2 as a print server, and one as a sprinkler system controller.  Perfect use for them.  

Eventually supply will catch up, I hope.


----------



## graham-xrf

@WobblyHand 
Your spare Pi resources are more than mine. I am now unable to mention Pi4(s) in the plural.  I have had one Pi4 running for near a couple of years, 24/7. It's my mailser/web server. That one is dominated by the IceTower on it, and so it doodles along at about 36C. The MicroSD only runs a few lines at boot-up, which then gives it all over to a 500GB USB3 SSD drive, which has the OS, etc. on it.

My only "other" Pi4B sadly, looks _kaput_. Clearly most of it works, but whatever it uses to work the MicroSD connection does not 
Beyond that, a couple of Pi 3B+ , which work just fine. I have them right now being used as XRF tryouts testbed.
Hanging around in the "electronics resources "junkbox" is an old Pi model A with the 26 pins, and a "hat" with a wobbulating signal generator on it. No electrons have moved in that one for years!

For guys like Mark, and yourself, the computer part is not a problem. You would hook up what takes your fancy. I was looking to the Pi Zero as something most any other interested user could reasonably get going with this, without any special computer or electronics expertise. That it comes at such a low cost (when available), was the motivation.

The business of chips shortage is interesting. It is having a big hit on new car manufacture, phones, and all sorts of products. It seems that when COVID hit, the last thing folk were going to do was visit socially distanced car showrooms. They feared for their jobs, and hung onto the wheels they had, sending second-had prices way up. Even a small percentage downward shift in car sales throughput would cause layoffs, etc. These places operated with just-in-time deliveries, and they were turning off the chip supply tap. The chip fabricators moved to making other silicon for other clients. Cars have hundreds of processors in them, and a car-maker advance order, placed late 2021, was going to the back of the queue. Something similar happened to chips for smartphones.

An exception was Elon Musk's Tesla. They kept their orders in, and placed new orders for new designs, even if they would have to stockpile the chips. What happened to Raspberry Pis, especially the Pi4B, their Compute Modules, the Pi Pico, and the Pi Zero, is that demand soared way beyond expectations, because they were being widely used for embedded control and robotics in industries outside of their planned target market.

*Random Topic Change Tangent* 
I am browsing through the available soldering iron ensembles on offer (Amazon, eBay, etc) My old 45W 24VAC Weller with the bang-bang "thermostat" switches Curie temperature magnets on the back ends of the tips still works OK, but it is a tad unkind to surface mount tiny stuff. I am also going to have to move on to using heated re-flow like Mark (and you?) do. It's the only realistic way to deal with 0.5mm pitch quadpacks.

Your picture of a LT6237 DFN-8 soldered onto a DIP adaptor (post #702, page 71) was, in essence, us admitting that for practical use, we have to "convert" the chips back into something of a size we can get our fingers around, and apply a Weller to without destroying it! They made the stuff too small, forcing the stupid irony of reflow soldering the things to little PCBs that can have it fit in DIP-size layouts!


----------



## WobblyHand

@graham-xrf, I have a Hakko FX-888D soldering iron.  It works very well and you can set the temperature to a degree, no matter what kind of degrees you are working with.  It wasn't super expensive, and all sorts of iron tips are available.  I use it for all the DIP pin size stuff and some 0.5mm work.  Has a holder for a sponge, and also some curly steel wool for removing tip oxidation.  It's a nice iron.  Have no idea if it is still available.

These days we need to be able to work with the little stuff.  For that, an oven or hot air is a must.  I couldn't find parts in the bigger packages, (that was two years ago!) and didn't want to spin a board for prototyping a circuit I came up with.  Hence the silly adapter PCBs, then wired into perf boards.  Not optimal, but it does work.  

Next go around, I'll re-teach myself KiCAD and do some boards.  I have used it, for schematic capture, but was having troubles adding parts and footprints.  Might revisit it again.  However, in a strange turn of fate, the ppa-release for FreeCAD uses a library libocct which is a higher revision than that used by KiCAD and my base distribution.  My package manager _most generously_ removed KiCAD.  Kind of frosted about that.  There are workarounds, but honestly, that's rather unfriendly of FreeCAD, breaking other packages.  But, have been learning FreeCAD, so not all is lost.


----------



## graham-xrf

WobblyHand said:


> @graham-xrf, I have a Hakko FX-888D soldering iron.  It works very well and you can set the temperature to a degree, no matter what kind of degrees you are working with.  It wasn't super expensive, and all sorts of iron tips are available.  I use it for all the DIP pin size stuff and some 0.5mm work.  Has a holder for a sponge, and also some curly steel wool for removing tip oxidation.  It's a nice iron.  Have no idea if it is still available.
> 
> These days we need to be able to work with the little stuff.  For that, an oven or hot air is a must.  I couldn't find parts in the bigger packages, (that was two years ago!) and didn't want to spin a board for prototyping a circuit I came up with.  Hence the silly adapter PCBs, then wired into perf boards.  Not optimal, but it does work.
> 
> Next go around, I'll re-teach myself KiCAD and do some boards.  I have used it, for schematic capture, but was having troubles adding parts and footprints.  Might revisit it again.  However, in a strange turn of fate, the ppa-release for FreeCAD uses a library libocct which is a higher revision than that used by KiCAD and my base distribution.  My package manager _most generously_ removed KiCAD.  Kind of frosted about that.  There are workarounds, but honestly, that's rather unfriendly of FreeCAD, breaking other packages.  But, have been learning FreeCAD, so not all is lost.


I had a stumble or two, so I maybe had better let you know what happened with me.
Forgive me if you already got to this.. but anyway..

*KiCad 6* is a huge update! It has got so much new stuff, and it seems all real nice. I suppose that there can still be some minor annoyances if one is used to something else, but I can see why it's now being widely used. It has some cool new stuff, like dim-out transparency to layers you are not working on with the current one overlaid up clear.

The new one *--> Blurb & Pictures*
Even with my latest LinuxMint, the Ubuntu repository it uses is 6 months or more behind in previous versions, so it loads up *KiCad 5*.
To get *KiCad 6.0*, I had to use the _*ppa:kicad/kicad-6.0-releases*_
You can just follow the downloads page, and select for your distro *--> https://www.kicad.org/download/*
BUT..
If you ever had a previous KiCad install - although installation of the new one does happen OK, *there is a stall!*
It won't see any global libraries, even though they do exist, and are all correctly installed.

In my case, I had first used the software manager for getting KiCad 5.  Then almost immediately afterwards, I was going after the newly discovered KiCad 6.0 Thus, I no longer looked like a first-time user. For many, they may have a stash of their own library components and symbols. This is still OK. Everything in *~/.local/share/kicad/* can stay. It will create a "*6.0*" folder in there. You can move your stuff in, and if you did use that path, still no problem.

It is the _other_ hidden folder that needs attention!  I purged the old KiCad, including configuration files, but there is a place the installer (sensibly) will not touch. That is the hidden folder in your home directory. It wants to make *~/.config/kicad/6.0/* when you are detected as a "first user", but there is a file in there called *sym-lib-table*, where the name and type of all the symbols are listed. It will be stuffed full of paths with the wrong environment variables. It needs to see *${KICAD6_SYMBOL_DIR}* everywhere.

The solution is easy. Purge the old KiCad. Save any of your own creations safe. Delete the hidden folder in .config. Then install. On first use, you get the pop-ups that guide you, and it all works from there on. Opening any projects from the old version will work, but it saves them as the new version, and they then can't be opened in the old version. It has a facility to re-name files with .lib extension to the new extension it uses.

It just looks all really nice, with 3D views and all. There are a bunch of YT videos on using it.


----------



## WobblyHand

Thanks for the warning.  Yes, I will back up all the old KiCAD stuff and purge it.  Have a bunch of stuff to do in FreeCAD first, before I play with KiCAD again.  

Just now drawing up a backplate for my lathe.  Couldn't buy one for my lathe, with the right features.  I can blame supply shortages on this.  Same cause as the chip shortages.  So bought some cast iron and going to make one.  Need to design the backplate, since the manufacturer didn't post the dimensions.  Suppose it is fun, but really would have preferred to have bought the backplate.  The raw cast iron disc cost nearly as much as the fully machined piece.


----------



## graham-xrf

*Non-reflections..*
Related to arranging geometry of arranging the sources around the sensor, we get it that a simple shield between is OK. The photons cannot go around corners. Also, we have to accept that the good stuff is pinging out in all directions, so therefore into shielding around it's side, and to the rear. We only get to play with those headed in the direction of the material being tested.

We want to arrange things that as many as possible gammas can arrive there, sneaked under the photodiode, so that as many as possible of the X-rays that get shaken out have not much way of escape other than by scattering back into the diode. Of course, the X-rays too will start off in all sorts of random directions, going into and through stuff. We can only capture the fraction coming at our sensor.

Here I make an assumption. A gamma coming at the material at an oblique low angle will always go into the material, and shower forth X-rays 
It will never "reflect", no matter how shiny the surface polish, nor how low the angle. I say that, but we all know how even a grinding block "reflects" if you look at it at a small enough angle. I leave it to others to speculate why this is so.

This is just a little musing of mine, getting to grips with what is "reflection" anyway, and how it happens. When we polish surfaces, we do get things to atomic dimensions. The wavelengths of light, are around 400nm to 700nm. Ultra-violet gets to as short as 10nm, but is mostly around 200-400nm. The longest wavelength in our scheme belongs to magnesium, at 1.2536keV, with a wavelength about 0.989nm.

The gamma from smoke detectors has wavelength around 21pm. It will go right into the middle of any atom, though it might miss stuff, and pass right through. Magnesium has atom size parts 141pm to 173pm, and spacings around 320pm metallic radius (so double it). So, there can be no "reflection", and there is no limitation on range for the lucky X-ray photon that happens to exit heading towards the photodiode.

*Get up close!*
Thus, quasi-optical geometry is misleading. Basically, we want as large an area of stuff irradiated as can still see a straight line back into the diode, even if this is at an extreme low angle.  Short-range back-scatter right under the diode does not have an advantage over X-rays that had a longer journey to get there. Therefore it seems to me that if we do not tip the sources at an angle, but instead point straight ahead, and put the diode + smoke detector sources assembly down as close as possible to the sample surface, consistent with getting X-rays from the furthest sample extent to still see a straight line into the sensor, then we have possibly a better count gathering arrangement.
.Just a thought ..


----------



## homebrewed

Even xrays can be focused, but only under very specific conditions.  Google "Wolter telescope".  But you are correct that the much shorter xray wavelength places extreme requirements on the mirror surface.

Regarding the subject of flat vs. tilted source geometry, I think you are correct in saying that getting everything as tight as possible, consistent with the need to shield the detector from our sources, is the best approach to take.  A ring of flat sources is a simpler geometry, that's for certain -- but I don't think it's the one that will get the total area of the source closest to the sample.  This also could be quibbling over an improvement that's buried in the statistical nature of the counts coming in   The only way to tell is to do it both ways and compare....now, where did I put that other set of sources that I haven't ordered yet


----------



## graham-xrf

homebrewed said:


> The only way to tell is to do it both ways and compare....now, where did I put that other set of sources that I haven't ordered yet


Duh - you are so right about the sources. We may have got a few together, but for how much longer do we believe smoke detectors will be made with Am241? It's not as if we can just get hold of more gamma sources, even weak ones!


----------



## graham-xrf

My apologies for the hiatus. I have had, and still have, a number of current things that will stall me.
I have been getting quite far into bringing together the bits of design, and getting into KiCAD. So here I discuss a little, and ramble on a little, and I have a question.

One thing I have discovered is no matter where the source, be it DigiKey, Mouser, Analog.com, even though one is purchasing their product anyway, none can bring themselves to simply provide the pin-outs, footprints, and even simulation models without wrapping it behind the need to run a executable on one's PC to access it. They all have their various names for it. It seems there are good reasons KiCAD do not bundle the DigiKey KiCAD library.

Thus, I have made my own symbol, and linked footprint for the analog-to-digital converter.




*AC noise reject filter*
The gain of the transimpedance amplifier is enormous, no matter what configuration, and it is actually quite difficult to eliminate the hum from magnetically and voltage field induced interference. I suppose in many places, things are electrically quiet enough for it not to be a problem, but in my design, I push the limits right to the noise floor. The ambition is try for the lowest energies between 1.2keV and 2keV. The absorption probabilities are between 1% and 10%. Magnesium and aluminium are just about possible, and getting the proportions of silicon in the iron might also happen.

I intend to add in my version of the Twin-T AC 50Hz -60Hz filter at a place where I might exploit the presence of a buffer-driver pair that has to be there anyway. At worst, the filter gets it's own dual op-amp, costing about $4. Do not take fright at the look of it. Several components are in parallel, and a pair can be replaced by one part. Some shown are not connected anyway.




If the opinion is that something like this should be an included feature, then we get to why I designed it to do 50Hz as well as 60Hz. I thought it may as well be universal. As seen in the plot, one notch takes out 50Hz, and the other hits the 60Hz.

*Bit Banging the Raspberry Pi*
It was a little experiment. We decided to throw out various Pi libraries. I will spare the detail, and just say we ran a little C program which when compiled, was only about 8K, devoted to wiggling a pin as if sending data. We tried it up to about 66 MHz, and clearly could have gone much further, but it had reached the loop speed of the little C program. I don't understand where the program execution boundary is, but the program was trying for 100MHz, and can be persuaded to do it. We could have modified the program max out on the GPIO pins, etc, but there seemed little point. 2MHz is all we need for ADC clocking, and we can use (say) 20MHz or something for serial data transfer. The traces came out somewhat over-bright exposed on the Samsung Galaxy phone camera, but anyway, you get the idea.



Above is 66MHz off a GPIO pin. We never have to go anything like that fast!
Try for some real data..




Here I am sending the data hexadecimal CF21 into the un-terminated GPIO pin. I switched on the "connect the dots" display. On this old scope, it does 1GSample/sec if on a single channel mode. With the right resistor, and correct pF capacitor, the overshoots and ringing goes away, and it turns into a prettier square wave. The code in there is 0xCF = 11001111 followed by 0x21 = 00100001. This is still clocking out at 66MHz.

The little C program I used is here ..




I can't really figure out why so many examples I see are a mess of libraries and bloated code.
The advice here is "_*Don't use the default Python*_" unless its an undemanding application like zillions you can find on the net. I am not after educational demos here. The Pi does it easily. Comparing to C program as the reference set to 1, a compiled Java program manages about 1.2. Python is at around 75!. Old-style C might be a bit wild-West, and needs careful discipline in making and using space, (like using those "malloc" instructions), but it lets you do nearly anything.

*Conversion Rate - and "looking into the past"*
I am going to try for the conversion clock to run all the time at 2MHz, driven by the Pi, to provide 20 samples out of the 10nS pulse duration, capturing perhaps 1/2 a second's worth at a time in a cyclic buffer. I decided to save on the components and not build in the hardware comparator to provide the "pulse is here" trigger. The detection of a pulse, and it's recent past, is taken from the cyclic buffer. It's an all-software trigger with a certain amount of false pulse weeding out ability.

*Noise- again!*
The quality of the conversion, and it's signal-to-noise ratio also depends on the speed, cleanliness, and low  jitter of the conversion initiation signal from the Pi. I hope the signal from the Raspberry Pi GPIO can be dressed up nice enough to do this. The test circuit on the Pi is now mostly together. The darn stuff is just a bit small = "I need better soldering kit" ! 




*Stuff that, (I think) needs to be in there.*
Several kinds of noise-conditioned power sources. I choose 10V or 12V diode bias, driven by a tiny charge pump like LT1317B (£4.91) or similar, at 600kHz. If not then simply a couple of lithium cells. The size of the pulse is much decided by the capacitance it has to spread itself into, and the benefit of having 75pF at 12V bias instead of 190pF at 2V, or a disastrous 500pF at near zero bias, outweigh the small increase in dark current from 1.5nA to 2.5nA.

We have to not allow the DC component dark current in anyway, which is why I choose AC coupled at the transimpedance amplifier. That would be the only place it happens. The circuit does not have any return-to- baseline overshoots, nor ambiguities.

The 5V supply will ultimately come from a USB. It has to see at least a filter, with common mode and differential surface mount choke inductors, and the usual associated capacitors. In this design, a 2.5V separate low noise LDO regulated supply is needed for the analog part of the ADC converter. That too, gets filtered, with only one place common to the digital zero.

The 3.3V digital supply is stolen from the Raspberry Pi, but also filtered, and digital bit energy ground bounce limited with resistors in the digital signal line, and all the usual sensible precautions.

In the end, there is not much physical stuff on the circuit, and, (when they again become available), I hope to use the tiny Raspberry Pi Zero 2C  in there, with only a USB line, or BlueTooth link to the phone or PC for display. The plot is on a live web page in the Raspberry Pi. No software app needed on the phone. Only a browser.

*Vary the gain?*
I plan to include one of those op-amps that have 3-Bit control of gains, to allow a "zoom-in" option on the low energy regions of the plots. The amplifier can hopefully see down into the 30pA to 100pA range (where the noise is). Most arrival energies should be in the range 100pA to several hundred pA, and some up to around 1.3nA. The Pi can control which gain range is selected. Of course, this gain stage is right at the end of the chain, where the outputs are given to the ADC using a 2.5V reference for the full resolution.

*The Question..*
Mostly for Mark - given that you have already tried it, just asking what sort of "tick rate" can we expect? I would hope at least some Hertz.

What we have here is that the pulse events may not come by very often, but when they do, it's all over in 15uS. The one quantity that sets the pulse length is the photodiode biased capacitance (75pF in my plan). The pulse has a near exact relationship to the energy in it. The delay distortion in extreme low pass filtering of all other kinds of pulse-stretching blur this relationship. I would love it is we would be getting a high speed buzz, but somehow, I think that might be unlikely.

That's it for now folks. I know this is extreme nerd stuff, especially if encountered by HM members who don't quite get it that this stuff is directly machining-interest related. I will get back when I have the proto together. I am OK to mail (a few) bare PCBs, but I will check in here before I commit to making them.


----------



## homebrewed

A few comments on Graham's latest post.   First, it's good to see some progress, since I've been stymied by a cascade of machining-tool issues.  Hopefully they will be resolved soon (part of the problem is my own fault, unfortunately).  But because of that I don't have a lot of new data w/regard to count rates.  Damitall  

On the positive side, the rehab work on our rental is done, fini, over.  We've passed the headaches on to a property management firm, so there should be much more time available for fun stuff.

Regarding the circular buffer approach, that looks like a great way to implement all sorts of pulse-selection algorithms without needing to worry overmuch about the resulting processing overhead....as long as the buffer is deep enough.   But I'm a bit concerned about using the RPi's GPIO to operate the A/D -- Linux (and Windows) have all kinds of interrupts running in the background so the timing could vary all over the map if it's determined by a program running in the foreground.  Unless there's a way to configure the particular OS to behave like an RTOS, I'm still leaning toward a microprocessor-based ADC front end where I know that all the interrupt-driven processes are the ones I want to run, and I can kill them when I need to without crashing the system.

Noise inputs -- both systematic and random -- are part of the territory we will need to deal with.  High gain circuits are just going to be noise sensitive so robust H/W and S/W approaches will be needed.  There's a reason that commercial versions of XRF spectrometers are expensive, the vendors have spent a lot of effort addressing those kinds of things.  After my experience with the high levels of noise coming in from that on-board switcher (on the PocketGeiger) I'm strongly leaning toward purely linear supplies:  or switchers that are very well isolated from the high gain stuff -- both physically and electrically.  As an alternative, how expensive are two series-connected 9V batteries?  You can't get much lower noise than that....and if they're just used to bias the detector, they will last just as long as ones just sitting on the shelf.


----------



## graham-xrf

homebrewed said:


> On the positive side, the rehab work on our rental is done, fini, over.  We've passed the headaches on to a property management firm, so there should be much more time available for fun stuff.


Yay!. You have been put through the wringer a bit. Glad to hear you are now getting back to normal. I say that carefully, because for you "normal" sometimes looks a bit messy and dangerous!


homebrewed said:


> Regarding the circular buffer approach, that looks like a great way to implement all sorts of pulse-selection algorithms without needing to worry overmuch about the resulting processing overhead....as long as the buffer is deep enough.   But I'm a bit concerned about using the RPi's GPIO to operate the A/D -- Linux (and Windows) have all kinds of interrupts running in the background so the timing could vary all over the map if it's determined by a program running in the foreground.  Unless there's a way to configure the particular OS to behave like an RTOS, I'm still leaning toward a microprocessor-based ADC front end where I know that all the interrupt-driven processes are the ones I want to run, and I can kill them when I need to without crashing the system.


Forgive that I get a bit expansive here. This is the very point I wanted to test, and establish.

The thing about process allocation in Linux is that one _can_ set it to run user processes with absolutely exclusive grip on the CPU, but that leaves one with the responsibility to "let go" periodically. In practice, hardly anybody ever needs to. The kernel default clever settings maintains enough room in the loop for all the "housekeeping". The vast majority is available to the user, and slow-downs are never hang-ups.

I think Windows has seven levels, only the top one being user space. What goes on in the others is unknown, except we can see it takes CPU time as a law unto itself, and is often doing significant uploads (why?) This is the reason none of the satellite Earth Station servo software I ever became involved with could be entrusted to a Windows OS, quite aside from most client's needs not to rely on any kind of "trust" anyway.

There is some kind of synchronization scheme in the task allocation, so that the intervals one sets in programs, in do in fact loop on the expected microsecond. This is how I noticed that an expected 1uS repeats data stream repeat had exactly that interval on the scope. Then, as we "sped up" things, we got to the point where only 2/3 of the code could execute before the interrupt. The result was an automatic adjustment to the loop to have execution in 15uS instead of 10uS, which is why the display shows 66.666MHz. I have to appreciate that the individual bits in that stream looked like 100MBaud !!

Linux kernel has 2 levels, both of which can have user access. The keyboard poll is default at 300Hz. Some users who like to run high end audio recording applications in real time, and still want "instant keyboard response"  will set the rate to 1kHz. Where millisecond latency down to less than 5mS is needed, say when using Jack Audio connection kit with several MIDI interfaces, you use the repository, and invoke the low-latency or real-time kernel. Again, very few users experience enough data drop-out to need this. Those who do would probably run the OS headless. As it happens, during this little test, the whole display, network, keyboard, mouse, BlueTooth, etc. everything was running!  If I had a monitor on it, I could have gone browsing, although I dare say running a bloat like Chromium browser playing Ed Sheeran on YT would have slowed it down a bit! Instead, I let it get on the WiFi on the default DHCP address, and I accessed it via SSH from my desk PC.

I do get it that we are never going to be thrashing a Pi into oblivion like this. I wanted to see if the (pathetic) little heatsink I used would be enough. Not having a fan involved is an objective. Of course, a full-blown Pi4 is not needed. An older Pi3 Model 2B is enough, and indeed the aim here is to use the (damn fast!) little Raspberry Pi Zero 2W. You can appreciate the size from the picture.  I am reasonably sure that a $15 bucks little computer like this is actually up to it. It won't have the overhead of a user screen, and indeed, one can just install the stripped down "headless" version if need be. I imagine all the XRF software to be running in there, with no need for any outside resource other than the user running a browser with interactive buttons on a display page.




*Re: The Cyclic Sampler.*
I worked it out. Suppose on samples 20 in a 10uS period. That's 2MHz.
Suppose we get greedy, and pessimistic, and decide to stash a whole second's worth. So two million samples, each two bytes worth.
The 4Mbyte of memory is not such a big chunk of the half a GigaByte of SDRAM in there! (in a Pi Zero).

OK then. We get it that the "tick rate" might be quite slow, maybe several per second, up to some hundreds per second. The thing is, when the pulse arrives, it's all over in about 10uS or 15uS, and there is then a whole milli-second or two before the next event. I know a whole second's worth might involve sorting out a lot of pulses, so maybe we can choose say half a second, or less. These times are an age for a computer. I am now reasonably sure even a (slow) 2MHz cyclic stash leaves more than enough time to play with it's numbers.


homebrewed said:


> Noise inputs -- both systematic and random -- are part of the territory we will need to deal with.  High gain circuits are just going to be noise sensitive so robust H/W and S/W approaches will be needed.  There's a reason that commercial versions of XRF spectrometers are expensive, the vendors have spent a lot of effort addressing those kinds of things.  After my experience with the high levels of noise coming in from that on-board switcher (on the PocketGeiger) I'm strongly leaning toward purely linear supplies:  or switchers that are very well isolated from the high gain stuff -- both physically and electrically.  As an alternative, how expensive are two series-connected 9V batteries?  You can't get much lower noise than that....and if they're just used to bias the detector, they will last just as long as ones just sitting on the shelf.


There are good charge pump circuits that can deliver switcher type low(ish) noise volts. I do agree that the 2 cells lithium solves quite a lot of the problems, and a saves a whole bunch of components. Of course, the cells have their own price, and on needs to mount them somehow, but I am sure we can find a way. OK then, everything about our layouts and choices are going to be hostile to noise, and we use a pure DC for the bias.

The lithium cells may have a working life somewhat more than I have left for myself!   The bias current does have some noise, but I am not sure how much. The diode "equivalent" circuit may not represent it right. A reverse biased diode is not a real resistor with resistor molecules bashing about in it. I was after getting the transient pulse away from it, through a capacitor, into the transimpedance amplifier.

I know you are using a modified Pocket-Geiger. There will be more space on my protoype PCB than I can use. There is no extra charge for "step-and-repeats" except if there are a lot of holes to be drilled. One possibility is that if you have a modified pocket-geiger circuit, and want to put your stuff on a PCB, you can post here, or send it to me, to include on the prototype gerbers. I have to check what the deals are now, but I am thinking one might fit several of both our efforts on one PCB proto minimum size, and just share them.

I have two schemes. One uses the LT6269 dual op-amp in a straightforward transimpedance circuit. The other is the version with the front-end JFET, and scheme to lose the noise with frequency component.
Unfortunately, the dual opamp I bought is only available in MS8E, or we know it as MSOP-8. The SO-8 package only does the single op-amp LT6268.

*Soldering !*
Now becoming a problem for me. I need to resort to the technique normally used for BGA arrays, meaning placing the solder first, and the part, then covering with the flux goo, and holding the iron into the flux blob, and waiting for the melt. Otherwise, it's going to have to be the "heat it all up" way that you have practiced.


----------



## WobblyHand

I hesitate to mention this again, but for prototyping SMD I'd use a hot air gun and solder paste.  No iron, no extra flux.  A temperature controlled hot air gun can be bought new for less than $35.  Comes with different size nozzles and adjustable air flow.  I've seen them as cheap as $10.  They really are the cats meow.  Easy to use.  Doesn't move the parts.  The $35 one has an auto shut off when the gun is put in the cradle.  Turns on again when you pick up the gun again.

Have no ownership or interest in any of these companies, just a happy user.


----------



## graham-xrf

WobblyHand said:


> I hesitate to mention this again, but for prototyping SMD I'd use a hot air gun and solder paste.  No iron, no extra flux.  A temperature controlled hot air gun can be bought new for less than $35.  Comes with different size nozzles and adjustable air flow.  I've seen them as cheap as $10.  They really are the cats meow.  Easy to use.  Doesn't move the parts.  The $35 one has an auto shut off when the gun is put in the cradle.  Turns on again when you pick up the gun again.
> 
> Have no ownership or interest in any of these companies, just a happy user.


It's OK. I was thinking of you anyway.  I now have a real nice hot air gun with LCD display of temperature setting, fan speeds, cool-down blow, etc. It's just that the previous adventure, with previous hot air gun, ended up as  a bit of a bust!. Try and imagine surface mount bits getting blown into places where the next time they might move is into a vacuum cleaner. Then imagine second try, scorching things like the paint-stripper it was designed to be. Cheapo crap method of "getting hotter" was by "slow down the air flow"! By then, I was already far past the "give-up" point.

I have been looking at some YT videos where the guy was removing only the micro-SD card holder from a circuit. He pinged the metal casing tabs first, then used a generous splodge of the transparent, slightly yellow-looking flux across all the pins at once. He put the end of the soldering iron into the flux, and in a few seconds, the whole thing un-soldered. The same with replacing a IC with DD case. This was a phone repair. He covers it all with the flux stuff, puts his iron into it, and it all comes away. he even used the trick for soldering the new chip in.

At least some of what I have to be doing is changing the odd part on an already built board. The hot-air trick, is, I think, probably the best when soldering all the components on in one hit. They just "align themselves" onto the pads.


----------



## WobblyHand

those little nozzles are great for rework.  I had to rework an SD card holder before.  Used hot air and flux.

And sorry to hear about your previous misadventures with hot air!  Would have soured me a bit as well.  Having decent tools always make the job go better.


----------



## homebrewed

One scheme we looked at for board rework used an interesting approach for directing heat at a specific location.  It was a high-intensity projector lamp and a lens to further focus the hot spot.  For situations where that wasn't quite sufficient, it included a little hot air gun but it was placed on the opposite side of the board to just provide that little bit of extra thermal "oomph".  Items with low emissivity (like shiny metal shields) didn't work too well but it was OK for soldering IC's.


----------



## graham-xrf

*A quick 'n dirty XRF pulse simulator.*
LTSpice has it's shortcomings, especially getting one's own models into it. It does have a 555 timer, as in NE555. Of course, over some decades, this handy, popular little IC has all kinds of versions, from all kinds of manufacturers. The LTSpice default NE555 does not even simulate like a real Signetics NE555. Regardless, I can still tweak out what I want. Just vary the components a bit to suit yourself.

The circuit is a temporary test pulse generator intended to deliver a reasonable representation of a photon pulse arriving. I wanted to be able to vary the height, and have the whole pulse over in about 13uS. Also, with no undershoots, or funny fumbles in returning to zero. The idea is to have a test getup to offer the pulse at the ADC capture, and it's ring buffer with software trigger.

Of course, one could also offer the output into other analog circuits that might end up making stretched versions. This circuit assumes there is a coincidence new pulse only 30uS away, simulated by making the repetition frequency about 32KHz.




Note that R9 cannot be reduced much further than 330 ohms without letting the output pulse start suffering a little undershoot.
The pulse height setting is by varying R5, which can be anything up to about 10K, to keep the pulse from getting too big for the ADC. If R5 were a 10K potentiometer, with wiper taken to the (+) input of the opamp, you can alter it with a knob. Having some ohms in R8 tames the high speed glitch from the opamp as the MOSFET switches.  Probably one could use just about any transistor that will turn on and off, but if a bipolar NPN is used, the bias and driving components would be different.

I have found a better 555 model, though I dislike the symbol. It lets you make your own model. I include the test example here in a ZIP file.

This stuff is just something temporary I found useful. I wanted to get the ADC measuring figured out  without trying to persuade a bunch of radioactive stuff to cooperate.


----------



## homebrewed

Regarding undershoot, are you referring to the case where R5 is replaced with a 10K pot (and the wiper is near R9)?  If so It sounds like either the opamp's inputs are not rail-to-rail or perhaps the output isn't, despite your comment on the schematic.  Otherwise I don't understand why R9 would have something to do with undershoot.


----------



## graham-xrf

graham-xrf said:


> *A quick 'n dirty XRF pulse simulator.*


Hi Mark
I was surprised too!
The op-amp is billed as "rail-ro rail", but of course, that means "nearly so". Also, it has something like 325MHz bandwidth! When the FET slams on, the op-amp tries to deliver. I was looking at about 1.8V high pulses with R5 at 10K, and there wasn't a R9 at all. I knew one couldn't simply ground the positive input. When I set R5 to anything less than about 330 ohms, the undershoot starts happening, so I added R9. One thing I don't want is negatives arriving at the ADC.




Investigating a bit, it seems it is not about starvation of the op-amp. I gave it a negative supply, and tried -0.5V and -1V, and still I get sim overshoot.
The 555 is just the crappy default in the LTSpice library, and the MOSFET is one of the first I saw in the choices. It might be some mighty motor-driver. I was not too concerned about making great sim pulses. Almost anything I can lash together to give me variable height pulse of approximately correct duration would do. There is the odd old 555 in the junk jar, and an old MAX666 regulator will do for now for the 2.5V, in place of the ADM7160 Ultra-Low Noise 200mA regulator that I hope to use in the final circuit.
[The MAX666 has probably been in that jar I found in the cellar since sometime in the 1990's]

I will knock up some sort of variable pulse gen. I do have a variable pulse generator that had quite the high specification in it's day, when Hewlett Packard was not just a maker of crappy printers, but it now needs some repair/service, and is yet another bench instrument, while a 555 is just a little temporary handy hanger-on in the test lash-up. I resisted the temptation to just use software to make the Pi provide it's own test pulse into a R-C network, or switch a FET, then into a R-C network.

*Getting into the main deal*
I will post my (two) circuits here soon. As I have thought it through, I have liked the design that has a PCB which mounts the photodiode, possibly at right angles to the board, and has everything on it except the computer card. This can be married to a $15 Raspberry Pi Zero, simply pushed onto a GPIO connector. For me, while the Pi Zeros, (or any Pi for that matter) are in short supply, I can manage with what I have around me. The bit-banging experiment was with a old Pi Model 3B

If  done this way, then almost any other small computing board can be used with it instead. It only has to work the ADC, and supply a 3.3V

I also have much else going on right now that is important to me, involving some travel to London.  That slows me up when trying to get the XRF going, but I try to move it on any chance I get.


----------



## homebrewed

That undershoot is a strange one. Perhaps the MOSFET's gate capacitance has something to do with it, but how would a low resistance on the opamp side modulate that?  It will be interesting to see if an actual circuit exhibits this.


----------



## graham-xrf

homebrewed said:


> That undershoot is a strange one. Perhaps the MOSFET's gate capacitance has something to do with it, but how would a low resistance on the opamp side modulate that?  It will be interesting to see if an actual circuit exhibits this.


I should have used the NE555 that I included in NE555Test.zip. That one models the innards of the 555 as a sub-circuit, but I was in a hurry.
Anyway, the 555 cannot reasonably be responsible.  If you reduce the 470R in the gate, it drives the charge capacitance faster, and you get (very) high speed ringing, and a curious  positive going lurch at the MOSFET source on 3. which actually catches up with the output of the RC filter, as it discharges.

I put the 470R in the gate to moderate the charge rate into the gate capacitance. This tames it, and it made be think that there may be a Miller capacitance effect through to the output.

I have included the simulation circuit netlist here, but you have to edit off the .txt extension to end up with '_ 555_XRF_Sim__Pulse_Gen.asc _'
This is another one of those that we sometimes ask @vtcnc to arrange that ASCII text files of type _.asc_ to be allowed, but it is easy enough to rename it.

Regardless what the simulation is does, I am soldering away with some of my old-school non-PC 60/40 tin-lead, found in the same junk box as the MAX666, and the NE555. (I might as well use it up).    We can soon look at some real waveforms, using the old 54520A, which is another bit of kit that comes from before HP became Keysight.

Better still, I want to see them plotted as if they came from some material, but that may be a little further down the road. I am only just getting into digging through the PyMCA software.


----------



## homebrewed

graham-xrf said:


> I should have used the NE555 that I included in NE555Test.zip. That one models the innards of the 555 as a sub-circuit, but I was in a hurry.
> Anyway, the 555 cannot reasonably be responsible.  If you reduce the 470R in the gate, it drives the charge capacitance faster, and you get (very) high speed ringing, and a curious  positive going lurch at the MOSFET source on 3. which actually catches up with the output of the RC filter, as it discharges.
> 
> I put the 470R in the gate to moderate the charge rate into the gate capacitance. This tames it, and it made be think that there may be a Miller capacitance effect through to the output.
> 
> I have included the simulation circuit netlist here, but you have to edit off the .txt extension to end up with '_ 555_XRF_Sim__Pulse_Gen.asc _'
> This is another one of those that we sometimes ask @vtcnc to arrange that ASCII text files of type _.asc_ to be allowed, but it is easy enough to rename it.
> 
> Regardless what the simulation is does, I am soldering away with some of my old-school non-PC 60/40 tin-lead, found in the same junk box as the MAX666, and the NE555. (I might as well use it up).    We can soon look at some real waveforms, using the old 54520A, which is another bit of kit that comes from before HP became Keysight.
> 
> Better still, I want to see them plotted as if they came from some material, but that may be a little further down the road. I am only just getting into digging through the PyMCA software.


I often find it necessary to put some R in series with the gate connection on power MOSFETS to keep them from oscillating so that's no surprise.

I have loads of 60/40 (in different sizes) so it's the solder of choice for me, too.

Thanks for uploading the simulation netlist.  I think I'll play around with it some, myself.


----------



## graham-xrf

This may be premature, but we do have the PyMCA up and running on my _*Hobby Machine XRF Raspberry Pi3 Model B*_
Also, on the Raspberry Pi 4 Model B
I know there is still a whole ton of reading to do, and figuring out how best to interface with this.
In the most basic case, you have a capture program stash the results of a "run" into a file. Then open it with PyMCA.
There are other ways, like shared memory access.
BUT..
There are a whole lot of other ways, and formats, and built-in analysis tools, "background subtraction", and elements identification, and stuff.
The suite comes as a set of 6 programs.
1. EDF Viewer.
2. Elements Info (which happens to be open in the picture).
3. Peaks Identifier.
4. PyMCA (which happens to be open in the picture)
5. PyMCA PostBatch.
6. PyMCA POI tool


----------



## homebrewed

Some fooling around with Graham's pulse generator has shown that the undershoot and overshoot on the input to the low-pass filter are totally due to the MOSFET.  I stripped the circuit down to the MOSFET,  the low-pass filter network and 430 ohm gate resistor, and substituted a fixed voltage source for the opamp variable-voltage source and a voltage source configured as a pulse generator with selectable Tr and Tf.  The overshoot/undershoot start to show up when the pulse risetime goes below 10us.

Some of the other MOSFETs in the LTSpice library are even worse.  I think they were selected for switching regulators -- big devices with high gate capacitance (or high charge injection via the gate, if you want to think about it that way).

On a slightly different note, I finally got my lathe put back together again, and while I was at it I shimmed the headstock to reduce the amount of taper I was getting when turning longer pieces.  Things went slowly because I had to fabricate a number of fixtures to make sure the bearings went in straight -- my first try at it was a mess and I screwed up the bearings.  The second time around I went with tapered roller bearings because the outer and inner races can be installed separately, reducing the chances of damaging the bearing by pressing on the wrong part of the bearing.  That was an expensive lesson for me.


----------



## graham-xrf

Great that you are up and running again with the lathe. Sorry about hurting the bearings. It's always emotionally hard to take when it is the new stuff that gets the hard time.

I agree entirely about the MOSFET. I think power MOSFETs are basically hundreds of them in parallel, or a big area thing. Aside from the capacitive input charge to turn them on, there is a large capacitance from the drain back to the gate (Miller). This feedback significantly resists what one is trying to do with the gate, and it's effect becomes more marked, the faster one goes at it!

The default choice in FETs is a case in point about Spice models available for Linear Tech. They happen to offer a Spice, with models that are of their products. Most are surrounded by SUB-circuit scripting tricks that basically use some other long-known element in it, augmented maybe by little inductances and stuff around it, perhaps to model the package. They seem to have the whole Infineon range in there.

There is, of course, the "other" kind of model, often also in a SUB-circuit, that is internally a mathematical fiction, using dependent current generators, gain blocks, and function expression blocks. If the whole thing models the product, then great!  It runs many times faster than simulating the whole internal circuit of an IC

Persuading other models in there, including one's own, contrived from a data sheet, is a bit more awkward, and I think the best way is just to use a .INCLUDE text with your own .MODEL statements in it.

Of course, I was not into that! Having satisfied myself the little dodge was OK for a quick test setup, I was just zipping along, not trying too hard to get a great simulation, more intent on unearthing some long-lost FET to lash up this thing. Don't laugh, but I came across a small packet of 2N7002!
Can you tell I was getting distracted from a clear-out?


----------



## homebrewed

I had figured it probably was the particular choice of FET but just had to verify it.  Really no big deal since it's highly unlikely any of us will use a FET like that in our pulser, if we make one.  I've got a bunch of small-signal BJT's and have no problem with a small loss in pulse amplitude due to Vsat so would just use them.  I bought them by the pound when a local electronics company was clearing out their stockroom.  Mostly 2N3904 and 2N3906 devices  )

Back to the lathe, it also was frustrating because I had decided to make a punch and die set for the little lead ring around the base of my "focus ring".  That had to wait until I put the lathe right again.  It also didn't help that my bandsaw was acting up as well, and I needed it to make some of those bearing-installation fixtures.  Sort of a cascade of problems but now resolved.

I'm currently machining the die portion -- an 1/8" thick steel rectangle that will have two holes in it to match the ID and OD of the ring.  Lead is very soft so I'm just using low-carbon steel for the punch and die, no hardening required.  The approach is a lot more wasteful than my original scheme but I think the end result will be much better.


----------



## homebrewed

I finally have been able to do more work on my XRF hardware.  Before my lathe went out I turned the aluminum "focusing ring" but my punch and die scheme for making that little shield ring was thwarted -- until just recently.  After getting the lathe up & running again I made the punch and die, formed the ring and epoxied the focusing ring and shield ring to my lead shield.  After all that set up I mixed up another batch of epoxy and dipped the edge of each source into it, then placed them in the focusing ring.  The shield ring acted as a "stop" so they didn't slip down too far..  That's setting up as I type this.  So I should be able to re-assemble everything pretty soon and see what kind of count rate I get as a result of getting everything _much_ closer to the detector.

In addition to the shield ring I made a shield piece to wrap around the outside perimeter of my focus ring.  I thought that would be a good way to further confine the sensitive volume, to reduce and/or eliminate false counts from fastener hardware, like the latch on the exterior of the box.  That shield also is freshly-glued to the focus ring.


----------



## homebrewed

I've made some progress on my hardware and software for this project.  First, a couple of photos:




The first shot was taken looking down the axis of the focus ring.  Some of the Am241 sources can be seen, and the bottom edge of the detector can be seen on the other side (because the photo was taken a bit above the center-hole).  The second shot is a top-down view showing my signal conditioning board, detector board and lead shield/focus ring in left-to-right order.  I also cut a piece of lead to wrap around the OD of the focus ring to shield me and other extraneous hardware from 60Kev x-rays.  I'm not as rigid as aluminum so in that context I guess I could be called "exterior software" 

Some preliminary tests have shown that the count rate increases when an iron sample is placed up against the focus ring, but I didn't succeed in completely eliminating stray counts sneaking in from the sources.  It's possible I'm seeing some counts from the lead shielding.  If so it's going to be difficult to totally eliminate that with my setup.  Backing off from the "get everything as close together as possible" approach may be required.

Advancement on the "real" S/W front:  I adapted some serial I/O code I wrote for a different project, to set acquisition parameters (used by my Teensy front-end) and also to capture pulse data sent out by the Teensy.  For now it will output pulse data in a CSV style format, making it easy to plot using a spreadsheet.  It will be run in a terminal window, no fancy GUI for now.

I also found an ADC library written for the Teensy series of processor boards that looks pretty good.  It should be relatively straightforward to implement a continuously-running setup using a circular buffer and (hopefully) relatively simple pulse-identification code.  The open question is if the library + Teensy can deliver a high enough sample rate for this application.


----------



## graham-xrf

Well done on getting together the hardware.
I am also going for 8 sources. When you say "count rate", approximately how many would that be? I was always after how many events happen, and we have to hope that 60keV hits coming from 8 sources is enough.

You should be OK for ADC sample rate, because the pulses are "stretched". If you have pulses that happen too close to each other, that can get awkward.

You would have been hoping for almost dead quiet zero pulses, except when the iron is offered at it. It sounds as if you have a some part responding from everything and everywhere, and the rest coming from the iron. There cannot be responses from lead K-shell (energy too high), but there might be some at 10.55keV and 12.61keV coming from lead L-shell. Who knows, maybe these might be quite numerous.

I am thinking that "background subtraction", if that's what the software does, might be something like gathering the counts from when the iron is not there, and sorting their energies into buckets. A sort of "pre-testing calibration". Then, with iron present, the new set gets all those buckets presumed to have come from the lead "subtracted". I think that the fact you find the counts increase when you bring the iron up to it is just great. The darn thing is working OK ! 

When you get to it, your kit will want to see buckets of 6.4keV, 7.05keV, from Iron K-shell. The feeble energies (0.7keV) from iron L-shell won't wiggle the diode anyway. There may be other energies coming from the iron. Basically, if you see pulses in two energy groups, one being about double the energy (though not the count) of the other, one peak is lead, and the other is iron. (I think).


----------



## homebrewed

graham-xrf said:


> Well done on getting together the hardware.
> I am also going for 8 sources. When you say "count rate", approximately how many would that be? I was always after how many events happen, and we have to hope that 60keV hits coming from 8 sources is enough.
> 
> You should be OK for ADC sample rate, because the pulses are "stretched". If you have pulses that happen too close to each other, that can get awkward.
> 
> You would have been hoping for almost dead quiet zero pulses, except when the iron is offered at it. It sounds as if you have a some part responding from everything and everywhere, and the rest coming from the iron. There cannot be responses from lead K-shell (energy too high), but there might be some at 10.55keV and 12.61keV coming from lead L-shell. Who knows, maybe these might be quite numerous.
> 
> I am thinking that "background subtraction", if that's what the software does, might be something like gathering the counts from when the iron is not there, and sorting their energies into buckets. A sort of "pre-testing calibration". Then, with iron present, the new set gets all those buckets presumed to have come from the lead "subtracted". I think that the fact you find the counts increase when you bring the iron up to it is just great. The darn thing is working OK !
> 
> When you get to it, your kit will want to see buckets of 6.4keV, 7.05keV, from Iron K-shell. The feeble energies (0.7keV) from iron L-shell won't wiggle the diode anyway. There may be other energies coming from the iron. Basically, if you see pulses in two energy groups, one being about double the energy (though not the count) of the other, one peak is lead, and the other is iron. (I think).


My guesstimate (which could be totally wrong due to my DSO's holdoff time) is that the incremental count rate is somewhere around 10CPS.  A decent acquisition program with a circular buffer will really tell the tale.  Working on that now.

I think the background counts I'm seeing are mostly due to the 10Kev photons from lead (but there are always other environmental contributors).  One thing I didn't take into account is that the top inside corner of my shield ring isn't nearly as thick as the bulk so they could be coming from that region.  Perhaps one reason to back off a bit from the get-everything-close approach, eh?  Geometry seems to be more complicated than I originally thought.  Something to consider is that lead should be pretty good at blocking its own XRF photons so perhaps "fringe effects" are talking.  Apparently there's still room for improvement....

But as long as the counts from lead are relatively low, it should be OK -- subtracting a baseline spectrum if we have a low pileup rate should be fine.  Hoping so at this point.


----------



## graham-xrf

Thanks for the count rate estimate. My admittedly crude calculations suggested a pessimistic 1 every 2 per second, while another was looking to be about 60 or 100 per second.

I have been thinking geometry.. Quoting Mark..
"_One thing I didn't take into account is that the top inside corner of my shield ring isn't nearly as thick as the bulk so they could be coming from that region.  Perhaps one reason to back off a bit from the get-everything-close approach_".

We know that once a photon gets going, it will keep going to the end of the universe unless it hits an atom of something. What it encounters is pretty much empty space, even when it finds some material. I don't really know what happens as a photon encounters material, but I think it goes on in until it finds electrons to mess with. The resulting XRF photons then have to find their way out. The solid angle of candidates that got so lucky they end up aimed at the diode is small enough. The closer you get, the better the chances. Thus, lacking a diode about 150mm diameter under it, and maybe another over it, I think I still believe that getting up close is best.

Our sources can't see the diode directly, but they can beam their stuff "past the corner". How close you get may be governed by that.

*I invested in a new soldering iron..*



It had to happen! I take my chances that replacement tips may not be altogether straightforward to find, because although the supplier was in UK, I think it is probably Chinese. This one has the pump that sucks the smoke and fumes up a little pipe. The rest of it is the "slow hot air" stuff. I am taking a bit of a gamble here. The kit cost £85 ($112). I was not thinking I would be madly into circuit construction, so I am thinking it had better be the last soldering iron I ever buy.

I had another rake through all the available low noise amplifiers, with particular emphasis on stuff with SO8 packages. There are some extremely low noise types out there, even some with RF-type bandwidths, but my original choice LTC6269 is still clearly the best.


----------



## homebrewed

graham-xrf said:


> Thanks for the count rate estimate. My admittedly crude calculations suggested a pessimistic 1 every 2 per second, while another was looking to be about 60 or 100 per second.
> 
> I have been thinking geometry.. Quoting Mark..
> "_One thing I didn't take into account is that the top inside corner of my shield ring isn't nearly as thick as the bulk so they could be coming from that region.  Perhaps one reason to back off a bit from the get-everything-close approach_".
> 
> We know that once a photon gets going, it will keep going to the end of the universe unless it hits an atom of something. What it encounters is pretty much empty space, even when it finds some material. I don't really know what happens as a photon encounters material, but I think it goes on in until it finds electrons to mess with. The resulting XRF photons then have to find their way out. The solid angle of candidates that got so lucky they end up aimed at the diode is small enough. The closer you get, the better the chances. Thus, lacking a diode about 150mm diameter under it, and maybe another over it, I think I still believe that getting up close is best.
> 
> Our sources can't see the diode directly, but they can beam their stuff "past the corner". How close you get may be governed by that.
> 
> *I invested in a new soldering iron..*
> 
> View attachment 402267
> 
> It had to happen! I take my chances that replacement tips may not be altogether straightforward to find, because although the supplier was in UK, I think it is probably Chinese. This one has the pump that sucks the smoke and fumes up a little pipe. The rest of it is the "slow hot air" stuff. I am taking a bit of a gamble here. The kit cost £85 ($112). I was not thinking I would be madly into circuit construction, so I am thinking it had better be the last soldering iron I ever buy.
> 
> I had another rake through all the available low noise amplifiers, with particular emphasis on stuff with SO8 packages. There are some extremely low noise types out there, even some with RF-type bandwidths, but my original choice LTC6269 is still clearly the best.


 The LT1028 has pretty amazing noise performance and is available in a DIP-8.  The question is if its 75MHz GBW is sufficient for your purposes.  I've been looking at low noise amplifiers as well, but with emphasis on very good low frequency performance like very low 1/F and (or?)  flicker noise.  The LT1028 is specified as having just 35nv peak to peak noise amplitude in the .1-10 Hz band and .85nV/sqrt-hz  (typ) @1KHz.  Current noise is not as good as the LTC6269 @ 1pA/sqrt-hz.  I'm not looking at it specifically for a TIA but mulling over attempting an ultralow field NMR spectrometer.

I've found that a lot of so-called "low noise" amplifiers don't even specify what their noise current is.  The omission usually means "not great".


----------



## graham-xrf

Absolutely agreed! If the feature was something to be proud of, it would be in the headline!
While I was rummaging about in the (rather small) cellar, finding junk from the last century, I came across this free sample promo that I never got around to opening. It hails from about *1996* when Comlinear was still a thing, though the datasheet is from 2001. There is even a small double-sided with ground-plane evaluation PCB stuck on the back of the card. From the days of through-hole mounting, and big enough to not disappear if you dropped it!




It's in a *DIP* package!  GBW is 1.7GHz!  Vnoise is 1.05nV/√Hz.

It's not bad, but..
It needs +/- 5V power supplies.
It has 100uV input offset voltage.
.. and various other things that make it fun only for some other one-off project.

For me, the 5.5fA bias current of the LTC6269 is the truly amazing spec. It allows having quite high value resistors in the circuit. Thinking about it, that amounts to (the charge effect of) only about 34000 electrons in a whole second!

This is not a good thought. Unless the manufacturer test getup was pretty special (glass?), the leakage across the PCB between the pins under a tiny MSOP or TSOT-23 might account for a fair fraction of that!

[EDIT:  I have the datasheet of LT1028 in my XRF collection, so I have must have visited it before. Like the LTC6269, it's expensive! £10.49 ($13.84). 75MHz sounds like a lot, but if the first TIA gain is (say) 500,000, then the bandwidth is 150Hz, or put another way, needing nearly 1.66mS to rise or fall.

The published TIA Photodiode Amplifier on the LT1028 datasheet is a variant of the (several) TIA amps from Glen Brisebois, all featuring the discrete FET input. ]


----------



## homebrewed

graham-xrf said:


> Absolutely agreed! If the feature was something to be proud of, it would be in the headline!
> While I was rummaging about in the (rather small) cellar, finding junk from the last century, I came across this free sample promo that I never got around to opening. It hails from about *1996* when Comlinear was still a thing, though the datasheet is from 2001. There is even a small double-sided with ground-plane evaluation PCB stuck on the back of the card. From the days of through-hole mounting, and big enough to not disappear if you dropped it!
> 
> View attachment 402360
> 
> 
> It's in a *DIP* package!  GBW is 1.7GHz!  Vnoise is 1.05nV/√Hz.
> 
> It's not bad, but..
> It needs +/- 5V power supplies.
> It has 100uV input offset voltage.
> .. and various other things that make it fun only for some other one-off project.
> 
> For me, the 5.5fA bias current of the LTC6269 is the truly amazing spec. It allows having quite high value resistors in the circuit. Thinking about it, that amounts to (the charge effect of) only about 34000 electrons in a whole second!
> 
> This is not a good thought. Unless the manufacturer test getup was pretty special (glass?), the leakage across the PCB between the pins under a tiny MSOP or TSOT-23 might account for a fair fraction of that!
> 
> [EDIT:  I have the datasheet of LT1028 in my XRF collection, so I have must have visited it before. Like the LTC6269, it's expensive! £10.49 ($13.84). 75MHz sounds like a lot, but if the first TIA gain is (say) 500,000, then the bandwidth is 150Hz, or put another way, needing nearly 1.66mS to rise or fall.
> 
> The published TIA Photodiode Amplifier on the LT1028 datasheet is a variant of the (several) TIA amps from Glen Brisebois, all featuring the discrete FET input. ]


Sometimes I wonder if some of those amazingly good Ibias specs are just specsmanship -- the vendor comes up with the part and then puts it in a package that isn't at all that friendly for doing things like guard rings.  Analog Devices has some (older) designs that are packaged in a way that actually makes sense if the user wants to make a truly low input-current circuit but that seems to be an exception rather than the rule.


----------



## graham-xrf

Yes, you are right. I wanted guard rings, but the spacing between the pins is just too close. One can surround the input pin most of the way, and hope that the capacitive fields around the pin go to it more than the capacitance pin-to-pin. If one could get a trace between the pins, then it would split pin-to-pin capacitance to be in series, but I think this is not an option for us (unless we go for big DIPs, or even SO8s).

Related to this, on my PCB, I split the transimpedance Rf gain resistor into two in series, and used two 3.3pF capacitors in series to go past the strays over Rf


----------



## graham-xrf

Raspberry Pi supply is getting kinda dire, and this is worldwide!

Since I saw the entire PyMCA software suite up and running on my Pi, I definitely want a Pi in there. While there have been huge efforts to ramp up supply, the demand has stayed ahead of it. There is no point in "shopping around" yet. One fine fellow has automated the task with a Raspberry Pi supplier stock tracker app.

--> HERE --> https://rpilocator.com/

It's not all that useful as it is. What we need is  a product select, then "sort by supplier" to discover if there is any stock.


----------



## WobblyHand

graham-xrf said:


> Raspberry Pi supply is getting kinda dire, and this is worldwide!
> 
> Since I saw the entire PyMCA software suite up and running on my Pi, I definitely want a Pi in there. While there have been huge efforts to ramp up supply, the demand has stayed ahead of it. There is no point in "shopping around" yet. One fine fellow has automated the task with a Raspberry Pi supplier stock tracker app.
> 
> --> HERE --> https://rpilocator.com/
> 
> It's not all that useful as it is. What we need is  a product select, then "sort by supplier" to discover if there is any stock.


Seems that I'm lucky, or silly, to have a few of most of the versions.  Still have a 2, a 3b, and  2GB, 4GB, & 8GB RPI4 spares.  I try to use them for little tasks around the house.  One is a print server, another an advert filter, known as pi-hole, and one as an irrigation controller (Open Sprinkler Pi).  

The RPI 4 is light years ahead of all the rest.  It's satisfactory as a home computer, albeit a little slow, and runs two monitors.  I used one that way when my laptop motherboard failed and was waiting for a new laptop to ship.  It's not bad, as long as you boot from disk.  Running from SD is still quite slow.  You can buy an inexpensive SSD and boot from USB.  At the time I bought the disk it was only $24.  Huge improvement.

I'm in the same quandary with trying to source a microcontroller board to make an electronic lead screw.  Delivery time is now over a year.  I've been trying to source the board for 4 months now.  No luck so far.


----------



## homebrewed

Hardkernel has some RPi equivalents, although the one closest to the RPI4 is currently out of stock.  It's claimed to be available again "by early May".  I have three of them, of two different generations.  I'm using one as a networked front end for a 4K TV (to bypass its built-in but hard to use browser), one as a print server and one as a smart call blocker.  

The one being used for the TV is an 8-core job (IIRC, 4 A15's and four A7's) running at 2GHz and has a built-in graphics coprocessor so it can upconvert video streams to 4K.  It can use either SD cards or EMMC.  The latter are much faster, pretty much like an SSD.  It's claimed to run about 7x faster than an RPI3.


----------



## homebrewed

I've been working on the S/W side of my version of an XRF spectrometer and have a few suggestions for other folks who may be doing the same thing.  To make it easier to exchange information regarding things like trigger levels (to start the pulse processing stuff) and goodness of fit values (as a way to reject ill-formed pulses), it would be best to use values that are an accurate representation of the pulse amplitude coming out of the detetor front end.  That's the approach I'm taking at present, because those values can easily be adjusted if you know the gain of the analog front end.  And if it becomes clear that a different kind of detector like a scintillator is needed, the S/W wouldn't need much editing to adapt to that.  

A fully user-friendly system would encapsulate the specific hardware parameters in an easily edited configuration file.  Something to consider down the line.

Since the A/D front end needs to run upwards of 400KSPS this pretty much eliminates low-end Arduinos.  The Teensy4 I'm writing code for has an FPU and hardware support for other DSP functions like FFT's so using floating point is not that big a deal.   With all that you can do a lot with a 600MHz microprocessor in a short period of time.  And it costs a bit under $20 so there's not much of a downside.


----------



## graham-xrf

Hi Mark
To this same end, I did think that in my build, there could be included circuit for a (accurate) peak-detect-hold, or at least, to provide tracking for it, even if no components are fitted for that feature if one wished to leave it out. This is something which can also be implemented in software, though it takes up processor time.

A similar reasoning applies for a settable trigger, if possible meaning software settable. I still have no clear idea what would be a nice level that occurs with certainty, but it can be near the noise, and might tip on less than 50,000 carriers released. This stuff happening below 1nA might be just silly, but I would try for it. Such a trigger might also provide a "it's all over" signal. Again, none of the components for such a feature need be fitted, but the tracking can be there.

The same approach applies to the front end gain, allowing some choices of circuit variants. I choose LTC6268IS8 or LTC6268HS8 as the transimpedance op-amp. These have only one op-amp in the package, but it is SO8 size, and so has space between pins for a guard ring.

There are three circuit variants..
One is using just the op-amp by itself with transimpedance gain resistor split as two in series, and positions for oscillation stabilizing capacitors. We add ground plane track going under them to minimize strays across the top. The remaining two circuit choices add the discrete FET front-end, for the transimpedance implementations researched by Glen Brisebos. I am still a bit unsure of how to maintain the guard ring arrangements for this. If I have to, I will simply build for one circuit, but so far, the variants can be made by using a zero-ohms resistor in places, and choosing which links to have, and which components to leave out.

The pin-out for single op-amp packages is very standard, and I think a whole lot of other op-amps could be used in there if one had something to hand. They might be lower cost, or slower, but never mind. The only place where I can't let it be messy is with the ADC.

Oh yes - I have included the 50Hz/60Hz notch filter that we simulated before. As with the rest, it goes away if you leave out the components, though in this case, I hoped to hijack driver stages that have to be there anyway, so it becomes just omitting the capacitors and resistors associated with the notch(s). Getting along with KiCAD has , so far, been slow going. I admit I have been getting much diverted by other stuff in my home life. This includes what was (for me) a spectacular adventure in a sailplane a couple of weeks ago, and my first trip to London in more than a decade. My shop is filling up with crates of new machines to be unpacked, and I am steadily knocking off the remaining tasks of the house build.


----------



## homebrewed

I've been working on the front end portion of my XRF system, basically the A/D-centric stuff (including a circular-buffer based rolling averager for noise-free triggering) and the pulse-qualification code.  The latter is based on a fast least-squares polynomial fitting routine optimized for a second-order polynomial.  The main purpose for that is to identify "good" pulses by their relatively low RMS error.  It also is easy to calculate the estimated peak value using the polynomial coefficients.

I was curious regarding the overall accuracy of the least-squares fitting routine compared to a simple pulse integration scheme, so I included that in my standalone test program.  While the numbers are different (peak values vs. integrated values), the percentage error is pretty much the same.  If nothing else, that means my code is working right.  

That's when integrating over the same data set used by the fitting procedure.  I think the integration approach can actually do better than that (see below).

So if we come up with a less computationally intensive approach for identifying "good" pulses we can be sure that the simple integration approach is about as good as we can hope for.  Also, since the 2nd degree polynomial really is only valid right around the pulse's peak value, the integration approach is more correct in terms of the actual pulse shape.  Finally, since we don't care WHAT the pulse shape is, as long as it's consistent with the ideal single-pulse shape is, we can integrate over a larger data set than the polynomial fit can use -- which should further improve its SNR.

One possible pulse qualification scheme could be to compare a sequence of integrated values for the pulse to what we'd get with an ideal pulse.  As soon as they differ by some TBD amount, the pulse would be rejected.  No curve fitting required.  However, the downside is that we'd need to somehow come up with that ideal pulse shape -- implying a very good simulation model.  A more laborious approach would be to characterize a real-world system using a known elemental reference and fine-tune the discriminator for the best accuracy.  I'd start with values based on a SPICE simulation and tweak them as needed.


----------



## graham-xrf

Hi Mark
Good to hear from you.
One can, of course, successfully discriminate between some peaks using only the relative recovered amplitude of a peak, even if it be grossly distorted, slow, delayed, very low-pass filtered remnant of the original (few) carriers that made it into the first amplifier. The true knowledge of what was the relative energy in the event, and separating it from other event energies requires we do do better than that. Integrating a single pulse does it! Especially if we can throw out the overlapped, noise intrusion, and other pulse artifacts that sullied it in various ways.

A good, fast check is having a reliable peak, knowing the remainder of the waveform is of a known characteristic type. The area under the pulse, representing an analogue of the photon energy is related to the peak value by a (almost) constant factor, so the percentage error in working from only a reliably discovered peak is quite small. This is only so if the there are waveform shapes other than the ideal. Note that one pretends the waveform was an artificial perfect triangle, the peak value would be enough to know all one needs.

In my scheme, I do admit that I have a hardball approach to discovering the energy. I reasoned that since we need the ADC there anyway, and the software can easily persuade it to do it's thing many times during a pulse, then collecting a number for the peak is just as easy as collecting a whole bunch of them to add up the area. As I looked closer, especially at results of peaks the PyMCA program has to pick through, I got to thinking about how it has to relate little ups and downs on a line riding generally high enough to mask lower peaks. Basically, if there is not enough accurate resolution in figuring the area under that peak, then adjacent buckets are going to have counts that run into each other. Do it well, and you get separated narrow(er) peaks.

Then I looked at the document (attached). The huge mess of energies in all sorts of combinations that actually comes out of materials that have been hit by Am241 gamma was a new realization for me. Your approach would seem to be effective as a way of cutting down the amount of computation.

I have included a fast peak detector option in my circuit. One can leave out the components if going for a pure software approach.

Also, a hardware 2-level trigger, which provides the computer a way of working with the circular buffer (ie. how far back was the start). and a "it's all over" pulse, to aid in rejecting overlaps. If the second pulse has not arrived in a certain time, the pulse is a mess, and gets rejected. As with the peak detector, one can leave it out.

Staying with the "Swiss Army Knife" set of options, the transconductance amplifier can also be built in various flavours, depending on which components are put in, and which links be set. First is using low noise op-amps only. Second and third are the versions with a FET front-end. The interface to whatever computing board there is general purpose. The board is a kind of experimenter's handy thing. Keep in mind, I am trying to have it be OK for my scintillator PMT tube also. One can choose alternative op-amps so long as they have the "standard" pinout. About the only hard set choice was that I plan to use 3 x Lithium 3.3V button cells as the fixed 10V low noise DC bias for the photo-diode.

The PCB will be a step-and-repeat of as many as I can cram onto a 12" square board. I will only be needing a couple, of spares so the remainder can be gratis to any HM folk wanting to play XRF. Maybe a single postage to someone in USA would make sense. One could cut off the bits wanted, and send the rest on like pass the parcel 

*The computer*
The lack of supply of Raspberry Pi's is temporary problem, but everything the Pi can do in this context is also done by the 1GHz Beaglebone Black, including running PyMCA under Debian or Ubuntu. Its £25 in UK (about $30). Probably about $45 with PSU and options.

I think the PyMCA software might have some damn clever false pulse discriminators built in. It is a big load of code, and so far, all I have done with it is install it, and run it, and marvel at it!

--> https://beagleboard.org/black/

I can only visit my pet project occasionally, but I will get to play more quite soon. My order for IC's and stuff from Mouser on Friday was £70+ though it was not all for XRF, and I rarely order only one of any IC unless it happens to be darn expensive.



	

		
			
		

		
	
 _ 
	

		
			
		

		
	




I could not make any of the available symbols for the ADC simply drop in to my KiCAD in a way that suited me, so I had to "roll my own". Here is a fragment of what it looks like. I will be posting the whole circuit soon.


----------



## homebrewed

While writing the Teensyduino code for my front end ADC system, it occurred to me that implementing a simple "geiger" mode would be handy for troubleshooting the hardware and also for getting a rough idea of what the trigger level should be for a particular design.  Just a suggestion for anyone else who is interested in this thing.


----------



## graham-xrf

I kind of guessed that you might be getting into code  I am a bit envious that you already explored getting real pulses from your experimental setup.

I do agree about the usefulness of a "geiger" type operation available, even if not ever to be used as a geiger counter. As I mentioned in my last post, a 2-level trigger is one of the "optional to include" bits of circuit I have in mind. Looking back at the original pocket geiger, it was all about using LM393 comparator trigger circuit to make a pulse to be counted, and a "noise pulse", which I think was about rejecting the count. I had thought to use a dual high grade op-amps as comparators monitoring a resistor chain circuit, and even add in some positive feedback to make Schmitt type. Motive here was  just to keep it all as rail-to-rail stuff with one end at 0V, and (lazy) using the op-amp output as a logic signal.

Following on getting some idea of what the trigger level(s) should be, I would ask if you think there is value in having some means by which the trigger levels could be adjusted by the computer, or perhaps from pot adjuster(s) not mounted on the little board. Having to make alterations by changing out resistors is awkward. Just possibly, we might like the ability to alter the trigger setting in software anyway, especially if we include gain range settings. Does the Teensyduino maybe have a DAC capability?


----------



## homebrewed

Arduinos in general have a DAC function that's based on low-pass filtering a PWM signal.  Depending on the processor, some also have a "real" DAC but the processor used in the Teensy 4.X series does not.  Looking at the processor data sheet, all I found was a 6-bit DAC that only is used internally as an input to some comparators.  I believe there are some in the 3.X series that are better in this regard.  The Teensy 3.6 actually has better analog functions than the T4, but like a lot of electronics right now it is out of stock, with no indication of when it will be available again.

I agree that the ability to make adjustments remotely would be very handy, at least during the initial testing.  The question is if it's useful enough to justify the additional complexity if you go with things like DACs, digital pots etc.  All those are available with I2C and SPI serial interfaces, which are pretty well supported by any Arduino you have lying around.


----------



## graham-xrf

I was going for brutal minimalism, but with tracking laid in for the "optional extras". A compromise might be to use some tiny adjustable pots. Another way might be to include tracking to provide test terminal hook-ups for external pots to override the higher resistance fixed resistors in the chain that determines thresholds. Low-pass filtering a digital output which is being PWM bit-banged puts the complexity in the computer, and is not such a bad idea. I will be checking out some SPI type DACs anyway. 

While on this subject, would you extend the "adjustable" desire to include the diode bias? I had thought that three little lithium button cells at 3.3V each, all in series, and with no other job, would be the best low noise bias. One could alter that to two, or even one cell if the lower dark current noise proved to have a better result, despite the signal charge being arriving into a into a larger capacitance. Back when I was looking at switch-mode type bias, remotely changing the voltage was easy.

I am including software switched gain ranges, using analog switches to change the gain of the op-amp stages. I thought three ranges would be OK. It would allow to "zoom in" on small signals.

It occurs to me that anyone dropping into this thread now will be looking at our discussions of a evolved design, and might be a bit overwhelmed by it.


----------



## whitmore

homebrewed said:


> Since the A/D front end needs to run upwards of 400KSPS this pretty much eliminates low-end Arduinos.


Um... why?  There's  not a high rate of counts expected, and integrating on the rising edge of a peak
only takes microseconds, with no digital action at all.   Then you digitize the integration capacitor
value, and reset it (probably polling driven, the CPU doesn't have other real-time tasks that need
rapid response).    

If you expect 10k pulses/second, there's usually well over 20 us to make the conversion (and
if you want, two or more gains can be accomodated, using two or more integrators with
different hold capacitors; if the highest gain shows a maximum value, just convert 
the voltage on a lower-gain channel (an Arduino UNO has six).


----------



## graham-xrf

whitmore said:


> Um... why?  There's  not a high rate of counts expected, and integrating on the rising edge of a peak
> only takes microseconds, with no digital action at all.   Then you digitize the integration capacitor
> value, and reset it (probably polling driven, the CPU doesn't have other real-time tasks that need
> rapid response).
> 
> If you expect 10k pulses/second, there's usually well over 20 us to make the conversion (and
> if you want, two or more gains can be accomodated, using two or more integrators with
> different hold capacitors; if the highest gain shows a maximum value, just convert
> the voltage on a lower-gain channel (an Arduino UNO has six).


*Trying to summarize here *
The Teensyduino has a 180MHz microcontroller. Teensy 4.0 races along at 600MHz (I think), but right now, just like the Raspberry, supply is very short. The Beaglebone is a whole 1GHz chip PC. The Raspberry Pi has a overclockable 1.5GHz CPU, although the rate at which it can toggle a single GPU pin is less than that. I ran up an old Raspberry Pi 3B in a test run for SPI data transfer from ADC, and the limit was at 33MHz only because of the cycle time in the loaded software. Of course, it did have a whole Debian Linux OS loaded, with PyMCA and everything else. Not stripped down at all. I know it's a lazy overkill, but for me, this was about value. The thing is powerful, low cost, and runs the already highly developed open source software from the European Synchrotron Radiation Facility . I tried it, and it works on stashed captured data. It should be easy to figure a program to get the numbers from an ADC, and put them in a file that PyMCA can read.

Above all, I want the final gadget to be very affordable, yet still aspire to the practical limit in signal capture.

*You can (apparently) sample slower, if you like .. [Mark's post #332]*
Getting at a version of a energy pulse from a photodiode can, apparently, be "slowed down", or "stretched". This is the effect of low-pass filtering by bandwidth limitations in the main amplifier, and was used some time ago to allow the audio channel of a regular PC to be used as a ADC. The theory is the general size of the surviving pulse lump has sufficient correlation to the original pulse to be able to represent a photon energy. I explored the pulse distortion of the early circuits (post #232), and in my bones, I so disliked the results.

Mark has taken to mathematical awesomeness to show that the relationship of the (distorted) pulses to the original energy is still "pretty darn good". On the way, we can figure that he has a grip on numerical differentiation analysis and polynomial regression curve fitting! I love this, and I am keeping it in reserve in case my amplifier design ends up a bit slow. I consider it better than "in my bones"!

*How many samples per second?*
I still  take the hardball approach. Consider this a personality defect from a life in military and aerospace norms. The duration of the original photodiode pulse is still, to some degree, "stretched" simply by the fact the charge is spread into the self-capacitance of the photodiode, which trades off signal height against dark current noise.



With 10V bias, it's 85pF, running 2.5nA dark current.
With only 2V bias, it's about 230pF, running about 1.3nA dark current.
We would love it to work at 2V bias, because of this next thing -->



Capturing energies down to less than 2keV with still as much as 10% absorption probability is what gives this gadget the promise of great performance for the dollar.

High or low, the duration of a photon pulse is about 10uS to 13uS, with tail to 20uS. Trading off cost vs speed, the £39 ADC will go at *2MSamples/sec*, giving about 20 samples out of the pulse shape.

*The extreme TIA gain - with low noise!*
The reason I choose a op-amp with 500MHz gain-bandwidth product is to be able to preserve a pulse with waveshape content up to about 300kHz. Trying for a gain of a million in one stage is the recipe to stretch a pulse, and maybe have it drive into saturation from random noise and offsets. A transimpedance amplifier of (say) even 500MHz gain bandwidth product will not be able to move it's output other than very slowly. My way is to divide and conquer, by splitting the gain task between more stages, while still having more than 35dB gain in the first stage to bring the signal to the point it is out of reach of noise. The device is chosen for the lowest possible noise figure I can get, with input bias current in femto-amps. The gain-bandwidth product of the overall  transimpedance amplifier is around 2.4GHz, allowing as much as 78dB(V) gain at 300kHz.
This instrumentation is intended to be able to see the small peaks at higher resolution, in between the big pulses. The metals we are interested in do not have huge energy flourescence.

20Msamples/second is where I am aiming. I can always slow it down some, if I have to. I can also relax the TIA performance some, if I have to. I can make it lower cost, but there is not very much left in it, because of the way we outrageously exploit low-cost little computer boards and free software.


----------



## WobblyHand

whitmore said:


> Um... why?  There's  not a high rate of counts expected, and integrating on the rising edge of a peak
> only takes microseconds, with no digital action at all.   Then you digitize the integration capacitor
> value, and reset it (probably polling driven, the CPU doesn't have other real-time tasks that need
> rapid response).
> 
> If you expect 10k pulses/second, there's usually well over 20 us to make the conversion (and
> if you want, two or more gains can be accomodated, using two or more integrators with
> different hold capacitors; if the highest gain shows a maximum value, just convert
> the voltage on a lower-gain channel (an Arduino UNO has six).


Agreeing here.  Lots of ways to get it done.  I had an Adafruit M4 Feather Express digitize at 1MHz, using DMA and ping pong buffers.  Just digitization isn't that bad.  Doing concurrent processing without fouling up can be tough.  For my Doppler chronograph, I only needed 60KHz sampling, so I slowed it down.  But I was doing concurrent radar signal processing and target detection at a 50 Hz rate.  It was only tricky because I didn't have an in circuit emulator.  Had to use a lot of idiot lights (just GPIO) to figure out where things went awry.  Break points would have been nice, but made it work anyways.


----------



## graham-xrf

Paraphrasing a famous, though flawed man.
_"This is not yet near the end. It is not even the beginning of the end. But it is, perhaps, the end of the beginning"._

I have sunk enough cash and time and even ex-Russian (Ukrainian) hardware into this to have reached that point where I want to press it home, and I can sense we now have a complete grip on what we are trying to do. We are definitely getting there!

At the start, I would never have thought how much we would learn, not only about some electronics applications and design simulation, but about nuclear physics, and chemistry, and the practical realities of machining up stuff that includes lead! We have the inorganic chemistry expertise of @pontiac428, and the actual experience of @RJSakowski, and the professional background of @WobblyHand. I have to dabble in this effort in between other stuff that I simply have to give attention to, and also to some elective activity I can't resist, like flying sailplanes in thermals, even at my age!

I fully realize that this thread charts a complete, if somewhat laid back, development effort that pretty much wrings out most of what it takes to make the kit do something sensible. Anyone coming across it for the first time is likely not going to trawl the whole thing, and many who have interest may have been taken out of their depth, and had to let go. I hope we soon(ish) get to the point where we can describe the stuff, where to get, how to make, and let folk run with it. If it starts to get noticed, there may be others who can come up with improvements.


----------



## homebrewed

graham-xrf said:


> While on this subject, would you extend the "adjustable" desire to include the diode bias? I had thought that three little lithium button cells at 3.3V each, all in series, and with no other job, would be the best low noise bias. One could alter that to two, or even one cell if the lower dark current noise proved to have a better result, despite the signal charge being arriving into a into a larger capacitance. Back when I was looking at switch-mode type bias, remotely changing the voltage was easy.


After I removed the switcher from my PocketGeiger board and replaced it with an external (linear) bench supply I took the opportunity to check the detector's sensitivity to bias voltage.  I didn't observe a strong dependency so I believe that your battery approach would be fine.  It certainly will be optimal in terms of the bias supply's noise contribution!

A well-shielded external switcher or charge pump voltage boost circuit probably would be OK in terms of not injecting noise into the detector signal path.  That giant PIN diode is a great antenna, and I think that was the main issue with having the (unshielded) diode near the switcher.

One thing to keep in mind if operating the detector at a reduced bias voltage is that its capacitance will go up.  So the feedback capacitor in the TIA  will need to be changed accordingly.


----------



## homebrewed

Although my approach has been to digitize a highly filtered version of the pulse coming out of the TIA -- which on the face of it should permit the use of a fairly slow ADC -- there are reasons why I'd been looking at something faster.  If we use a 2nd degree polynomial fit to back-calculate the "real" peak value we get an additional benefit by an improvement of the SNR -- it's a least-squares fit that, of course, uses multiple samples to get there.  One should see an improvement proportional to sqrt(N).  But the fly in the ointment is that a second degree fit really only is good for values right around the peak.  So I wanted as many as I could get on either side of it.  Like Graham, I'm an SNR addict but I like a different sauce .

Realizing that integrating the entire pulse instead is a better approach sort of threw the fast-as-possible ADC requirement out the window (for me anyway), but I'm still interested in using the polynomial fit's RMS error as a possible way to identify good pulses.  So something that runs at a few hundred KSPS still might be desireable.  They cost less than MSPS ADCs, too.


----------



## graham-xrf

Is not cooking foil, flimsy version, simply so "transparent" to X-ray photons that it could cover over the photodiode with a Faraday shield that will simply stop it being any kind of antenna pickup?

OK then - I do agree that a switch-mode anything buzzing away in the same space as a low-noise 60dB+ gain amplifier is just a bad idea. Even if the voltage was generated outside, and filtered to death on the way in, trying to stop common-mode interference is a b*tch. Even the bias battery pack has to live in there with the circuit, just so it does not carry in trouble. For these reasons also, the 50Hz + 60Hz deep notch filter will be in there.


----------



## graham-xrf

*"Maxim Integrated and Analog Devices are now one company"*
Actually, I think it might be more of a take-over than a merger, but one wonders if this means Maxim devices will appear in the LTSpice model library ??


----------



## homebrewed

graham-xrf said:


> Is not cooking foil, flimsy version, simply so "transparent" to X-ray photons that it could cover over the photodiode with a Faraday shield that will simply stop it being any kind of antenna pickup?
> 
> OK then - I do agree that a switch-mode anything buzzing away in the same space as a low-noise 60dB+ gain amplifier is just a bad idea. Even if the voltage was generated outside, and filtered to death on the way in, trying to stop common-mode interference is a b*tch. Even the bias battery pack has to live in there with the circuit, just so it does not carry in trouble. For these reasons also, the 50Hz + 60Hz deep notch filter will be in there.


I tried re-installing copper foil around my detector and that didn't improve the situation w/regard to switcher noise getting into the analog signal path.  I hypothesize that the noise may be magnetic coupling due to currents in the inductor and PCB traces to/from it.


----------



## homebrewed

graham-xrf said:


> *"Maxim Integrated and Analog Devices are now one company"*
> Actually, I think it might be more of a take-over than a merger, but one wonders if this means Maxim devices will appear in the LTSpice model library ??


Having retired from Maxim Integrated before all that occurred, I don't have any direct knowledge on whether it was a take-over or merger.  But from talking to some of my ex-coworkers who are still there my impression is that ADI holds the reins.  But I think ADI also paid a lot for the priviledge.  ADI had approached Maxim before with a buyout offer and was turned down, so I presume they sweetened the deal.  I think it largely was a response to Texas Instruments acquisitions of some big guns like Burr-Brown, National and some ohers.  Go big or go home..... 

As far as Spice models, I think it is pretty likely that at least some of Maxim's parts will make it into the LTSpice library.  There is a fair number of Linear devices present, another company they acquired, so there's some precedent there.

Speaking of TI, I've noticed that they have some pretty nice ADCs for decent prices.  For example he ADS8471 is a parallel-out 16 bit 1 MSPS device with an integrated Vref generator that has a multiplexer built in so you can interface it with an 8 bit parallel port.  Digikey has them for about $32.  My Teensy 4.0 doesn't have 8 contiguous inputs but perusal of its schematic and processor data sheet found two blocks of 4 bits each in one of the GPIO registers that could be easily combined.  With a 600MHz clock shifts don't take very long so I'm pretty sure I could get the full 1MSPS out of it.


----------



## graham-xrf

@whitmore :
I realize that you need a better response, and I apologize. I happen to be going the route of integration by simply adding up ADC samples during a pulse, and indeed, the concept is to have a "circular" buffer store a good deal longer than any one pulse, or perhaps a bit of a crowd of them awkwardly overlapping. Combined with a trigger, or some effective software alternative, one gets to capture the whole event, including what happened "before" the trigger. I do love analog computing integrators, and I was originally minded to use one, but I ended up being practical. We get there with software, and save the cost.

*The integrated waveshape*
The rise and decay of the surge of electrons from released carriers, into the transimpedance amplifier, is the energy we want to collect. The area under the curve of the voltage pulse waveform resulting is the direct analog of the photon energy. [1] You are absolutely right that one can accurately capture this value using a nice op-amp integrator. The result arrives at the speed of electrons. It can outrun any digital sampling and calculating. I had in mind a op-amp with a quality capacitor in the feedback loop, shunted by a resistor and analog switch for reset. That stage could hold the value for an ADC, until reset.

Call it lazy, but I left out the analog integrator because a good one with low offset error is quite elaborate, both in design and  parts, and one can save all it's cost and PCB tracking simply because there has to be an ADC there anyway, and it can go fast enough to get a pretty good integration by doing it in little pieces. This is doing it in software instead. Also, having "historical" data of the pulse in the buffer allows a whole bunch of other software tricks, like recognizing a pulse overlap, or spotting a out-of-range event, both reasons for rejection.

Analog computing was used when you needed accurate real-time answers at a speed no digital computing can ever match, such as in servo control of missile fins or some rocket engine gimbals. In some applications, probably military, I dare say it's still there, and now, curiously, is making a comeback. It's what I used to do - long ago 

Mark's experiments indicate that the arrival of nice valid pulses would be quite slow, meaning from a few per second up to perhaps some hundreds of Hz. My guess was anywhere from slow up to perhaps 400Hz. For me, it's not so much about the arrival rate, as about the 13uS duration. Allowing bandwidth limited pulse distortion to "stretch" the pulse, to then have an easier time with a slow sampling ADC is not what I wanted to do.

[1] Energy --> current x time. Unfortunately only a few tens of thousands of electrons worth.


----------



## homebrewed

To add to Graham's comments, I believe there are other reasons to get the signal into the digital domain as soon as possible.  The main justification is based on my own observations regarding the pulse waveforms I've seen, plus information from the Theremino folks who have commented that it is very important to process only very well-shaped pulses for generating the XRF spectrum.  It is much MUCH easier to implement sophisticated pulse differentiation (in a logical sense, not the mathematical derivative sense) algorithms in the digital realm than the analog one.  In fact, I'm willing to bet that digital far exceeds what analog can do in this regard with an approximately equal expenditure on processing elements, despite my love for analog.

My observations looking at the analog signal coming out of my PocketGeiger detector/amp chain is that the pulse shape can exhibit substantial variations, probably due to pulse overlap + noise of various types (environmental, popcorn, 1/f, etc.).  This situation is a real killer when it comes to getting a decent XRF spectrum, and would be pretty hard for a purely analog implementation to address in a simple and cost-effective manner.

My concerns and emphasis in this regard is that the energy differences between iron and vanadium, chromium, cobalt, manganese and nickel are going to be close to the detector's energy resolution.  If not less (more on that in the next paragraph).  So anything we can do to improve the situation will help us.

So, what if our detector's energy resolution isn't good enough to tell the difference between, say, Iron and its neighbors manganese and cobalt.  That's where the use of physical energy filters may come into play.  As has been noted by me and others, the absorption vs. energy curves for these elements exhibit a significant drop at a different photon energy for them.  So by using that property with a set of filters we could better differentiate these elements.  The filters would be thin sheets of chromium, manganese, iron and cobalt.  For some of these elements they're not necessarily easy to come by (especially for a reasonable price!)  but that's yet another opportunity for hobbyists to get creative.  I've shown that the filter's "finesse" can improve without limit as its thickness increases, but of course the overall attenuation increases as well -- so there's definitely a limit to the real-world improvement we can achieve.  One thing in our favor is that we (may) be willing to wait longer to get a result, compared to a commercial lab.


----------



## whitmore

graham-xrf said:


> I left out the analog integrator because a good one with low offset error is quite elaborate...there has to be an ADC there anyway, and it can go fast enough to get a pretty good integration by doing it in little pieces. This is doing it in software instead. Also, having "historical" data of the pulse in the buffer allows a whole bunch of other software tricks,



Yeah, I see the  merit; in the old days, differential linearity was the big issue with using an ADC of the packaged
type, we always used the single-slope (rather slower than SAR) scheme because SAR 
(successive-approximation with a DAC and feedback) didn't have as much accuracy as is now available, 
and we could pick our precision, with a precise capacitor discharge current source.    

I think the integration onto a capacitor still has signal/noise merit, and would prefer
(for peak shape analysis) a simple preamplifier pickoff and... using an  outboard digital sampling 
oscilloscope for those extra bits of info.   But, with good linearity and fast conversion, you can 
digitize before the peak is detected, which means the detection can be refined in field-upgradable software, 
along with other interesting possibilities.   

How difficult is it to get an outboard fast ADC-FIFO combination?  Circular buffer ADC?  That takes pay-attention load off
of the control CPU, and allows an integrator-based coarse peak detector (interrupt? polling?)  in conjunction with
digitized peaks.  

As for offset error, I'd think it's easy enough to take a few no-pulse-present samples after reset, throw
away outliers and use those samples for a zero baseline.


----------



## graham-xrf

homebrewed said:


> My concerns and emphasis in this regard is that the energy differences between iron and vanadium, chromium, cobalt, manganese and nickel are going to be close to the detector's energy resolution.  If not less (more on that in the next paragraph).  So anything we can do to improve the situation will help us.
> 
> So, what if our detector's energy resolution isn't good enough to tell the difference between, say, Iron and its neighbors manganese and cobalt.  That's where the use of physical energy filters may come into play.  As has been noted by me and others, the absorption vs. energy curves for these elements exhibit a significant drop at a different photon energy for them.  So by using that property with a set of filters we could better differentiate these elements.  The filters would be thin sheets of chromium, manganese, iron and cobalt.  For some of these elements they're not necessarily easy to come by (especially for a reasonable price!)  but that's yet another opportunity for hobbyists to get creative.  I've shown that the filter's "finesse" can improve without limit as its thickness increases, but of course the overall attenuation increases as well -- so there's definitely a limit to the real-world improvement we can achieve.  One thing in our favor is that we (may) be willing to wait longer to get a result, compared to a commercial lab.


----------



## graham-xrf

Even if we do get a collection plot of fine high resolution, separated "bumps" at various energies, I think it likely that Mark's mentioned strategy of deliberately physically filtering will be important to identify the alloys and proportions we would be interested in. The energies coming from cobalt, nickel, and iron are such a close muddle that it's a tough call.

Mostly, we can correctly infer what is there from the combination of peaks present. I am hopeful we might get to see some counts from sulphur and phosphorus (if we wait some minutes), and just maybe, silicon. I think aluminium and magnesium might be beyond what we can expect, unless we discover a better diode.

The lead present in free machining steel alloys would not get exited by Am241 radiation at Pb main K-shell peaks, (too feeble), but should show L-shell energy at 10.5keV and 12.6keV. These might spoof arsenic, or selenium, but the presence of both peaks together more or less confirms it is very probably lead.


----------



## homebrewed

A program capable of Identifying elements using multiple peaks probably would need to use mathematical correlation.  Easiest to do in the frequency domain.  But l think worrying about this kind of stuff is putting the cart before the horse.  I want to see if we can get a spectrum -- of any kind, with amazing or (more likely) so-so resolution -- before moving on to sophistication like energy filters, background subtraction, correlation using elemental standards and the like.  I have to keep hauling myself back from considering those other fun things, myself.....to work on the more basic aspects first....


----------



## graham-xrf

homebrewed said:


> A program capable of Identifying elements using multiple peaks probably would need to use mathematical correlation.  Easiest to do in the frequency domain.  But l think worrying about this kind of stuff is putting the cart before the horse.  I want to see if we can get a spectrum -- of any kind, with amazing or (more likely) so-so resolution -- before moving on to sophistication like energy filters, background subtraction, correlation using elemental standards and the like.  I have to keep hauling myself back from considering those other fun things, myself.....to work on the more basic aspects first....


I cannot confirm yet, but it kinda looks like PyMCA suite may have identification smarts built-in.


----------



## homebrewed

Just a quick update on my front end code-writing.  I've had some under-the-hood things I needed to think about and find solutions that (may) work well enough to test the whole system.   The main issues were:  how to determine the analog front end has settled enough to ensure the no-pulse baseline remains consistent during the course of acquiring a spectrum; how to (hopefully) reliably trigger on a pulse and then format the data for my fast polynomial peak-find; and, most importantly, how to ensure that the background ADC/ring buffer functions aren't going to be mucked up by the foreground routines that are doing things like checking the USB interface for commands from the host, or changing acquisition parameters like the sampling rate, trigger level, etc.

Along the way I've had to rip up preexisting code and re-do it in the light of problems I found in the approaches taken.  For instance, I had originally stuffed integer ADC data into my ring buffer, the idea being that it would introduce less overhead in my ISR -- but then the subsequent pulse qualification stuff had to convert all the data into floating point.  Since the Teensy has an FPU, I decided it made a lot more sense to go directly to floating point.  This in turn simplified the trigger stuff because I now can just look at the pulses with my oscilloscope and immediately change trigger parameters, expected baseline voltage, etc, without dealing with scale factors, float-to-int conversions etc.

These nitty-gritty details are the things that actually will make or break the system, and, in my experience, are the most difficult to get right.  They can produce some problems that are mighty difficult to debug.

All this said, I'm near to the point of flashing an LED when the program thinks a valid pulse has been detected.


----------



## homebrewed

No flashing LEDs yet, but I have at least gotten my code to compile.  I had done quite a bit of code-writing without compiling so expected a lot of error messages but was pleasantly surprised by how few there were.  Nothing difficult to figure out, mostly things like missing semicolons and a few typos.  Of course, that doesn't mean there are no functional errors in the code  

At this point the front end code is 407 lines long, so not so unwieldy as to make it overly difficult to maintain.  I expect it to grow some as I get some real data to analyze.  I can use the Arduino's Monitor tool to see how things are working, and can also use it to modify the pulse acquisition parameters on the fly.

There are a number of system constants that currently just have best-guess values so I know there will be some tweaking needed once I start getting some data to examine.  For instance, I have a guesstimate for the baseline peak noise voltage, and that guess is used to help determine when a "real" pulse is detected.

Work on this has slowed down with the arrival of summer weather -- the lion's share of time has been spent getting the garden in shape, and attacking all the weeds that came up in our wet and cool spring/early summer.  So I'm poking at it when time permits....


----------



## WobblyHand

Saw this recently on the PJRC Forum.  Might be of interest.  MCA Gamma Spectrometer, powered by a Teensy and a PMT.


----------



## graham-xrf

@WobblyHand :
Thanks for the link
76mm PMT's are like ... expensive!  This gadget is, of course, one he is promoting for sale.

It seems to be a nicely put together gamma range thing. I had a quick look through the spectrum images. All start at 0KeV, and end at between about 1.4MeV and 2.1MeV. I don't know how often one would be after identifying Eu-152 (Europium), or Ca-137 (Caesium). I do like that it's driven by a Teensy  and that it has it's own little 3.5" screen in the plastic case 

Of course, our needs are different! We do start with a gamma source, but we want to see X-rays, not gamma.  We want it to see energy ranges from as low as possible, up to about 60KeV, or 90KeV, sampled at the highest resolution possible. We try for as ultra low noise as possible. We want it to be as low cost as possible, and within the abilities of most any member interested to get one together. This attempt could be more demanding than seeing higher energy gamma hitting a PMT. For our design goals, I think the challenge is greater. I am hoping we have not bitten off more than we can chew!

I have had a easy, cruddy lash-up (sort of) working, and I have somewhat explored PyMCA on a Raspberry Pi. Mark has done rather better, with a first run shielding mount experiment, looked at real signals, and he has done good stuff with the software. (He can write actual software from scratch)! For me, playing with radioactive stuff, and electronics has to fit in between other things. Good Lord, I can't believe I am STILL doing stuff to my house!

I will have you in mind as I progress, but (I think) I recall you are one of those with considerable electronics assembly ability already, and would not have a problem putting something together. When we do get something really figured out, there may be several HM members interested, but not really into soldering surface mount IC's. We may have to find some way to help them.

You posted his link, so it should be OK to show some of the plots here ..


----------



## WobblyHand

@graham-xrf just wanted to show there's activity in this area.  This thread's focus has been different than in the URL above, but the idea is similar.

As for Teensy, I have been writing my own ELS software, using a similar, but cheaper, 3.5" touch panel display and a Teensy 4.1.  I have a project thread on it.  Teensy is good for general stuff and DSP, but it lacks an OS.  RPI is good for lot's of stuff, I'm embarrassed as to how many I have.  They are great for automation.  Before the great shortage I managed to get an RPI4B-8GB.  This is amazing for what it costs.  Had some serious Linux kernel issues on my main computer and transferred my files to the RPI4 and a ssd and was able to carry on with life, albeit a bit more slowly.  Even was able to run FreeCAD on the RPI4 using the 64 bit OS.

Guess this was just a virtual poke to this thread - trying to keep it alive.  If either of you publish any code, or schematics, (can't remember if schematics we're ever "released",) I'd be happy to look at it.  Writing C or C++ isn't my forte, but can get by.  I'm a bit better at Python, having used it as a replacement for Matlab, for commercial automotive radar simulation.


----------



## homebrewed

WobblyHand said:


> If either of you publish any code, or schematics, (can't remember if schematics we're ever "released",) I'd be happy to look at it. Writing C or C++ isn't my forte, but can get by. I'm a bit better at Python, having used it as a replacement for Matlab, for commercial automotive radar simulation.


I'll take that as a broad hint  . Here's what I've got so far: Teensy H-M XRF  Warning:  although it compiles for me, that doesn't mean it doesn't produce garbage!

The Teensy code is meant to be a front end pulse acquisition/qualification system.  It sends out pulse data via the USB acting as a TTY so when plugged into my linux box it shows up as /dev/ttyACM0.  I haven't even gotten close to the MCA part, but it should be possible to use the Arduino's serial monitor to change acquisition parameters and examine the pulse data coming out.

Reading other folks' code can be difficult so feel free to ask questions.  Anyhow, it's likely I have overlooked something....


----------



## WobblyHand

homebrewed said:


> I'll take that as a broad hint  . Here's what I've got so far: Teensy H-M XRF  Warning:  although it compiles for me, that doesn't mean it doesn't produce garbage!
> 
> The Teensy code is meant to be a front end pulse acquisition/qualification system.  It sends out pulse data via the USB acting as a TTY so when plugged into my linux box it shows up as /dev/ttyACM0.  I haven't even gotten close to the MCA part, but it should be possible to use the Arduino's serial monitor to change acquisition parameters and examine the pulse data coming out.
> 
> Reading other folks' code can be difficult so feel free to ask questions.  Anyhow, it's likely I have overlooked something....


Wasn't directed exactly towards you, but thanks.   Haven't looked at it yet, but how are you timing the sampling?  Via some sort of timing interrupt or DMA?  I've done DMA on an M4, but have to say I had help.  Not so good to debug, but very nice to offload the processor.  

I also run Linux as my main platform.

Remind me, is there any consensus on the front end?  There was quite the lively discussion MANY pages ago.  You still doing a version of pulse stretching, vs Graham's super high fidelity mode?  So still running two schools of thought?  I have no dog in the race so far, but have to say if simple works, then go with it.


----------



## graham-xrf

WobblyHand said:


> I also run Linux as my main platform.


Me too. I did try several times to live with Windows, but I found myself hardly ever turning it on. The last marginally effective Windows was W7, after being stripped of it's most egregious intrusions. W8 thru W10 Truly turned me off. I think part of it's problem was that there was this little Raspberry Pi right next to it that kept showing it up. Running FreeCAD on a Pi is impressive, but not really what we want to have the Pi doing. (So says he who is not beyond making it play smooth jazz From YouTube as a "background task" 

Re: Mark's Teensy H-M XRF  link.  Um.. it's on Google Drive - so not something I would be able to open for the moment.


WobblyHand said:


> Remind me, is there any consensus on the front end?  There was quite the lively discussion MANY pages ago.  You still doing a version of pulse stretching, vs Graham's super high fidelity mode?  So still running two schools of thought?  I have no dog in the race so far, but have to say if simple works, then go with it.


You are right, though we don't actually _need_ complete consensus. It's OK to have variety. Mark has shown that, up to a point, a low-pass filtered (distorted) pulse can still be representative of the energy, provided that the general wave-shape is much the same for most pulses, and is roughly triangular. Just the peak amplitude only, retains sufficient correlation to the full energy integral area under the pulse.

I simply do not want to slow the pulse up when I happen to have an ADC and Raspberry Pi that can go fast enough to do the integration without compromise. In previous posts, I have mentioned my notions to use 3 x button cell fixed bias, 50/60 Hz notch filters, a choice of amplifier front-end configurations, a trigger, switched gain ranges, guard rings, separate ADC 2.5V ultra-low noise reference, etc. I will try and get more going on posting the whole circuit. We can then decide on what might be "gilding the lily", and alter it according to the advice folk give.


----------



## WobblyHand

As you well know, a LPF (low pass filter) is a very good approximation to a matched filter, which is optimal.  So Mark's approach is not giving up much SNR, but may be susceptible to errant pulses.  It is unclear to me, in practice, how much of an issue it is.  I have no instrumentation of this nature, so at the moment, I can offer no insight.  I think both circuits have merit, but both have some issues with overlapping pulses.  Gated integrators are effectively the best one can do, (a matched filter) but the devil is in the implementation details which can be tricky for those less skilled in the analog arts.  Lots of pitfalls, as you well know.  And a gated integrator can get clobbered by pulse pile up, because random pulses do not respect our proper sense of timing.  Guess the best one can do is to reject that pulse (or pulses) and carry on after that.  

If one has moderately fast sampling then the pulse processing (integration) could be done digitally, with optional single pulse or pulse block rejection.  This can be done in something like a Teensy or equivalent relatively easily.

I guess, for anyone else to play along, we need to have something to make, with enough details to actually make it.  No, it won't be perfect, and might not work straight away, but in a way this is good, because it may highlight design issues.  In the end, we would like something "easy enough" that others could make something and contribute to the effort.  If there are tricky parts, we need to have methods to make them easier to set up, or calibrate.  If I can get Mark @homebrewed to temporarily enable a download from his google docs, I can at least take a look at his approach.  Not to critique anything, but to get a better idea of the issues.


----------



## homebrewed

@WobblyHand, sampling is done by an ISR triggered by one of the Teensy timers.  The default in my code (although it can be changed by sending out a command on the USB) is 360Ksps, about the max possible for the built-in ADC's.

I've been thinking more and more strongly about a faster sampling rate, even for heavily-filtered pulses.  Mostly because that will permit more samples around the peak and consequently a more substantial improvement in the SNR.  The whole-pulse integration scheme would benefit from that, too.  That's one of the reasons I investigated some ideas on getting decent data rates using a 16-bit parallel ADC on a Teensy 4.0.  I now can get a raw read rate close to 80MBytes/second by getting a lot closer to the hardware.  Just to sweeten the deal, TI makes some 16-bit parallel-output ADCs where the upper 8 and lower 8 bits can be multiplexed onto an 8-bit bus, just by changing the state on one of the pins.  So no 74XX244's (or their equivalent) needed.

The Teensy4.1 has enough pins to get a full 16 bits in one chunk, but it still is necessary to do a shift and OR to do it because all 16 aren't contiguous in the port's Data Register.  It would be VERY handy to be able to separately read  the upper 16 and lower 16 data register bits but it doesn't work that way.

If there's any interest in it, I can provide more information regarding the parallel I/O stuff, including putting on google Drive if it's deemed useful for the cause.  BTW all the info necessary to do it is in <imxrt.h>

Mark


----------



## WobblyHand

homebrewed said:


> @WobblyHand, sampling is done by an ISR triggered by one of the Teensy timers.  The default in my code (although it can be changed by sending out a command on the USB) is 360Ksps, about the max possible for the built-in ADC's.
> 
> I've been thinking more and more strongly about a faster sampling rate, even for heavily-filtered pulses.  Mostly because that will permit more samples around the peak and consequently a more substantial improvement in the SNR.  The whole-pulse integration scheme would benefit from that, too.  That's one of the reasons I investigated some ideas on getting decent data rates using a 16-bit parallel ADC on a Teensy 4.0.  I now can get a raw read rate close to 80MBytes/second by getting a lot closer to the hardware.  Just to sweeten the deal, TI makes some 16-bit parallel-output ADCs where the upper 8 and lower 8 bits can be multiplexed onto an 8-bit bus, just by changing the state on one of the pins.  So no 74XX244's (or their equivalent) needed.
> 
> The Teensy4.1 has enough pins to get a full 16 bits in one chunk, but it still is necessary to do a shift and OR to do it because all 16 aren't contiguous in the port's Data Register.  It would be VERY handy to be able to separately read  the upper 16 and lower 16 data register bits but it doesn't work that way.
> 
> If there's any interest in it, I can provide more information regarding the parallel I/O stuff, including putting on google Drive if it's deemed useful for the cause.  BTW all the info necessary to do it is in <imxrt.h>
> 
> Mark


I have interest in the parallel I/O.  Think you need to enable access to your google drive.  I put in a request to access.  As of a few minutes ago, I had no access.  I have 3 Teensy 4.1's.  One for an ELS, one for an ELS encoder simulator, and a 3rd to play around with.  So #3 can have XRF.


----------



## homebrewed

WobblyHand said:


> As you well know, a LPF (low pass filter) is a very good approximation to a matched filter, which is optimal.  So Mark's approach is not giving up much SNR, but may be susceptible to errant pulses.  It is unclear to me, in practice, how much of an issue it is.  I have no instrumentation of this nature, so at the moment, I can offer no insight.  I think both circuits have merit, but both have some issues with overlapping pulses.  Gated integrators are effectively the best one can do, (a matched filter) but the devil is in the implementation details which can be tricky for those less skilled in the analog arts.  Lots of pitfalls, as you well know.  And a gated integrator can get clobbered by pulse pile up, because random pulses do not respect our proper sense of timing.  Guess the best one can do is to reject that pulse (or pulses) and carry on after that.
> 
> If one has moderately fast sampling then the pulse processing (integration) could be done digitally, with optional single pulse or pulse block rejection.  This can be done in something like a Teensy or equivalent relatively easily.
> 
> I guess, for anyone else to play along, we need to have something to make, with enough details to actually make it.  No, it won't be perfect, and might not work straight away, but in a way this is good, because it may highlight design issues.  In the end, we would like something "easy enough" that others could make something and contribute to the effort.  If there are tricky parts, we need to have methods to make them easier to set up, or calibrate.  If I can get Mark @homebrewed to temporarily enable a download from his google docs, I can at least take a look at his approach.  Not to critique anything, but to get a better idea of the issues.


The heavily-filtered approach is predicated on a fairly slow count rate.  But due to the random nature of radioactive decay there still is a finite chance of pulse overlap.  So some kind of pulse-qualification scheme is needed.  My code actually uses three criteria that have to be satisfied:  1.  The pulse amplitude needs to exceed a user-set trigger level.  This is like the simplest kind of oscilloscope trigger scheme.  2.  The pulse width has to be close to the pulse width expected for a single pulse.  I think this will eliminate most kinds of pileup.  And finally 3.  The FastPeak function returns the RMS error between the polynomial fit and the pulse data, centered around the peak.  Another user-set value (called F_level in the code) sets what differentiates a "good" pulse from a mal-formed one.  This will hopefully address shorter noise pulses that might originate in the detector electronics.

Regarding being able to examine the code, I probably didn't get the permission stuff done correctly.  It was supposed to work for anyone with the link.  I also don't know if the link changes depending on the permission, so after changing it, here you go.


----------



## homebrewed

Also, regarding the trigger level, I implemented a simple rolling-average scheme to help reduce false triggers.  It basically is a crude IIR filter.  I could have done it differently but I think an IIR approach is better because it will recover more quickly after a pulse comes along.  I also expect it to respond more quickly to a pulse so (hopefully) I don't need to compensate much for phase shift when I integrate pulses.  BTW I haven't written the pulse-integration code yet, but it should be pretty simple.  I hope.


----------



## WobblyHand

homebrewed said:


> The heavily-filtered approach is predicated on a fairly slow count rate.  But due to the random nature of radioactive decay there still is a finite chance of pulse overlap.  So some kind of pulse-qualification scheme is needed.  My code actually uses three criteria that have to be satisfied:  1.  The pulse amplitude needs to exceed a user-set trigger level.  This is like the simplest kind of oscilloscope trigger scheme.  2.  The pulse width has to be close to the pulse width expected for a single pulse.  I think this will eliminate most kinds of pileup.  And finally 3.  The FastPeak function returns the RMS error between the polynomial fit and the pulse data, centered around the peak.  Another user-set value (called F_level in the code) sets what differentiates a "good" pulse from a mal-formed one.  This will hopefully address shorter noise pulses that might originate in the detector electronics.
> 
> Regarding being able to examine the code, I probably didn't get the permission stuff done correctly.  It was supposed to work for anyone with the link.  I also don't know if the link changes depending on the permission, so after changing it, here you go.


Have the code now.  Thanks!  Now I need to make up an Arduino project and give it a whirl!  And thanks for the text embedded in the code - lets me get an idea what you were thinking when you wrote it!


----------



## homebrewed

I have placed my benchmark code for testing fast 8-bit parallel I/O on a Teensy4.0 on my drive.  I don't have code for a T4.1 but I had summarized which 16 bits are contiguous (my memory was incorrect -- it's possible to do ONE 32-bit read and just shift the bits to get a 16-bit value).  That document is on google Drive, too.  The link is here.  The code is a little messy because I was playing around with different schemes so please be kind . 

By using the port's Toggle register it's possible to output data pretty fast -- my benchmark indicates about 300MBytes/second.  That's for a tight loop with nothing but calls to digitalWrite8Bits_Toggle() inside it.  And it updates all 8 bits at the same time.  A T4.1 could do 16 bits at the same rate.


----------



## homebrewed

WobblyHand said:


> Have the code now.  Thanks!  Now I need to make up an Arduino project and give it a whirl!  And thanks for the text embedded in the code - lets me get an idea what you were thinking when you wrote it!


The comments were self-serving so I could revisit the code with a faint chance of figuring out what I'd done!


----------



## homebrewed

When reviewing my Arduino XRF code, I realized that the data format of the pulse info I send to the server won't be displayed correctly on the Arduino's serial monitor.  It has to do with my decision to send raw floating-point values rather than ASCII text.  That's easy to fix for the upcoming debugging phase, where results will be sent to the serial monitor ap.  That decision might come around and bite me if it turns out that the floating point format used by the T4.x is different than what the server's PC uses.  I guess I need to check that....


----------



## homebrewed

I have uploaded a newer version of my Teensy XRF front-end code.  I have done a fair amount of debugging and found/fixed some problems.  The most notable was an issue with the IDE using the wrong header file for ADC.h.  It's ugly but I fixed that by specifying the full path to the one I wanted.  The link I provided before should work.  If not, let me know and I will post the updated one.


----------



## homebrewed

On a slightly different subject, I am working on a longer chuck wrench to make it easier to dial things in on my 4-jaw chuck.  The ones I have now are too short so I'm always bumping the DI when I'm doing that.  The new one will be about 5 inches long.  One of the first steps in making it was to turn down all but about .7" to a smaller diameter.  I ended up with about .002" of taper over 6 inches.  Not too bad for a mini lathe.  That's after I shimmed the headstock, based on my RDM testing.  I suspect that a fair amount of that taper is due to slight misalignment of my tailstock -- I used a live center to support the end of the shaft.

I had the headstock off because, as some might recall, I replaced the headstock bearings & thought I might as well do what I could to improve its alignment.


----------



## WobblyHand

homebrewed said:


> On a slightly different subject, I am working on a longer chuck wrench to make it easier to dial things in on my 4-jaw chuck.  The ones I have now are too short so I'm always bumping the DI when I'm doing that.  The new one will be about 5 inches long.  One of the first steps in making it was to turn down all but about .7" to a smaller diameter.  I ended up with about .002" of taper over 6 inches.  Not too bad for a mini lathe.  That's after I shimmed the headstock, based on my RDM testing.  I suspect that a fair amount of that taper is due to slight misalignment of my tailstock -- I used a live center to support the end of the shaft.
> 
> I had the headstock off because, as some might recall, I replaced the headstock bearings & thought I might as well do what I could to improve its alignment.


That was one of my earlier lathe tools that I made.  For some reason, cost primarily, the keys were knuckle busters, way too short.  I made two chuck keys, one for my 3 jaw and one for my 4 jaw.  Don't know why the manufacturer chose different sizes, just another inconvenience for a mini lathe user to deal with.


----------



## rwm

I ran across this interesting of XRF pitfalls:









						When XRF analysis goes wrong
					

So recently I melted down some scrap zinc  ingots I'd made from recycled boat anodes. I wanted aluminium in the alloy to get something similar to ZAMAC...




					forums.thehomefoundry.org


----------



## graham-xrf

rwm said:


> I ran across this interesting of XRF pitfalls:
> 
> 
> 
> 
> 
> 
> 
> 
> 
> When XRF analysis goes wrong
> 
> 
> So recently I melted down some scrap zinc  ingots I'd made from recycled boat anodes. I wanted aluminium in the alloy to get something similar to ZAMAC...
> 
> 
> 
> 
> forums.thehomefoundry.org


There are dozens, or maybe hundreds of ways a test can wrongly indicate what metals are supposedly present. It starts with the calibration, and the purity of the samples, and the resolution of the XRF analyzer. We have first the analyzer measurement of return energies, then next we have the fumbles an analyzer software can encounter in interpreting them.  

Then - when one looks at the possible spectra from elements, there are many from L-layer interactions that can spoof the presence of metals that are just not there!  All the analyzers can show you a spectrum. Only the good ones can deduce from the presence of certain combinations of peaks whether a particular element is actually there, and get a probability.


----------



## homebrewed

Even the high-end x-ray spectrometer we had at work would make crazy guesses at what it was looking at.  One time I had a sample analyzed and it claimed it had Dysprosium in it!


----------



## graham-xrf

Just in experimentally messing with a single op-amp package LTC6268IS810#PBF, not on a PCB, but super-glued upside down onto a scrap of PCB, as in "dead bug". It proves to be a tiny handful!
*
It needs very low leakage around the transimpedance amplifier input!*
It's looks like it is going to work OK, but comes with a caution on stopping it becoming a powerful little oscillator. It takes around 1pF or 2pF across the feedback resistor Rf to get it going sensible, and that is easy enough, except for I think the capacitor has to be of extraordinary quality! The leakage current of most capacitors I could find handy is way more than the input bias femto-amps. An old-school axial polystyrene cap with the thin wires worked, but is almost the size of the whole chip. Two short wires stood close to each other with some stripped off PTFE sleeve pushed over one also worked, but this is only crude breadboard-style messing with it.

I read that ceramic capacitors have leakage that is orders of magnitude more than the input bias current of this amplifier.
It makes me wonder if a casual bit of FR4 printed circuit board is going to be up to it. It almost seems to be getting into the class of electrometers which used glass. Low leakage should be easy with caps having values of only a few pF, and I think even pH meters have used FR4. I think this may be a non-problem, only an artifact of my sloppy breadboard, and sweaty hands.

Now looking into surface mount low leakage caps.


----------



## homebrewed

graham-xrf said:


> Just in experimentally messing with a single op-amp package LTC6268IS810#PBF, not on a PCB, but super-glued upside down onto a scrap of PCB, as in "dead bug". It proves to be a tiny handful!
> 
> *It needs very low leakage around the transimpedance amplifier input!*
> It's looks like it is going to work OK, but comes with a caution on stopping it becoming a powerful little oscillator. It takes around 1pF or 2pF across the feedback resistor Rf to get it going sensible, and that is easy enough, except for I think the capacitor has to be of extraordinary quality! The leakage current of most capacitors I could find handy is way more than the input bias femto-amps. An old-school axial polystyrene cap with the thin wires worked, but is almost the size of the whole chip. Two short wires stood close to each other with some stripped off PTFE sleeve pushed over one also worked, but this is only crude breadboard-style messing with it.
> 
> I read that ceramic capacitors have leakage that is orders of magnitude more than the input bias current of this amplifier.
> It makes me wonder if a casual bit of FR4 printed circuit board is going to be up to it. It almost seems to be getting into the class of electrometers which used glass. Low leakage should be easy with caps having values of only a few pF, and I think even pH meters have used FR4. I think this may be a non-problem, only an artifact of my sloppy breadboard, and sweaty hands.
> 
> Now looking into surface mount low leakage caps.


It's always interesting to see what happens when actually building up some circuits!

Thin film capacitors are available in SMT format and aren't too expensive for picofarad-level values.  Their dielectric is a silicon dioxide-silicon nitride composite so they should be pretty good when operated below their maximum-rated voltage.

You're correct about the relatively high leakage associated with multi-layer ceramic capacitors, and the high-K varieties are the worst.  Ceramic caps with a low temperature coefficient are the best you can get for low leakage, because you've got a better dielectric.  Another clue:  don't use capacitors with a significant variation of capacitance vs voltage that's a big clue regarding the type of dielectric.

Dead bug should be pretty good w/regard to leakage -- after all, even with a good guard ring PCB layout you're still dealing with leakage around the package pins.  So that's about as good as you can get, given the limitations of the package.  I _still_ don't understand why vendors sell opamps with FA-current-level inputs when they're immediately adjacent to VCC/VEE/output pins, what a stupid way to shoot themselves in the foot.  Gotta wonder how many designs have been burnt by that.

An alternative to full-on dead-bug is to lift the critical package pin(s) and directly solder to them.  I've done some designs using that approach.  For a TIA that would be just one pin.  My rant still applies .

FYI, the LTC6268/9 series have about the lowest input capacitance I've seen in a wideband FA-input-level amplifier...at least, for devices where the input capacitance is spelled out ( I suppose one could get an idea with SPICE simulations of the target amplifier that are designed to elicit that parameter...or maybe examine the SPICE model to see if it's spelled out).  They're pretty good for low input-C, but if it's achieved using some type of bootstrap scheme they could be abnormally sensitive to the impedance presented to their input terminals.


----------



## graham-xrf

homebrewed said:


> Dead bug should be pretty good w/regard to leakage -- after all, even with a good guard ring PCB layout you're still dealing with leakage around the package pins.  So that's about as good as you can get, given the limitations of the package.  I _still_ don't understand why vendors sell opamps with FA-current-level inputs when they're immediately adjacent to VCC/VEE/output pins, what a stupid way to shoot themselves in the foot.  Gotta wonder how many designs have been burnt by that.


This is the whole reason I went for the 6268 single op-amp in the package in the SO8 size package. It gives (some) opportunity to sneak a tiny thin guard ring track between the pins.


homebrewed said:


> An alternative to full-on dead-bug is to lift the critical package pin(s) and directly solder to them.  I've done some designs using that approach.  For a TIA that would be just one pin.  My rant still applies .


In view of what you say, I think a sure-fire approach would be to set the chip down with one pin deliberately lifted up, and tack it to a very thin wire that drops into a guard ring. In my circuit, there is a 10pF capacitor between the diode and the input, which is part of my AC-coupled scheme to leave the bias current all in the diode. That could help in connecting to the pin. My circuit is not like the DC-coupled TIA circuits I see, but it seems to work in simulation.


homebrewed said:


> FYI, the LTC6268/9 series have about the lowest input capacitance I've seen in a wideband FA-input-level amplifier...at least, for devices where the input capacitance is spelled out ( I suppose one could get an idea with SPICE simulations of the target amplifier that are designed to elicit that parameter...or maybe examine the SPICE model to see if it's spelled out).  They're pretty good for low input-C, but if it's achieved using some type of bootstrap scheme they could be abnormally sensitive to the impedance presented to their input terminals.


Would that be the same as "Miller" capacitance between drain and gate in FET amps? I don't know what is really in the model. The device could be like a microwave op-amp. I suspect the input capacitance is genuine.


----------



## homebrewed

Looking at the simplified schematic in the data sheet, it appears that indeed some of the input capacitance is bootstrapped away.  If you look at the "cmos input buffer" you will see two signals referred to as "input replica" on the other side of some ESD protection diodes.  The input replica signal forces the voltage on the other side of the diodes to follow the input, so the diodes' capacitance disappears.  At least, up to some maximum frequency beyond which the buffer's phase shift causes the capacitance cancellation to become less and less effective.


----------



## K30

RJSakowski said:


> There is some danger associated with amassing quantities of Americium 241 so caution should be exercised.


The NRC would take a real dim view, that's for sure.  I don't think they want that to happen again.


----------



## RJSakowski

K30 said:


> The NRC would take a real dim view, that's for sure.  I don't think they want that to happen again.


What is the "that" you are referring to?


----------



## K30

RJSakowski said:


> What is the "that" you are referring to?


Nuclear Boyscout


----------



## graham-xrf

K30 said:


> Nuclear Boyscout


Hi @K30.
This is a epic huge thread, and I never expect anyone to read it all through, but from memory, I know that we fully calculated what emanates from the very tiny amount of Am241 in a smoke detector, and what it can do to one. @RJSakowski has always been there for our reality backstop, and he helped at the time. The major radioactive energy from Am241 drives alpha particles, which are the things needed for smoke detectors. They are charged helium atoms nuclei, You would see them pinging away if you put them over dry ice, all under a bowl. (Wilson cloud chamber high school experiment).

Our XRF uses the remaining other by-product energy, this being a 60KeV gamma ray photon. The amount of Am241 in there is so small, it's quite hard to get enough of the photons to hit a material, get it to "glow" out some lower energy x-rays, and end up with a diode detector current above 40,000 electrons. We can safely take apart the ionization chambers, down to the little metal button with the smidge of oxide in it, and handle it normally, so long as we don't swallow them, or crush them up. The alpha radiation would not even get through a piece of paper!

The 1995 case of the David Hahn is well enough known. He was not using a few pellets of Am241 smoke sources for XRF. Instead, he bulk-bought possibly 200 for a dollar, and added those he managed to steal over a long time. He also added a startling quantity of _radium_ from a bottle of paint used to make clock hands glow in the dark. He used nitric acid chemistry, and various procedures to concentrate his stash of precursors, including uranium (ore or cake), and lithium from batteries. He was intent on making an effective neutron source to use as a "gun" to make a small breeder reactor, hence letting it irradiate beryllium, and various other stuff. The Am241+ radium was a starting step to breed a better cocktail. Leaving his "ball" of reactants all wrapped up in aluminum foil and Duck tape in the trunk of his car for days on end, with the count rising every day, was a mistake! It was detectable at the end of the street! Even when he thought to separate the stuff, he was incredibly inept.

There is not the remotest prospect that our smoke-detector Am241 traces can do anything like that, even if you stack them together. I plan to use a circular array of 6 or 8, or as many as I can pack into a couple of inches circle.

Of course, the public and media misconception confuses, or lumps together what is the difference between exposure to radiation, and what is exposure to radioactive materials from tiny amounts getting onto or into our body tissues. We have evolved to live in and among quite high levels of the former.

I know its a fun graphic, so I include the PDF comparing "doses". I have no idea how anyone figured that you have to sleep with 10 people to rack up 0.5uSv of radiation dose.  Somehow, it neglects what they would have received from you.
(It's a big image, you may need some zoom)


----------



## K30

If you took that as anything more than tounge in cheek I apologize! I'm well aware of the low levels you're dealing with, and how little clue the general public actually has. I hold an NRC license to operate a reactor.
My first thought in this thread was that you'd get most your components just taking an old detector that was being surplused out of a power plant, but it appears theres not much luck to be had with the internal components after sitting on the shelf for 40 years. General Atomics will gladly make you new, for dumptrucks of cash it appears 

Hey! That's neat! I've never seen that graphic in Seivert before, only REM.


----------



## graham-xrf

K30 said:


> If you took that as anything more than tounge in cheek I apologize! I'm well aware of the low levels you're dealing with, and how little clue the general public actually has. I hold an NRC license to operate a reactor.
> My first thought in this thread was that you'd get most your components just taking an old detector that was being surplused out of a power plant, but it appears theres not much luck to be had with the internal components after sitting on the shelf for 40 years. General Atomics will gladly make you new, for dumptrucks of cash it appears
> 
> Hey! That's neat! I've never seen that graphic in Seivert before, only REM.


*Things that caught my interest*
One can find various descriptions of the the 1.6kg  "Demon Core" of plutonium that killed Harry Daghlian, and later, Louis Slotin (1945/1946). Harry took an estimated 5.1 Sieverts from the instantaneous blue flash, and wave of intense heat. He died after 25 days.
The Slotin accident exposed Louis to about 10 Sieverts. He knew he was a walking dead man, and he died 9 days later. I would guess that might be the highest dose anyone has ever received!

Recently, I have been somewhat distracted by the goings on in Ukraine involving the nuclear reactors, and the attentions of the Russians.
When the Russian troops took over the Chernobyl site, they must have been operating in complete ignorance. It beggars belief that there was not enough basic knowledge right through the command chain to be aware that the entire evacuated area around Pripyat got that way for a reason! 

Digging in to defensive trenches in the Red Forest, regardless the warnings, was what caused their acute radiation sickness, and hasty withdrawal. They were taken by buses to the Belarusian Radiation Medicine Center in Gomel, and I doubt the full story about their fate will be known for some time.

One of the employees at the exclusion zone management taunted them on Facebook with..
“Have you dug trenches in the Red Forest, b*tches? Now live the rest of your short life with this. There are rules for handling this area. They are mandatory because radiation is physics — it works regardless of status or shoulder ranks".

*My XRF project feel?*
It's great! To figure a way to use the feeble leftovers from a few smoke detector innards, re-purposed into a materials identification tool, delivers a nice first buzz.  Learning some nuclear physics, low noise electronics design, and small computer programming on the way? Now that is just delightful!


----------



## K30

graham-xrf said:


> The Slotin accident exposed Louis to about 10 Sieverts. He knew he was a walking dead man, and he died 9 days later. I would guess that might be the highest dose anyone has ever received!


Ummm, let me dig!  I think it might not be!  Let me see if I can dig up the estimated dose for the guy that didn't immediately die in the SL-1 "accident".  I think there might have been a higher one outside the US too, but I can't remember the circumstances.

On a funny note.  I actually tried to follow the rules once, and send 5 or 6 30+ year old detectors back to the manufacturer for disposal.  They had ceased operation at least a decade before...


----------



## graham-xrf

I have not  posted here for a while, because of other critically important things in my life that have to come first. When I can, I keep pressing on, mostly using LTSpice, and  using components from Analog Devices that I do have model data for. Also, I keep adding to my KiCAD circuit.

*Regulators - suggestions?*
As I get the circuit line-up gathered together, I run into some quite tricky power supply component problems. The TIA likely is able to see below the noise floor of what is coming out of the photodiode. The photodiode bias is clean, coming from batteries. Everything else needs a variety of voltages, some of which need to be pure as the driven snow. We can rely on high PSRR to some extent to help.

There are good, extremely low noise high bandwidth low dropout regulators, like (say) LT3042, but the darn thing is in a 10-lead plastic MSOP package 3mm x 3mm body, and 5mm from tip-to-tips of the leads, 0.5mm lead pitch. So - I am still looking for good low noise LDO that mortal fingers with tweezers have a sporting chance of getting soldered in.

My basic line-up allows for two transimpedance amplifier circuit configurations on the same board, depending on which components are left out, and where some resistors are replaced by zero-ohms links. It has the TIA stage, then a 3-range gain switched stage, allowing "zoom" onto low level pulses. The next stage can add more gain if needed, but it's main job is the 50Hz/60Hz deep notch filter. Last is the ADC driver, using a dual op-amp pair to make the ADC differential signal from the single ended input. Control can be from Raspberry Pi, Teensy, Beaglebone, and possibly a few others.

The ADC is the AD7622, using a 2.5V regulator devoted to its (clean) analog conversion supply. It also needs a 2.5V digital supply, and the temptation is to steal some of the analog supply via a 10 ohms resistor and a couple of capacitors. I have a dedicated ADM7160AUJZ-2.5 regulator for 2.5V analog need, which takes from the 3.3V supply. (Yes - I get it that that is an over-long part number for a little regulator!).

*What total gain does one need?*
Hopefully not long now, I will post the circuit, it's simulations, and a little explanation of my thinking on it. For present entertainment, and to imply that I am still alive, I attach a couple of plots. One shows a simulated 5nA pulse TIA amplified to about 2V ADC level (red trace). The other shows the FET input TIA doing it's thing on a 45pA worth of photodiode electrons (green trace) with claimed 900pV/√Hz input referred voltage noise. I think the noise from the diode will be above that! Do not take this as final. In practice, I might use 200K (2 x 100K in series) for the TIA feedback resistor. Maybe even lower than that.

We can have all the gain we can ever want from the subsequent stages. Even if the first TIA gain was 100K from 2 x 50K, that is a power gain of 50dB, which is more than enough to get to the point the signal/noise ratio cannot be degraded by subsequent stages. The idea here is to make the noise contribution from the feedback resistor lower than from the photodiode. We use two in series to control the stray capacitance, so we can have our own low value 1pF capacitance there to keep it from oscillating

I don't (yet) know how to make LTSpice do its "integration" function. I don't really know what current pulse height will come from the photons it sees. We might be able to see less than 2KeV, if we allow some time for the count to gather at 20% probability. I never expect to see aluminum (pity). There is hope. Al is theoretically (just about) within reach at 1.5KeV at about 2% capture probability, meaning wait even longer.

Perhaps wishfully, silicon, phosphorus, and sulphur might also be in range. Most other heavier stuff should display OK.


----------



## homebrewed

Yeah, there's been a bit of a silence from all involved parties.  Summertime is not a good time for stuff like this because we know the nice weather only lasts for so long.  Myself, between the garden, house-related items and the occasional hike, right now there isn't much time left over for the other stuff.  But summer is waning so I should be able to return to some other fun projects.

One way around your assembly-related problem might be to roll your own regulator(s) using low-noise op-amps.  Based on my browsing through DigiKey and the like, it appears to me that high-performance regulators cost about as much (or more) as good op-amps --- so why not?  You could have a "master" regulator and resistive dividers off that to provide lower voltages.  Good bypass capacitors will drop the thermal noise from the dividers.  If you worry about such things 

On a slightly different note, I also have noticed that many so-called "low noise" regulators are pretty lame compared to decent op-amps.  'Course, one could say the same about vendor claims about many of their op-amps...


----------



## graham-xrf

homebrewed said:


> Yeah, there's been a bit of a silence from all involved parties.  Summertime is not a good time for stuff like this because we know the nice weather only lasts for so long.  Myself, between the garden, house-related items and the occasional hike, right now there isn't much time left over for the other stuff.  But summer is waning so I should be able to return to some other fun projects.
> 
> One way around your assembly-related problem might be to roll your own regulator(s) using low-noise op-amps.  Based on my browsing through DigiKey and the like, it appears to me that high-performance regulators cost about as much (or more) as good op-amps --- so why not?  You could have a "master" regulator and resistive dividers off that to provide lower voltages.  Good bypass capacitors will drop the thermal noise from the dividers.  If you worry about such things
> 
> On a slightly different note, I also have noticed that many so-called "low noise" regulators are pretty lame compared to decent op-amps.  'Course, one could say the same about vendor claims about many of their op-amps...


Yes - I have done this before, and I agree that this could be a convenient way.  Hanging a follower op-amp between the supply terminals, and connecting the input to a voltage divider using two resistors. There is enough current availability from any one of the low noise op-amps. The resistors set the output to drive the 0V reference, so making available a positive, and a negative to use for the other op-amps supplies. They need not be symmetrical. One can set the "negative" supply to be (say) -0.8V, and the "positive" end to be (say) 2.5V. That way, one can have inverting stages without saturating at the rail, all taken from a 3.3V master regulator.

The tiny regulator I mentioned happens to be exceptional. It has 800uV noise, and 1MHz bandwidth, 200mA current rating, and is capable of cleaning up switched regulator supplies. It's just too darn small to be attractive.

*I don't know how much gain to use*
The 16 bits has 65536 counts. Allowing the unknown threshold for the least significant bit, then 32768 states can be had with certainty. That would be 90.3dB dynamic range. The data sheet claims 92.5dB (but I don't know how that happens). The SINAD is claimed 91dB minimum.

So, thinking about the range needed. The biggest pulse we would ever be curious about is a direct hit from a smoke detector. 60KeV.
The smallest energy that we can reasonably expect the photodiode to respond to is about 1.5KeV.
Thus the range is 20*log(60/1.5) = 32dB
Therefore, we don't need any gain range switching. The ADC should easily manage the range the photodiode has, and more. We only need set the gain to deliver about 2V for the ADC when it sees 60KeV.


----------



## homebrewed

graham-xrf said:


> We use two in series to control the stray capacitance, so we can have our own low value 1pF capacitance there to keep it from oscillating


I used a similar approach in an active probe I designed for probing internal nodes of RF IC's.  For that one I used three series-connected 0201-sized resistors.  It worked reasonably well but the technician who assembled them said those resistors were a PITA to solder down.


----------



## WobblyHand

@graham-xrf you may find that the better newer components are only available in tiny packages.  Since you are making a PCB (from the KiCad reference above) you might consider the boards being all SMD and just having it assembled.  Personally, I wouldn't even attempt 0201 stuff, about the smallest these days I would consider for hand work is 0805, or maybe 0603.  Fine motor control and eyesight are not where they used to be...  For the critical parts, maybe consider hand assembly using very slow hot air or an oven using a lower temp solder.


----------



## WobblyHand

Just recently taught myself KiCad and did my first design.  What a lot of stuff to learn to get things done!  It was a simple through hole design, for a home made electronic lead screw controller, but it taught me a lot.  In ancient times, for work, I did a few PCB designs, but I had access to rules based auto-routers and other high end tools.  DIY hand routing is an art.  Fortunately, remembered enough from 40 years ago to get through the design.  I had the PCBs fabricated recently.  Just waiting for them to arrive.  Next design will be primarily SMD, since the parts availability is so much better.  Also the smaller parts make it easier to make more compact designs.  Those DIP packages take up a heck of a lot of room!


----------



## graham-xrf

I guess I do agree with you in general. One gets to use the nice goodies if they are put down on a PCB. It's just that, when one is messing with the first prototypes, it is necessary to be able to work on them. Given the cost of things like ADCs, I can't assemble a PCB, have a problem with it, and start from scratch with a new one in the hope of accidentally coming across why the first did not work! Diagnosing requires dissasembly.

Since I will have a KiCAD circuit, it does make sense to follow through to the PCB, and then sure , one can site the components, and when the solder paste melts, they "pull" exactly into place. The thing is, unlike Mark, who at least has powered up a modified pocket geiger, all my "experimenting" has been on separated circuit fragments. I need to at least get the first together, so I was thinking to try for manageable component sizes where possible.

*Being able to mess with it - and variations.*
I had in mind to have the thing so that others could use the PCB, with options to change things on it.
We can have a straight op-amp TIA, or we can add the JFET version, That trick also comes in several flavours.

I used a 1.5nF coupling capacitor to be able to bias the photodiode without causing offsets at the input of an extreme gain amplifier. The simulations showed it worked without need for all sorts of return overshoot and baseline compensations. Even so, I saw how it was done for Hamamatsu photodiodes using LTC6244HV. There it is in Fig 6a, a way of connecting with DC coupling so that you can have arbitrary bias VBB. I could not get it to work in simulation, and the circuit I chose has lower noise anyway. Regardless, the layout can still have the circuit, just by putting in 0-ohms links in place of some of the resistors.




Further in considering a basic PCB which is capable of accepting "experimental variations", I had in mind to have headers so that a user can choose to interface with Teensy, Beaglebone, or Raspberry Pi. Maybe having a header separated from the works by a means to have wire links to get to any interface pinout would be the most flexible. It does not _have_ to be this way, but a PCB might be as many as will step and repeat on 12" x 12", and I don't mind sending some to anyone who wants to play. I will only need a couple. Hence, trying for bigger bits where possible.

I deliberately purchased a some LTC6268, which is a single op-amp package in SO8, just because it then becomes possible to lay out a guard ring at the input, and you even get given a guard ring recommended layout. Of course, the other thing I was thinking was, an SO8 can also be handled by fingers like mine.




*The gain calculation.*
Someone who is used to teaching sciency stuff had better check my calculation. 
When one is dealing with a photon with energy in KeV, you don't get to know the currents involved straight away. It all depends on the capacitance those electrons are spread into. 60KeV would be 60,000 electrons on a capacitor with one volt across it, or 30,000 electrons with 2V, and so on. 60KeV energy is *9.613059804E-15* Joules. We simply don't know how many electrons were involved, without knowing a voltage.

Those Joules ended up in about 230pF capacitor, before getting leaked away into driving a TIA.
Energy in the capacitor has equivalent expressions (C/2) * V^2 = (Q*V)/2 = Q^2/(2*C).
It is the last of those that lets us in. Charge Q also equals current x time. We actually have an approximately triangular pulse, with base time about about 13uS. We can get to the area under the curve using 1/2 base x height. Suppose the pulse peak is Ip, and energy was E joules.
Q~= 6.5uS x Ip  where the 6.5uS came from being half of 13uS

E = ((6.5E-6 * Ip)^2)/(2*C) where C was 230pF

then 6.5e-6*Ip = √(E*2*C), and Ip = √(E*2*C)/6.5e-6
Doing the arithmetic, Ip = 3.2351e-7A, which is better said as *323.5 nA*.

Wow!, My 5nA simulation even is way too small. I think that is huge! A third of a micro-amp!

We can now get at least a reasonable estimate of the components to deliver the required gain, and make a final adjustment when we have a chance to assault the photodiode with a direct view of a smoke detector.
Something feels wrong! We don't need as much gain as I have been thinking about,
If I fumbled any of that, please do tell.


----------



## WobblyHand

E = 9.613e-15 J
t = 13e-6
C = 230e-12
Q^2 = E * 2 * C
Q = sqrt(E*2*C) = 2.1e-12 coulombs
Q = i * t
i = Q/(t/2) = Q/6.5e-6 = 2.1e-12/6.5e-6 = 3.235e-7A

3.235e-7A * 1e9 nA/A = 323.5 nA = 0.3235 uA

You slipped 3 orders of magnitude.  This is assuming the numbers are as you stated.  If this is true, you have lots of current to play with, a veritable walk in the park!


----------



## graham-xrf

WobblyHand said:


> E = 9.613e-15 J
> t = 13e-6
> C = 230e-12
> Q^2 = E * 2 * C
> Q = sqrt(E*2*C) = 2.1e-12 coulombs
> Q = i * t
> i = Q/(t/2) = Q/6.5e-6 = 2.1e-12/6.5e-6 = 3.235e-7A
> 
> 3.235e-7A * 1e9 nA/A = 323.5 nA = 0.3235 uA
> 
> You slipped 3 orders of magnitude.  This is assuming the numbers are as you stated.  If this is true, you have lots of current to play with, a veritable walk in the park!


Hmm.. I think we actually agree.
I get the same answer as you, which is *3.235e-7A*
3.235e-7A is indeed 0.3235 uA.

Moving the decimal 3 places to the right turns uA into nA
323.5nA is what I said.
It is huge, and would deliver 32.35mV from a 100K gain in the first stage

Noise from √(4 * k * T * B * R)
k = 1.380649E-23
T = 295 (about room temperature)
B = 300KHz (the pulse has that content)
R = 100K (say) for the TIA stage
Noise = 22.1uV

S/N ratio = 1463.8 => 20log(1463.8) => 63.3dB (for the 60KeV)
It's a great big fat clean signal.
------------------------------------------------------------------------------------
Now to go again, but this time for a 1.5KeV energy.
I am thinking from #885 that the S/N will be 32dB less than what we get from the big fat pulse. 63-32 = 31dB ?
That would still be a noise-free signal


----------



## WobblyHand

graham-xrf said:


> Hmm.. I think we actually agree.
> I get the same answer as you, which is *3.235e-7A*
> 3.235e-7A is indeed 0.3235 uA.
> 
> Moving the decimal 3 places to the right turns uA into nA
> 323.5nA is what I said.
> It is huge, and would deliver 32.35mV from a 100K gain in the first stage
> 
> Noise from √(4 * k * T * B * R)
> k = 1.380649E-23
> T = 295 (about room temperature)
> B = 300KHz (the pulse has that content)
> R = 100K (say) for the TIA stage
> Noise = 22.1uV
> 
> S/N ratio = 1463.8 => 20log(1463.8) => 63.3dB (for the 60KeV)
> It's a great big fat clean signal.
> ------------------------------------------------------------------------------------
> Now to go again, but this time for a 1.5KeV energy.
> I am thinking from #885 that the S/N will be 32dB less than what we get from the big fat pulse. 63-32 = 31dB ?
> That would still be a noise-free signal


If the original energy was 60 keV and the new energy is 1.5 keV, then the amount in dB's is 10*log10(1.5/60) = -16 dB.  We use 10, because we are dealing with energy, (power) not voltage or current ratios.  So the S/N is 63-16 = 47 dB.  Pretty high!


----------



## homebrewed

One of my friends is assembling his own SMT circuit boards using a solder mask in a 3D printed frame.  For a relatively small fee, some PCB vendors will provide a mask for printing solder paste.  JLCPCB may.

That doesn't lessen the pain of placing the components, although I have seen some DIY pick and place efforts.  At least you're not trying to (1) hold them down in the right place while (2) soldering a few package pins.

But solder paste and a reflow oven (or hot plate) are about the only option if you're dealing with QFN style packages.  I have soldered them down (up to 48QFN packages) by pre-tinning the PCB footprint _AND_ the package pins, then carefully placing the package on top of the footprint.  Higher-viscosity solder flux helps to keep the package in place for this.  From there they would go to a hot plate.  If done correctly, the solder would melt and align everything via surface tension, but it didn't always work.  And even if alignment was OK sometimes a pin or two or three (etc.) wouldn't make contact to the footprint.  The edges of QFN packages also have the pins exposed, althoughthey're  co-planar with the molding compound so in that case we would try to solder the edge with a fine-tipped soldering iron.  That rescue procedure requires solder flux to keep from shorting adjacent pins together.


----------



## graham-xrf

WobblyHand said:


> If the original energy was 60 keV and the new energy is 1.5 keV, then the amount in dB's is 10*log10(1.5/60) = -16 dB.  We use 10, because we are dealing with energy, (power) not voltage or current ratios.  So the S/N is 63-16 = 47 dB.  Pretty high!



Of course. I was using voltage ratio 20*log10(60/1.5)
Which way up, (1.5/60) or (60/1.5) does not matter, it only changes the sign to a (-) or (+) . Using 20 instead of 10 for power ratio is what hiked the 16 into 32.
This is great -even more noise free!

This surprises me. Having as much as 12dB signal above the noise racket is enough for very clean signals, and here we have a big excess.
So far, it's not a true S/N. We have only calculated how much comes from the 100K Rf.
The actual scenario will and in the input noise voltage 4.3 nV/√Hz, and the current noise 5.5fA/√Hz at the input, and then add in the noise coming from the photodiode.

We may be 47dB clear from the √(4 * k * T * B * Rf) noise of molecules bashing around in the Rf resistor, but we will be looking at a whole lot of other additional amplified noise. Thankfully, from any place downstream of the first TIA stage, there is not much in the way of noise that can add to significantly degrade the S/N. The S/N is "locked in" by then

 I am so looking forward to trying this, and getting at the real signal.
[Reminder to self - include built-in test points access. You can't connect most scope probes to this stuff! ]


----------



## WobblyHand

graham-xrf said:


> Of course. I was using voltage ratio 20*log10(60/1.5)
> Which way up, (1.5/60) or (60/1.5) does not matter, it only changes the sign to a (-) or (+) . Using 20 instead of 10 for power ratio is what hiked the 16 into 32.
> This is great -even more noise free!
> 
> This surprises me. Having as much as 12dB signal above the noise racket is enough for very clean signals, and here we have a big excess.
> So far, it's not a true S/N. We have only calculated how much comes from the 100K Rf.
> The actual scenario will and in the input noise voltage 4.3 nV/√Hz, and the current noise 5.5fA/√Hz at the input, and then add in the noise coming from the photodiode.
> 
> We may be 47dB clear from the √(4 * k * T * B * Rf) noise of molecules bashing around in the Rf resistor, but we will be looking at a whole lot of other additional amplified noise. Thankfully, from any place downstream of the first TIA stage, there is not much in the way of noise that can add to significantly degrade the S/N. The S/N is "locked in" by then
> 
> I am so looking forward to trying this, and getting at the real signal.
> [Reminder to self - include built-in test points access. You can't connect most scope probes to this stuff! ]


Believe me, it's all too easy to lose SNR.  Seen it frittered away in many a beginner's design.  I don't think you will have that problem.

Re: Test points.  The best one's I have ever used were miniature test jacks that one plugged in the scope probe.  They were coaxial.  They were a little expensive, but worked extremely well.  In ancient days I used them on high speed ECL.  No bounce, no ringing.  Probes didn't fall out.  To use them one unscrewed the plastic barrel that surrounded the probe, revealing the ground shield.  The ground shield contacted the outer conductor, whereas the probe tip contacted the inner.  Had horizontal and vertical versions.  

All that said, the best test points are the one's you have and can access.  I'm saying this in retrospect, since I just spun a board.  Yes, I forgot the test points!  My previous board spin was in the 1980's, so it seems I forgot about them.  Next spin, I will put them in.  Haven't even received the boards yet, and am a tad worried about testing.


----------



## graham-xrf

@GreyhawkUSA30340 
If you made it here, you probably have figured out what is going on. I should post my KiCAD circuit here as soon as possible, even without the PCB layout, just so we can get on with it.


----------



## homebrewed

"Progress" for me has been to transfer all my XRF S/W to a more-modern laptop.  The one I'd been using to develop code for lower-performance Arduino clones wan't able to support the Teensy4.x line of "Arduinos".  My new one sports an SSD, is much faster and is smaller/lighter.  There were a few bumps on the way to installing Ubuntu on it but it appears to be working OK now.  My front-end pulse acquisition code compiles OK, so does the code for the host computer.  I anticipate needing to debug both sets of code, hence the need for a decent lab computer.


----------



## graham-xrf

homebrewed said:


> "Progress" for me has been to transfer all my XRF S/W to a more-modern laptop.  The one I'd been using to develop code for lower-performance Arduino clones wan't able to support the Teensy4.x line of "Arduinos".  My new one sports an SSD, is much faster and is smaller/lighter.  There were a few bumps on the way to installing Ubuntu on it but it appears to be working OK now.  My front-end pulse acquisition code compiles OK, so does the code for the host computer.  I anticipate needing to debug both sets of code, hence the need for a decent lab computer.


Hi Mark
In passing, could you let us know your preferred connection set between the Teensy and the TLA with A-D converter board. It already has a set of connections for GPIO plug-in for Raspberry Pi, ( if they are ever to be seen in the wild again)! I have a set of terminals that end on a set of link pads in a row, right opposite a set to plug onto a Teensy, and the idea was to be able to use short high impedance links so it becomes a very flexible kind of "patchboard".

That said, I have the other idea, which I think might be a nicer build, and that is to be able to directly connect a Teensy as a daughter board. It occurs to me that you might have the need to have the Teensy some way from the TIA, via cable or ribbon. Even if a Teensy, or come to that, any of the computing things are used, it may pay to have the pins allocation as flexible as possible, and being able to change one's mind about which goes where might be handy. It may also ease "adding features".

I am also thinking to make connection to Beaglebone reasonably easy.


----------



## homebrewed

graham-xrf said:


> Hi Mark
> In passing, could you let us know your preferred connection set between the Teensy and the TLA with A-D converter board. It already has a set of connections for GPIO plug-in for Raspberry Pi, ( if they are ever to be seen in the wild again)! I have a set of terminals that end on a set of link pads in a row, right opposite a set to plug onto a Teensy, and the idea was to be able to use short high impedance links so it becomes a very flexible kind of "patchboard".
> 
> That said, I have the other idea, which I think might be a nicer build, and that is to be able to directly connect a Teensy as a daughter board. It occurs to me that you might have the need to have the Teensy some way from the TIA, via cable or ribbon. Even if a Teensy, or come to that, any of the computing things are used, it may pay to have the pins allocation as flexible as possible, and being able to change one's mind about which goes where might be handy. It may also ease "adding features".
> 
> I am also thinking to make connection to Beaglebone reasonably easy.


My current setup consists of 3 modules.  

1. The front end analog component, which includes the AM241 exciters, modified pocketgeiger and signal conditioning boards.  

2.  A Teensy 4.0 with the pulse acquisition/processing S/W.  The on-chip 12-bit A/D will be used to acquire the pulse, although I expect a final version to use a separate 16-bit A/D running at 1MSPS or faster (this is why I spent some time on coming up with a fast parallel digital I/O scheme for a Teensy4.x board).  The Teensy will communicate to the host computer via its USB interface.  

3.  A host computer running a command-line based program that can set the Teensy's acquisition parameters and output a CSV style file for generating spectra.  The CSV files can be processed/displayed using Excel (actually the Libreoffice equivalent), gnuplot, scipy, octave, whatever.

As you can see, this setup is designed for prototyping -- definitely not a portable item -- because it still isn't clear to me what the final system might be.  IMHO at this stage flexibility in being able to refine each portion is more important than anything else.


----------



## homebrewed

Well I finally got all the pieces connected up.  It appears that so-called "geiger mode" of operation works -- if I change the trigger level the count rate changes.  But the pulse processor is NOT working.  The pulse-width discriminator is rejecting every pulse as being too short.  I found one significant bug but haven't had time to modify the code & try it out.

Here's a photo of my current setup:




The Teensy board is behind the laptop.

I got the electronics workbench at harbor freight when it was on sale.  It also has an overhead shelf for storing equipment.  My metalworking stuff is about 180 degrees the other way, the opposite corner of our basement.  

Along with the workbench my electronics "lab" currently consists of a number of power supplies, a Hantek 1GSPS 'scope, a DS212 10MSPS mini-oscilloscope, a DVM , a function generator and a soldering station.  I also have a fairly decent collection of transistors, assorted digital/linear IC's and passive components.   While it's pretty limited as far as bandwidth goes, the mini-scope is handy for debugging things that are directly connected to the mains, since it is battery powered.  I've been repairing the temperature controllers on a friend's food dryers and those are definitely "hot" boards...

Fairly basic stuff, although I also have an SDR "stick" I've used to debug RF problems with wireless motion sensors, remote entry car keys, garage door openers etc.  At some point it would be nice to have some RF gear -- spectrum analyzer, RF generator, maybe one of those inexpensive VNAs -- but so far I really haven't come up with a good justification to spend the $ for that stuff.


----------



## homebrewed

I tracked down some major problems with my pulse qualification code.  One slap-the-forehead problem was in the function that updates the circular buffer and was simple to correct (once I found it), but the other was more subtle.  The interrupt routine that runs the ADC does several things, one of which is to set a flag if a lowpass-filtered version of the input is greater than the trigger level (the intent is to reject noise).  My main pulse-processing routine waits for that trigger flag to be set, and as soon as it happens it starts processing the pulse data.  And that was the problem -- since the processor clock runs at 600MHz it was outpacing the ADC by a huge factor.  So the data it was seeing in my circular buffer didn't contain any information regarding the current pulse.

The solution was fairly simple, basically insert a delay in the pulse processing code to allow the circular buffer to capture the entire pulse.  After that I started getting some valid pulses.  Most pulses still weren't right, but just reflected the fact that I had done a lot of guessing on the expected pulse width values (maximum-valid pulse width and minimum-valid pulse width).  I also hadn't initialized my "goodness of fit" parameter so my pulse qualification code was rejecting everything.

One thing that needs some attention actually is that goodness of fit parameter.  The values I'm seeing are consistently very low, ranging from 0 to .01.  Given the liklihood of pulse overlap plus system noise, I think there should be some pulses being rejected for an excessively high error coming out of the fitting routine so....more code validation is in the near future.

I could upload my latest version to my Google Drive for folks to examine, but at this point it's full of debug code and not useful for a real MCA.


----------



## graham-xrf

Most excellent stuff!
I was trying out circular buffer sampling right at the beginning. Basically, it runs all the time, and is big enough to capture 20uS. There may later be a case to change that, but I was, and still am into pulses that have not been significantly stretched.

 When a threshold is seen by the trigger, it might be noise, it might be a mangled "two arrivals", or a direct radiation photon way oversize, but regardless, the numbers taken from the buffer are from an address some microseconds worth of samples earlier. I guess that was my version of a "delay". Also, I was only using C-R filtered signal generator "pulses". Getting the tiny hardware to work with my attempt at manual prototype breadboard assembly did not go so well. I broke stuff, and I have now gone for SO8 size first IC.

I would be interested in what front-end circuit you built using the pocket geiger PCB, and what you used to get a low pass, noise-filtered version. Did you have to hack the tracks a lot?

I have the op-amp hardware trigger still planned to be in there, but I have been attempting to use number testing on the sample as it is put into the circular buffer. If the most recent four samples in a row in the buffer are greater than a threshold number, the assumption is that some kind of pulse is under way, so that constitutes a "software trigger". This also messed up, but I can't see anything wrong with the idea, so I will try again.

I can't yet buy a Raspberry Pi Zero at reasonable cost. So far, I am using an old Raspberry Pi 3B. It seems to do everything OK, though to be fair, "everything" is so far, not much asked. Yes, the PyMCA software does run, but it still needs the fast front end to make the data files the PyMCA works on.  Also, I am being tempted by Teensy and Beaglebone.

I am so impressed  that you do this. If you do manage to repeatedly capture  whole pulses, do let us know what they look like.


----------



## homebrewed

Hi Graham,

Still working my way through some programming problems so I don't have any pretty pictures yet, but I think that will happen pretty soon.  I'm trying to use the Arduino serial plotting utility since that's the most expedient way to plot data.  I was initially concerned that my polynomial curve-fitting routine wasn't working right because the fit error was so low, but that just took some scaling-up to start seeing some significant pulse-to-pulse variations.  I _have_ succeeded in plotting the portion(s) of pulses that are used for the curve fitting routine so I know I'm doing something wrong when I try to plot the whole thing.  Since my rather slow ADC only acquires about 10 samples around the peak the plots look pretty jagged.

Regarding your question about the approach I used for the low-pass filter, it is similar to your 4 samples in a row idea.  I implemented a second circular buffer that only contains 8 sequential samples, sum them and use that to trigger the pulse processor.  It's a dead simple FIR filter, AKA "the rolling average".  However, to avoid summing all 8 samples every time I want to get the rolling average, I realized that all I really needed to do was to calculate the difference between the latest sample and the one being bumped out of the buffer, then add the result to the rolling average value.  The rest of the samples are already represented in the rolling average so why recalculate the whole thing.  I know that part works, verified using my oscilloscope triggered by a pulse generated by the S/W.

Like its analog cousin, the rolling average lags the signal but I know exactly by how much.  So when my pulse processor is triggered the code looks back a little ways into the main circular buffer to capture the actual start of the pulse.  Pretty much like what you've done.

I haven't modified the pocket geiger "much".  The analog signal path is the same, which does have some low pass filtering, just one RC network around the second amplifier in the chain.  I just tapped into the output of the second stage, routing the analog signal to the signal-conditioning board I made (basically to provide some additional gain).  The significant modification was to remove the switching regulator to get rid of the switching noise.  It was pretty bad.  I also added a 1uf plastic-film capacitor to the bias voltage circuit in an attempt to reduce low-frequency noise but I don't think it was particularly successful.  It was a pain in the butt to add it, since the footprint for the original ceramic capacitor was so small.


----------



## graham-xrf

Yes, I think the most recent 8 average, as it climbs up from zero, is a statistically very reliable indicator that a proper pulse is under way. It might later have to satisfy more critera, like it's not totally OTT, or something, but at least you know something significant is going on, and can use it as a reliable trigger, with the luxury of being able to get at pre-trigger values. I may adopt this way.

My original scheme was even more brutal! I adapted it from a switch de-bounce circuit I used years ago. The value of each sample individually must be above a threshold, with no regard to what average the group might have. All four states (flags) feed a logical "AND" gate, which delivers a reliable trigger. One can, of course, increase the set of them contributing to the gate, but in my scheme, everything is happening much faster. The whole pulse is over in about 13uS. At 2MHz sampling rate, that's only 26 samples for the whole pulse! I struggle to get as many as "10 around the peak".

To be able to go a bit slower is why I was interested in your earlier confirmation that, within reason, a benign low pass filter that "slows the whole thing down", still retains most or all of the original pulse shape curve fit information, only scaled in time as in "pulse stretcher". I may yet deploy at least some of that, and there is place in my circuit to add op-amp low-pass, but for now, I make it go as fast as possible. A small slowdown, and sampling at 1MHz instead, would help me a lot.

The extent to which "pulse stretching" was taken in the first circuits we saw was mad! The filtering itself distorted the pulse badly. There was nothing much left of the pulse shape, other than a slow rise that went beyond a window comparator trigger, good enough to signal a "count". We wanted more! We needed to know how much of a count. The peak amplitude is all we have to differentiate materials elements. I think the more we slug it in slow-down filtering, the harder it becomes to expand the range around the peaks to have high resolution. If filtered to the extent very slow ADCs can deal with it, I feared it may limit the performance in discovering elements. This is the basic reason I keep trying to capture the pulse with high speed stuff.

*Re: Bias voltage noise*
Everything I could do to make "clean" voltages for the bias, and also the ADC, was blighted by switcher regulators. In the end, the clunky, but effective way was to use 3 x Lithium 3.3V cells. My lash-up had 3 x CR25, just because I had handy a cheapo bubble pack full of them from replacing motherboard CMOS batteries, but in the end, I would use the smallest, CR12 or something. The scheme allows to choose 3.3V, 6.6V or 9.9V for bias.

Here is where we have the first trade-off, and the first stage of "pulse stretching". Reverse biased diodes seem to be magnificent noise generators. Using 3.3V lowers the dark current noise (which we want), but saddles us with 160pF of photodiode capacitance. Using 3 batteries for 9.9V increases the dark current noise, but we have only 84pF reverse bias capacitance, which, I think, doubles the size of the pulse we can have into the TIA. I think the only way is to build it with three batteries, and experiment, reducing to two, and then to one. My instinct so far is telling me the pulse gets bigger faster than the noise increases, so bias near 10V seems to be best.

I fitted the curve of PIN capacitance estimated from the (zoomed up) data sheet. You can have an equation from a spreadsheet. I post ODF and xlsx here.

*Noise at the ADC*
Having a separate ADC forces some tough design. At first, with input short-circuited, I could not get a number (out of 65536) any lower than some several hundreds. Even the way registers roll over in 5V computing anythings make ground bounce noise.  Things slowed up when I trashed an ADC. I mourned because the AD7622BSTZ originally costing £29.68 was more than £38, and is now £49.09 !! At this rate, I would be looking for a lower cost ADC. I was trying to make this kit "low cost".

The only way was to start with a cleaned up 3.3V stolen from the Pi, and regulate down to 2.5V using a ultra low noise linear regulator, and then make sure that the current summing point is right under the ADC, and that nothing else shares that path. Even SDI clocking stuff gets some resistance in the leads, uses a separated 2.5V, and I was even considering opto-isolation. You can get the zero down to two digit numbers, but it's not easy!

*At home*
Right now, flooring is going down in the shop, and other building operations are happening at the house. I want to get this stuff out of the way, so I can play xrf and machines again. One good thing I have discovered about the outhouse shop is that the insulation is pretty good. I did, of course, use double-glazed windows, but it does have two large view windows. Yesterday afternoon, temperature was about 4C (about 39°F). I turned on a blower-fan heater for about 15-20  minutes, bringing the temperature up to about 11C ( about 52°F), which was OK. Then, with no further heating, I worked in there for about 2 hours, and it still showed temperature holding above 9C. I can't think my "working" would have had much contribution 

The picture is from some days ago. I now have more than 3/4 floor area of the oak engineered flooring down. There will always be woodwork, but the planer-thicknesser-jointer will eventually be moved back to the garage. That spot is prime lathe space!


----------



## homebrewed

You're going to have a very nice shop there!  It looks like it should be a pleasure to use.

I have thought that a simple charge pump might be suitable for a bias generator.  The bias current should be very low on average so the CP wouldn't need to run very fast, nor would it need substantial capacitors in the multiplier portion of the circuit.

I designed an ionization type radiation detector that uses a charge pump to sweep radiation-created ions out of a collection tube, but haven't built it yet.  It is designed to generate 50V from a 10V power supply bus.  Simple thing really, just the bias generator plus a TIA and the mechanical bit, a tube with an electrode down the middle.  I've been thinking it could be used to characterize my AM241 sources, making it possible to get an approximate number for things like count rate -- in turn useful as a sanity check for a functioning XRF system.


----------



## homebrewed

I finally am able to capture and plot pulses coming out of my analog front end.  It turns out that the pulse acquisition process is more complex than I originally thought.  Fortunately, having a fairly deep circular buffer makes it possible to "look back in time" once the the pulse amplitude exceeds a set trigger level.  That was one of the problems, I wan't going far enough back to process/display the entire pulse.  Right now I'm going back a fixed amount, but that can easily be refined.  The Teensy4.0 is fast enough to do a lot of processing before there's any danger of overwriting the pulse data.  

Another thing I initially neglected to consider is that the magntude of the RMS error between the fitted curve and data depends on the amplitude of the pulse, so I now am normalizing that value by dividing it by the (fitted) peak voltage.  Something difficult to do in the analog world!

Anyway, here's a screen shot showing a pulse.  I set the trigger level to 400mV and am going back in time by 20 sample intervals.  I'm using the Arduino Serial plotter tool for this.


----------



## rwm

First pulse!


----------



## homebrewed

rwm said:


> First pulse!


Yup.  Now I'm starting to think about the MCA portion.


----------



## graham-xrf

rwm said:


> First pulse!


Yep - isn't that just GREAT!!


----------



## graham-xrf

Is the "straight line" part simply that the ring buffer length ran out shortly after the peak? No matter, so long as we get the peak!


----------



## WobblyHand

Now things are getting very interesting!


----------



## homebrewed

graham-xrf said:


> Is the "straight line" part simply that the ring buffer length ran out shortly after the peak? No matter, so long as we get the peak!


I don't think so, the circular buffer is 512 values deep.  At 360KSPS that's 1422 samples.  microseconds  But that falling edge doesn't look very much like exponential decay, does it.  Since I want to use the pulse area to get the best possible noise rejection the pulse shape DOES need to conform to reality.

I'll have to look more closely at the code to see if there's something wrong with it.  It wouldn't be the first time!

Edit:  changed the circular buffer depth to microseconds.  Clearly a buffer that's 512 long can't be 1422 samples deep at the same time!


----------



## WobblyHand

homebrewed said:


> But that falling edge doesn't look very much like exponential decay, does it.


No it doesn't.  Something isn't right.  It's like some signal is missing, or some samples got rejected.


----------



## homebrewed

Some steps forward, some back.  I "improved" a number of things and the plotted pulses subsequently looked like hell.  One issue I found was that I was double-incrementing the index into my pulse buffer -- the index is the "i" variable in a for(i=0; i < something; i++) {} loop and then I did something dumb like this inside the loop :  pulse_buffer[i++] = some-value.  The result of skipping every other entry was intermixing old and new data.  Not a good way to preserve the shape of a pulse.....

The other problem, possibly causing that falling-edge issue, is that I have been incorrectly using the trigger-level value to establish the limits of the pulse.  Clearly, a pulse that significantly exceeds the trigger level has a "life" before and after that.  Well, more bug-smashing is in the works.

Getting late tonight.  I'll attack it some more tomorrow.


----------



## homebrewed

BTW thanks to @graham-xrf  and @WobblyHand for vetting my results.  Different eyes see different things, all good!


----------



## homebrewed

This one really drove me up the wall.  I tried all kinds of different approaches and nothing produced any decent-looking pulses, even though my pulse qualification code was saying things were looking good.  I started getting suspicious about the serial plotter tool in the Arduino IDE and it turns out that there were two problems happening.  The first is that I was trying to dump lots of data in a tight loop into a fairly small serial buffer.  It naturally overflowed.  The second is that all evidence suggests the serial plotting code isn't particularly fast, so trying to plot data at something faster than 9600 baud causes it to misbehave.

After addressing those issues I'm seeing much more reasonable-looking pulses.  Not all the time so there may still be something going on with either my code or that pesky serial monitor.  I'm inclined to dump it for something better.

Anyway, here's a reasonable looking pulse captured by my current S/W:



I can't plot the entire pulse due to limitations with the serial plotter.  If you look at the x axis you see it's showing just a few over 40 samples.  Not sure what's going on there --  documentation for the serial plotter is just about nonexistent so I don't know if it is possible to change the horizontal resolution or not.  The plot window is completely filling the screen so I can't get any better than that.  At this point anyway.


----------



## WobblyHand

GitHub - taunoe/tauno-serial-plotter: Serial Plotter for Arduino and other embedded devices.
					

Serial Plotter for Arduino and other embedded devices. - GitHub - taunoe/tauno-serial-plotter: Serial Plotter for Arduino and other embedded devices.




					github.com
				



Don't know if this is useful or not, but it seems to be a python based plotter for this sort of use.  Should run on linux, macs & windows.  I have had to do something similar because the built in serial plotter is very limited and not well documented.  Seem to remember a buffer length of 500 or something weird like that.  I had 1K FFT's I wanted to look at!


----------



## homebrewed

WobblyHand said:


> GitHub - taunoe/tauno-serial-plotter: Serial Plotter for Arduino and other embedded devices.
> 
> 
> Serial Plotter for Arduino and other embedded devices. - GitHub - taunoe/tauno-serial-plotter: Serial Plotter for Arduino and other embedded devices.
> 
> 
> 
> 
> github.com
> 
> 
> 
> 
> Don't know if this is useful or not, but it seems to be a python based plotter for this sort of use.  Should run on linux, macs & windows.  I have had to do something similar because the built in serial plotter is very limited and not well documented.  Seem to remember a buffer length of 500 or something weird like that.  I had 1K FFT's I wanted to look at!


I found that one too.  I may take a closer look at it, but I also just bought a little standalone TFT display from Adafruit that has decent resolution, a reasonable price and only needs an SPI interface.  And there's a library available for it.  

One way or the other, I will get to the root of this current problem... if it's real.  I'm not convinced it is, but it will be nice to have another way to troubleshoot complex data acquisition/processing problems.


----------



## graham-xrf

While Python code _can_ be persuaded to play nice, it takes some skill to make it so, especially when it comes to loops in code with other loop conditionals. Avoid in favour of Java, or C++  if possible. I do not say this as a expert in programming, because, despite that I have at some stage meddled with  most computing languages and platforms starting with 6502 hex code, through FORTRAN, Pascal, C, C++, etc. ending up with Python and Java, that is my weak area. I tended to suck at all of them!

This was advice from my son, who definitely _is_  programming professional, with a math Masters from Exeter. He wrote an entire satellite system data management and tracking control suite that runs 24/7 in dozens of places on the planet. He points out the difficulties with Python, and why It takes deep experience to avoid Python code running slow, and with a variable loop execution time.

In Raspberry Pi, various Python tools  and development environments are useful as a fast way to get up a final application, and publish code other experimenters can just load up and use, and Python can, if done right, be very powerful, but I have had trouble making it so. I have an old A/D converter Pi "hat" add-on that was supposed to control a signal generator chip to make a sweep signal analyzer. The Python code ran so slow it was simply dysfunctional. Admittedly, the originator should not have used loops within loops the way he did, but it took my son only minutes to get up (Java) code that was running at several MHz!

Python is handy as controller that relies on calling up much faster, better code which handles critical areas. PyMCA will be OK, because it analyzes and presents the plots as a separate, post-processing action working on files already assembled by the data gathering code. It is not part of a time-critical thing, and does not snatch execution time from real-time sampling processes in a way that makes the high priority loop execution time variable.

When we attempt to be snatching data on a continuous basis, it is important that the timing loop be constant, and have a portion that departs to execute little pieces of slow stuff like a plot display someone is looking at, or mouse input someone is doing. We won't notice it, because the loop completes in something less than 5mS. This is not something that interpreter languages like Python or BASIC are good for. That is not to say don't use ithem They are great for fast, easy development of the user interface. Just don't let them be in the way of critical timing data logging code.

The approach of letting the sampling and stashing functions interrupt the display plotting code should work just fine.
What Mark is attempting is extremely challenging, and I am in awe of it!
*
Why is Python so Slow?*





*Why People Use Python Even If It’s Slow*


----------



## WobblyHand

graham-xrf said:


> While Python code _can_ be persuaded to play nice, it takes some skill to make it so, especially when it comes to loops in code with other loop conditionals. Avoid in favour of Java, or C++  if possible. I do not say this as a expert in programming, because, despite that I have at some stage meddled with  most computing languages and platforms starting with 6502 hex code, through FORTRAN, Pascal, C, C++, etc. ending up with Python and Java, that is my weak area. I tended to suck at all of them!
> 
> This was advice from my son, who definitely _is_  programming professional, with a math Masters from Exeter. He wrote an entire satellite system data management and tracking control suite that runs 24/7 in dozens of places on the planet. He points out the difficulties with Python, and why It takes deep experience to avoid Python code running slow, and with a variable loop execution time.
> 
> In Raspberry Pi, various Python tools  and development environments are useful as a fast way to get up a final application, and publish code other experimenters can just load up and use, and Python can, if done right, be very powerful, but I have had trouble making it so. I have an old A/D converter Pi "hat" add-on that was supposed to control a signal generator chip to make a sweep signal analyzer. The Python code ran so slow it was simply dysfunctional. Admittedly, the originator should not have used loops within loops the way he did, but it took my son only minutes to get up (Java) code that was running at several MHz!
> 
> Python is handy as controller that relies on calling up much faster, better code which handles critical areas. PyMCA will be OK, because it analyzes and presents the plots as a separate, post-processing action working on files already assembled by the data gathering code. It is not part of a time-critical thing, and does not snatch execution time from real-time sampling processes in a way that makes the high priority loop execution time variable.
> 
> When we attempt to be snatching data on a continuous basis, it is important that the timing loop be constant, and have a portion that departs to execute little pieces of slow stuff like a plot display someone is looking at, or mouse input someone is doing. We won't notice it, because the loop completes in something less than 5mS. This is not something that interpreter languages like Python or BASIC are good for. That is not to say don't use ithem They are great for fast, easy development of the user interface. Just don't let them be in the way of critical timing data logging code.
> 
> The approach of letting the sampling and stashing functions interrupt the display plotting code should work just fine.
> What Mark is attempting is extremely challenging, and I am in awe of it!
> 
> *Why is Python so Slow?*
> 
> 
> 
> 
> 
> *Why People Use Python Even If It’s Slow*


I think it's a bit of misinformation to state that python is always slow.  If you use the numpy and scipy libraries it isn't.  It's at least as fast as Matlab.  Both those libraries are vectorized and have been optimized in C++.  So like Matlab you can do element by element multiplication or matrix math of any sort, including SVD and stuff like that.  (Singular Value Decomposition)

I ran full up radar simulations with loads of physics models in Python/numpy/scipy in my job.  Dozens of moving targets and calculating statistics on the quality of the results.  Using numba you can have computation on GPU's.  What's in python's favor is it's ease of development.  I'm at least 5-10x more productive using python than C.  Of course it's not for real time processing.  I've often prototyped algorithms in Python to validate they work and ported them to lower level languages.  Prototyped a client server system that way in a single day to get it to work.  I had never done any network programming before. (Both client side and server on two different computers.)  Then ported to C++ the second day, without knowing C++.  The object oriented design of both languages was so similar that even my dense self could pull it off.  Had to use C++ on the server so I could take advantage of OpenMP.  Was running 52 cores in parallel, 48 of which were running FFTW.  This was before the days of GPU's.

You can get pretty far with python before throwing in the towel.  That's if you use the optimized libraries.  At least that's my experience.

All that being said, I've only used C and C++ on a Teensy.  It's pretty darn capable for it's size and power.  I'm using one in my own ELS.  Wrote the code from first principles and it's seriously one of the nicest additions to my lathe.  I hated changing gears on my lathe since often little pieces would go flying to parts unknown and handling the gears was always messy.  Now that mess and inconvenience is in the past.  Highly recommend going with an ELS system of any sort.


----------



## graham-xrf

WobblyHand said:


> I think it's a bit of misinformation to state that python is always slow.  If you use the numpy and scipy libraries it isn't.  It's at least as fast as Matlab.  Both those libraries are vectorized and have been optimized in C++.  So like Matlab you can do element by element multiplication or matrix math of any sort, including SVD and stuff like that.  (Singular Value Decomposition)


Indeed, and I agree. It's just that, at least at the fairly humble level I dabble in, the examples of Python code, downloaded, and supposed to work projects one might be making, have suffered from slowness. It was always from poor programming. In my very first sentence, I said that Python _can_ be good, and using libraries that have fast implementations of functions is the skill I was alluding to.

I thought I chose the words carefully, but it seems I should have tried harder. When it came to getting really good programming, it would not be from me. I would get in professionals who could manage high accuracy servo control code good to about 280 milli-arc seconds, at an exact celestial time, with computer clocks using local time servers synced to NIST, and we could rely on a interrupt response within 300uS.

I definitely did not intend the observation to be seen as "disinformation", and I am sorry you thought it so.


----------



## homebrewed

I have some experience with Python as well.  I used it as the data acquisition/plotting side of a home-made spectrometer.  It drew heavily on functions available in numpy, pylab (the latter for plotting the spectrum) and a machine vision library.  The latter can acquire image frames from a web cam, extract individual video lines and process them.  I can (and do) average the pixel data over several frames to improve the SNR.   That's the stuff I used to actually grab the spectral lines so the physical spectrometer itself is very simple -- an aperture, a diffraction grating and a webcam.

Using it I can generate spectra like this:



This is the spectrum from a CFL.  The peaks are very characteristic so that's what I used to calibrate the system.  The webcam I used for this plot has a built-in IR filter, which limits its performance -- basically there's nothing down in the near IR region.  I have since gotten a "night vision" webcam that has no IR filter but haven't had an opportunity to try it yet.

Going back to the XRF stuff, I wasn't counting on finding or writing code for a realtime serial plotter.  The serial interface itself isn't fast enough -- even at 115200 baud the circular buffer wraps around & trashes the pulse data before it can all be sent to the host.

Anyway, I have sort of bypassed the serial plotter.  I bought a little TFT display from Adafruit that should be fairly easy to use (so he sez blithely).  They have an Arduino library to make it easier to get it up & running so hopefully most of the harder bits are already done.

Another approach would be to use a PWM output as a slow DAC, then view the reconstructed pulse on my 'scope.  That would be VERY non-realtime!  If I had a Teensy 4.1 I'd have enough digital pins to roll my own DAC using an R/2R ladder but that's not in the cards right now.


----------



## homebrewed

One point I neglected to mention is that the limitation of the serial interface really only is significant when trying to debug my code.  My plan all along has been to use the Teensy as a pre-processor to send just the relevant pulse information, which would just be 3 values:  the goodness of fit, peak voltage and pulse area.  This would be on a per-qualified-pulse basis.


----------



## WobblyHand

homebrewed said:


> Anyway, I have sort of bypassed the serial plotter. I bought a little TFT display from Adafruit that should be fairly easy to use (so he sez blithely). They have an Arduino library to make it easier to get it up & running so hopefully most of the harder bits are already done.


Ooh, falling into the rabbit hole I see.  That's what I used for my doppler chronograph using a $3 eBay X-band door opener module.  I used the display to plot FFT's in dB's.  (Linear scale is useless for radar work.)  The chronograph would only display upon a detection, which helped with the update rate.  The 1K FFT's and detection process ran continuously.  I used DMA for the ADC and a pair of ping pong buffers.  While one buffer was filling, the other one was the data source for the FFT and detection.  Had to time everything so there were no overruns.  Was a great bit of fun to do!  On a Feather M4, SPI display interface, and the Adafruit libraries, I could do about 6 Hz update rate.  Adafruit limits SPI to 24MHz, but the displays can take data about twice as fast.  PJRC allows you to set the SPI rate faster.  The sample rate was 60 KHz, an FFT and OSCFAR detection and a parabolic estimator was done every 17.05ms continuously.  The trickiest bit was the noise estimator, I used a rolling median filter of length 17 to quiet things down to a tolerable level.  Length 21 would blow the timing budget, and 19 wasn't much better performance wise than 17.

There was as much code for the FFT display as for everything else...  It's not terribly hard, but there's plenty of stuff to do...  For my ELS it has been 2X the code for the display and human interface.  It's quite rewarding when the displays are up and running correctly, never mind the application.


----------



## rabler

LOL, just started debugging my 20x4 character LCD output this morning on my version 1 (aka prototype) board.  Just used one of the common port I2C expanders (MCP23008) and typical schematics so it should be compatible with most of the LCD "shield" libraries, but, still at the get it working stage.  I used a second MCP23008 as an I/O expander for buttons and LEDs.  2nd dedicated I2C channel for an A/D converter.

I'm looking at using the wifi interface on some of the newer gumstick modules  to get higher output speeds and data logging post FFT.


----------



## WobblyHand

rabler said:


> LOL, just started debugging my 20x4 character LCD output this morning on my version 1 (aka prototype) board.  Just used one of the common port I2C expanders (MCP23008) and typical schematics so it should be compatible with most of the LCD "shield" libraries, but, still at the get it working stage.  I used a second MCP23008 as an I/O expander for buttons and LEDs.  2nd dedicated I2C channel for an A/D converter.
> 
> I'm looking at using the wifi interface on some of the newer gumstick modules  to get higher output speeds and data logging post FFT.


After suffering with those sorts of displays, I have given up on them.  They work, but convey limited information.  If it works for your application, then great.

I went with small pixel addressable 320x240 TFT touch displays for my little chronograph and for my ELS.  The interfaces and the info you can display are a lot nicer, but naturally take a bit more work.  I think the work is worth it, having done it twice.  What's nice after having done it once, you have learned the hard part of doing display work.  The second time around, I spent more time designing menus and storyboards, because implementing them had become much easier.  Reused some of my old chrony display code to speed up the development of the ELS graphics.  Most of the work is just text stuff and locating stuff on the screen and optionally doing processing on soft buttons.  Occasionally you can go wild and insert pictures and stuff like that.  I somewhat gave up on pictures simply because they became a distraction and I was running out of screen real estate.  Designing clear interfaces with a lot of information is an art, especially on small displays.  Really focuses you on the essentials.


----------



## rabler

WobblyHand said:


> After suffering with those sorts of displays, I have given up on them.  They work, but convey limited information.  If it works for your application, then great.
> 
> I went with small pixel addressable 320x240 TFT touch displays for my little chronograph and for my ELS.  The interfaces and the info you can display are a lot nicer, but naturally take a bit more work.  I think the work is worth it, having done it twice.  What's nice after having done it once, you have learned the hard part of doing display work.  The second time around, I spent more time designing menus and storyboards, because implementing them had become much easier.  Reused some of my old chrony display code to speed up the development of the ELS graphics.  Most of the work is just text stuff and locating stuff on the screen and optionally doing processing on soft buttons.  Occasionally you can go wild and insert pictures and stuff like that.  I somewhat gave up on pictures simply because they became a distraction and I was running out of screen real estate.  Designing clear interfaces with a lot of information is an art, especially on small displays.  Really focuses you on the essentials.


Already have the v1.0 boards fabbed for a character LCD display although I'm targetting the 20x4 display instead of the more common 16x2.  Looked at TFT graphics but just stuck with the character display and a rotary encoder for entering numbers/adjusting values.  Admittedly clunky, especially the interface.  The majority of the TFT displays I saw end up with fairly small characters.  Obviously more $$ buys bigger.  But I'm not fond of squinting, reminds me that I'm aging.

Ironically I'm in coding mindset, so typing here on HM is painful, I keep resorting to VI editor keystrokes for error correction.


----------



## WobblyHand

rabler said:


> The majority of the TFT displays I saw end up with fairly small characters.


The font size is programmable, so are the fonts.  Making a readable display on a small screen does have it's challenges.  

FWIW, the screen I am using is $18 in unit quantities.  320x240 3.2" across the diagonal.  Good enough for an ELS with DRO.  I can display or select 25 threads on a page without scrolling.  That's good enough for me.  Bonus is the touchscreen, I just press the thread I want, the display shows what I selected and geek parameters (for me ) and I press the enter button.  If I don't quite have enough room for all those characters, I can cheat and use a narrower font!  You can have mixed larger and smaller fonts on the screen.   Easy as pie, or is that pi?

Can't help you with the squinting part, so update your vision prescription.  It will help your coding too!  It helps to be able to see what you are doing.


----------



## rabler

WobblyHand said:


> FWIW, the screen I am using is $18 in unit quantities. 320x240 3.2" across the diagonal.


That's the same size as the LCD display.  Hmm.  Link to the one you're using?

Readers work fine for coding.  I use a weaker lens in the safety glasses, most of the shop work is at a bit more distance.  But at 3.2" diagonal, not an issue.


----------



## WobblyHand

rabler said:


> That's the same size as the LCD display.  Hmm.  Link to the one you're using?


https://www.pjrc.com/store/display_ili9341_touch.html  Get the 3.2" one, it is $18.  The 2.8" one is $16.
HTH.


----------



## rabler

@WobblyHand, thanks, I ordered a couple for testing.


----------



## homebrewed

WobblyHand said:


> https://www.pjrc.com/store/display_ili9341_touch.html  Get the 3.2" one, it is $18.  The 2.8" one is $16.
> HTH.


That's much less than Adafruit's offering.  Next time, if I need another one for something I'll buy from PJRC.  I noticed that they currently have more T4.0 and T4.1's in stock.  I may spring for a 4.1, mostly for the additional GPIO's.

Awhile back I bought one of their LC controller boards.  I put it somewhere so "safe" that I can no longer find it!


----------



## WobblyHand

homebrewed said:


> That's much less than Adafruit's offering.  Next time, if I need another one for something I'll buy from PJRC.  I noticed that they currently have more T4.0 and T4.1's in stock.  I may spring for a 4.1, mostly for the additional GPIO's.
> 
> Awhile back I bought one of their LC controller boards.  I put it somewhere so "safe" that I can no longer find it!


Yes, it is.  It's resistive, but perfectly adequate for the job.  PJRC has some really nice libraries for the ILI9341, they can update the display pretty quickly.  I'm using the PJRC ILI9341 and a Teensy 4.1 in my ELS.  I'm glad I chose the 4.1, lots more IO, which is really good for beginning a project.

Speaking of displaying FFT data, I did this on a ILI9341 breakout board from Adafruit for my doppler chronograph.  FFT displayed in dB's. Lines on graph are every 10 dB.  Automatic detection of a tuning fork.  A = 440 Hz, converted to speed at X-band.  (10.250 GHz ISM band).  Display is only 320 pixels wide, but the 512 points are mapped to 320.  1K FFT sampled continuously at 60KHz (DMA), using ping pong buffers.  The FFT's never stop.  Get FFT results and detections every 17.05ms, (58.65 Hz) but results are only displayed if there is a target detection.  Using it to chronograph pellets. With the Adafruit libraries, I am limited to a 6 Hz screen update rate.  The PJRC libraries allow significantly higher data rates.  Another reason to use the PJRC display.  

 As you can see, I am trying to box it up.  Totally screwed up the USB connector location, and for that matter, the box wall thickness.  Don't have enough room for inserts without blowing out the walls.  Hey, I'm new to this 3d printing and design...


----------



## homebrewed

WobblyHand said:


> Yes, it is.  It's resistive, but perfectly adequate for the job.  PJRC has some really nice libraries for the ILI9341, they can update the display pretty quickly.  I'm using the PJRC ILI9341 and a Teensy 4.1 in my ELS.  I'm glad I chose the 4.1, lots more IO, which is really good for beginning a project.
> 
> Speaking of displaying FFT data, I did this on a ILI9341 breakout board from Adafruit for my doppler chronograph.  FFT displayed in dB's. Lines on graph are every 10 dB.  Automatic detection of a tuning fork.  A = 440 Hz, converted to speed at X-band.  (10.250 GHz ISM band).  Display is only 320 pixels wide, but the 512 points are mapped to 320.  1K FFT sampled continuously at 60KHz (DMA), using ping pong buffers.  The FFT's never stop.  Get FFT results and detections every 17.05ms, (58.65 Hz) but results are only displayed if there is a target detection.  Using it to chronograph pellets. With the Adafruit libraries, I am limited to a 6 Hz screen update rate.  The PJRC libraries allow significantly higher data rates.  Another reason to use the PJRC display.
> 
> As you can see, I am trying to box it up.  Totally screwed up the USB connector location, and for that matter, the box wall thickness.  Don't have enough room for inserts without blowing out the walls.  Hey, I'm new to this 3d printing and design...
> View attachment 429890


A tuning fork isn't a bad way to go if you don't have a good signal generator.  I recently bought a cheap DDS based sig gen that claims resolution down to the micro-hertz level.  I have a potential application that actually will benefit form that kind of resolution but for most folks it's overkill.

I read your thread describing your efforts to package your chronograph in a 3D printed enclosure.  Sounds like you're learning a lot there!


----------



## WobblyHand

homebrewed said:


> A tuning fork isn't a bad way to go if you don't have a good signal generator.  I recently bought a cheap DDS based sig gen that claims resolution down to the micro-hertz level.  I have a potential application that actually will benefit form that kind of resolution but for most folks it's overkill.
> 
> I read your thread describing your efforts to package your chronograph in a 3D printed enclosure.  Sounds like you're learning a lot there!


It's good enough to calibrate a police radar to give you a traffic ticket.  It's what the manufacturer uses, which is good enough for a judge!  This is X-band, I don't have any known good RF sources.  One could multiply up the DDS or phase lock it to get that, but it's not necessary for a calibration.  The fork is more than good enough.  If I used an external source I would have to phase lock it to the radar and then generate an offset signal say 10 KHz away.  This is a colossal PIA in a simple home lab.  I used to do it a work all the time, but I had access to 500K Microwave and MMW synthesizers.  

Been having fun doing the packaging!  Shorted out my main LDO regulator somehow.  Repaired it and got it running again.  Going at another spin of the case.  Relocated the holes, thickened some walls for the inserts, and hopefully got the USB port located a little better.  Will be printing Rev3 tonight and tomorrow.  With any luck it will be a lot closer, and maybe good enough.


----------



## homebrewed

Are you holding a vibrating tuning fork in front of the module?  If so I dispute the velocity detection as being definitive.  If the position of a tuning fork tine is equal to A * sin(2*pi*r440*t) then velocity is equal to A * 2*pi*440 * cos(2*pi*440*t), the derivative of position WRT/time.  Doppler shift isn't going to work out very well for that, particularly since A is an exponentially decreasing function == continuously changing velocity.  Then there is the continuously changing velocity due to the cos() term.

I also note that the free air wavelength of a 10GHz signal in cm is equal to 3e10/10e9 = .3 e1 = 3cm so the sub-mm vibration of even a hard-struck tuning fork wouldn't seem to be enough to produce much of a phase shift in the transmitted vs. received signal, if THAT is what's going on.  But maybe it IS enough??? I admit to being confused about what really is being detected here. I suspect the relationship is more ad-hoc rather than having a strong theoretical basis: and if I was a lawyer with some technical background might be able to throw some sand in the works.

How is that tuning fork being used?  When you mentioned it I thought you were injecting the tuning fork's signal via a microphone but that doesn't seem to be the case.


----------



## WobblyHand

homebrewed said:


> Are you holding a vibrating tuning fork in front of the module?  If so I dispute the velocity detection as being definitive.  If the position of a tuning fork tine is equal to A * sin(2*pi*r440*t) then velocity is equal to A * 2*pi*440 * cos(2*pi*440*t), the derivative of position WRT/time.  Doppler shift isn't going to work out very well for that, particularly since A is an exponentially decreasing function == continuously changing velocity.  Then there is the continuously changing velocity due to the cos() term.
> 
> I also note that the free air wavelength of a 10GHz signal in cm is equal to 3e10/10e9 = .3 e1 = 3cm so the sub-mm vibration of even a hard-struck tuning fork wouldn't seem to be enough to produce much of a phase shift in the transmitted vs. received signal, if THAT is what's going on.  But maybe it IS enough??? I admit to being confused about what really is being detected here. I suspect the relationship is more ad-hoc rather than having a strong theoretical basis: and if I was a lawyer with some technical background might be able to throw some sand in the works.
> 
> How is that tuning fork being used?  When you mentioned it I thought you were injecting the tuning fork's signal via a microphone but that doesn't seem to be the case.


No microphone what so ever.  The tuning fork causes the reflected phase of the RF signal to be shifted by the movement of the tine towards or away from the radar.  The rate of change of the phase d phi / dt is the frequency (velocity) by definition.  Say there's a movement of 0.1mm, that is a phase shift of 0.1/30 * 360 degrees = 1.2 degrees.  440 Hz corresponds to dt = 0.0023 seconds.  So dphi/dt = 1.2/0.0023 = 521 Hz, which is a pretty big quantifiable number.  If you recall, the doppler frequency is given by fd = -2 * vr / lambda.  For fc = 10 GHz, there are 66.7 Hz per meter/sec of velocity.  So for this rough example, the velocity would be 521 Hz/ ( 66.7 Hz / m/sec) = 7.8 m/sec, or about 25.6 feet per second.

You might want to reconsider that court challenge.   The tuning fork creates a doppler return which is accurately measured by the radar set.  It is fortuitous that such a simple instrument can be used to calibrate a complicated system.  A lot cheaper than a synthesizer!

Radars are very good at detecting vibrating objects, IF the vibration is relative to the radar.  If the relative velocity is zero, ie perpendicular to the radar, then there is no doppler.  Then we use ranging 

There are some radar chronographs that use microphones to start the FFT.  I didn't want that, because they can be falsely started.

Probably be good to wander back to your original content...  Don't want this thread to wander too far!


----------



## homebrewed

Yeah I agree, time to get back to shooting x-rays at stuff .


----------



## graham-xrf

*Analog = Linear Technology = Maxim*
It seems that Analog has "integrated" maximintegrated.com.

Aside from that now, there is Analog, and not very much else when it comes to analog stuff, one wonders if this means we soon get LTSpice models for Maxim parts?


----------



## WobblyHand

graham-xrf said:


> *Analog = Linear Technology = Maxim*
> It seems that Analog has "integrated" maximintegrated.com.
> 
> Aside from that now, there is Analog, and not very much else when it comes to analog stuff, one wonders if this means we soon get LTSpice models for Maxim parts?


I hope so.  LTSpice is a pretty good simulator.  Designed and simulated a 7 pole Chebychev filter with it and it got me really close.  Only thing that was way off were the bias currents.  Some detective lab work fixed that.


----------



## homebrewed

graham-xrf said:


> *Analog = Linear Technology = Maxim*
> It seems that Analog has "integrated" maximintegrated.com.
> 
> Aside from that now, there is Analog, and not very much else when it comes to analog stuff, one wonders if this means we soon get LTSpice models for Maxim parts?


Most, if not all, analog IC design/manufacturing companies have SPICE models available for their parts.  I've used TI-provided models in LTSpice. 

And yes, I would expect Maxim parts to start appearing in the LTSpice parts library.  Probably none of the ones I did failure analysis on but you never know.


----------



## homebrewed

I found my Teensy LC board the other day.  I was reviewing its specifications and noticed that its built-in ADC is a 16-bitter, although PJRC indicates that the noise level reduces the effective resolution to 13 bits.  I think some averaging would improve that.  I didn't get deep enough into the MCU datasheet to see what kind of sample rate it can support at 13 bits, but I suspect it won't be near as fast as the Teensy 4.0/4.1, which max out at about 360KSPS for 10 bit resolution.  They will go faster than that but the ENOB goes down.

The reason I bring this up is that the LC might work OK in an XRF system that uses a more classic (analog) peak-hold circuit, much like the circuit we discussed earlier in this now-gargantuan thread.  I posted a circuit analysis of the analog portion, if that helps jog the memory.  The circuit used a one-shot and the Arduino was used to reset the peak-hold circuit.

It would have some obvious limitations when using a relatively noisy Xray detector front end like the 100mm^2 silicon PIN used in the pocketgeiger, but if someone wants to go with something like a PMT + scintillator it might work pretty well.

On a different subject, my 320x240 TFT display arrived a couple days ago, and I've been occupied making an enclosure for it -- I think it could be helpful for debugging other projects that use an Arduino so I'm spending some time packaging it up.  A little.  I don't have a 3D printer yet so I'm taking a minimal approach.  I'll post some photos once I get it buttoned up.

One thing I ran into with the display board is that its dimensional information on the Adafruit web site is incorrect.  The mounting holes' X and Y dimensions are substantially off, at least compared to what I got -- so beware!  I only discovered the problem after I had already drilled and countersunk a mounting plate for it.  In some ways that wasn't all bad because I re-thought the approach I was taking and think I now have something better.


----------



## WobblyHand

homebrewed said:


> One thing I ran into with the display board is that its dimensional information on the Adafruit web site is incorrect.


No surprise to me.  I make my drawings based on their specs to make a CAD model.  Then I spot check key values using digital calipers to see if I got everything right.  That's when I find things not quite as expected.  Now I check all important dimensions, to verify their drawings.  The drawings are not complete mechanically, for instance on their Feathers there is no location data for the USB connector, nor height information.  Took me three prints to get the through hole in the printed housing to line up properly.


----------



## rabler

homebrewed said:


> One thing I ran into with the display board is that its dimensional information on the Adafruit web site is incorrect. The mounting holes' X and Y dimensions are substantially off, at least compared to what I got -- so beware!


Which tft display?  I ended ordering one from them so that is a helpful heads up so I don’t fab another pcb based on the prints.


----------



## graham-xrf

homebrewed said:


> I found my Teensy LC board the other day.  I was reviewing its specifications and noticed that its built-in ADC is a 16-bitter, although PJRC indicates that the noise level reduces the effective resolution to 13 bits.  I think some averaging would improve that.  I didn't get deep enough into the MCU datasheet to see what kind of sample rate it can support at 13 bits, but I suspect it won't be near as fast as the Teensy 4.0/4.1, which max out at about 360KSPS for 10 bit resolution.  They will go faster than that but the ENOB goes down.
> 
> The reason I bring this up is that the LC might work OK in an XRF system that uses a more classic (analog) peak-hold circuit, much like the circuit we discussed earlier in this now-gargantuan thread.  I posted a circuit analysis of the analog portion, if that helps jog the memory.  The circuit used a one-shot and the Arduino was used to reset the peak-hold circuit.
> 
> It would have some obvious limitations when using a relatively noisy Xray detector front end like the 100mm^2 silicon PIN used in the pocketgeiger, but if someone wants to go with something like a PMT + scintillator it might work pretty well.


*Can we use a peak-hold detector?*
I believe the answer is yes, and it might even manage to be quite good at it!
There is sufficient correlation between the pulse peak value as snatched by a peak-hold analog detector, and the true integrated energy indirectly, (but proportionally), represented in the pulse area, to make it useful. I considered this, and there is a fast peak-hold circuit I had thought to include, but have it remain unpopulated. (Also, I happen to have a purchased ex-Ukraine PMT and scintillator stashed in the "hopefuls" box).

*Why I aimed for high speed sampling*
I imagined there could be all sorts of shot noise, double-pulse arrivals, lower level but overlong duration pulses, and other unknowns where the only analysis choice would be..
a) Just believe the peak detector saw a good pulse most times.
b) Get up to some filtering decision in software to simply reject the very obvious wrong ones.
c) Use an additional criterion that a single pulse happened, discovered by analog window comparator, within a credible duration range.

So yes- the possibility is there, but I hoped for a better "pulse recognition". Your curve-fit correlation does that. So does integrating by adding up constant width samples, although even that may still have to pass a "recognition test". What I see is that even if one gets a spectacularly well captured and measured pulse, it's shape might look like a dog's hind leg, and need to be recognized for rejection. I thought there might be some simple few criteria a "good" pulse might have to get a "pass". Perhaps fit under a crude profile?

*Valid element peaks in a waveform?*
Quite early on, I saw a smoothed plot of bucket counts that had some definite single peaks, but on the slopes of the peaks were sampled counts making lower value peaks that suggested other elements in there. So what makes all those false counts happen in the spaces in between them? How we get identification from that I just don't know. Ideally, there would not be "counts" of noise or unwanted stuff of non-elements in buckets between good accumulations.

Improving the resolution by getting extreme with the noise figure, and having as few unworkable bits jangling around in the ADC as possible is what I thought it needed. That stuff is quite hard to do, even if the ADC is not sharing a chip package with a computer and has it's own ultra-low noise supplies, and does not share current return paths.

*Invalid bits?*
We know that at the lowest level, there is the inherent threshold uncertainty that would flip the LSB least significant bit. That is perhaps why we can have "guaranteed 16-bits", meaning that internally, there are actually 17 bits. Alternatively, that last bit uncertainty is accepted because a count of 1, or 2, in a 16-bit counter is still around -90dB or -91dB down.

A Teensy ADC having 13 "reliable" bits from a 16-bit ADC means the smallest valid change to give a new number one will accept is 1 part in 8192. Three bits worth jangling around is 256 counts  out of 65536.

*What can we expect?*
I truly ran out of reasonable guesses here. When I tried the AD7622 in an admitted short-lived lash-up, I could, at times, get counts below 80 from a short-circuited input. I expect I could get the noise count down lower than that. I wanted the ADC to have it's claimed 91dB SINAD, which is a couple of counts. I take a guess that the lowest counts I might manage will be more than that, but perhaps not 3 bits worth

The racket from the photodiode should be of this order. Also, the TIA should be able to see to the noise floor.
 Given  the difficulties of getting hold of a Raspberry Pi Zero-2W, and the now higher price (£50) of a separate AD7622 ADC , maybe we just have simple connection interface to put a Teensy 4.1 on the board. The idea is to have it use our own low-noise LTC6268 plus JFET TIA  and the 50/60Hz rejection filter, with the Teensy on the end of it?


----------



## homebrewed

rabler said:


> Which tft display?  I ended ordering one from them so that is a helpful heads up so I don’t fab another pcb based on the prints.


I got the 320x240 TFT display from Adafruit.


----------



## rabler

homebrewed said:


> I got the 320x240 TFT display from Adafruit.


I was curious as to which physical size, as Adafruit has several with different mounting form factors/dimensions.


----------



## homebrewed

graham-xrf said:


> *Can we use a peak-hold detector?*
> I believe the answer is yes, and it might even manage to be quite good at it!
> There is sufficient correlation between the pulse peak value as snatched by a peak-hold analog detector, and the true integrated energy indirectly, (but proportionally), represented in the pulse area, to make it useful. I considered this, and there is a fast peak-hold circuit I had thought to include, but have it remain unpopulated. (Also, I happen to have a purchased ex-Ukraine PMT and scintillator stashed in the "hopefuls" box).
> 
> *Why I aimed for high speed sampling*
> I imagined there could be all sorts of shot noise, double-pulse arrivals, lower level but overlong duration pulses, and other unknowns where the only analysis choice would be..
> a) Just believe the peak detector saw a good pulse most times.
> b) Get up to some filtering decision in software to simply reject the very obvious wrong ones.
> c) Use an additional criterion that a single pulse happened, discovered by analog window comparator, within a credible duration range.
> 
> So yes- the possibility is there, but I hoped for a better "pulse recognition". Your curve-fit correlation does that. So does integrating by adding up constant width samples, although even that may still have to pass a "recognition test". What I see is that even if one gets a spectacularly well captured and measured pulse, it's shape might look like a dog's hind leg, and need to be recognized for rejection. I thought there might be some simple few criteria a "good" pulse might have to get a "pass". Perhaps fit under a crude profile?
> 
> *Valid element peaks in a waveform?*
> Quite early on, I saw a smoothed plot of bucket counts that had some definite single peaks, but on the slopes of the peaks were sampled counts making lower value peaks that suggested other elements in there. So what makes all those false counts happen in the spaces in between them? How we get identification from that I just don't know. Ideally, there would not be "counts" of noise or unwanted stuff of non-elements in buckets between good accumulations.
> 
> Improving the resolution by getting extreme with the noise figure, and having as few unworkable bits jangling around in the ADC as possible is what I thought it needed. That stuff is quite hard to do, even if the ADC is not sharing a chip package with a computer and has it's own ultra-low noise supplies, and does not share current return paths.
> 
> *Invalid bits?*
> We know that at the lowest level, there is the inherent threshold uncertainty that would flip the LSB least significant bit. That is perhaps why we can have "guaranteed 16-bits", meaning that internally, there are actually 17 bits. Alternatively, that last bit uncertainty is accepted because a count of 1, or 2, in a 16-bit counter is still around -90dB or -91dB down.
> 
> A Teensy ADC having 13 "reliable" bits from a 16-bit ADC means the smallest valid change to give a new number one will accept is 1 part in 8192. Three bits worth jangling around is 256 counts  out of 65536.
> 
> *What can we expect?*
> I truly ran out of reasonable guesses here. When I tried the AD7622 in an admitted short-lived lash-up, I could, at times, get counts below 80 from a short-circuited input. I expect I could get the noise count down lower than that. I wanted the ADC to have it's claimed 91dB SINAD, which is a couple of counts. I take a guess that the lowest counts I might manage will be more than that, but perhaps not 3 bits worth
> 
> The racket from the photodiode should be of this order. Also, the TIA should be able to see to the noise floor.
> Given  the difficulties of getting hold of a Raspberry Pi Zero-2W, and the now higher price (£50) of a separate AD7622 ADC , maybe we just have simple connection interface to put a Teensy 4.1 on the board. The idea is to have it use our own low-noise LTC6268 plus JFET TIA  and the 50/60Hz rejection filter, with the Teensy on the end of it?


My thoughts regarding going to the digital domain for the heavy lifting are based on several things.  The first is that it's the approach taken by the Theremino crowd, with their claim that they are achieving very good energy resolution as a result.  The second is that it's much easier to experiment with different pulse analysis approaches when the information is in digital form.  However, this does require a good ADC so it's not a freebie in terms of being "easy" to go that direction.  As you have discovered.

As soon as I saw the noise level coming out of the analog portion of my pocket geiger I realized that addressing the noise, one way or the other, was going to be key to making this thing work for us.  Both the curve fitting and pulse integration functions improve the SNR, and doing something similar in the analog realm would be much more difficult, if not just plain impractical.


----------



## homebrewed

rabler said:


> I was curious as to which physical size, as Adafruit has several with different mounting form factors/dimensions.


It is this one.  The bottom of the first page of their tutorial shows the board dimensions:  but as I said earlier they don't quite match what I actually got.

At this point I have no plans to use the touch screen function.


----------



## graham-xrf

Teensy 4.1 is apparently £34.99 ($42.47) from Amazon.co.uk.
Is Adafruit the place to be getting these?
The "out of stock notice" looks similar to when searching for Raspberry Pi(s)


----------



## homebrewed

graham-xrf said:


> Teensy 4.1 is apparently £34.99 ($42.47) from Amazon.co.uk.
> Is Adafruit the place to be getting these?
> The "out of stock notice" looks similar to when searching for Raspberry Pi(s)


Your situation likely is different compared to mine.  The PJRC web site is selling their T4.1 w/o ethernet for $29.60 and has them in stock.  But since you ran into some problems when buying the pocketgeiger from Sparkfun you might encounter similar issues when ordering a teensy from them.

PJRC's "corporate headquarters" actually are in Portland.  I could drive there in about 30 minutes if they have a retail outlet.

If you are really after a Linux SBC you might want to take a look at offerings from Hardkernel.  They have some pretty good stuff but it's going to be more expensive than an RPi.  Last I checked their 8-core SBC was running about $53, and that's without a memory card, which you need for the OS.  They have a bunch of GPIO's brought out to connector pins but I can't say whether or not they're siimilar enough to the RPi to meet your requirements.  The 8 cores are divided into 4 A15's and 4 A7's.  System clock is 2GHz.

I'm using one of their XU4's as a media server and it works a treat for that.  I have a couple of their lower performance boards as well, one is being used as a print server for a photo-quality inkjet printer and the other is a DIY call blocker.  It listens to the incoming phone line and if the phone number or caller ID are on the blacklist it picks up the call and then immediately drops it.


----------



## WobblyHand

If you look up PJRC store, I think you can find local stocking dealers for PJRC products in the UK.  There's around 3-4 stockists, ie authorized companies.  Others may mark up the prices more.  Adafruit stocks in the US, to the best of my knowledge.  At least in the US, their Teensy pricing was ok.  When Teensy 4.1's were of limited availability, I bought one off Amazon, and it was easily the most expensive one I bought.  (Have 3 of them.). PJRC now has them in stock, so I just order them directly.  Might order one and a display just for this application in the next few weeks.


----------



## graham-xrf

homebrewed said:


> PJRC's "corporate headquarters" actually are in Portland.  I could drive there in about 30 minutes if they have a retail outlet.


I thank you kindly for the generous suggestion, but I would not wish to put you to such trouble on my account. 
Getting hold of one from a nearby store may be easy enough, but then getting it all the way to me is a whole ridiculous nonsense that can easily end up costing much more than the item itself. It should be "post-able" in a padded envelope as a very light item, but because the value is more than a few pounds, it hits a wall of paperwork and fees that were the last ditch admin rapid setup after a Brexit débâcle.

If nobody else says it, then I will. We were promised the bright trading future, both with European nations, and US /Asia / Pacific Australasia. The reality sucks, and I fully account the effects of COVID and supply chain problems in saying this. At the present, stuff that arrives in container ships at minimal cost because of bulk scale loading, mostly from China /Taiwan, has increased in cost a bit, but not markedly, with certain major exceptions. Everything else is a import organizational mess!



homebrewed said:


> If you are really after a Linux SBC you might want to take a look at offerings from Hardkernel.  They have some pretty good stuff but it's going to be more expensive than an RPi.  Last I checked their 8-core SBC was running about $53, and that's without a memory card, which you need for the OS.  They have a bunch of GPIO's brought out to connector pins but I can't say whether or not they're siimilar enough to the RPi to meet your requirements.  The 8 cores are divided into 4 A15's and 4 A7's.  System clock is 2GHz.



I had in mind to get the PCB done with tracking to allow as much experimenting as possible. The circuit would use links to be able to have the low noise TIA, with ability to change components to set various gains. have an ADC - or not, Have a window comparator trigger available - or not. Have deep notch 50/60Hz rejection - or not. The plan is to have three button cell lithium battery mountings. One can have 3.3V, or 6.6V or 9.9V for low noise bias sans switching regulators.

I plan to have the PCB made as as many as I can fit on the standard minimum board (12" x 12") on step-and repeat. Then I can post them off to the members that want one, and feel able to get some components on.

I thought to have ready-made connection areas to mount Raspberry Pi Zero-2W.
That same GPIO can also mount any other Raspberry Pi, either direct on header, or cabled to a separate mounted Raspberry Pi.
Then also, connections for a Teensy 4.1, or perhaps some connection setup to best suit Teensy of several sorts, if compatible.
Allowing for the more available Beaglebone was also in mind.
I don't yet know the kit from Hardkernel, but I see ODROID C4 at $54, and an apparently much higher performing ODROID-XU4 which comes standard with mounted fan for a special offer of $53.

These are my "I would like it to be" notions. Right now, I want to first continue the first build to test and prove the TIA analog stuff, and capture pulses. I don't yet have the mechanical mounting for the smoke detector sources as envisaged in the first CAD model. I was thinking to go for something simpler and easier to make, with the sources facing straight forwards.


homebrewed said:


> I'm using one of their XU4's as a media server and it works a treat for that.  I have a couple of their lower performance boards as well, one is being used as a print server for a photo-quality inkjet printer and the other is a DIY call blocker.  It listens to the incoming phone line and if the phone number or caller ID are on the blacklist it picks up the call and then immediately drops it.


I have had a Raspberry Pi 4 hooked to 500GB SSD overkill working as my mailserver for some years now. It can also do webserver, but the space is mostly useful to let folk download big files unsuitable for email, or display the videos I put there on a browser. The network it is on is only about a metre from the fibre-optic modem.


----------



## graham-xrf

*odroid.co.uk* -> https://www.odroid.co.uk/
Check out the C4 with no frills for *€85.64*
So that would be *$90.97*.
I can't discover the shipping cost without going almost all the way to buying one from the cart.

We know by now the SBC on the end is not really the problem. All sorts have the power to do the job, and folk can use whatever they feel happier with, or can get in at reasonable cost, or maybe just happen to have handy. The real preforming stuff that needs serious attention is all about the TIA, and pulse capture, and getting working mechanical mountings together.

In passing, have any other candidates for the photo-diode been seen? Are we still into buying a Pocket Geiger, and robbing / re-working it's innards?


----------



## homebrewed

graham-xrf said:


> In passing, have any other candidates for the photo-diode been seen? Are we still into buying a Pocket Geiger, and robbing / re-working it's innards?



I have found a few other silicon PIN diodes that might be suitable.  They're not as large in area, but plusses and minuses there in terms of performance.  Less capacitance but less detection area.  One example from Advanced Photonix:  the PDB-C107.  17mm^2 area, $27.93  from Digikey-USA.  The detector is protected by clear epoxy so it _might_ be suitable for detecting low energy Xrays.  Thorlabs has their FDS1010 photo detector.  It is 100mm^2 and costs about $60 (but it's not clear if it is a PIN diode or not).  They also have a 13mm^ photodiode for even less but, again, the data sheet says nothing about the diode technology.   

The latter is in a metal can that might need to be de-lidded so lower energy Xrays can find their way to the diode.  That sounds intimidating but it actually isn't that big a deal if one has a lathe -- make yourself a specialized collet to grip the body and use a sharp tool to cut off the lid.  I did it all the time when I was de-lidding optical receivers at work.  In that case they contained TIAs my company had made & sold as dice and I needed to analyze them to figure out how (or IF) they had failed.

The downside to all repurposed photo detectors is similar to PMTs -- they have to be shielded from ambient light.  But that might be accomplished by using black silicon RTV or 2-part epoxy with black pigment in it.  As @RJSakowski has pointed out, carbon doesn't absorb Xrays very strongly so black plastic wouldn't necessarily be a deal killer.

If I was in the mood to buy a different photo diode I probably would look hard at the SiPM offerings from ON Semi and couple a CsI(tl) or NaI scintillator to it.  But the latter, due to their hygroscopic nature, are typically packaged in a manner that negates their use for detecting low-energy Xrays. 

Digikey sells their ~9mm^2 SiPM devices for about $56, in an SMT style package.  They probably won't be as quiet as an old-school PMT but the power supply requirements are greatly simplified.

First things first.  Let's see if the pocketgeiger detector can do for this.


----------



## graham-xrf

homebrewed said:


> I have found a few other silicon PIN diodes that might be suitable.  They're not as large in area, but plusses and minuses there in terms of performance.  Less capacitance but less detection area.  One example from Advanced Photonix:  the PDB-C107.  17mm^2 area, $27.93  from Digikey-USA.  The detector is protected by clear epoxy so it _might_ be suitable for detecting low energy Xrays.  Thorlabs has their FDS1010 photo detector.  It is 100mm^2 and costs about $60 (but it's not clear if it is a PIN diode or not).  They also have a 13mm^ photodiode for even less but, again, the data sheet says nothing about the diode technology.


OK - thanks for doing the digging. I will have a look. "About $60" is OK, because, at least for me, it puts it about level with the Pocket Geiger as a source for the main detection item. Even if all else about the Pocket Geiger is not so useful, and an expense, at least one gets a thing mounted on a little PCB, with ways to connect to it, and power it. Interesting that you worked for a company that made TIAs 



homebrewed said:


> The downside to all repurposed photo detectors is similar to PMTs -- they have to be shielded from ambient light.  But that might be accomplished by using black silicon RTV or 2-part epoxy with black pigment in it.  As @RJSakowski has pointed out, carbon doesn't absorb Xrays very strongly so black plastic wouldn't necessarily be a deal killer.


The basic design of our envisaged kit to put the material in the way of some Am241 excitation does exclude other light anyway, so using a "bare naked" photodiode need not be a problem.


homebrewed said:


> First things first.  Let's see if the pocketgeiger detector can do for this.


Absolutely agreed! It's affordable, and everything we have come to know about it has not shown up any reason it would not work.


----------



## graham-xrf

Re: Teensy ADC
It's me just getting into checking out Teensys, looking at pinouts

At PJRC site, the Teensy comparison page shows Teensy *3.2* through Teensy *3.6* having 13 bits usable resolution, and the much faster Teensy 4.0 and 4.1 as having 10 bits usable resolution.  I take it that  Teensy 3.x series is what we are into if the internal ADC is intended.


----------



## WobblyHand

graham-xrf said:


> Re: Teensy ADC
> It's me just getting into checking out Teensys, looking at pinouts
> 
> At PJRC site, the Teensy comparison page shows Teensy *3.2* through Teensy *3.6* having 13 bits usable resolution, and the much faster Teensy 4.0 and 4.1 as having 10 bits usable resolution.  I take it that  Teensy 3.x series is what we are into if the internal ADC is intended.


Yes and no.  The Teensy 3.x are very rare due to IC shortages.  NXP isn't making them available to PJRC, and isn't making any more chips available for about another half year.  PJRC had a small batch of 3.x and they sold out very quickly just recently.  I think the 3.5, 3.6 are M4 devices.

I think you can get some M4 based chips maybe from Adafruit.  They used to have a Feather M4 Express that was nice.  Made my Doppler chronograph with one.  Personally, I started out with Adafruit, but in some ways, the Teensy libraries are more advanced. But Adafruit supports a lot of devices.  Either is decent.


----------



## graham-xrf

WobblyHand said:


> Yes and no.  The Teensy 3.x are very rare due to IC shortages.  NXP isn't making them available to PJRC, and isn't making any more chips available for about another half year.  PJRC had a small batch of 3.x and they sold out very quickly just recently.  I think the 3.5, 3.6 are M4 devices.
> 
> I think you can get some M4 based chips maybe from Adafruit.  They used to have a Feather M4 Express that was nice.  Made my Doppler chronograph with one.  Personally, I started out with Adafruit, but in some ways, the Teensy libraries are more advanced. But Adafruit supports a lot of devices.  Either is decent.


OK, and thanks. I get it now 
The support for easy connection to the computing part for most devices folk might want to play with is all I was trying for right now.
For the Raspberry Pi(s), I envisaged using the little Raspberry Pi Zero - 2W stood on the same PCB as daughter board, but that one is in the same kind of supply situation as the Teensy(s). For now, it's perfectly OK for me to just hook up one of the boards I already have. It seems OK with an older Raspberry Pi 3B.

It occurs to me that some might want to use the 600MHz Teensy 4.1, but using the separate 16-bit ADC. I think the internal ADC on Teensy 4.x 10 bits worth of usable resolution is not enough, but folk who like Teensys might want to stay with them.

I have bought the AD7622, but this choice need not be set in stone. The price has now gone up to near £50 (£61). Before I put too much more on my KiCAD circuit, I am going to have another last look at available ADC choices, with a view to finding something lower cost, yet still "good enough".

[Edit: Hmm.. is the plural of "Teensy" called "Teensies" ? ]


----------



## homebrewed

I recently ordered an AD7667 to play with in the LQFP package.  It is a 1MSPS version and looks pretty similar to the AD7622, functionally speaking.  One thing I like about these is the fact that they can be pipelined to reduce the effective acquisition overhead.  If using it in the parallel mode, you can quickly read out the result of the previous conversion command, and that also triggers the ADC to start another conversion.  So no waiting around for the converter to go through its SAR business.  In addition, the byteswap pin allows you to mux the upper 8 and lower 8 bits.  This makes it possible to use the T4.0, because its board was designed so there are only 8 bits available for parallel I/O (and there is some bit shifting needed as well).  It will be a little slower than the T4.1 because it can handle a full 16 bits in one read cycle.  The data isn't going to be on "nice" 16 bit boundaries so there will be some shifting required, but at 600MHz that won't take very long!

The AD7667 cost me $33.65 from Digikey, not counting shipping.


----------



## graham-xrf

Mark, the ADCs seem to be more than "looks pretty similar". They use so many identical pinouts, it may be possible let either go on the same layout, with only one pin perhaps linked to a different function if it is used at all. The basic difference is that the 7622 has a differential input, so *IN-* [39] becomes *INGND* [39], and *IN+*[43] becomes plain *IN*[43] for the AD7667 single ended input. The inputs still use the same pin numbers.

BYTESWAP is pin [4] on both ADCs, shown used in the AD7667 Fig26 _Typical Connection Diagram_, but not apparently invoked in the AD7622.
Pin [7] is called *IMPULSE*, on the AD7667, and called */NORMAL* on AD7622. Both are connected to GND anyway.

I was planning to load in the samples in serial manner, because they can still load in at 1MSPS, or at 2MSPS if "WARP" mode is invoked, only because the Raspberry Pi can do it, but parallel is OK into a Teensy as well.

The group pins 5, 8, 6 connect to 0VDD in my AD7622 circuit, whereas the same pins are taken to DVDD for the AD7667.

I did mark up the Fig25 typical connection diagrams with blue pin numbers in a separate PNG image, because I found it handy instead of repeatedly looking up pins on the 48-pin LQPF picture. The corresponding connection diagram for AD7667 is on it's Fig 26.

Note that pin 3 is used for for DGND on AD7622, and is just not connected to anywhere on AD7667.

The layout, so far, seems to be a pin for pin compatible, drop-in replacement when it comes to the layout, so long as one looks after what happens to pins 5. 6, 8, done with a zero-ohms link.

I include both pictures here. The AD7667 shows the interesting pins in a different colour, and the pin function names, where there are differences in usage, are highlighted in red.

I usually end up needing two or three print-outs of these sort of pictures, because mine get pretty messed up when I try stuff out. So far, it's one little scorch mark, curled up corners, and a bit of a coffee mug ring + spillage.




Compare to the AD7622 one I used..


----------



## homebrewed

Interesting that the typical connection diagram you found for the AD7677 is a bit different than the one I have.  The most significant difference is that 10uF capacitor hung on the Ref pin.  Mine doesn't show that.


----------



## graham-xrf

homebrewed said:


> Interesting that the typical connection diagram you found for the AD7677 is a bit different than the one I have.  The most significant difference is that 10uF capacitor hung on the Ref pin.  Mine doesn't show that.


I downloaded it from _analog.com_ this very evening!
Ahh - I see it now. On your datasheet, Figure 26, that capacitor is Cr(4), indicating look at NOTE 4.
"A 10uF ceramic capacitor, (X5R, 1206 size) is recommended (eg Panasonic ECJ3YB0J106M)"

BTW - we are seriously pushing at 100 pages of this thread.


----------



## homebrewed

graham-xrf said:


> I downloaded it from _analog.com_ this very evening!
> Ahh - I see it now. On your datasheet, Figure 26, that capacitor is Cr(4), indicating look at NOTE 4.
> "A 10uF ceramic capacitor, (X5R, 1206 size) is recommended (eg Panasonic ECJ3YB0J106M)"
> 
> BTW - we are seriously pushing at 100 pages of this thread.


Aha!  I took the DS off the Digikey web site.  Apparently their information can be stale.  I'll head over to ADI and get the latest one to see if there's anything else I need to be aware of.

I don't think we're even close to having the longest thread, but some of the really long ones are more generic like POTD.  I'm not so sure for a (mostly) single subject.


----------



## homebrewed

If any of you are seriously looking at getting a TFT display for this project make sure its logic/power supply requirements are compatible with your particular processor board.  Adafruit has different versions of their 3.5" TFT display, but only some of them appears to be compatible with both 3.3 and 5V systems.  They are ones designed around the ILI9341.  I bought the right one for my Teensy4.0 but it would be all too easy to get the wrong one.  The one offered by PJRC also is based on the ILI9341.

I just fired mine up using an old Uno and it worked fine for that.  Next up:  I'll try it with a Teensy LC, which is a 3.3V processor.  I'm trying to avoid potentially damaging my one & only T4.0, although I do have a 4.1 on the way.

I haven't checked the PJRC graphics library but the Adafruit one allows you to rotate the axes in 90 degree increments.  Handy because I want the long dimension to equal the X axis (time) in this particular application.

One important thing to note is that, like many video display drivers, the (0,0) point is the upper-left corner on the display.  So for plotting data in a landscape display mode the Y axis has to be inverted:  Y' = (239 - Y).  The Y axis pixel "coordinate" range is 0....239, that adds up to 240 pixels


----------



## WobblyHand

The PJRC ILI9341 is compatible with Teensy 4.x and 3.x.  On the anti static bag is pasted a sticker which tells you that the screen pixel map is 180 degrees out from the display.  Both are simply rotated with simple commands.  In the beginning it is a bit fun to sort that out, but I can assure you it can be done successfully!  I power the screen with the 5V input, but the screen accepts 3.3V I/O.  Internally, the screen runs on 3.3V.
If I recall the screen rotation is just something simple like tft.rotate(n);  where n is an integer, 0, 1, 2, 3.  I think the touch display is similar.

I was at a Microcenter store this morning.  They had Teensy 4.0 and 4.1, and not a single Raspberry Pi of any sort.  Plenty of accessories for Pi's but no Pi's, which is what I expected to see.  The Teensy's were reasonably priced, primarily because PJRC has a similar policy as The RPi Foundation, no scalping.  There were no Teensy 3.X that I could find.


----------



## homebrewed

WobblyHand said:


> The PJRC ILI9341 is compatible with Teensy 4.x and 3.x.  On the anti static bag is pasted a sticker which tells you that the screen pixel map is 180 degrees out from the display.  Both are simply rotated with simple commands.  In the beginning it is a bit fun to sort that out, but I can assure you it can be done successfully!  I power the screen with the 5V input, but the screen accepts 3.3V I/O.  Internally, the screen runs on 3.3V.
> If I recall the screen rotation is just something simple like tft.rotate(n);  where n is an integer, 0, 1, 2, 3.  I think the touch display is similar.
> 
> I was at a Microcenter store this morning.  They had Teensy 4.0 and 4.1, and not a single Raspberry Pi of any sort.  Plenty of accessories for Pi's but no Pi's, which is what I expected to see.  The Teensy's were reasonably priced, primarily because PJRC has a similar policy as The RPi Foundation, no scalping.  There were no Teensy 3.X that I could find.


The Adafruit graphics library has an identically named command.  To test the pixel vs. coordinate assignment I just issued tft.rotate(n) plus a tft.write() command to display text correctly, then drew a line from (0,0) to (319,239).  Observation did the rest.


----------



## homebrewed

Unfortunately the Adafruit display draws more power than the LC's 3.3V regulator can supply.  The T4.X boards are OK though.


----------



## WobblyHand

For my ELS, I powered the display with 5V, not 3.3.  That way the onboard regulator on the processor is not used to power the display.  Basically USB powered it, not the Teensy.


----------



## WobblyHand

The Adafruit break out display can be powered by either 3.3V or 5V.  My chronometer uses the 5V option, so I don't draw current on a Teensy regulator.  Should work the same, I think we have the same displays.


----------



## WobblyHand

The Adafruit display can be powered by 3-5V.
picture of display
So no need to use a Teensy LC regulator...


----------



## homebrewed

WobblyHand said:


> The Adafruit break out display can be powered by either 3.3V or 5V.  My chronometer uses the 5V option, so I don't draw current on a Teensy regulator.  Should work the same, I think we have the same displays.


If the display controller's SPI logic levels remain fixed at 3.3V that's doable.  Documentation of that nature for the Adafruit display seems to be nonexistent.  Their "data sheet" for the display is nothing but a mechanical drawing.


----------



## WobblyHand

It's good to be cautious.  I'm using that display with a Feather M4 Express board for what it is worth.  In that case, I regulated a 6.4V battery to 5V.  That powered the M4 Express and the display.  The M4 has 3.3V I/O.  The M4 outputs like SPI controlled the display.  You could separately power the display and measure the inputs and outputs.

You've hit upon a peeve of mine about documentation.  Seems that the "Maker area" is weak on documentation and Adafruit follows that trend.  Really makes it a more difficult for true makers, like HM folks, who come from backgrounds that are expecting actual documentation, in all three dimensions, and actual data sheets with content.  If it's a simple breakout board, sometimes one is pointed to a vendor part number.  They are peddling incomplete products and are expecting the users to figure it out themselves, in exchange perhaps for lower product cost.  Seems to be the nature of the beast these days.  My approach is to use this stuff perhaps for one ofs.  I don't think I'd ever attempt a product, with the Adafruit's of the business since there's scant evidence that these kinds of products have sufficient configuration management to support a product based on them.  PJRC seems to take this a little more seriously, and supports businesses that use PJRC products.  That being said, their documentation is not much better than Adafruit's.


----------



## homebrewed

Here's a photo showing the TFT in operation.  It's been quite awhile since I've written pixel-level computer graphics code so it took an embarassingly-long time to get the relatively simple code working right.  The biggest hangup was correctly addressing the need to plot about 70 data points (about the number of samples I may get per detected x-ray pulse) while fitting them into 320 horizontal pixels. 

I _am_ at the 4 day point into Covid so I'll use that as an excuse   The anti-viral that's available for it is amazing but....I still have a low grade fever, for me at least.  Fully vaxxed/boosted but that clearly is not a guarantee.....




To get this display orientation to look right I called tft.setRotation(3).  That's using the Adafruit graphics libraries.

I like this little display.  I think I will find lots of uses for it.


----------



## homebrewed

WobblyHand said:


> It's good to be cautious.  I'm using that display with a Feather M4 Express board for what it is worth.  In that case, I regulated a 6.4V battery to 5V.  That powered the M4 Express and the display.  The M4 has 3.3V I/O.  The M4 outputs like SPI controlled the display.  You could separately power the display and measure the inputs and outputs.
> 
> You've hit upon a peeve of mine about documentation.  Seems that the "Maker area" is weak on documentation and Adafruit follows that trend.  Really makes it a more difficult for true makers, like HM folks, who come from backgrounds that are expecting actual documentation, in all three dimensions, and actual data sheets with content.  If it's a simple breakout board, sometimes one is pointed to a vendor part number.  They are peddling incomplete products and are expecting the users to figure it out themselves, in exchange perhaps for lower product cost.  Seems to be the nature of the beast these days.  My approach is to use this stuff perhaps for one ofs.  I don't think I'd ever attempt a product, with the Adafruit's of the business since there's scant evidence that these kinds of products have sufficient configuration management to support a product based on them.  PJRC seems to take this a little more seriously, and supports businesses that use PJRC products.  That being said, their documentation is not much better than Adafruit's.


I agree 100% with your observations.  The majority of hobbyists served by Adafruit and the like don't seem to understand or value the goodness that really complete documentation brings to the table.  I think if their customers demanded it things would be different.  Operations like PJRC (and likely Adafruit) probably have just a few really technical people and their time is spread out over many products so something has to give, eh?  

But the lack of good documentation must surely limit their penetration into markets where customers are accustomed to paying more for well-documented products. Sort of a nasty feedback cycle because less money coming in = less support.  I suppose for folks like us we have to grit our teeth and take what we get.


----------



## WobblyHand

homebrewed said:


> Here's a photo showing the TFT in operation.  It's been quite awhile since I've written pixel-level computer graphics code so it took an embarassingly-long time to get the relatively simple code working right.  The biggest hangup was correctly addressing the need to plot about 70 data points (about the number of samples I may get per detected x-ray pulse) while fitting them into 320 horizontal pixels.
> 
> I _am_ at the 4 day point into Covid so I'll use that as an excuse   The anti-viral that's available for it is amazing but....I still have a low grade fever, for me at least.  Fully vaxxed/boosted but that clearly is not a guarantee.....
> 
> View attachment 430741
> 
> 
> To get this display orientation to look right I called tft.setRotation(3).  That's using the Adafruit graphics libraries.
> 
> I like this little display.  I think I will find lots of uses for it.


They are quite handy displays.  Although they are small, you can convey a bit of information.

Sorry to hear about your catching COVID.  Your excuses are accepted.   Actually, you've done very well for starting out and being sick.  It took me quite a while to get my chronometer display graph to be presentable.  

Doing grid lines, axes and graphing are tough the first time.  Auto scaling is fun as well.  You'll get thinking about that after clipping or having the display do unexpected things.

I don't know the dynamic range of the expected signals, but for the chronometer I had to convert the Y axis to dBs to see everything, since the dynamic range of signals was more than 60 dB.  You just can't see the noise floor, all the little stuff and large signals at the same time without dBs.


----------



## homebrewed

The expected data range is the resolution of the ADC used.  At the moment I'm using the T4"s built-in ADC, set to 12 bits resolution so to display full-scale signals it is necessary to multiply the ADC result by 240/4096 -- at least, if you want to use the display in the landscape mode.  Since I'm immediately converting the ADC value to a floating point in the ISR that's trivial.

Scaling data to expand lower-level signals will run the risk of clipping higher amplitude signals, but at this point I'm mostly interested in using the display to debug the pulse processing code.  I may just auto-scale each pulse so it fits, since I'm currently interested in finding the actual start and end of each pulse.

The power supply for my most recently-acquired Linux computer for lab work just died.  I mean that literally, like 45 minutes ago.  Sucks.  I unplugged & re-inserted the power cord at the socket and brick (the computer side is a hardwired connector), no joy there.  Banged on it to hopefully reconnect a bad solder joint somewhere.  No joy there.  I have a replacement on order but given the season it won't arrive until after Christmas.  I _could_ pay a bunch more to get it sooner but I'm teed off & refuse to pay any more than necessary.  I'll do something else for a little while.  God knows I have plenty of projects to keep me busy!


----------



## WobblyHand

Sorry to hear of the demise of the power supply. It happens.  My laptop keyboard is dying, so I can sympathize.

Re: dynamic range.  With some radars FFTs are used, and they can extend the dynamic range of the system, at least if you have decent ADCs.  As I understand it there won't be any FFTs used for this application, so no process gain there, all one gets is the ADC.  Even so, 10 or 11 bits is still 60-66dB.  If it was me, I'd plot in both linear and dB and see which conveyed more useful information.  Might see some info near the noise floor that would be invisible in a linear scale.  Even if it is power supply issues, like supply modulation, it is useful to find, so you can eliminate it from your design.  I have observed in systems, current variations due to processing get put onto the signal waveform.


----------



## homebrewed

I found a few papers discussing pulse analysis using  FFTs.  My impression (perhaps incorrect) was that the claimed improvement in effective SNR is due to the fact that each term of the FFT is derived from the entire time-domain-based data set.  In essence, averaging-out the noise (assuming it isn't correlated to the pulse, which is a reasonable assumption).  Calculating the area of the pulse will accomplish something very similar but with much less computation overhead.

I think this type of per-pulse processing -- calculating the FFT or something like integrating the pulse --  should produce a noticeable improvement in the XRF spectral data.  Since my pulse-processing code will output both the peak and integrated pulse values it should be easy to compare those two approaches.


----------



## WobblyHand

FFTs reduce the noise by having multiple narrow band filters.  They cost N*log(N) computations.  You can do things like pulse area integration to help, instead of an FFT.  However, a 1024 point FFT reduces noise power by 1024, where as integrating 10 points gives only a factor of 10 in the pulse, but doesn't reduce the local noise nearby.  The FFT does that automatically.  However, sometimes an FFT isn't appropriate.

The better choices become more obvious when you have access to data.  It depends on the nature of the inputs.  Think you have a good approach for now, just need to see where it leads you.  Simple is good, especially in the beginning, loads easier to debug and get some further insight.  If required, then increase the complexity of the processing.  

Hope it never escalates to SVDs, although that might be fun on a Teensy.  An SVD has an unusual property of decomposing inputs into a signal space and a noise space.  It's used in the ESPRIT algorithm.  Head splitting linear algebra, I'm afraid, but very powerful under some circumstances.  Probably have to compile LAPACK to use it.


----------



## WobblyHand

Inserts foot in mouth.  CBlas and cLAPACK are quite advanced for a Teensy.  It could be done, but it's a project all by itself.  When I did something similar for an embedded platform, I had vendor support.  I don't for see PJRC doing that simply because they have their hands full getting parts to maintain production.  They have had to do multiple redesigns because of parts availability.  Their interests seem to be aligned with audio, but not general signal processing.

The afore mentioned libraries were designed for PCs with an OS and having threads.  Not insurmountable for embedded, but not a walk in the park.


----------



## homebrewed

In the context of a relatively slow ADC I'm stuck with a maximum of about 70 pulses.  I don't think there's much advantage in performing an FFT on that, compared to just summing 70 data points.

A 1MSPS ADC will get you close to a 128-point FFT.  But is that going to be a significant advantage compared to

float_t integral = 0;
for(uint16_t i = 0; i < datalen; i++)
 integral += pulsedata_;

If all you want to do is use "integral" as the index into an MCA array (along the lines of "MCA[integral] += 1" ) and then plot it.?  I'm leaving real-world niceties like scaling the integral value so it doesn't overflow the MCA array, what I wrote is just for pedagogical purposes 

A 1024 long FFT containing real pulse data of a 100us pulse would require a 10MSPS ADC.  I found a 16 bit LTC2386 on Digikey selling for about $44 so it should be possible to do something like that.  It has a LVDS serial interface so the serial channel would have to be running about a 160MHz clock rate.  The interface is NOT SPI but it should be possible to use the FlexIO peripheral system on the T4.x chip.  The converter would require LVDS-to-single-ended level translators for the clock and data lines.  The FlexIO system may be fast enough but I'd want to double-check that before jumping into that kind of projecte.

The question is, at the end would the extra effort pay off or not.  I think it's too soon to say._


----------



## WobblyHand

homebrewed said:


> In the context of a relatively slow ADC I'm stuck with a maximum of about 70 pulses.  I don't think there's much advantage in performing an FFT on that, compared to just summing 70 data points.
> 
> A 1MSPS ADC will get you close to a 128-point FFT.  But is that going to be a significant advantage compared to
> 
> float_t integral = 0;
> for(uint16_t i = 0; i < datalen; i++)
> integral += pulsedata_;
> 
> If all you want to do is use "integral" as the index into an MCA array (along the lines of "MCA[integral] += 1" ) and then plot it.?  I'm leaving real-world niceties like scaling the integral value so it doesn't overflow the MCA array, what I wrote is just for pedagogical purposes
> 
> A 1024 long FFT containing real pulse data of a 100us pulse would require a 10MSPS ADC.  I found a 16 bit LTC2386 on Digikey selling for about $44 so it should be possible to do something like that.  It has a LVDS serial interface so the serial channel would have to be running about a 160MHz clock rate.  The interface is NOT SPI but it should be possible to use the FlexIO peripheral system on the T4.x chip.  The converter would require LVDS-to-single-ended level translators for the clock and data lines.  The FlexIO system may be fast enough but I'd want to double-check that before jumping into that kind of projecte.
> 
> The question is, at the end would the extra effort pay off or not.  I think it's too soon to say._


It all depends on what you need to capture and the pulse SNR's.  If there's buckets of SNR, than almost anything works.  Looking forward to seeing more data.  Hope that data will make it more clear what is required.

Re: FlexIO, it seems to be pretty fast. It has a minimum speed of 49MHz.  Not sure of the max, but it is designed to shuttle around camera data for pixel processing.  I think there's a post by Paul Stoffregen on Teensy FlexI/O on his (PJRC) forum.  Date is around 2018.


----------



## homebrewed

To continue my previous post, it also is worthwhile to consider the detector.  X-ray detectors have an inherent minimum-energy resolution that is dictated by what technology they use. The best, for something that is hobbyist-affordable, probably is a NaI(tl) scintillator coupled to a PMT, and that will get you about 6-7% (usually specified with 662Kev gamma rays).  If that relationship holds true down to the 10Kev range (and it probably doesn't), that means the spectrum produced by a 10Kev gamma ray source would have a spread of 600ev.  That is enough for iron and cobalt peaks to significantly overlap -- regardless of how much fancy SNR-improving stuff we do.  So it doesn't make sense to beat ourselves up a lot over improving the pulse SNR once we get to a certain point.

But there is one way the FFT can improve things.  That is to use it to de-convolve the MCA spectrum to achieve an effectively-better energy resolution.  That wouldn't be a realtime FFT so even C++ FFT code would be OK.

For the latter application, head on over to the Theremino gamma spectrometer information web pages.  They have a (machine translated) paper regarding their success in using deconvolution.


----------



## WobblyHand

homebrewed said:


> For the latter application, head on over to the Theremino gamma spectrometer information web pages.  They have a (machine translated) paper regarding their success in using deconvolution.


Is their code well documented?  I haven't had a lot of luck with deconvolution, personally.  Or rather, I have failed to implement it successfully.  I'm supposing that I didn't quite understand it sufficiently...

Edit.
I found the paper on Gaussian deconvolution at the Therimino site.  The basic premise is that you know all the possible contaminating spectral lines.  Suppose we do, since there's a finite number of elements, and even less of them have adjacent lines.  Based on that possibility one tries to sort that all out.  I need to reread it.  Seems you will need quite a bit table or database of all the lines.  Could principal component analysis be of help here?  Or is the gaussian deconvolution sufficient?

2nd edit.  Wish that Therimino wasn't in visual basic.  Would have thought it would be in C or C++.


----------



## homebrewed

WobblyHand said:


> Is their code well documented?  I haven't had a lot of luck with deconvolution, personally.  Or rather, I have failed to implement it successfully.  I'm supposing that I didn't quite understand it sufficiently...
> 
> Edit.
> I found the paper on Gaussian deconvolution at the Therimino site.  The basic premise is that you know all the possible contaminating spectral lines.  Suppose we do, since there's a finite number of elements, and even less of them have adjacent lines.  Based on that possibility one tries to sort that all out.  I need to reread it.  Seems you will need quite a bit table or database of all the lines.  Could principal component analysis be of help here?  Or is the gaussian deconvolution sufficient?
> 
> 2nd edit.  Wish that Therimino wasn't in visual basic.  Would have thought it would be in C or C++.


I'm not very familiar with principal component analysis so I took a look at the Wikipedia article about it.  It looks to be similar to methods used in linear algebra to reduce a matrix to its equivalent diagonal.  Basically finding the simplest basis vectors of the given data space.

I also was immediately reminded of the K-L "Karhunen-Loeve" transform which does something similar.  Guess what, the Wikipedia article regarding the "Kosambi-Karhunen-Loeve theorem" mentions that it is used to perform principal component analysis!

IIRC the KL transform is extremely computation intensive.  It's necessary to separate the contribution of different "dimensions" by calculating the covariance of the process that generated the data.  I have no idea how XRF data might fit into that.  The output of an MCA is, in essence, a two-dimensional dataset -- the number of counts inside an array of contiguous energy windows -- while the stuff generating the data comes from 1 or more elements.  It appears to me that there isn't enough "dimensionality" in the dataset to use principal component analysis.  The classical linear algebra equivalent is where you have "N" unknowns but something less than "N" equations, so you can't explicitly solve the unknown values.


----------



## homebrewed

homebrewed said:


> I'm not very familiar with principal component analysis so I took a look at the Wikipedia article about it.  It looks to be similar to methods used in linear algebra to reduce a matrix to its equivalent diagonal.  Basically finding the simplest basis vectors of the given data space.
> 
> I also was immediately reminded of the K-L "Karhunen-Loeve" transform which does something similar.  Guess what, the Wikipedia article regarding the "Kosambi-Karhunen-Loeve theorem" mentions that it is used to perform principal component analysis!
> 
> IIRC the KL transform is extremely computation intensive.  It's necessary to separate the contribution of different "dimensions" by calculating the covariance of the process that generated the data.  I have no idea how XRF data might fit into that.  The output of an MCA is, in essence, a two-dimensional dataset -- the number of counts inside an array of contiguous energy windows -- while the stuff generating the data comes from 1 or more elements.  It appears to me that there isn't enough "dimensionality" in the dataset to use principal component analysis.  The classical linear algebra equivalent is where you have "N" unknowns but something less than "N" equations, so you can't explicitly solve the unknown values.


And this my friends is about as far-removed from machining that we've gotten so far!  Gotta do more lathe or mill talk here


----------



## WobblyHand

homebrewed said:


> And this my friends is about as far-removed from machining that we've gotten so far!  Gotta do more lathe or mill talk here


True enough, but if you want to do spectral analysis or XRF, there's going to be some math involved.  The things we have to suffer so we can know what we are machining!


----------



## WobblyHand

99 pages of stuff, a math diversion or two won't hurt!


----------



## rwm

I think ya'll are just trying to get to 100 pages before you build a prototype!


----------



## WobblyHand

rwm said:


> I think ya'll are just trying to get to 100 pages before you build a prototype!


Seems like it


----------



## homebrewed

WobblyHand said:


> Seems like it





WobblyHand said:


> Is their code well documented?  I haven't had a lot of luck with deconvolution, personally.  Or rather, I have failed to implement it successfully.  I'm supposing that I didn't quite understand it sufficiently...
> 
> Edit.
> I found the paper on Gaussian deconvolution at the Therimino site.  The basic premise is that you know all the possible contaminating spectral lines.  Suppose we do, since there's a finite number of elements, and even less of them have adjacent lines.  Based on that possibility one tries to sort that all out.  I need to reread it.  Seems you will need quite a bit table or database of all the lines.  Could principal component analysis be of help here?  Or is the gaussian deconvolution sufficient?
> 
> 2nd edit.  Wish that Therimino wasn't in visual basic.  Would have thought it would be in C or C++.


For quantitative xray spectroscopy it is quite common to use elemental references.  That way your particular system's peculiarities can be taken into account.  Collecting elemental samples is a "thing" these days so it isn't too difficult or expensive to come up with a set.  I bought some pure manganese, iron and nickel samples off ebay for characterizing my XRF system.  The iron and nickel were accompanied by cadmium and zinc -- while not useful for characterizing steel alloys, they could be used for a wider xray energy range, if one of us wants to use our XRF system for other purposes.  Like checking to see if the paint on some old structure you've got has lead in it.  I know, there are off-the-shelf tests for that.....but as time goes by their availability is going away.  I got the last two at a local Home Depot not very long ago, and that store was the only one that had them within a 25 mile radius.  An XRF system like ours should be able to detect lead like gangbusters, since the pocketgeiger's xray detector sensitivity is close to its maximum for the lead 10Kev line.

The thought occurs to me that there's little most buyers can do when it comes to verifying the veracity of those elemental sample vendors.  We should be able to do that .

Anyway, my point is that coming up with a dictionary of different elements won't be all that hard to do.  The tricky bit may be making sure that the XRF system is relatively stable over time.

Regarding your comment about the use of visual basic:  I agree with you.  C or C++ would have been nice.  I haven't looked at the pyMCA code to see if it includes deconvolution -- but given all the stuff available via scipy or numpy that seems pretty likely.  At this point I would find it easier to follow the Python code compared to Visual Basic.


----------



## homebrewed

I decided to make a little mounting setup for my TFT display.  It holds the display at a convenient angle for viewing and is heavy enough to keep it from moving around.  I had all the material I needed to make it on hand, with the exception of a few 4-40 screws to assemble it and attach the board.

Like this:




I'm using the display in its serial mode.  For now I'm leaving the protective plastic film over the display.


----------



## homebrewed

A number of things have conspired to slow progress on my version of the XRF project.  The holiday season in general, getting Covid, bad weather and attendant damage, subsequent cleanup, probably a few other things I already have forgotten all needed attention.

In my last post I showed the TFT display mounted on a little holder and today I was able to actually plot some decent looking pulses.  Along the way I found that I couldn't share the built-in LED pin with the Teensy4.0's SPI clock pin -- trying to use that pin to use it as a flasher for my "geiger" mode AND the SPI clock caused the TFT library function to hang.  Not sure why, but there you go.  So for now the geiger mode is broken (it used the LED pin).

The other thing I ran into was some subtle problem with my approach to acquiring the entire pulse waveform once the input voltage exceeded the trigger voltage.  I tried a sequential method, backing up to find the beginning of the pulse then sucking in the pulse data up to the current pointer into the circular buffer; and then following the acquisition until the pulse amplitude decayed to close to zero.  Not sure why, but the subsequent pulses didn't resemble the waveforms I was seeing on my oscilloscope.  Ranging from slightly wrong to _really_ wrong.  Just to move forward, instead I just inserted a delay function that was long enough for a valid pulse to come and go, then processed the data in the circular buffer to extract the entire pulse  My motivation for trying the other approach was efficiency:  it would be possible to abort the pulse processing as soon as it became clear that it wasn't good enough, reducing the chances of missing a subsequent good pulse.  I think it should work but clearly need to do a better job of analyzing how the code _actually_ works.

Anyway, at this point I can acquire decent-looking pulses, although my program is rejecting more pulses than I like.  There's more debugging in the future.....

Here's a photo of my TFT display showing a pulse, sampled at 360KSPS:




I deliberately chose a photo of a fairly noisy pulse, just to show why I think a simple peak detection scheme won't work all that well.  Integrating the entire pulse should produce a value that is much less affected by noise.

The plot also is auto-scaled, so this particular pulse may be lower in amplitude so the system noise is more apparent.


----------



## WobblyHand

homebrewed said:


> A number of things have conspired to slow progress on my version of the XRF project.  The holiday season in general, getting Covid, bad weather and attendant damage, subsequent cleanup, probably a few other things I already have forgotten all needed attention.
> 
> In my last post I showed the TFT display mounted on a little holder and today I was able to actually plot some decent looking pulses.  Along the way I found that I couldn't share the built-in LED pin with the Teensy4.0's SPI clock pin -- trying to use that pin to use it as a flasher for my "geiger" mode AND the SPI clock caused the TFT library function to hang.  Not sure why, but there you go.  So for now the geiger mode is broken (it used the LED pin).
> 
> The other thing I ran into was some subtle problem with my approach to acquiring the entire pulse waveform once the input voltage exceeded the trigger voltage.  I tried a sequential method, backing up to find the beginning of the pulse then sucking in the pulse data up to the current pointer into the circular buffer; and then following the acquisition until the pulse amplitude decayed to close to zero.  Not sure why, but the subsequent pulses didn't resemble the waveforms I was seeing on my oscilloscope.  Ranging from slightly wrong to _really_ wrong.  Just to move forward, instead I just inserted a delay function that was long enough for a valid pulse to come and go, then processed the data in the circular buffer to extract the entire pulse  My motivation for trying the other approach was efficiency:  it would be possible to abort the pulse processing as soon as it became clear that it wasn't good enough, reducing the chances of missing a subsequent good pulse.  I think it should work but clearly need to do a better job of analyzing how the code _actually_ works.
> 
> Anyway, at this point I can acquire decent-looking pulses, although my program is rejecting more pulses than I like.  There's more debugging in the future.....
> 
> Here's a photo of my TFT display showing a pulse, sampled at 360KSPS:
> 
> View attachment 431558
> 
> 
> I deliberately chose a photo of a fairly noisy pulse, just to show why I think a simple peak detection scheme won't work all that well.  Integrating the entire pulse should produce a value that is much less affected by noise.
> 
> The plot also is auto-scaled, so this particular pulse may be lower in amplitude so the system noise is more apparent.


Great progress, both on your covid recovery and pulse recovery!  If the pulses all look this way, it would be great.  They probably don't, but this one is very encouraging.  Agree with pulse integration being helpful.  

Correlation might help as well since the shape is important.  How many samples is this pulse?  Correlation is expensive computationally, but one could do it in the frequency domain and take the IFFT, which will reduce the burden.

How are you choosing your trigger threshold?  Ideally it should be based on a fixed ratio of the noise floor.  Or at least, that is what is commonly done in radar signal processing.  I used a median filter to estimate the local noise floor.  It runs on an M4, so might be ok for your use.  If you are interested in a code sample I can send you one.  I used this code in my Doppler chronograph.


----------



## rwm

Why would the shape of the pulse be important? I assume the decay rate would be more hardware related than related to the arriving photon? Unless you mean summation of nearly coincident detections. Then yes.


----------



## WobblyHand

rwm said:


> Why would the shape of the pulse be important? I assume the decay rate would be more hardware related than related to the arriving photon? Unless you mean summation of nearly coincident detections. Then yes.


Your second comment is what I was thinking about.  We have no control over the timing of incoming pulses, and many will overlap.  Using shape could help discriminate overlapping pulses a little.  Sometimes the shape can also help determine if the pulse is "real", as apposed to coming from a different source.  If the shape is totally wrong, then that energy can be rejected.

Sometimes the pulse has a shape due to the source, and other times due to one's electronics.  Wide bandwidth systems preserve pulse shape whereas narrowband systems smear or blur those features.  What's best depends on the features one is trying to extract.  If the pulses didn't overlap one could use simple pulse energy.  Overlapping makes things harder.  There's lots of strategies, and each one has it's plusses and minuses.  Pulse rejection works at the expense of identification time.  It's simpler to implement but one has to wait longer, or one misses an element.  In the end, it's a balance between cost, performance and time, just like any other engineering project...


----------



## homebrewed

WobblyHand said:


> Great progress, both on your covid recovery and pulse recovery!  If the pulses all look this way, it would be great.  They probably don't, but this one is very encouraging.  Agree with pulse integration being helpful.
> 
> Correlation might help as well since the shape is important.  How many samples is this pulse?  Correlation is expensive computationally, but one could do it in the frequency domain and take the IFFT, which will reduce the burden.
> 
> How are you choosing your trigger threshold?  Ideally it should be based on a fixed ratio of the noise floor.  Or at least, that is what is commonly done in radar signal processing.  I used a median filter to estimate the local noise floor.  It runs on an M4, so might be ok for your use.  If you are interested in a code sample I can send you one.  I used this code in my Doppler chronograph.


I don't think that correlation would help.  Each (good) pulse represents one x-ray photon, which could come from an iron or nickel or chrome or cobalt or molybdenum or vanadium or manganese atom (etc.), so attempting to combine pulses wouldn't do us any good.

The trigger is a simple fixed value.  However, my ADC ISR includes a low-pass filter, whose value is subtracted from the raw ADC data before being entered into my circular buffer.  But it's even a bit more complicated than that.  The startup code examines the data coming out of the ADC and extracts the RMS noise, then sets a data-clip value that is equal to 3*RMS + the low pass filter value.  This in turn is used to reject pulses so they don't push the low pass filter voltage around too much in the ISR.

Also, to reduce the possibility of noise triggering the pulse processor I keep a rolling average of the last 8 ADC samples and trigger on that.


----------



## homebrewed

WobblyHand said:


> Your second comment is what I was thinking about.  We have no control over the timing of incoming pulses, and many will overlap.  Using shape could help discriminate overlapping pulses a little.  Sometimes the shape can also help determine if the pulse is "real", as apposed to coming from a different source.  If the shape is totally wrong, then that energy can be rejected.
> 
> Sometimes the pulse has a shape due to the source, and other times due to one's electronics.  Wide bandwidth systems preserve pulse shape whereas narrowband systems smear or blur those features.  What's best depends on the features one is trying to extract.  If the pulses didn't overlap one could use simple pulse energy.  Overlapping makes things harder.  There's lots of strategies, and each one has it's plusses and minuses.  Pulse rejection works at the expense of identification time.  It's simpler to implement but one has to wait longer, or one misses an element.  In the end, it's a balance between cost, performance and time, just like any other engineering project...


For now I'm simply discriminating on the pulse width.  Pulse overlap = a longer pulse.  I was hoping that my 2nd order polynomial fit, performed around the pulse peak, also might help.  Presumably a peak caused by the overlap of two pulses won't be as "nice" in terms of the goodness of fit.  But, given the noise levels I'm seeing, I'm starting to think that my polynomial fit may not buy me much in that regard.  One problem with the fitting routine is that my ADC sample rate is slow enough to limit the number of samples around the peak.  I'm using 10 samples at this point.  A 1MSPS ADC would more than double that number of samples, plus the ADC resolution would be much better.  The Teensy ADC's ENOB is around 10 bits.


----------



## WobblyHand

homebrewed said:


> I don't think that correlation would help.  Each (good) pulse represents one x-ray photon, which could come from an iron or nickel or chrome or cobalt or molybdenum or vanadium or manganese atom (etc.), so attempting to combine pulses wouldn't do us any good.
> 
> The trigger is a simple fixed value.  However, my ADC ISR includes a low-pass filter, whose value is subtracted from the raw ADC data before being entered into my circular buffer.  But it's even a bit more complicated than that.  The startup code examines the data coming out of the ADC and extracts the RMS noise, then sets a data-clip value that is equal to 3*RMS + the low pass filter value.  This in turn is used to reject pulses so they don't push the low pass filter voltage around too much in the ISR.
> 
> Also, to reduce the possibility of noise triggering the pulse processor I keep a rolling average of the last 8 ADC samples and trigger on that.


Correlation sometimes helps, other times it devolves into a mess.  Since you currently have the means to collect and store data you are on the forefront of all this, it's obviously your judgement on how to proceed.  I'm just a bystander at this point, but would like to help if I can.

How do you extract the RMS noise?  What do you use for the noise estimator?  I have learned that this subtraction process can come with it's own problems, namely it actually can increase noise if done without care.  A simple subtraction of random variables always increases the variance of the resultant.  However, if the estimate has low variance we can minimize the SNR loss.

The 3*RMS noise estimate is roughly a 10 dB SNR threshold plus your local estimate.  Since the local average can be heavily biased by the energy of a local pulse, you may be inadvertently raising your threshold, which may cause you to miss detections.  This is why I recommend using a median filter which tends not to be biased by noise impulses or local energy.  Using a median filter for local noise estimation is the basis for OS-CFAR detection.  (Ordered Statistic Constant False Alarm Rate).   Anyways, just a suggestion.  I have used OS-CFAR for decades in preference to other schemes as it behaves a lot better in real life than cell averaged cfar.  I think what you have implemented is practically equivalent to CA-CFAR.  JMHO.


----------



## WobblyHand

homebrewed said:


> For now I'm simply discriminating on the pulse width.  Pulse overlap = a longer pulse.  I was hoping that my 2nd order polynomial fit, performed around the pulse peak, also might help.  Presumably a peak caused by the overlap of two pulses won't be as "nice" in terms of the goodness of fit.  But, given the noise levels I'm seeing, I'm starting to think that my polynomial fit may not buy me much in that regard.  One problem with the fitting routine is that my ADC sample rate is slow enough to limit the number of samples around the peak.  I'm using 10 samples at this point.  A 1MSPS ADC would more than double that number of samples, plus the ADC resolution would be much better.  The Teensy ADC's ENOB is around 10 bits.


Ah, the fitting is kind of a correlation, I think.  That might help.  Certainly lower computation load.

Its a bummer that the newer Teensy 4.x has only 10 bit ENOB.  To be honest though, the 3.x chips aren't hugely better.  They might have 10.5-11 bits.  Based on my Doppler chronograph, it was about 66 dB dynamic range on an M4.  I think Teensy 3.5 is an Arm M4 processor.


----------



## homebrewed

WobblyHand said:


> Since the local average can be heavily biased by the energy of a local pulse, you may be inadvertently raising your threshold,


My "low pass filter" code rejects data that exceeds my baseline+noise estimate in an attempt to prevent pulses from affecting the threshold.  I long ago figured out that classic analog-based approaches to things (like PID controllers) can be sub-optimal compared to more intelligent methods that can only be implemented in S/W.

But more eyes can offer a different perspective.  I just uploaded my latest code to my Gdrive so folks can give it the once-over.  Like I said earlier, I think it's rejecting more pulses than it should, so definitely still a work in progress.  Here's the link.  Anyone who uses the link should be able to access the file.


----------



## WobblyHand

homebrewed said:


> My "low pass filter" code rejects data that exceeds my baseline+noise estimate in an attempt to prevent pulses from affecting the threshold.  I long ago figured out that classic analog-based approaches to things (like PID controllers) can be sub-optimal compared to more intelligent methods that can only be implemented in S/W.
> 
> But more eyes can offer a different perspective.  I just uploaded my latest code to my Gdrive so folks can give it the once-over.  Like I said earlier, I think it's rejecting more pulses than it should, so definitely still a work in progress.  Here's the link.  Anyone who uses the link should be able to access the file.


Appreciate the link.  I will take a look in a couple days.  

A median filter sort of behaves linearly for stuff that's noise like, practically low pass filter like but rejects high amplitude impulse junk.  Sometimes it's a great solution.  It's used in many automotive radars.  It's rather immune to false biasing and maintains the threshold in the correct place. This results in fewer missed detections.  False negatives, we called them.  It's not the only technique that can work, but it is rather robust to enormous variation in operating conditions.  There are millions of automotive radars using this or related methods for detection.  It might work for this application.


----------



## WobblyHand

Forgive me if you already do this, but do you have a software repository set up?  Might facilitate development, or at least better manage it.  I have done this for my larger home projects.  What's nice about this is backtracking or development of advanced features without messing up the main development.  I can try out stuff without breaking what works.  The software branches are independent of one another.

When I develop over a 1000 lines of code, I don't want to risk breaking it.  A repository allows me to backtrack to any point.  Of course one has to comment enough on one's changes, but that should be second nature for most.  I comment both my source code and my commits because typically I'm the only developer and I don't have anyone else to ask.  In a couple of weeks, I've usually forgotten some tricky bits, so I comment profusely.  Defensive coding, for myself...  Seems to work for me anyways.


----------



## homebrewed

WobblyHand said:


> Forgive me if you already do this, but do you have a software repository set up?  Might facilitate development, or at least better manage it.  I have done this for my larger home projects.  What's nice about this is backtracking or development of advanced features without messing up the main development.  I can try out stuff without breaking what works.  The software branches are independent of one another.
> 
> When I develop over a 1000 lines of code, I don't want to risk breaking it.  A repository allows me to backtrack to any point.  Of course one has to comment enough on one's changes, but that should be second nature for most.  I comment both my source code and my commits because typically I'm the only developer and I don't have anyone else to ask.  In a couple of weeks, I've usually forgotten some tricky bits, so I comment profusely.  Defensive coding, for myself...  Seems to work for me anyways.


At this point as I implement major changes I increment the version # and keep the old code so if I break something I can backtrack.

I also comment my code pretty extensively, for pretty much the same reasons.

If this project actually produces some usable results it will be time to get more formal about managing the code so other folks can work on it, too.  Perhaps use github or the like.  So far I haven't done that for anything I've written, but it really hasn't been written for anyone else but myself.   The exception was some graphics and animation stuff I did for the old Atari ST platform.  That was in the 80's......and a lot of it was written in Forth.


----------



## WobblyHand

Based on what I am seeing, there will be tangible results.  Think you are heading in the right direction.


----------



## homebrewed

WobblyHand said:


> Based on what I am seeing, there will be tangible results.  Think you are heading in the right direction.


The proof of the pudding is in the eating, as they say .

I'm not in a place where I think what I'm doing is THE right way to do things.  Like I have said many times before, we STILL don't have a lot of results so who knows what the final system will be.  It's clear to me that you have a lot of experience in dealing with noisy signals:  and one of the keys to getting good results out of a cheap xray detector is going to be noise management.  I am convinced of that (I think @graham-xrf is, too).  I am totally open to suggestions on ways to turn that lemon into lemonade, whether that's S/W or H/W design (most likely both).  Based on that, I think it probably IS time to set something up so other folks can mess with the code.  Or at least examine it to come up with something that functions the same on different platforms.

But we need to consider the fact that different systems could be fairly different w/regard to overall gain, noise level, bandwidth etc.  A well done hardware layer would help a lot. OR:  fix things on the hardware level and define the parts so they're affordable for interested DIYers and perform well enough for the task at hand.  Again, some vigorous discussion on that side of things is needed.

BTW, congratulations (I think) on posting #1000 in this thread......who'd a thunk it??

#1:


graham-xrf said:


> I have some chunks of nice steel, 31mm thick and 120mm x 60mm (about 1.2" thick and 4.7" x 2.3").
> The 31mm apart faces are parallel to within a tenth thou, so they are sometimes handy as a sort of fat parallel, but the perimeters are not as in a rectangular block. They have the profile of whatever hydraulic pump kit they were originally destined for.
> 
> They don't rust - so not just some nearly tool steel.
> They are magnetic, so mostly iron in there.
> 
> It seems there is not much between the "spark test" on a grinder, and some expensive kind of analysis.
> I can't afford one of those FLIR things which are only cost-effective if they are identifying exotic stuff all all day long.
> Trying for density once let me identify a nice chunk of titanium, but I did have some other clues.
> 
> Is there some lower cost way of figuring out what is in the alloy?


----------



## WobblyHand

Happy New Years to all the hardy souls that have weathered this epic thread.

Wasn't aware of making the 1000th post, but that's amazing.


----------



## WobblyHand

Just got back from visiting my kids, and have downloaded @homebrewed 's code.  Where can I find FastPeak.h?  
Will have to look at this in the next day or so.  Kind of worn out from 10 hours on the road...


----------



## homebrewed

WobblyHand said:


> Just got back from visiting my kids, and have downloaded @homebrewed 's code.  Where can I find FastPeak.h?
> Will have to look at this in the next day or so.  Kind of worn out from 10 hours on the road...


There is a sub-folder inside the XRF drive folder I posted a link to.  Drill down to the "src" folder.  The link should be here if it turns out the sub-folder isn't shared.

I've been doing some additional debugging and have managed to eliminate most of the "malformed pulses" problem.  Unfortunately, it was accomplished using some random experimentation so I still am not certain WHY my code was working that way.  Probably another head-slapper when I figure it out .

I don't envy your long drive.  The older I get, the less fun that kind of stuff gets.  Our most-recent long road trip was an 11 hour drive from my wife's sister's place back home.  Yet another wedding.  Fortunately it was a little earlier in the season so we didn't have to worry about snow.   It helps to regularly switch places between driver and navigator.  Fortunate that way.


----------



## WobblyHand

homebrewed said:


> There is a sub-folder inside the XRF drive folder I posted a link to.  Drill down to the "src" folder.  The link should be here if it turns out the sub-folder isn't shared.
> 
> I've been doing some additional debugging and have managed to eliminate most of the "malformed pulses" problem.  Unfortunately, it was accomplished using some random experimentation so I still am not certain WHY my code was working that way.  Probably another head-slapper when I figure it out .
> 
> I don't envy your long drive.  The older I get, the less fun that kind of stuff gets.  Our most-recent long road trip was an 11 hour drive from my wife's sister's place back home.  Yet another wedding.  Fortunately it was a little earlier in the season so we didn't have to worry about snow.   It helps to regularly switch places between driver and navigator.  Fortunate that way.


Thanks, got the file.  

Yeah, some of those bugs can be head slappers.  Usually after I fix one of those, I write some additional comments in the code, explaining the fix, so the future me doesn't undo those fixes!  It's a double head-slapper to fix it again...

I used to like to do these drives.  Now it's not as fun.  Could be be vehicle, or more likely the traffic.  Driving is the easy part, watching out for the nut jobs on the road takes active work and sometimes avoidance.  

Actually, this drive was pretty easy.  Had good weather all the way, and driving on an "extra holiday" helped since the traffic was kind of low.  Started out at 9:30am, got home at 7PM.  Made a stop for lunch and gas, and then a stop for dinner.  Got to say though, the last hour or so, I just wanted to be home.


----------



## homebrewed

I just clicked on the "pay" button to get 5 partially-assembled PCBs from JLCPCB.  It is a 1MSPS ADC on a 4-layer board with through-hole plating, solder mask and silk screen on both sides of the board.  The assembly includes most of the passive components -- JLC didn't have the headers or active components (a low-noise opamp and the AD7667 A/D).  Total cost plus shipping for 5 boards came to a bit less than $17.

Here's an image of the board.  It isn't quite current because I added 4 mounting holes.




The board is designed to be compatible with either the Teensy4.0 or 4.1, although the T4.1 should work a little better because it can load all 16 bits at once, while the T4.0 will have to toggle the "BS" pin to load the upper 8 bits.


----------



## homebrewed

While (once again) browsing through Digikey's selection of large-area photodiodes I came across some parts made by OSI Optoelectronics.  They have a photoconductive version that is 9.7x9.7mm.  It has wire leads and only costs $21.84 in unit quantities!  The so-called "photoconductive" version is claimed to have faster response.  It's not a PIN detector so I don't know how it would do as a straight x-ray detector, but it might be OK when coupled to a scintillator.  The part number:  S-100CL.  Like the detector used in the pocketgeiger it has a rather large dark current and capacitance.


----------



## graham-xrf

I am not really functioning well enough yet, but I am enough here to be saying I really love Mark's board. Getting the difficult bit ready assembled seems the thing to do. 

At the times when I am up,  I let YouTube run free. Somehow in between getting completely charmed by the two lovely ladies from Baccara doing "_The Devil Sent You to Laredo_", and high voltage PMT circuits, I came across an interesting tear-down video of a XRF gun.

It uses 40kV X-rays, possibly to excite a silver mirror to yield 22.1KeV and 24.9KeV excitations. The detector cannot see anything lighter than Titanium (about 4.5 and 4.9KeV). Interesting physical layout. The voltage multiplier is filled with oil. I am doubtful about the guy's physics explanation of electron state excitation, because I never thought photon excitation requires the atom become ionized.

Also, at the end, we discover an XRF gun that uses a "cartridge" of plastic tape to make the X-Rays. Apparently from a known phenomenon that when one pulls plastic packing tape off the reel, it does more than make high voltage static charge on the tape. It seems one also gets X-Rays!

*Demo and teardown of an X-ray fluorescence gun (measures chemical composition)*


----------



## rwm

That is a great video! I think this illustrates the simplicity of the Americium emitter design vs an xray tube or other means. Whatever happens you guys need to make sure your gun makes cool noises...


----------



## graham-xrf

rwm said:


> That is a great video! I think this illustrates the simplicity of the Americium emitter design vs an xray tube or other means. Whatever happens you guys need to make sure your gun makes cool noises...


Huh!
OK, to that end, we maybe need stuff from some early project of Mark's. If Arduinos can make pingy whistle and tone noises, then a Teensy can do also.

Actually, a Geiger counter sounding type tick, speed controlled non-linear, signalling some counts are coming in, might appeal to some, and provide some user feedback that something is working a little. I get it that the gadget in the video looked like a ray gun, and has a "trigger". It was probably inevitable they would add a blaster sound effect.

I am perfectly OK with dead silent, but I just know some would like a airport chime, or a trumpet fanfare when the plot arrives with a composition display and a guessed-at material ID. The snobby aficionados of "Star Trek" will want the full Tri-Corder bleeps  "à la mode du Dr Spock" !   

Robert, you are quite right about the simplicity of our design. Sure, we know that "simple looking, elegant, very few components", etc. masks very deep design thought, and crazy clever software. We may eventually have some armchair critics who will say "that whole thing is dead simple, hardly anything in it. Almost anybody could do  that" !


----------



## WobblyHand

Teensy's are pretty good at music, so we could add sound effects.  PJRC sells an audio board and has a lot of audio signal processing tools.  Or course, this is all frills, and adds cost, but would be fun to add!


----------



## rwm

I was actually kidding but how about Geiger clicks followed by an alert when the sample is finished?!


----------



## homebrewed

rwm said:


> I was actually kidding but how about Geiger clicks followed by an alert when the sample is finished?!


Oh no, now it's a feature  

That x-ray generator using "tape" is pretty interesting.  According to the video it really is a system that uses a piece of silicon brought into contact with some other material (probably teflon), then pulled back (repeated ad infinitum).  The resultant triboelectricity generates static discharges and is high enough in voltage to generate xrays.  Very clever, indeed.

Years back I thought of a scheme to generate fairly high voltage using something that on first examination looks like a Wimhurst static machine, with two anti-rotating disks that have a series of round metal patches on each one.  But my core idea was to charge a capacitor when the two capacitor plates were very close together -- when the capacitance is highest -- then rotate the two plates away from each other.  Since the total charge has to remain the same (in the absence of leakage), and the capacitance decreases due to the increased separation, the voltage across the capacitor had to increase.  Q = CV.  Rearranging some things we get:  V = Q/C.  So as C decreases, V must increase.  Say we start with a 1nf capacitor charged to something easy to generate, like 100V.  That comes to Q = 1E2 * 1E-9 = 1E-8 coulomb.  Now decrease the capacitance to .1pf, 1E-13 farad.  V = 1E-8/1E-13 = 1E5 = 100KV..... that should be be enough to make some x-rays!   BTW 1nF for an air-dielectric capacitor is pretty big so this thing wasn't miniature in any sense of the word.

My stated scheme was to use it as the voltage source for a hydrogen pulse-discharge UV laser for a work-related problem:  but the REAL purpose was to scare the **** out of my boss so he would just buy us what we needed.

Anyway, it might not even be necessary to use anything very exotic to make some pretty decent high voltage.  An intriguing thought.

Lest anyone think this is getting high voltage for virtually no power input, the capacitor plates do attract each other so some work has to be done to pull them apart.


----------



## graham-xrf

Making high voltages at low current is (relatively) easy.
40KV at 7mA is not, and I would rate that as lethal, or at the very least, bloody dangerous!
Several Cockroft-Walton voltage multiplier stacks, all in series, each separately excited by that one-turn toroid, and all dunked in oil is great to look at, or play with, but is complicated, and expensive!

Having the high voltage alone is not enough to make X-Rays. It needs electrons to happen, and get get accelerated, and target collisions, and that generally does not happen easily in air. I don't know enough about that "tape effect". If the effect is real, then something special is happening at the interface of the tape separation, perhaps within the tape. Apparently patented, (not the same thing as being a real worthwhile thing), it's still moving parts and complications. There is not much that can come close to a smoke detector source as a convenient way of getting a X-ray response out of stuff you put in it's way.

I am making the effort to get back to the KiCAD, maybe to catch up to Mark a bit. Unfortunately, it still has to be in between hangover-like spells, but things are improving.


----------



## rwm

It is kind of interesting that they built the hardware separately and plugged a HP tablet into the gun to do the processing and data point fitting. That makes sense in the way you are approaching this. They are almost separate projects. 

This thread is now so long that I have lost track of where we are and what has been decided! 
Can someone summarize the thinking so far? What is the current thought on the best type of detector, signal processing, etc. 
I for one, would really like to build this but I do not have the software and computing background to do so. I can put the parts together but I will be dependent on you guys for the rest!


----------



## homebrewed

graham-xrf said:


> Making high voltages at low current is (relatively) easy.
> 40KV at 7mA is not, and I would rate that as lethal, or at the very least, bloody dangerous!
> Several Cockroft-Walton voltage multiplier stacks, all in series, each separately excited by that one-turn toroid, and all dunked in oil is great to look at, or play with, but is complicated, and expensive!
> 
> Having the high voltage alone is not enough to make X-Rays. It needs electrons to happen, and get get accelerated, and target collisions, and that generally does not happen easily in air. I don't know enough about that "tape effect". If the effect is real, then something special is happening at the interface of the tape separation, perhaps within the tape. Apparently patented, (not the same thing as being a real worthwhile thing), it's still moving parts and complications. There is not much that can come close to a smoke detector source as a convenient way of getting a X-ray response out of stuff you put in it's way.
> 
> I am making the effort to get back to the KiCAD, maybe to catch up to Mark a bit. Unfortunately, it still has to be in between hangover-like spells, but things are improving.


7mA @40KV comes to 280 watts, a lot more power than needed for XRF.  I thought the narrator said 7 micro-amps but if he said milliamps, he misspoke.  We had a real-time Xray unit at work that could put that kind of power into a target, and the Xray gun was NOT a cute little glass vacuum tube.

The capacitance at the final output stage of a voltage multiplier capable of sourcing 7 uA still could give you a nasty jolt!

BTW I totally agree with the convenience factor of using smoke detector capsules.  It's interesting to see what lengths inventors sometimes will go to in order to come up with a unique (patentable) item, but that approach often comes to naught.


----------



## graham-xrf

homebrewed said:


> 7mA @40KV comes to 280 watts, a lot more power than needed for XRF.  I thought the narrator said 7 micro-amps but if he said milliamps, he misspoke.  We had a real-time Xray unit at work that could put that kind of power into a target, and the Xray gun was NOT a cute little glass vacuum tube.
> 
> The capacitance at the final output stage of a voltage multiplier capable of sourcing 7 uA still could give you a nasty jolt!


Hmm - sorry, my mistake. He did say "micro-amps", so then 0.28 Watts. I rate that at the top end of nasty!
I guess I got conditioned by the eBay common definition of what is a "milli"amp when claiming 50,000mAh for phone sustainer USB battery packs


----------



## WobblyHand

Wonder what the net capacitance is in that circuit.  1nF charged to 40kV is 0.8 J, which might kill you.  

I was shocked by a Van de Graaff generator that had about 0.1J and I collapsed on to the floor due to involuntary muscle contraction.  I'm darn lucky it was through my right hand and right leg.  Spark was well over 3 feet long in air to my idiotically pointed finger.  One moment I was pointing to corona, the next moment I was on the floor because nearly every muscle on my right side contracted at once.  I simply fell over.  Was sore for a while...


----------



## graham-xrf

rwm said:


> It is kind of interesting that they built the hardware separately and plugged a HP tablet into the gun to do the processing and data point fitting. That makes sense in the way you are approaching this. They are almost separate projects.
> 
> This thread is now so long that I have lost track of where we are and what has been decided!
> Can someone summarize the thinking so far? What is the current thought on the best type of detector, signal processing, etc.
> I for one, would really like to build this but I do not have the software and computing background to do so. I can put the parts together but I will be dependent on you guys for the rest!


Sorry Rob - you have been patient. Allowing that you have kept up with us, and already understand the principles, Let me try for others..

1. We have had an expanded discussion that was all about self-learning, teasing out the rubbish, and evaluating all the ways this can be done. We are agreed that using some smoke detectors, and an available large area PIN diode is a feasible way to excite stuff into making X-rays, and detecting them. The stress has been on simplicity, and lowest cost, consistent with getting a really worthwhile result.

2. We have minutely explored, dissected, criticized, and simulated circuits that will do this stuff. One very viable method involving high gain photomultiplier detector tubes, and scintillators that make measurable flashes of light is put aside. Good as it is, the bits are hard to come by, and need high voltages. We go for the PIN diode, stolen off a Pocket Geiger project, because that's still the cheapest way.

3. We have figured out, and fully understood how to quantify the energy in the X-ray florescence flashes, in a relative sense calibrated against known sample materials. We have some fully developed (free) software used in Universities for studies at CERN and similar projects called PyMCA. It runs OK on the tiny computing boards we intend to use - if we use it. We also understand enough to hang together much of our own code. The software will accumulate statistical counts of returns of similar energy, providing a way to estimate the proportions of elements seen.

4. We are agreed on the importance of capturing and preserving as much information as possible without it becoming lost in circuit noise, whether from unwanted interference, or simply from the molecules in the amplifier components bashing about. It turns out the ADC (Analog-to-Digital) component performance is as critical as the high-gain low noise amplifier.

5. Mark has put together some experimental arrangements to get actual pulses to happen, and done extensive work in using software to aid evaluating the detected pulses, both to filter out the useless, and to measure the good ones. Mark and I end up using ADC chips that are so nearly identical that they can fit on the same tracks, with only some differences in specification. I think Mark's choice is better value. Mark now has a PCB board design that carries the critical components, and has ordered one with the difficult surface mount assembly already done.

6. I think we are at a fairly advanced experimental stage. Even as we may get some setups functioning, we have to pull together a physical mounting that is reasonably easy for anyone to put together - but as a suggestion. There is plenty of room for anyone to get creative about how to package the whole thing. I am taking a similar path as Mark. In many ways, our view of the critical parts has converged, to the extent we almost end up with the same basic circuit. The small computing board that manages the data count collection can be any that is capable. I happen to be using Raspberry Pi, but it could as easily be a Teensy.

I know - I have left a lot out!


----------



## homebrewed

graham-xrf said:


> I know - I have left a lot out!



Sure, but there really has been quite a sorting process to get to where we are.  I suppose the most striking thing about it is that it's all been on public display.....and perhaps that we are still communicating in meaningful and cordial ways .


----------



## graham-xrf

*About the physical front end design.*
Taken from the tear-down video when I was not being so excessively distracted by Mayte Mateos (Baccara).
The feature at the sharp end deserving of the zap-ping sound effect had a 45° corner "reflector" looking thing which the presenter said was "silver".

Then we also discover that the front of the zap gun was not open aperture, but instead blocked by a sheet of metal acting "transparently". OK - that would make it thin aluminium, just like with the scintillator receptacles on the front of photomultiplier tubes. This is something I think we should have!

If it were, say, 0.5mm (about 0.020") very pure aluminium, or anything we find handy, there are advantages. Even something from one of those slightly thicker products like the foil tubs used for Chinese take-away food. That kind of foil is pure, as opposed to sheet metal alloy.

Using this allows the entire diode front end with circuit to be shielded. Sure, from light (although ours has black paint anyway), but mainly, it constructs a total Faraday cage that will not allow any external electric fields, and all but very low frequency (60Hz) magnetic fields, to exist inside. We would not be waving around a diode antenna with 80dB+ gain. You could bring your hand up to it without stray capacitance coupled effects.

Aside from having built in a 50/60Hz deep notch filter in the design, I think if the connections to the diode were  low capacitance, fine wire, PTFE insulated twisted pair threaded through small ferrite toroids, then 60Hz magnetic fields might well be substantially excluded, and with way less bother than trying for mu-metal shields.
--------------------------------------

*Making more photon collisions*
This gets more subtle, and I admit, I don't really know what goes on here. This is just what I be thinking..
Back to the tear-down design.
My first thought was that the whole point of standing something metal at 40°, or perhaps somewhat less, would be to "redirect" the X-ray beam, but we know that X-ray "beams" do not get "reflected" like light off a mirror. If the intention was to get a shower of lower energy photons, say from silver, then getting them from the first surface, as opposed to those that might have to make it right through, does make sense. This, I think, would also be "second-hand xrf working on the leftovers of a first silver collision xrf" ! Could this actually be a great idea?

*The excitation question(s).*
So I think on back to a fundamental question I never did get to learn the answer for.
_"When a higher energy (60KeV) photon arrives and excites some xrf photon out of an atom, is that the end of it for the 60KeV photon"?_
What if it only provoked (say) some 5.4KeV flash from chromium. What happens to the rest of the energy?
Can we expect we might get both 5.4KeV AND 5.9KeV xrf photons out of the same atom of chromium?
Crucially, might these happen at the same time? Perhaps not.
It may be that an entire 60KeV incoming photon may be expended (wasted?) in only producing one flash at a time.

There is an actual delay before the elevated electron drops out of it's excited state. and I have no idea whether a single incoming photon can excite both Kα1 and Kβ1 states in one go, nor whether they flash out simultaneously.
Can a single higher energy (60KeV) photon ever wring more than one xrf flash out of a pile of atoms?

*Back to the "silver" target on the zap gun*
Here, of course, we do not have the occasional single arriving photon. We have a "beam", like light, of presumably zillions of them, all colliding into the tilted piece of "silver".  If that is what it is, it makes a shower of 22.16KeV and 24.94KeV photons. Given that the zap-gun only had 40KV to start with, these can only be one photon kind at a time.

I had first thought that this might be a handy way to get a huge increase in xrf returns from the material under test, but it cannot be! It also excludes getting returns from all elements heavier than silver. Have we missed something? Can X-ray "beams" ever be "reflected".

From all the above, I end up very much liking the aluminium front cover, and I fail to understand the motivation for the "silver" plate deflector-looking thing.


----------



## rwm

If I am reading the comments on You tube correctly, the metal foil is 8um beryllium foil. Very fragile. Check my work.

My understanding is that the incoming gamma photon excites multiple electrons in the sample in series until it loses all energy. Many of these are outer orbital electrons and we will not see the low energy emitted from these. However, some of these will be characteristic xrays (k shell) and that is what we are picking out.

The xray tube in that device creates a polychromatic beam with 40kV peak energy. The curve is not Gaussian but is skewed to the higher energies. My guess is the idea behind the silver is to create a monochromatic beam (secondary xrays from silver) so you are bombarding the target with only one (or 2?) discrete energies. Again, this scheme is unnecessarily complex if you have a radionuclide gamma emitter as in your design.


----------



## homebrewed

I too have been mulling over the function of the silver foil.  I don't think it is used to increase the x-ray flux because the maximum energy from the x-ray tube is only high enough to get one 22Kev photon from an incident 40Kev photon.  It _might_ be used to reduce the energy of the photons hitting the sample, to avoid exciting other transitions that would muddy the water, so to speak, but that is pure speculation on my part.

If the point is to have a monochromatic x-ray source, our Am241 fills that role nicely, without needing any silver to do it thankyouverymuch.

One phenomenon that affects all types of x-ray based elemental analysis tools is secondary fluorescence, where additional x-rays are generated by higher-energy fluorescence x-rays coming from elements with higher atomic numbers.  If we look at iron's k-alpha line, which is 6.4kev, that could be excited by an x-ray coming from something like tin, which has a k-alpha line of 25.2kev.  So a lot of tin would screw up a simple calculation for iron concentration.  I view that as a complication that wouldn't affect the kind of setup we're working on because ferrous alloys aren't going to have much, if any, silver present.  Nickel's xray line is a _little_ more energetic than iron's, but the difference is small enough that secondary fluorescence from that interaction would be down in the mud.

Effects like Compton backscattering will be present no matter what kind of source you're using.  For this kind of thing, system geometry is the primary determination of how many backscattered photons get into your detector.  Some papers I've looked at suggest our geometry is about the best for reducing the amount of backscattered xrays.


----------



## graham-xrf

rwm said:


> If I am reading the comments on You tube correctly, the metal foil is 8um beryllium foil. Very fragile. Check my work.
> 
> My understanding is that the incoming gamma photon excites multiple electrons in the sample in series until it loses all energy. Many of these are outer orbital electrons and we will not see the low energy emitted from these. However, some of these will be characteristic xrays (k shell) and that is what we are picking out.
> 
> The xray tube in that device creates a polychromatic beam with 40kV peak energy. The curve is not Gaussian but is skewed to the higher energies. My guess is the idea behind the silver is to create a monochromatic beam (secondary xrays from silver) so you are bombarding the target with only one (or 2?) discrete energies. Again, this scheme is unnecessarily complex if you have a radionuclide gamma emitter as in your design.


Excellent! Thank you for getting at the detail, and for providing the explanation that an incoming gamma photon can expend it's energy into more than one spin, and more than one shell, and even into more than one atom "in series", if there is enough energy left over.

Beryllium, having only one possible electron shell, has traditionally been the material of choice for X-ray transparent windows. Crude (and hazardous) precipitates cost about $4/gram for element collectors on eBay. Actual metal foils 3/4" diameter, 0.0005" thick I see for $400 for six, not including $16 for shipping. This is maybe not for us!

*What might we detect?*
Between beryllium and aluminium are several that we would love to get some counts from, these being carbon, oxygen, flourine, sodium, and magnesium, but I don't think those are likely. I think we may have to infer the presence of these if we identify a probable alloy from the bigger returns.





Suppose we go for it, and consider whether we might see aluminium. In theory, we might. One might have to increase the gather time to a couple of minutes or more. The PIN diode response probability for 1.48KeV is down to about 2%, meaning a count of only a couple of hundred out of several thousand incoming smoke detector photons.

Letting the bias become 6.6V (2 lithium cells) instead of 10V (3 cells) lowers the dark current from around 2.5nA to about 2nA, and the capacitance increase is from about 82pF to 100pF. The benefit in dark current noise, is hardly worthwhile. The change in capacitance is not going to lower the signal significantly. From the response of the PIN diode, and with the amplifier hoped-for noise figure, and the 91dB possible SNR from the ADC, we might marginally detect aluminium, sometimes. Magnesium is (just about), theoretically possible. Sodium is at probability 0.1%, would yield a count of about 20, even if 20,000 photons were expended on it. That could take much more than a couple of minutes!

Realistically, I think we can happily re-purpose the Chinese take-away aluminium foil tub after eating the contents, and use it for shielding. If I thought we could ever detect aluminium, magnesium, ans sodium, I would think to a conductive carbon shield window, instead of beryllium.

The more we mull this stuff over, the more I become convinced we have got it exactly right!


----------



## graham-xrf

homebrewed said:


> I too have been mulling over the function of the silver foil.  I don't think it is used to increase the x-ray flux because the maximum energy from the x-ray tube is only high enough to get one 22Kev photon from an incident 40Kev photon.  It _might_ be used to reduce the energy of the photons hitting the sample, to avoid exciting other transitions that would muddy the water, so to speak, but that is pure speculation on my part.


Yes - exactly as I said, simply because any silver output needs more than half the 40kV.

Do you have a slightly bigger image, or something that I may include a Teensy preferred interface pinout?


----------



## homebrewed

graham-xrf said:


> has ordered one with the difficult surface mount assembly already done.


I guess it depends on one's ability to hand-solder a 48LQFP.  I wouldn't have gone with the price JLC wanted for the ADC -- it was about 2X the Digikey price-- had they had it in stock.  Hand soldering LQFP's is a lot easier if you apply solder flux first, it helps keep the solder confined to the lead you're soldering down.  You actually can pre-tin the PCB footprint w/o problems if you put solder flux down first.  

I haven't used solder paste because I don't have a good way to apply it.   However, in the case where you already have most components soldered down (including some on the back of the PCB), I think that hand soldering probably is the best way to go.


----------



## graham-xrf

homebrewed said:


> I guess it depends on one's ability to hand-solder a 48LQFP.  I wouldn't have gone with the price JLC wanted for the ADC -- it was about 2X the Digikey price-- had they had it in stock.  Hand soldering LQFP's is a lot easier if you apply solder flux first, it helps keep the solder confined to the lead you're soldering down.  You actually can pre-tin the PCB footprint w/o problems if you put solder flux down first.
> 
> I haven't used solder paste because I don't have a good way to apply it.   However, in the case where you already have most components soldered down (including some on the back of the PCB), I think that hand soldering probably is the best way to go.


Given the design convergence, but the very different physical mounting of the PIN diode between concepts, I had in mind to get a first PCB in step-and repeat with as many as I could fit on the standard area board, and also to make circuit options up to the ADC as experimenter-friendly as possible. Also, I want, as much as possible, to simply follow, and include interface to Teensy as you might prefer. I know I will probably have some collateral damage on the way, and I may well be picking on your experience in re-flow soldering these things.

Once I have the KiCad layout, even though it be a bit of a prototype, I should have enough spare PCBs to distribute to the few here who are interested, and might want to play. My scheme uses a little separate PCB to mount the PIN diode, but I can include a link-able option to mount one direct on the mother PCB.


----------



## WobblyHand

If you don't have a stencil and a way to apply solder paste, you can use solder paste in a syringe with a small bore needle.  I have been able to solder DFN8 devices that way as well as larger devices.  Using the syringe under the microscope I can apply the paste to the tiny pads with some effort.  A stencil is a heck of a lot easier!


----------



## rwm

Please take pics of your soldering process.
Hey can someone review why this device will be superior to the Theremino project? What are we improving on?

I just realized that if we get bored with 59 KeV we may have other options to see heavier elements.
I am not sure if these have enough activity but multiple sources and longer acquisition times?





						RSS-8 Alpha, Beta, Gamma Disc Source Set [RSS8] - $480.00 : Direct Scientific, Radiation Detectors for Sale
					

Direct Scientific RSS-8 Alpha, Beta, Gamma Disc Source Set [RSS8] - Designed for gamma spectroscopy, the RSS-8 contains eight different gamma emitting isotopes covering the entire energy range from 32 to 1333 keV. Also included in the set is a mixed source of Cs-137 and Zn-65 which students may...



					www.drct.com


----------



## homebrewed

graham-xrf said:


> Do you have a slightly bigger image, or something that I may include a Teensy preferred interface pinout?


Are you talking about making something like an ADC shield?  Funny you should bring that up, I was thinking about that last night.

I've attached a PDF version of the current layout, with top metal, silkscreen and the ground plane.  This is the design that's being fabbed and stuffed.  The board dimensions are 75 x 35.2mm.  I moved the two 8-pin headers to accommodate the mounting holes:  but if it's turned into a shield it won't need mounting holes.

Right now I don't know if it would be possible to have a pinout that's compatible with both T4.0 _and_ 4.1.  I now have one of each with the product card so it won't be too difficult to check that.

BTW it appears that EasyEDA has PCB footprints for both the T4.0 and 4.1.  An adapter board is certainly possible but it would be best if we could avoid that.  A complicating factor is that the choice(s) available for 8/16 parallel input pins are fixed so there's no wiggle room there.  The control pins are a different story.


----------



## WobblyHand

rwm said:


> Please take pics of your soldering process.


If addressed to me, for one offs, I have a 15gm syringe with solder paste in it.  There's a 26 or 28 awg needle on it.  I just squeeze out the paste on to individual pads, place the part and use a hot air gun.  There's no way to take a picture, because my hands are full!

This is not practical for most boards.  For them, I'd get a stencil made and squeegee the paste on, place the parts and put it in a dedicated toaster oven to reflow, if I were to do it at home.


----------



## homebrewed

rwm said:


> Please take pics of your soldering process.
> Hey can someone review why this device will be superior to the Theremino project? What are we improving on?


I think the final system will be designed to be portable.  My current approach is NOT portable but that was a deliberate decision, to avoid the additional complication(s) involved.  For instance, I'm using bench supplies and all the different parts are strung out on the bench.  To make an analogy, it makes no sense (to me anyway) to work on the body color when we don't know what shape the automobile is going to have.


----------



## WobblyHand

homebrewed said:


> Are you talking about making something like an ADC shield?  Funny you should bring that up, I was thinking about that last night.
> 
> I've attached a PDF version of the current layout, with top metal, silkscreen and the ground plane.  This is the design that's being fabbed and stuffed.  The board dimensions are 75 x 35.2mm.  I moved the two 8-pin headers to accommodate the mounting holes:  but if it's turned into a shield it won't need mounting holes.
> 
> Right now I don't know if it would be possible to have a pinout that's compatible with both T4.0 _and_ 4.1.  I now have one of each with the product card so it won't be too difficult to check that.
> 
> BTW it appears that EasyEDA has PCB footprints for both the T4.0 and 4.1.  An adapter board is certainly possible but it would be best if we could avoid that.  A complicating factor is that the choice(s) available for 8/16 parallel input pins are fixed so there's no wiggle room there.  The control pins are a different story.


I have a KiCAD T4.1 footprint that I used successfully on my ELS board.  Let me dig it up.  I found the zip file with all the Teensy's.  It's 6MB, hope it goes through.


----------



## homebrewed

WobblyHand said:


> If addressed to me, for one offs, I have a 15gm syringe with solder paste in it.  There's a 26 or 28 awg needle on it.  I just squeeze out the paste on to individual pads, place the part and use a hot air gun.  There's no way to take a picture, because my hands are full!
> 
> This is not practical for most boards.  For them, I'd get a stencil made and squeegee the paste on, place the parts and put it in a dedicated toaster oven to reflow, if I were to do it at home.


Folks that have a 3D printer can make a stencil holder which aligns the stencil with the PCB.  I have a friend that's doing his own boards that way.

Many PCB fab houses will make stencils along with the board, for a relatively small additional fee.

BTW the board I'm getting done does have some hand-soldering for a slightly higher cost.  Probably because the design has two capacitors on the back of the board.


----------



## RJSakowski

graham-xrf said:


> If it were, say, 0.5mm (about 0.020") very pure aluminium, or anything we find handy, there are advantages. Even something from one of those slightly thicker products like the foil tubs used for Chinese take-away food. That kind of foil is pure, as opposed to sheet metal alloy.


We used 1100 aluminum for x ray attenuation  purposes as it is 99+% pure.  McMaster Carr sells 1000 series aluminum in foil form as thin as .0005".


----------



## RJSakowski

graham-xrf said:


> *The excitation question(s).*
> So I think on back to a fundamental question I never did get to learn the answer for.
> _"When a higher energy (60KeV) photon arrives and excites some xrf photon out of an atom, is that the end of it for the 60KeV photon"?_
> What if it only provoked (say) some 5.4KeV flash from chromium. What happens to the rest of the energy?
> Can we expect we might get both 5.4KeV AND 5.9KeV xrf photons out of the same atom of chromium?
> Crucially, might these happen at the same time? Perhaps not.
> It may be that an entire 60KeV incoming photon may be expended (wasted?) in only producing one flash at a time.
> 
> There is an actual delay before the elevated electron drops out of it's excited state. and I have no idea whether a single incoming photon can excite both Kα1 and Kβ1 states in one go, nor whether they flash out simultaneously.
> Can a single higher energy (60KeV) photon ever wring more than one xrf flash out of a pile of atoms?


The photon continues on at a lower energy due to that given to the newly created photon. This will continue until the photon exits the target or is low enough in energy to be incapable of further excitation.  Once the photon excites an electron, it's job is done. If it then encounters another electron it can excite it as well. Given the small dimensions and that the photon is traveling at light speed, for all intents and purposes, it is essentially simultaneous.


----------



## graham-xrf

RJSakowski said:


> The photon continues on at a lower energy due to that given to the newly created photon. This will continue until the photon exits the target or is low enough in energy to be incapable of further excitation.  Once the photon excites an electron, it's job is done. If it then encounters another electron it can excite it as well. Given the small dimensions and that the photon is traveling at light speed, for all intents and purposes, it is essentially simultaneous.


Thanks much! It confirms @rwm 's reply.
I had always thought that the excitation into all shells would be pretty much instantaneous. I do recall (from way back) that once energized into a higher state, there can be a surprising "pause" before the shell alters to have the electron assume it's stable energy state, and give up the extra as the florescence. I think, for visible light glows, up to near infra-red, the delay ranges from 0.5nS to as long as 20nS.

For the very nerdy, I got a startling update about the *Quantum Standard Model* from "dry-as-dust" Ivan Nilsen. All the chapters are strung together, so you need to start the video at around *26:40* to get hit by a startling, and truly mighty, yet simple re-arrangement of the Standard Model. It goes nearly all the way into fully unified theory, explaining away and replacing all those "Charmed Quarks" and other quaintly named conceptual goodies.

It was fun, but now, I am happy to let him get on with it. KiCAD is a better diversion. 
New theories of physics 2022 – Quantum filamentation and the new Standard Model – by Ivan Nilsen
It says "unavailable", but can watch on YT. Maybe because it's a long one. You just pick the place you want to watch anyway.






The actual URL was --> HERE


----------



## rwm

That video is amazing. I think he is on to something. It is just too elegant how 3 opposing charges unites all that and answers so many questions.


----------



## homebrewed

I have examined the pin assignments for the T4.0 and 4.1 boards.  One thing that jumps out is that the 4.1 has exactly the same pin assignments as the 4.0, where the pin functions are the same.  So a shield that is designed to plug into the 4.0 can plug directly into a 4.1 and work properly.

This means that we can design an A/D board that will work on either one of them: but the downside is that the maximum-possible sample rate is reduced because the driver will have to sequentially load in two separate 8-bit values & combine them to get the final 16 bit word.  It actually is a little worse than that because the T4.0 only has two groups of 4 bits each that are contiguous so there is some additional overhead to combine them into an 8-bit value.  The T4.1 has enough contiguous I/O pins to load all 16 bits at once (although the loaded-in value still will need to be right-shifted 16 places so the A/D LSB corresponds to D0 etc.).  To realize the performance improvement of using a T4.1 it probably will be necessary to add some jumpers to personalize the A/D board for it, because the GPIO vs A/D bit assignments will be different for T4.0 vs. T4.1.

To summarize the differences, the T4.1 will have about 1/4 the overhead of a T4.0 to load 16-bit values.  However, with a clock speed of 600MHz the additional overhead shouldn't be a deal-killer.  I hope.  I brought out all 16 bits on my prototype A/D board but was figuring on using hookup wires to customize the connection(s) to test out code for both flavors of T4 I have.  The header pin assignments are arranged in linear fashion, also not compatible with the required Teensy pinout(s).  Like I said, it's a prototype.

I have attached a document that describes the pinout(s) for T4.0 and 4.1 parallel I/O.


----------



## WobblyHand

Teensy 4.1 has 4x the flash memory and more IO.  But 4.0 is almost $10 cheaper.  For prototyping I'd pick the 4.1, that's what I did with my ELS.  No fun to run out of memory or io.


----------



## homebrewed

WobblyHand said:


> Teensy 4.1 has 4x the flash memory and more IO.  But 4.0 is almost $10 cheaper.  For prototyping I'd pick the 4.1, that's what I did with my ELS.  No fun to run out of memory or io.


I think the $10 difference will be minor compared to the total of other components needed to make a complete system, IF a Teensy is a part of it.  We have part of the pocketgeiger (for the x-ray detector), _maybe_ some kind of additional amplifier board, an ADC board and the Teensy itself.  Beyond that, possibly a Pi for the user interface, power supply components, the smoke detector capsules and some kind of enclosure plus the likely inclusion of some feel-good lead sheet to make sure we're not exposed to even low energy/intensity xrays.  Graham's approach of using a Pi to run the ADC along with the UI sounds like it would be a bit less money -- once Pi's return to being more readily available.

BTW my latest visit to Sparkfun showed that the pocketgeiger price has increased to $89.95, not counting shipping.  I also note that Mouser is asking $65.23 for the X100-7 part by itself:  Sounds good, right?  BUT they indicate that the manufacturer has placed the X100-7 in an end-of-life status.  Not Good.  We could be in a race as far as determining if the detector is good enough for our purposes vs. its EOL status.


----------



## graham-xrf

homebrewed said:


> I think the $10 difference will be minor compared to the total of other components needed to make a complete system, IF a Teensy is a part of it.  We have part of the pocketgeiger (for the x-ray detector), _maybe_ some kind of additional amplifier board, an ADC board and the Teensy itself.  Beyond that, possibly a Pi for the user interface, power supply components, the smoke detector capsules and some kind of enclosure plus the likely inclusion of some feel-good lead sheet to make sure we're not exposed to even low energy/intensity xrays.  Graham's approach of using a Pi to run the ADC along with the UI sounds like it would be a bit less money -- once Pi's return to being more readily available.


I have used an old Pi version 3B+, just because it was handy, I would be opting for the little Pi Zero 2W.  SPI serial can go at 2M Samples/sec, although I would probably be initially using 1M Samples/sec, so that ADC does not need to be in warp mode. I have a Pi version 4, which can do all the that stuff, but with speed to spare, and not needed.

While I do like a dedicated built-on display interface device, I went cheaper-skate, thinking that one of my two old smartphones, placed near enough for BlueTooth, or WiFi, or just use a USB lead, can do that stuff. More likely, I would let my trusty Dell laptop do the honours, because it has a bigger screen Regardless, I intend making the board itself Teensy friendly, and it can have exactly the features you describe. Maybe we can now define our choices for preferred ADC connections to the Teensy, with a little row of hookup pins patch area for those the user may want to customize for T4.0 or T4.1, or anything else, and just press on. At present, I have two rows, and one can jumper anything to anything.


homebrewed said:


> BTW my latest visit to Sparkfun showed that the pocketgeiger price has increased to $89.95, not counting shipping.  I also note that Mouser is asking $65.23 for the X100-7 part by itself:  Sounds good, right?  BUT they indicate that the manufacturer has placed the X100-7 in an end-of-life status.  Not Good.  We could be in a race as far as determining if the detector is good enough for our purposes vs. its EOL status.


Let us not worry too much about the EOL status of the X100-7. We have at least two between us right now, and there are not so many of us who might get into nuclear physics HM projects soon. The circuit can use any PIN diode, and I do not expect the X100-7 need be the last PIN diode we could make work.  Sooner or later, we would be adapting to allow the design to use available (or lower cost) components.

OK then, let us keep an eye out for newer PIN diode kit, but even then, I think semiconductor companies only ever manufacture all of a component type they are ever going to sell, in the first run, and will only run again if some customer wants a few million.


----------



## rwm

I hate to be the guy always asking for remedial education but....I am. We are over 1000 posts and it is just to hard to find and review relevant posts. Not knowing much (anything) about microprocessors I am confused about the devices and their basic purposes. Is the Teensy to function as the ADC or are we using another device for that? I assume the RPi will be the main processor to analyze the data and interface with the user? Can the Teensy not handle all that on its own? It might be nice to put together a basic flow/component diagram for anyone trying to follow this. At some point, you might want to start a "build thread" or "final version" to present this in a more direct and compact way. I hope this doesn't sound at all critical. It seems like you guys have made great strides.
I was explaining this project to a nuclear physicist last night and he was fairly impressed. His comment was that we might have a noise problem from a diode based system. He also suggested fresh smoke detector sources but I think he is off base on that since the half life of Am241 is 400 plus years.


----------



## WobblyHand

rwm said:


> I hate to be the guy always asking for remedial education but....I am. We are over 1000 posts and it is just to hard to find and review relevant posts. Not knowing much (anything) about microprocessors I am confused about the devices and their basic purposes. Is the Teensy to function as the ADC or are we using another device for that? I assume the RPi will be the main processor to analyze the data and interface with the user? Can the Teensy not handle all that on its own? It might be nice to put together a basic flow/component diagram for anyone trying to follow this. At some point, you might want to start a "build thread" or "final version" to present this in a more direct and compact way. I hope this doesn't sound at all critical. It seems like you guys have made great strides.
> I was explaining this project to a nuclear physicist last night and he was fairly impressed. His comment was that we might have a noise problem from a diode based system. He also suggested fresh smoke detector sources but I think he is off base on that since the half life of Am241 is 400 plus years.


I agree with you.  This thread has been sort of a stream of consciousness and is hard to extract the key points.  It's been great for the key contributors to exchange ideas and brainstorm, but it's not a build thread yet.  I've learned a bit along the way, but there's not quite enough meat to just go off and make something and expect it to work.  To be fair, there's lots of bits and pieces available so someone with an EE/programming could start, but the current state is a ways from being complete.

A Teensy is a capable processor for control.  It would be great for managing the ADC and any preprocessing.  But it lacks an operating system.  An RPI has an operating system and the normal stuff that we think of in computers. Both devices excel in different areas.  The RPI could run PyMCA and identify the elements, and the Teensy could run the ADC, do pulse rejection, do the binning and do safety related things like interlocks.  

Not sure which device will do the display or plotting.  Personally, I'd vote for a small display, so that the unit was self contained and could be used in the field.  I'd put in an option for a Bluetooth display but that's just another thing to drag around and increases the kit complexity.  If I'm in a junkyard, I need to have my hands as free as possible.  At home, on the bench, a larger display would be great.

Anyways, that's my two cents.  Feel free to disagree and discuss.  Hopefully there will be some convergence soon and some more prototypes built.  I'm toying with that idea now.


----------



## rwm

Crude:


----------



## rwm

What does this mean? "do safety related things like interlocks"


----------



## WobblyHand

homebrewed said:


> Are you talking about making something like an ADC shield?  Funny you should bring that up, I was thinking about that last night.
> 
> I've attached a PDF version of the current layout, with top metal, silkscreen and the ground plane.  This is the design that's being fabbed and stuffed.  The board dimensions are 75 x 35.2mm.  I moved the two 8-pin headers to accommodate the mounting holes:  but if it's turned into a shield it won't need mounting holes.
> 
> Right now I don't know if it would be possible to have a pinout that's compatible with both T4.0 _and_ 4.1.  I now have one of each with the product card so it won't be too difficult to check that.
> 
> BTW it appears that EasyEDA has PCB footprints for both the T4.0 and 4.1.  An adapter board is certainly possible but it would be best if we could avoid that.  A complicating factor is that the choice(s) available for 8/16 parallel input pins are fixed so there's no wiggle room there.  The control pins are a different story.


Is OVDD and OGND connected to Teensy's 3.3V power and ground?  If OVDD is 5V, the ADC will destroy the Teensy.


----------



## WobblyHand

rwm said:


> What does this mean? "do safety related things like interlocks"


If there were interlocks of some sort, something close to the microcontroller would be good.  If someone used a PMT, you'd want interlocks on the enclosure, so the high voltage would be shut down if the enclosure is opened.  Or the case was opened up and you could be exposed directly to the radioactive source.  Some kinds of interlocks are good, as long as they can be bypassed for diagnostics.  The interlocks prevent minor booboos from turning into issues, in my humble opinion.  That's what I meant.  Hope that is clearer.  If not, keep asking more questions.  I'm not looking for nanny stuff, which I dislike, but more reminders that doing X might have some hazards, and procede at your own risk.


----------



## WobblyHand

rwm said:


> Crude:
> 
> 
> 
> 
> 
> 
> 
> 
> 
> View attachment 432656


That's a possible (and reasonable) way to view the system.  I'm sure Mark and Graham have formed opinions on this   Some (software) functions which are not shown yet, could be partitioned various ways into the different processors, depending on how loaded one is compared to the other.  Hard to tell at this juncture.  Unless, this becomes a commercial product where we have to shave every penny, I usually like to see at least 50% spare capacity in each processing node in the beginning.  Stuff happens along the way during development.  Porting to a new platform isn't always easy, hence having capacity to add new features (or making stuff work at all) is important.  

I've seen this commercially where an adamant management delayed successful deployment because of an insistence on using processor X, but X simply did not have the capability to do the task.  X was cheaper, but just didn't have the resources or performance to do the job.  After a one year delay, said management was removed, and engineering finished the job.  Was a colossal waste of time and a loss of market share.


----------



## homebrewed

WobblyHand said:


> Is OVDD and OGND connected to Teensy's 3.3V power and ground?  If OVDD is 5V, the ADC will destroy the Teensy.


No, the ADC board has a 3.3V regulator for OVDD.


----------



## homebrewed

WobblyHand said:


> If there were interlocks of some sort, something close to the microcontroller would be good.  If someone used a PMT, you'd want interlocks on the enclosure, so the high voltage would be shut down if the enclosure is opened.  Or the case was opened up and you could be exposed directly to the radioactive source.  Some kinds of interlocks are good, as long as they can be bypassed for diagnostics.  The interlocks prevent minor booboos from turning into issues, in my humble opinion.  That's what I meant.  Hope that is clearer.  If not, keep asking more questions.  I'm not looking for nanny stuff, which I dislike, but more reminders that doing X might have some hazards, and procede at your own risk.


We would need some sort of physical interlock if there's real concern regarding the smoke detector capsules, since we can't turn them on & off.  Sliding in a lead shield through a slot would do it; but other than turning some sort of audible or visual alarm off, there's nothing that prevents the user from NOT using a sliding lead shield.

I suppose that's one argument for the considerable uptick in complexity and cost for using an xray tube.

My current setup has a lead shield on the interior of my aluminum box, except for the door.  The door is .25" thick aluminum, which by my calculations reduces the x-ray flux by about half.  A piece of 1/16" thick lead will drop the exit flux by a factor of 1.2E-4.  I have the lead sheet but the other lead shielding in the interior is a bit too long so I can't close the door if I put the 1/16" sheet in there.  I've been lazy and haven't trimmed the shielding bits yet.


----------



## WobblyHand

homebrewed said:


> We would need some sort of physical interlock if there's real concern regarding the smoke detector capsules, since we can't turn them on & off.  Sliding in a lead shield through a slot would do it; but other than turning some sort of audible or visual alarm off, there's nothing that prevents the user from NOT using a sliding lead shield.
> 
> I suppose that's one argument for the considerable uptick in complexity and cost for using an xray tube.
> 
> My current setup has a lead shield on the interior of my aluminum box, except for the door.  The door is .25" thick aluminum, which by my calculations reduces the x-ray flux by about half.  A piece of 1/16" thick lead will drop the exit flux by a factor of 1.2E-4.  I have the lead sheet but the other lead shielding in the interior is a bit too long so I can't close the door if I put the 1/16" sheet in there.  I've been lazy and haven't trimmed the shielding bits yet.


I'm just thinking out loud about some of this.  It might be appropriate to have shields and perhaps an interlock in the "release" design.  Obviously we cannot prevent folks from doing unwise things like sleeping on a pillow full of these capsules, but at least we can put in some warnings.  Personally, I would shield everything unless it was in use.  At that point, I'd open a door or aperture and allow the X rays "out" for a measurement.


----------



## WobblyHand

homebrewed said:


> No, the ADC board has a 3.3V regulator for OVDD.


Thought so, but I didn't have access to the backside of your board, only the front.  It was hard to tell how it was connected from the picture.


----------



## rwm

Can I ask about the PIN diode selection? We have selected the device from the pocket geiger (X100-7) however there seem to be a lot of choices available. What is the main reason for choosing this? I know dark current and sensing area are important factors. Could there be a better and cheaper choice? There are some diodes with lower dark currents but they seem to have smaller sensing areas.


----------



## homebrewed

rwm said:


> Can I ask about the PIN diode selection? We have selected the device from the pocket geiger (X100-7) however there seem to be a lot of choices available. What is the main reason for choosing this? I know dark current and sensing area are important factors. Could there be a better and cheaper choice? There are some diodes with lower dark currents but they seem to have smaller sensing areas.


There are several reasons why we're concentrating on PIN diodes.  The silicon detectors used in high-end x-ray analysis systems are PIN types.  The large intrinsic region (the "I" part) increases the detection volume, which should improve the energy resolution of the detector -- if an incoming xray photon isn't completely absorbed by the silicon, it generates a lower-amplitude pulse so the spectrum is smeared out .  So we want the depletion region as wide as possible, best achieved with a PIN diode.  And finally, since the depletion region is pretty wide compared to a plain-jane PN junction, the capacitance is minimized.

Dark current is going to be proportional to the sensor area because the current is due to thermally generated carriers -- more area, more carriers.

It would be instructive to see how a large-area _non_ PIN style photodetector performs,  As you've noticed, there are many less-expensive photodiodes that are not PIN diodes.  Reverse-biasing them to close to their breakdown voltage would give you a wide-as-possible depletion region:  but at the expense of high dark current.  

FWIW, cooling the detector with a thermoelectric cooler would reduce the dark current (regardless of what diode technology is in use).  I note that the teardown of that XRF "gun" revealed something that looked like a heat pipe going to the detector.  A photodiode won't dissipate enough current to go above ambient so it seems likely that the detector is being cooled.  I have a TE cooler I could use to see if it makes much of a difference but unfortunately there currently isn't enough room in my enclosure for it -- the spacing between the pocketgeiger board and my signal conditioning board is too small.  I can move things around but would need to slightly modify the enclosure for that.  Not up to attempting a homebrew heat pipe just yet .

I have noticed that some vendors offer two different types of detectors -- conductive and voltage-output types.  The conductive detectors are reverse-biased so incoming photons generate a current pulse, while the voltage-output types are more like solar cells.  Since they are NOT reverse biased their junction capacitance is very high compared to the other type.  For our purposes I think we want to concentrate on the types that are designed to be reverse-biased.  They'd feed into a TIA or load resistor.


----------



## WobblyHand

homebrewed said:


> Not up to attempting a homebrew heat pipe just yet .


They are not as hard to make as you think.  I made one out of some soft copper tubing, some absorbent paper towel and some freon.  Might have been luck, but it worked spectacularly well.  The heat transfer was amazingly fast.  I compared it with some tubing of the same size.  The transfer of the normal pipe was what we expect - relatively slow.  With the heat pipe it was in a fraction of a second to equalize the heat over a 8" distance.  The tube was sealed to prevent the freon from escaping.  I squirted in freon liquid and bent the tube over to seal it.  Beats me what one would use today, probably something more environmentally benign.  Grabbing one end of the tube made the other end the same temperature, practically instantly.  Was pretty neat to see as a teenager.  The paper towel was a folded to form a wick that extended the length of the tube.  As long as there was some liquid freon in the tube it worked.


----------



## homebrewed

WobblyHand said:


> Thought so, but I didn't have access to the backside of your board, only the front.  It was hard to tell how it was connected from the picture.


The regulator actually is on the top of the board, labeled as "LDO1".  But it IS routed to ODVDD on the back side of the board.

I did a small rev on the board, replacing "LDO1" with the actual devuce P/N but I did that after ordering the boards.

I've attached a PDF of the schematic that will hopefully clarify things.  The design pretty much duplicates what's shown on the data sheet so I don't think there's much point in being secretive about it.  The most significant variation from the DS is how I separated the analog and digital supplies, sort of doing a star connection rather than a daisy chain.  That decision was totally based on my concerns regarding noise coming in from the USB 5V line.  I figured a little more low-pass filtering on BOTH supplies would be a Good Thing.


----------



## homebrewed

WobblyHand said:


> They are not as hard to make as you think.  I made one out of some soft copper tubing, some absorbent paper towel and some freon.  Might have been luck, but it worked spectacularly well.  The heat transfer was amazingly fast.  I compared it with some tubing of the same size.  The transfer of the normal pipe was what we expect - relatively slow.  With the heat pipe it was in a fraction of a second to equalize the heat over a 8" distance.  The tube was sealed to prevent the freon from escaping.  I squirted in freon liquid and bent the tube over to seal it.  Beats me what one would use today, probably something more environmentally benign.  Grabbing one end of the tube made the other end the same temperature, practically instantly.  Was pretty neat to see as a teenager.  The paper towel was a folded to form a wick that extended the length of the tube.  As long as there was some liquid freon in the tube it worked.


Cool! <pun>  and also, just COOL!


----------



## rwm

"With the heat pipe it was in a fraction of a second to equalize the heat over a 8" distance."
Amazing. I had no idea about this.
TE cooler = Peltier?
Hey a 5" heat pipe is $3.86 at DigiKey


----------



## WobblyHand

rwm said:


> "With the heat pipe it was in a fraction of a second to equalize the heat over a 8" distance."
> Amazing. I had no idea about this.
> TE cooler = Peltier?
> Hey a 5" heat pipe is $3.86 at DigiKey


At that price, a heat pipe can't be all that complicated...  My heat pipe was soft copper tubing, a wick, and Freon.  The hardest part was soldering the tubing and getting it leak free.  Gas molecules have rather high velocities and within the device pretty quickly come to equilibrium.  I suspect any refrigerant like material could be used.  The key thing is there is some liquid under pressure.  The liquid is the reservoir, but the vapor is doing the bulk of the heat transfer, not the physical pipe.  Don't need much liquid, too much will prevent efficient heat transfer.

Yes, a TE cooler is usually a Peltier (or stacked Peltier) device.


----------



## homebrewed

According to information I found here, acetone would be a good working fluid for a heat pipe in the -48 to +125C range.  The heat pipes Digikey stocks appear to use water as a working fluid, so the low-temperature end wouldn't be any lower than 1 degree (also according to the table shown on that web page).

Cooling the detector down below the dew point would be problematic from a condensation viewpoint.  To get lower, it would be necessary to enclose the detector so it can be in a dry atmosphere.  One approach:  use two TE coolers, one attached to the detector and one with just its cold side exposed to the interior of the enclosure and make sure that the second cooler is colder than the other.  It will scavenge the water.  No need to carry around a bottle of compressed CDA or nitrogen; but it won't be an instant-on measurement.  And TE coolers are kind of power hungry if we're looking at a portable battery powered system.  

A cold finger with dry ice in it would do the trick as well but that introduces a consumable.

Detectors using wide-bandgap semiconductors like CZT circumvent the need for cooling but it looks like they are WAY out of our reach, moneywise.  One web site indicated that CZT crystals cost on the order of $2000/cc (cubic centimeter), and that is just for the raw material!  I'd look around for an SrI scintillator first, even if that means a PMT or SiPM.  PbI is supposed to be a good wide bandgap semiconductor for that kind of thing but is out of favor due to its toxicity. Although cadmium and tellurium aren't much better -- bad press is everything, eh?

Anyway, as in many other discussions we're getting a bit ahead of ourselves.


----------



## WobblyHand

homebrewed said:


> According to information I found here, acetone would be a good working fluid for a heat pipe in the -48 to +125C range.  The heat pipes Digikey stocks appear to use water as a working fluid, so the low-temperature end wouldn't be any lower than 1 degree (also according to the table shown on that web page).
> 
> Cooling the detector down below the dew point would be problematic from a condensation viewpoint.  To get lower, it would be necessary to enclose the detector so it can be in a dry atmosphere.  One approach:  use two TE coolers, one attached to the detector and one with just its cold side exposed to the interior of the enclosure and make sure that the second cooler is colder than the other.  It will scavenge the water.  No need to carry around a bottle of compressed CDA or nitrogen; but it won't be an instant-on measurement.  And TE coolers are kind of power hungry if we're looking at a portable battery powered system.
> 
> A cold finger with dry ice in it would do the trick as well but that introduces a consumable.
> 
> Detectors using wide-bandgap semiconductors like CZT circumvent the need for cooling but it looks like they are WAY out of our reach, moneywise.  One web site indicated that CZT crystals cost on the order of $2000/cc (cubic centimeter), and that is just for the raw material!  I'd look around for an SrI scintillator first, even if that means a PMT or SiPM.  PbI is supposed to be a good wide bandgap semiconductor for that kind of thing but is out of favor due to its toxicity. Although cadmium and tellurium aren't much better -- bad press is everything, eh?
> 
> Anyway, as in many other discussions we're getting a bit ahead of ourselves.


Just getting everything to work, from end to end, would be a major accomplishment.  No need to tweak until that happens in my opinion.  Active cooling will make this a lab bench curiosity.  I'm looking for something that one could possibly carry into the field, not a bench warmer!

Sometime, I might make another heat pipe with acetone.  You know, for the heck of it...


----------



## rwm

Interesting. I may fool around with acetone, stainless tubing, silver solder and a torch.
Regarding diode cooling...would the temperature need to be very constant or just the colder the better? I was thinking about something like a freezer pack linked to a heat pipe. The freezer pack would not really be consumable but would need an occasional recharge. Maybe make a custom pack the size of a D cell with the pipe down the middle?


----------



## homebrewed

rwm said:


> Interesting. I may fool around with acetone, stainless tubing, silver solder and a torch.
> Regarding diode cooling...would the temperature need to be very constant or just the colder the better? I was thinking about something like a freezer pack linked to a heat pipe. The freezer pack would not really be consumable but would need an occasional recharge. Maybe make a custom pack the size of a D cell with the pipe down the middle?


Thermally generated leakage current will have a fairly large temperature coefficient.  But the input to my signal conditioning board is AC coupled so slow shifts in the TIA output level due to temperature variations wouldn't cause pulse amplitudes to move around much.  The main impact would be w/regard to the SNR, something a bit more difficult to evaluate.

I'm thinking that getting more samples to integrate under over the length of our pulses will have a larger impact on the system SNR in terms of bang-for-the-buck approaches.  But, since the SNR improvement should be proportional to sqrt(#samples), the SNR improvement becomes less and less significant as we increase the number of samples.  This is not all bad -- it means that, for better or worse, throwing really expensive (fast & high resolution) ADC's at the problems won't pencil out all that well so there's no point in going there.


----------



## graham-xrf

This explains some of my thinking. My apologies, there is a lot here.

*Op-Amps*
I am back and getting technical  amid all sorts of decisions in getting my circuit together. The critical op-amps used in the transimpedance front-end are decided, as are the ADC drivers. My ADC has differential input, and needs the interface to single ended operation.

*Gain distribution and noise.*
I opted to have the first TIA gain resistance not be 1M, nor any of the "higher" values I have seen in TIA circuits. Instead, it is at a value where it's noise contribution is below that of the amplifier input. There is not much point in having a amplifier capable of seeing down to the PIN diode noise floor, then throwing that advantage away with a spectacular, bandwidth-limiting TIA one-stage gain. Anything above about 36dB there puts the noise figure safe from any subsequent circuitry, and relaxes the noise specification for op-amps we might use.
Thus, after the first TIA stage follows one or two op-amps to get to the final gain, and correct signal polarity.

*Hardware triggers removed*
To keep things simple, and reduce components, I have opted to not include window comparator trigger, which would use up a dual IC. Triggers can be done better in software.

*Hardware peak detect removed*
Similarly, I have removed the peak-detect -> peak hold. I am sure it does a great job, but for the same reasons as trigger, having the sampled pulses captured means the peak is quite available in software, without quite tricky high bandwidth hardware, each with a price!

*50Hz / 60Hz Notch Filter*
This is something I do include in the design. It is easy enough to leave out, replaced by a link. There are a whole bunch of different types, from expensive "programmable" state-variable filters. Twin-T with 2 opamps, Fliege topology, Bainter Notch, etc.

The well-known Twin-T with the two-op-amps simulated using the same LT1807 as for the ADC driver giving a -48dB notch. Throwing in two sets of passives resistors and capacitors, aimed at making 50Hz and 60Hz notches all in one go removed a band from 49.5Hz to 61Hz to -56dB, with a hump at 55Hz at about -48dB. The notches themselves were at -64dB for 50Hz, and -72dB for 60Hz.

I don't know how this actually works! The dedicated single-frequency 60Hz hum remover by itself does not do as well. It simulates at -50dB.
We learn how much the actual performance of these much depends on tolerance and balancing of critical components, and how some circuits are much more tolerant. Simulated performance showing notches 70dB to 100dB deep are more likely to achieve 50dB to 60dB in practice.
I have found notch filters implemented with a couple of old-school bipolar transistors that seem to have spectacular performance!

*OnefFilter package - regardless*
I am much tempted by the Twin-T, regardless it has six passives that need to be really good. Some others  are also tempting, but need three or four op-amps. Whichever we use, the filter takes one physical package, a dual, or a quad. It does not have to have a special low noise, but does need a gain-bandwidth product good enough to deliver 300kHz undistorted. That would mean 20MHz minimum. The LT1807's are there just because I have them around. For a 4-op-amp package, I thought maybe ADA4891-4ARUZ-R7. It's not pennies at £3.56 for one IC with 4 opamps in it.

If anyone has a suggestion for your favourite affordable op-amps in dual or quad small-outline SMD that are up to delivering deep notch filters while still having acceptable gain of at least x1 over the bandwidth we need for the rest of the pulse signal, then here is the place to say what is your favourite. Pin-outs for 14 and 16-pin packs tend to be standard. It may be one can throw in whatever is to hand at the time.


*The sketch*
I include here a scrappy little sketch which may help @rwm to imagine what's there.  I left a lot out, like the special lengths we go to regulated supplies, and prevent overloading anything. Sorry, but right now is not when I want to be producing drawing package documentation.

*The (simple) arrangement*
Start with the PIN diode, which has 3 x lithium button cells for bias, fed through a high value current limiting resistor with it's noise shunted by capacitor. I drew a lot from the TIA circuits of Glen Brisebois (Linear Technology) contributions from 2001 through 2022. Going back to the two basic ways we operate these PIN diodes, most circuits seen operate in photovoltaic mode at zero bias, and not at X-ray wavelengths. Photons arrive, and make volts, just like the solar panel on your roof!

We, instead, bias the large area diode OFF with 10V, and so we create a depleted layer that won't conduct, and it has a much reduced capacitance for it's (huge) area. Photons arrive in that insulating layer, and make electrons that will get gathered up by the bias field, and so we get a pulse.

*The DC isolation capacitor*
This would normally be a thing that loses us control of where the "bottom" of the pulse is. No more DC reference! In theory, the signal should float to where the pulse average is - except this one does not! The capacitor is optimum, fully big enough to deliver all the energy in the capacitance of the PIN diode in one quick pulse, without affecting it's amplitude. In simulation, I did not see the base line drift up. Here we are dealing with between 80pA and about 5nA. It seemed to work! Losing the 10V bias lets us use the very low noise TIA front end circuits.

*First stage gain choice*
As explained before, and drawing my earlier times having to fish a clean signal from some feeble satellite, the gain has to be enough to ensure that only the signal, and the noise of molecules banging about in the first stage are what gets amplified. If enough gain, the noise will be so huge as to make any subsequent stages noise contributions become trivial. Of course, the signal got amplified as well. The S/N signal/noise ratio is preserved. To this end, the TIA gain resistor is chosen not be be so large as to mess it up.

A 1Meg resistor is 130nV/√Hz, and if we want 300KHz bandwidth to nicely preserve the wave-shape of a 13uS pulse, then it makes 71uV, which is a darn racket compared to the 4.3nV/√Hz input of out op-amp, making only 2.3uV. I will be experimenting with that resistor, going for a value some 10's of K, and possibly using one of the feedback TIA networks explained by Jerald Graeme, and used by Hammamatsu Corp.
There is also the option of the FET input, also from Brisebois.

*What's with the extra FET?*
This is an optional variation to the TIA circuit. The FET and one op-amp work together, with the other op-amp in the pack used to force the bias at the FET to be zero. This can also be done without the FET.

*So what is there?*
In practice, this first stage is a LTC6268, which is a single lonely op-amp in a 8-pin SO pqackage. This is to have enough spacing between the input pins to allow a guard ring track. At it's simplest option, that is the only amplifier there. The feedback resistor is put in as two in series, to limit the stray capacitance across, and the stability compensation (a few pF) is contrived by having two SMD capacitors in series.
There is some minor tracking to allow using any of the "Feedback Tee" circuits from the traditional wisdom TIA book. These are just tracking options, not having components on unless you want to play.

If a FET input stage is chosen (simulated so far as best), then one has to drag in another op-amp, which needs to be low noise, but not necessarily as wideband as the LTC6268. There are a few resistors and capacitors that go with these active parts.

*The rest of the gain*
In my circuit, this is provided by two stages. They might be the op-amps in just one package. The input noise requirement is no longer there, but they need to be fast enough, and work within the 2.5V. First is a necessary polarity reversal, plus a huge chunk of gain. The next part has logic switched analogue gain range settings controlled from the little computer. This gain feature need not be there. Just ignore it and settle for one resistor if you like, or leave out the whole op-amp, although it will still be there in the package. Analogue switches can be ADG1201BRJZ or LTC202CS#PBF. The first is SPDT -NO (single pole double throw - normally open) or the latter is Quad SPST (single pole single throw). I have not tried it yet.

*The 60Hz interference noise rejection filter*
This is explained elsewhere earlier in this post. I see it as something we should have. I am just not sure where it should go. Should it be where I have shown it, or should it be immediately after the TIA? I will take suggestions on this point.

*The ADC driver.*
Most ADCs need a good driver, and this one takes it's supply from the ADC chip itself. If one has a ready-made single ended signal, and an ADC that does not care, then just leave it out. Alternatively, it can drive both the ADCs @homebrewed and I have been discussing. At this point, I was implementing from the circuits shown in the datasheet.

*The KiCad circuit*
This is still evolving. It seems everything I want is often just not available, or if taken from a supply site, comes locked up with all sorts of other software marketing lock-in tools. I have to "edit" the models to get what I want, without their add-ons. I end up making a lot of my own symbols. When I have it, and am getting down to tracking, I will post it. Folk here may have a opinion on whether we should exchange complete stuff via PM. If I have any PCBs over, even partially assembled, I am OK to distribute them between us.


----------



## homebrewed

graham-xrf said:


> Folk here may have a opinion on whether we should exchange complete stuff via PM. If I have any PCBs over, even partially assembled, I am OK to distribute them between us.


Another option that a bit more public but would avoid further loading up an (ostensibly) machining-centric forum, would be to create a group on groups.io or Google groups to exchange information.  Post a link to it, maybe in a new topic rather than somewhere in the current tome.

Groups.io might charge a fee these days but I suspect Google Groups has a free version.  There's github as well but I'm not so familiar with it, other than as a source for code I'm interested in.  Not sure  how well suited it is for a lot of messaging.

Just throwing some thoughts out there.


----------



## graham-xrf

homebrewed said:


> Another option that a bit more public but would avoid further loading up an (ostensibly) machining-centric forum, would be to create a group on groups.io or Google groups to exchange information.  Post a link to it, maybe in a new topic rather than somewhere in the current tome.
> 
> Groups.io might charge a fee these days but I suspect Google Groups has a free version.  There's github as well but I'm not so familiar with it, other than as a source for code I'm interested in.  Not sure  how well suited it is for a lot of messaging.
> 
> Just throwing some thoughts out there.


I hold that everything about this is ultimately all about machining interest, all the way from it's original motivation, to what what we would do with it. Figuring out what alloy, or is it weldable, or how tough to machine, or will it corrode, or what heat treatment, whatever. It is supposed to be useful. The mechanical bits are going to take some machine work to make it come together. This includes how to make parts out of lead, which should prove interesting. We are not making an electronics interest Elecktor type project! This stuff includes radioactive nuclear bits, stolen out of smoke detectors, which I think is one one of the coolest aspects.


----------

