title: How to measure the dB level of a signal?
body: <p>Can someone please help me to measure the strength / dB level of the signal being received before it is passed into a demodulator block?</p>
  
  <p>I need to compare the dB level of the signal against a user defined 'threshold' level. The reason why is explained below.</p>
  
  <p>Using GNU Radio Companion (and a bit of pretty basic python) I have created a program which allows the user to create two types of scans and then run those scans.</p>
  
  <p>Band Scans allow the user to specify a start frequency, a stop frequency and a step frequency. A function written in Python tells the SDR (HackRF One) to tune to the start frequency (for example 90MHz) and then sequentially tune through all of the steps until the stop frequency (say 110MHz) is reached. The step frequency defines the distance in frequency of each tuning step. So if the step frequency was 50KHz and the start and stop frequencies were as given above the scan would start 90MHz, 90.05MHz, 90.10MHz, 90.15MHz and so on until the stop frequency is reached. This works fine.</p>
  
  <p>Channel Scans allow the user to specify any number of discrete frequencies to scan. For example 88.4MHz, 98.9Mhz, 102.5Mhz and 103.8Mhz. Again, a function written in Python tells the SDR to tune to each of the 'channels' in turn. This also works fine.</p>
  
  <p>I have created a variable which stores the user defined 'threshold' value. The user can define a suitable threshold value by looking at the spectrum using the GNU RC generated wxGUI FFT Sink, observing where on the vertical axis (Power dB) the noise floor is, typing a dB reading (say -45) into a text box and clicking a button to set threshold (store the text box value into the threshold variable). Simples..</p>
  
  <p>What I need to do is measure the dB level of the signal going into the FFT Sink so that I can use a bit of python to check if the frequency the SDR is currently tuned to has RF energy above or below the defined threshold. If the comparison can be made then I can make the scan have certain outcomes such as add that frequency to a list of active frequencies, or stop the scan so the user can listen to the signal etc.</p>
  
  <p>I have done much, much duckduckgo-ing of the web and cannot find a solution. I have also tried a number of different blocks from GNU RC but I can't find one, or a combination, that allows what I need to do.</p>
  
  <p>I am a GNU RC / SDR newb so hopefully I'm missing something (not too) simple..</p>
  
  <p>Thanks.</p>