Friday, November 3, 2023

Gamma Dog - Assisted Squelch Auto-Set (ASAS) / "Smart Squelch" System

One of the main features of the Gamma Dog project is the unique Squelch System controlling the audio output.
Anyone familiar with Amateur Radio will be familiar with the Squelch System used in FM Hand-Held Transceivers.
In a nutshell, the Squelch System mutes the audio output of the instrument if the currently detected rate is at or around the natural radiation background level. If the rate goes up, above the natural radiation background level (in the presence of a radioactive specimen for example), the Squelch System enables the audio system of the instrument and a tone with variable pitch is produced. Once the rate drops to background level or below, the audio is again silenced.

This post will delve deeper into the inner workings of the Squelch algorithm and the Assisted Squelch Auto-Set (ASAS) System.

I felt like I should include something more amusing than the boring rate plots :-)
Here is AI's idea of what "Gamma Dog" is.

The Gamma Dog's Squelch System works by detecting a differential between the Natural Radiation Background (NRB) and the current detected rate coming from the scintillating detector. The Squelch System evaluates the Natural Background, mutes the audio and sets a threshold level at almost the same rate as the NRB. When the currently detected rate exceeds this threshold level, the audio output is enabled.

In other words, the current rate is treated as a relative rate to a pre-set reference point (the Squelch Level) and the absolute value is insignificant for the Squelch System.

I said "almost the same as the NRB" because establishing the optimal rate for squelch system at any given moment is a bit tricky due to the randomness of decay and the constantly changing conditions during prospecting.

Gamma Dog will sample the NRB rate on startup or any time when the Assisted  Squelch System or the user activates an "Auto-Set" action (by pressing and holding the blue Squelch button or using one the Gesture Control triggers).

