Home > GNURadio and USRP > Intro to GNURadio and the USRP (part 5, simple transceiver)

Intro to GNURadio and the USRP (part 5, simple transceiver)

This is going to be a short and sweet lesson. You want to communicate data across two USRPs. You’ll need a transceiver. Below (and in the source repository) you’ll find the GnuRadio-Companion blocks.

This is a pretty basic setup. You have two UHD blocks (a source and sink), a number of parameters to control things from the command line, modulator and demodulator, etc. One thing that is different is that this graph is not complete. The message source and sink are each missing something. The nice thing is, GnuRadio-Companion will still compile this to a python file. Then you can do as we learned in part 4, and modify the python code to interact with those message queues. There are, however, a few other changes you will need to make in the source. The creation of the message sink is not complete, as the constructor expects a message queue. You can easily create one (self.sink_queue = gr.msg_queue()).

There is something else about this block diagram. What are the two probes (probe avg mag^2 and probe signal)? Probes are used to allow the program to access certain information. For example. lets say you want to implement a MAC protocol (say CSMA/CA). You could use the probe signal (which is giving you access to complex to mag^2) to see the instantaneous received signal strength. This could be a good way to do the carrier sensing (something like db_val = 10 * math.log10(self.raw_mag_sqrd_probe.level())). If db_val is below threshold, then the channel is clear. Using the probe avg mag^2, you could get an estimate of the last received packet (since it is an average over the last few received samples). This would work well for an RSSI value which could be stuffed into a packet header and passed up the networking stack.

There are many possibilities. Given the state of the current block diagram, I’d start by writing a send_pkt and recv_pkt function for the simple_transceiver class which puts a message in the source queue or removes a message from the sink queue respectively (note, in the code above all messages must be 512 bytes in length).

Enjoy!

Advertisements
Categories: GNURadio and USRP
  1. Jon
    August 15, 2011 at 2:51 pm

    I would like to see this entry expanded upon, as the user does not get to delve into the python until here. How does one “put a message in the source queue”?

    • pwnhome
      August 20, 2011 at 7:22 am

      Good comment! There are lots of good resources online for learning python. Such as http://diveintopython.org/

      As for putting a message in the queue, see part 4 (linked to in the post).

      I’ll try to put together a post on python in the near future.

  2. sajjad
    March 7, 2013 at 10:23 am

    I have made an NBFM Tranciever for PMR446 Radio. I want to transmit the audio received from the radio in GNUradio onto network to the other host. Then on other host i can again receive the audio from the first host and transmit it into air using gnuradio and usrp1. Can u please help me out in this. I can share you my PMR446 tranceiver which i made in GRC.

  3. Eva
    August 9, 2013 at 1:37 pm

    I have try to make one application by combining part 4 & part 5 (transceiver), but keep getting some errors with the encoder/decoder. Any help?
    Here is how I initialize them:
    self.packet_encoder = gr.packet_encoder(samples_per_symbol=2,bits_per_symbol=1,access_code=””, pad_for_usrp=True, )
    self.packet_decoder = gr.packet_decoder(access_code=””, threshold=-1, callback=lambda ok, payload: self.packet_decoder.recv_pkt)

    Also: is there a way I can attach the whole code?

    Thanks for sharing

    Eva

    • pwnhome
      August 10, 2013 at 10:51 am

      Not sure how to attack the whole code. Error messages might help though. It has been a while since I’ve played with GnuRadio though, so we’ll see.

  4. November 16, 2014 at 4:37 am

    very good

  5. September 6, 2016 at 8:29 pm

    I have question!
    How do you use ‘UHD sink’ & ‘UHD source’ simultaneously.
    When I use sink and source at the same time to exploit the usrp as a radar application,
    It doesn’t work!!

    So I would like to know how to use sink and source simultaneously!!!!!

    Thank you in advance!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: