discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] usrp transmission but receiving a way little powe


From: Nick Foster
Subject: Re: [Discuss-gnuradio] usrp transmission but receiving a way little power!
Date: Wed, 1 Feb 2012 21:39:02 -0800

So there's a few things here. First, you're using the old libusrp driver, which is fine, except it's been deprecated for almost two years. I recommend using UHD instead, it's not hard to figure out, and we can provide better support for it.

Second, you have a misunderstanding of how the USRP works with Gnuradio. The USRP sink is set to a particular center frequency; the USRP will handle tuning the RF front end to that frequency. After that, your samples are sent from your gr.sig_source_x to the USRP, which upconverts them to the RF frequency you selected earlier. In other words, you don't send a 2.4GHz sample rate to the USRP -- you send a much lower sample rate to the USRP, and let it upconvert that to your center frequency. If you want to send a sine wave at 2400.5GHz, this is how it'd go:

from gnuradio import gr, gru, uhd
import sys

class my_tb(gr.top_block):
   def __init__:
      self.samp_rate = 2e6
      self.center_freq = 2400e6
      self.sig_freq = 500e3
      self.src = "" gr.GR_SIN_WAVE, self.sig_freq, 0.3) #0.3 is amplitude
      self.sink = uhd.single_usrp_sink("", uhd.io_type_t.COMPLEX_FLOAT32, 1)
      self.sink.set_samp_rate(self.samp_rate) #set the sample rate to 2Msps
      self.sink.set_gain(20) #set the gain to something reasonable
      self.sink.set_center_freq(self.center_freq)  #this is where you tune the RF center frequency
      self.connect(self.src, self.sink)

if __name__ == '__main__':
   tb = my_tb()
   try:
      my_tb.run()
   except KeyboardInterrupt:
      pass



--n

On Wed, Feb 1, 2012 at 8:14 PM, Ebtisam Ahmed <address@hidden> wrote:
Hi all,
i have been doing my final year project of MIMO-OFDM using gnuradio.
For this i first want to transmit a sine wave and i made a simple
program by the concept used in usrp_siggen.py. Although sine is
recieved successfully and its fft is plotted but it has a very low
amplitude and many harmonics. kindly have a look at my code:

#!/usr/bin/env python
from gnuradio import gr, gru
from gnuradio import usrp
import sys


class my_top_block(gr.top_block):
   def __init__(self):
       gr.top_block.__init__(self)
       #1. source
       #2. sink
       #3. connect
       self.interp = 64
       self.sink = usrp.sink_c (0, self.interp)   # Transmitter code
       self.usb_freq = 1000000
       self.src = "" gr.GR_SIN_WAVE,
2450000000, 32000, 0)
       self.src.set_frequency(input('Set the frequency'))

       self.connect(self.src, self.sink)


def main():

   tb=my_top_block()
   #tb.subdev.set_enable(True)                       # enable transmitter
   try:
       tb.run()

   except KeyboardInterrupt:
       pass


if __name__ == '__main__':
   main ()

Thanks in advance

Regards,
Ebtisam

_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

[Prev in Thread] Current Thread [Next in Thread]