The term "Auto-Set" comes from the fact that the Squelch Level (rate) is established automatically, based on sampling of the current rate. This is always done on startup, but later a manual Set can be done by the user by overriding the established level and setting it to a different value.
When "Auto-Set" is activated, Gamma Dog will use one of 3 available methods to determine the Squelch Level (the method used is selected by Menu Item #20):

    1. Single Sample - Squelch Level will be set to the currently detected rate, using a single sample at the moment when Auto-Set action is triggered.

    2. SD5 method (default) - The Gamma Dog will average the rate over the last 5 seconds, calculate the Standard Deviation in the rate and then use the upper bound of the 1-sigma threshold to compute and set the Squelch Level.

    3. SD10 - same exact method as SD5 but the rate is evaluated over the last 10 seconds before Standard Deviation is calculated.
The 1-Sigma Upper Threshold is calculated simply by summing the mean rate over 5 or 10 seconds and the Standard Deviation of all samples taken in the data set. 

The horizontal purple line is the Squelch Level as result of a Single Sample (S-S Mode).
The orange line shows the actual current rate, and the blue line shows the smoothed rate.
It is obvious that the Squelch level is set too close to the mean rate and the current rate deviates too often above it.
 Another problem that can arise from this method - in some cases (purely random), it can cause the Squelch to be set too low or too high as it relies on a single rate sample and if this sample happens to be a peak or a deep valley the squelch level will be off.

In this mode (SD5), the Squelch Level is set to the upper bound of 1-Sigma of the Standard Deviation, evaluated for the past 5 seconds (data set includes 1 sample per second).
 This is the Gamma Dog's default method. It does a better job at finding the correct Squelch Level while the system responds better to quick rate changes due to the short rate history being evaluated.

The last available option (SD10) is the same as SD5 but the evaluation of the Standard Deviation is done for the rate over the last 10 seconds. 
It is the most precise way to find the correct Squelch level and results in very minimal number of excursions of the Current Rate above the Squelch Level but due to the longer history of rates in the data set, it is less "dynamic."

Note: The plots above were made using the Gamma Dog's Bluetooth functionality - all of the data displayed on these plots was sent in real-time via BT to a companion Android App and plotted there. 
The yellow line at the bottom of each plot shows the current battery capacity in percent.

As discussed above, critical aspect to the operation of the instrument is a properly set Squelch Level - the audio is used to alert the user of an anomaly in the detected rate.  When the level is correctly set, it will make the squelch system responsive to small fluctuations detected just above the background level. The level should exclude or rather - "minimize" any fluctuations of the rate due to the randomness of radioactive decay.

Why I calculate standard deviation and not just "pad" the mean rate? 
The answer is simple - "padding" or offsetting the level from the mean rate can cause inaccuracies because the deviation from the mean rate varies with the isotopic content, distribution of radioactive material and detector sensitivity.

For U and Th isotopes with extremely long half-lives as well as other decay-chain products, which makeup good part of the Natural Background, the distribution of decay events over a very short period of time (5-10 sec) can be reasonably approximated by a normal distribution, although the actual distribution is still governed by the exponential decay law.

In my testing, assuming normal distribution of the decay events and using 1-sigma of the Standard deviation works very well for figuring out a good Squelch Level.

The "sweet spot" is when the current natural background rate (NRB) only occasionally opens up the Squelch System but not too often - up to 3-4 times per minute is a good level. It indicates that the squelch is very close to the optimal level by occasional breaks in the silence.

The Squelch level can be Auto-Set (by sampling the Natural Radiation Background rate) or adjusted Manually, when the user is modifying the already set level with the GD Squelch Level +/- controls.
In either case, if the Squelch Level is incorrectly set against the NRB level, this could result in missing possible specimen finds or less-than-optimal Squelch functionality. 

One of the problems Charles and I encountered in the field while surveying and prospecting different areas is the Squelch response to highly localized Natural Radiation Background Levels.

For example - when surveying a REE deposit in Southern New Mexico we realized that the NRB is extremely localized - there are very well-defined areas of the pegmatite exhibiting very high Natural Radiation Background ("hot zones") and just a few yards away, other areas with comparatively very low NRB ("cold zones"). Some of these "cold zones" exhibit natural background even lower than what is considered "normal" for the area! 
Such contrast and localization posed a unique challenge - it meant that we had to constantly sample the NRB rate and activate "Auto-Set" of the Squelch system manually, every time we crossed over from one zone type to another. On the other hand, to know that you have crossed over to a different zone you had to monitor constantly the display - something I didn't want to do. With Charles's version of the Gamma Dog it was even more difficult due to the lack of display.
It is also worth noting that both zones in this pegmatite produced very nice Euxenite crystals which could have been easily missed if the squelch level was not correctly set. 

In this situation, if we focus only on moving through the terrain without paying attention at the current squelch level, we can enter an area where the NRB rate is much lower than Squelch Level and any small peaks or fluctuations, possibly indicating the presence of a specimen, will be masked and hidden by the rate gap in the squelch system (that is if the rate is not promptly re-adjusted). 
It could be some time, before one realizes that the instrument has been quiet for too long due to a Squelch rate set too high for the current NRB Level.
The opposite is also true - crossing from an area with low background rate to an area with high NRB will cause the Squelch system to stay constantly open which defeats the purpose of having it in first place and it will require the user to activate the "Auto-Set".

To resolve this issue, we came up with the "Smart Squelch" or Assisted Squelch Auto-Set (ASAS) System.

Assisted Squelch Auto-Set System

The purpose of ASAS is to constantly monitor the current rate, compare it to the state of the Squelch System and detect conditions which can indicate that the Squelch rate might be incorrectly set for the current background. 
Once ASAS determines that the Squelch Level needs an adjustment, it will trigger an Auto-Set action, same as if the user pressed the Auto-Set button and it will re-sample and evaluate the NRB.
This allows for very easy, smooth and worry-free operation - ASAS System does all of the necessary adjustments when they are needed, and the user can focus on the terrain and not on the instrument. 

Note: The implementation of ASAS is different between the one I designed, and the one Charles is using in his GD version. The main difference is the algorithm and the fact that in my version, due to the availability of display, menu system and persistent configuration parameters, I can configure many internal aspects of the ASAS behavior and make it more flexible and more customizable for a particular situation.

These plots show how ASAS monitors the state of the Squelch System.
Out of the 20 Configuration Menu Items, there are 4 menu items dedicated to the ASAS system.

In my design, there are 2 separate timers configured with a single menu item, setting the period for a squelch condition to be present continuously, before an Auto-Set is triggered.
One timer is reset every time the Squelch opens, while the other timer is reset every time the Squelch closes. 
Basically, I monitor the state of the Squelch System over time while constantly cross-reference the state with the currently detected rate and if a discrepancy is present for longer than time "window", an action is taken.
The timers can be set for 15, 30, 45 or 60 seconds.

One additional functionality I implemented in ASAS is the ability to "decide" if Squelch Auto-Set is needed while the squelch has been open for a long time.
When the user needs to pinpoint the location of a specimen, it helps for the squelch to stay open so variations in the pitch of the audio tone can be closely monitored. In such case Auto-Set should not be triggered.

In my implementation of ASAS, I have a menu item which specifies a second, virtual threshold level which, when exceeded, it will prevent the Auto-Set from activating due to continuously open squelch by resetting the Open Squelch Timer.

The logic behind this is that if a specimen is found and the user is now trying to localize it, the detected rate will be vastly higher than the NRB / Squelch Rate and not just slightly above it as expected - the ASAS system will identify this large difference in rates and it will not trigger an Auto-Set, thus allowing the user to listen to the audio tone without an interruption.
The "ASAS Reset Lvl" Menu Item, determines the height of the virtual "localization rate" as a percent of the current rate above the squelch rate. This value can be configured as 37%, 50%, 62%, 75%, 100% and 150%.

For example - if ASAS Reset Lvl is set to 100%, the Squelch Rate is set to 200 CPS and the detector reports a current rate of >400 CPS (or exceeding the Squelch rate by more than 100%), ASAS will not trigger an Auto-Set assuming the user has found a specimen and just tries to pinpoint it. If the rate drops below 400CPS then the continuously open squelch condition will trigger an Auto-Set when the timer for it expires.

Another functionality in my ASAS System is the ability to add a "padding" (called ASAS Tolerance) between Squelch level and Current Detected Rate, while the squelch is monitored for continuously closed condition. The amount of padding or tolerance is adjustable with a menu item ("ASql Toler") and specifies in CPS how low the current detected rate must drop below the Squelch Level before the timer of the continuously closed squelch activates an Auto-Set action.
This differential can be set from just below the current Squelch Level to a few hundred CPS lower and it is intended to add "adjustable damper" for the response to constantly closed squelch.
The options are "Minimum" , 100 CPS, 150 CPS, 200 CPS, 250 CPS and 500 CPS

By default, the ASAS System is deactivated and can be toggled ON/OFF by double-clicking the GREEN Button.
The last menu item of the ASAS System configures whether the system is activated automatically at the startup of the instrument, or the user will activate it at a later time.

The ASAS System in action. 
In this video I simulate "wrong squelch setting" by manually overriding the established Squelch Level while ASAS is active and setting it very low and then very high.

When the ASAS is active, the "Sql" indicator above the Squelch Level is replaced with "(A)".
The ASAS timeout is set to 15 seconds in this demonstration.

The two separator bars on the display (above and below the rate readout) shrink, showing when one of the timers is about to expire. The top bar is for Open Squelch conditions and the bottom bar is for Closed Squelch conditions. 
A full width bar represents the maximum duration the timer is set to, and the bar will shrink to a dot (which is the trigger point if conditions for adjustments are still present). At the moment of the Auto-Set, a short beep is produced to indicate that ASAS has taken an action.
If an event (a change in the detected rate) changes the state of the Squelch, the bar resets to full width. 

Charles searching for REE in Petaca, NM while using the "Smart Squelch" System.
The Gamma Dog produces distinctive beeps every time when the Automatic Squelch System is triggered to re-sample the Squelch level ("Auto-Set").

A more extreme rockhounding in Petaca, NM by Charles in March, 2024