# Re g : spectrum sensing code

**URL:** <https://www.ruby-forum.com/t/re-g-spectrum-sensing-code/222392>\
**Category:** GNU Radio\
**Created:** [August 27, 2012, 2:01pm UTC](https://www.ruby-forum.com/t/re-g-spectrum-sensing-code/222392 "2012-08-27T14:01:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 27, 2012, 2:01pm UTC](https://www.ruby-forum.com/t/re-g-spectrum-sensing-code/222392/1 "2012-08-27T14:01:44Z")

</div>

Hi Community,

Question - 1

I was working with the UHD version of spectrum sensing code.

I have USRP2 with me. I learnt that USRP2 can achieve 50MHz of RF  
bandwidth  
with 8 bit samples and 25MHz of RF bandwidth with 16 bit samples.

I wanted to know how does this information translates while passing  
min\_freq  
ans max\_freq parameters to the spectrum sensing code. Does it mean  
(max\_freq

- min\_freq) = 25MHz.

Please correct me if I am wrong :teeth:

Question - 2

Why the minimum center frequency is set as follows :

self.min\_center\_freq = self.min\_freq + self.freq\_step/2

Why it simply doesn’t take the minimum frequency as we provided. Setting  
the  
max\_center\_freq I understood somehow.

Question - 3

In non UHD version of spectrum sensing code the adc\_rate was fixed fro  
USRP-1 i.e. 64M and that was used to calculate usrp\_rate while in UHD  
version of the same code usrp\_rate is calculated by the sampling rate we  
give.

I was wondering how does the code manages to work with devices of  
different  
sampling rates i.e. USRP-1 with 64M USRP2 with 100M

Context : I am trying to scan WLAN channels 1, 6, 11 continuously. So I  
have  
to keep working with a total bandwidth of 76 MHz

* * *

## Sumit Kr. Research Assistant Communication Research center IIIT Hyderabad India

View this message in context:  
[http://old.nabble.com/Reg-%3A-spectrum-sensing-code-tp34330101p34330101.html](http://old.nabble.com/Reg-%3A-spectrum-sensing-code-tp34330101p34330101.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![sumitstop](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@sumitstop](https://www.ruby-forum.com/u/sumitstop)\
**Post date:** [August 27, 2012, 2:05pm UTC](https://www.ruby-forum.com/t/re-g-spectrum-sensing-code/222392/2 "2012-08-27T14:05:10Z")

</div>

> Please correct me if I am wrong :teeth:

As far as I understand spectrum sensing code is used for wideband  
spectrum analysis, that is  
to scan across wide RF bands which USRP is not able to analyze at a  
time. So obviously  
max\_freq - min\_freq \> 25 MHz .

e.g Conider you have to analyze the spectrum from 400 MHz to 500 MHz.  
You can keep  
min\_freq = 400 MHz and max\_freq = 500MHz. If you have configured USRP  
sample rate  
to get 25 MHz bandwidth, ideally one round of scan will be complete by 4  
tuning steps.  
(practically 6 steps as the code is using 25% overlap to reduce  
non-linearity in DDC response).

Firas posted a detailed explanation of the code in the mailing list long  
back. You can find it  
here [Some usrp\_spectrum\_sense.py code Explanation - GNU Radio - Ruby-Forum](http://www.ruby-forum.com/topic/174437).

> Question - 2

> Why the minimum center frequency is set as follows :
> 
> self.min\_center\_freq = self.min\_freq + self.freq\_step/2

> Why it simply doesn’t take the minimum frequency as we provided. Setting the  
> max\_center\_freq I understood somehow.

e.g. Scan range 10MHz to 40 MHz  
USRP1 B/W = 8MHz  
First tuning step is with centre freq 14Mhz (10+8/2 ideally) which will  
cover the bandwidth from 10 to 18 Mhz

> Question - 3

> In non UHD version of spectrum sensing code the adc\_rate was fixed fro  
> USRP-1 i.e. 64M and that was used to calculate usrp\_rate while in UHD  
> version of the same code usrp\_rate is calculated by the sampling rate we  
> give.

> I was wondering how does the code manages to work with devices of different  
> sampling rates i.e. USRP-1 with 64M USRP2 with 100M

sampling rate ----\> Bandwidth ----\> feq\_step

> Context : I am trying to scan WLAN channels 1, 6, 11 continuously. So I have  
> to keep working with a total bandwidth of 76 MHz

Check the tuning delay of the device you are using and make sure that  
you are not losing any data during the sweeping process.I may be wrong  
somewhere. Please go through Firas’s explanation which will make things  
clear.

regards  
Sreeraj Rajendran

---

<div class="post-metadata">

**Author:** ![sumitstop](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/97f17d/32.png) [@sumitstop](https://www.ruby-forum.com/u/sumitstop)\
**Post date:** [August 27, 2012, 2:05pm UTC](https://www.ruby-forum.com/t/re-g-spectrum-sensing-code/222392/3 "2012-08-27T14:05:53Z")

</div>

Hi Sreeraj,

Thanks for the reply.

sreeraj r wrote:

> > Question - 1
> > 
> > I was working with the UHD version of spectrum sensing code.
> > 
> > I have USRP2 with me. I learnt that USRP2 can achieve 50MHz of RF  
> > bandwidth  
> > with 8 bit samples and 25MHz of RF bandwidth with 16 bit samples.
> > 
> > I wanted to know how does this information translates while passing  
> > min\_freq  
> > ans max\_freq parameters to the spectrum sensing code. Does it mean  
> > (max\_freq  
> > e.g Conider you have to analyze the spectrum from 400 MHz to 500 MHz. You  
> > here [Some usrp\_spectrum\_sense.py code Explanation - GNU Radio - Ruby-Forum](http://www.ruby-forum.com/topic/174437).  
> > so shall I pass sampling rate = 2_bandwidth i.e. for this case 2_25Mhz =  
> > 50MSPS (Pl correct if I am wrong)  
> > Question - 2
> 
> > Why the minimum center frequency is set as follows :
> > 
> > self.min\_center\_freq = self.min\_freq + self.freq\_step/2
> 
> > Why it simply doesn’t take the minimum frequency as we provided. Setting  
> > the
> 
> > In non UHD version of spectrum sensing code the adc\_rate was fixed fro  
> > USRP-1 i.e. 64M and that was used to calculate usrp\_rate while in UHD  
> > version of the same code usrp\_rate is calculated by the sampling rate we  
> > give.
> 
> > I was wondering how does the code manages to work with devices of  
> > different  
> > sampling rates i.e. USRP-1 with 64M USRP2 with 100M
> 
> sampling rate ----\> Bandwidth ----\> feq\_step
> 
> > Context : I am trying to scan WLAN channels 1, 6, 11 continuously. So I  
> > have  
> > regards  
> > Sreeraj Rajendran
> 
> * * *
> 
> Discuss-gnuradio mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

* * *

## Sumit Kr. Research Assistant Communication Research center IIIT Hyderabad India

View this message in context:  
[http://old.nabble.com/Reg-%3A-spectrum-sensing-code-tp34330101p34335158.html](http://old.nabble.com/Reg-%3A-spectrum-sensing-code-tp34330101p34335158.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).
