Ultrasound data transmission via a laptop

We present a simple example of data transmission using ultrasound, using a standard laptop using gnuradio. We simply make use of the laptops own in-built speaker, along with a cheap microphone.

Gnuradio is an excellent suite of programs, which allows the creation of Software Defined Radios.

The following is the flow diagram we designed using the gnuradio-companion program, which generates the necessary python
code for us. We make use of a carrier frequency of 23KHz, which is above the range of human hearing and a sample rate of 48KHz, which
allows us to produce this frequency. We tried PSK and FSK, but found FSK worked most reliably for this, however further research into the best modulation technique is necessary.

We make use of the packet encoder/decoder modules, in order to handle all good stuff like correctly aligning bits to the byte boundary etc.
One very important setting you must do is to make sure the gain of the final output, is around 0.5, as if not set to around this, you will get audible output.

Flow diagram

Further research:

I’m looking to modify the generated python code, to automatically iterate through a wide range of different potential baud rates and different modulators, in order to find the most effective configuration to use.


Download the gnuradio-companion file.

With thanks to the folks on #gnuradio for their help

  • JLOT
    December 10, 2013 Reply

    BadBIOS tecnology is true.

  • labbeth
    December 10, 2013 Reply

    Nice. It would be interresting to know how 23kHz is efficient under water.
    Thinking about RC submarines…

  • rajumoh
    December 18, 2013 Reply

    Hi, what version of gnuradio did u use ?

    • admin
      December 18, 2013 Reply

      Hi, I used the latest version 3.7.x. cheers

  • su
    January 7, 2014 Reply

    Hi, which daughterboard did you use in this project?

    • admin
      January 9, 2014 Reply

      I’m just using the computers soundcard.

  • me
    January 22, 2014 Reply

    Hi, what is the maximum distance between the laptop?

    • admin
      January 26, 2014 Reply

      I’ve only tested to around 3m so far.

  • hendri
    February 2, 2014 Reply

    hi, i’ve tried gnuradio-companion file, but the wx gui is not showing up? do you know shy? i’m using gnu radio companion

    actually i’ve got 2 warning, but have a same message when i execute the companion : “Block key “blocks_ctrlport_monitor_performance” not found when loading category tree”
    whether it has the effect of warning?

    • hendri
      February 2, 2014 Reply

      sory, i mean i’ve tried your gnu-companion file, and i mean “do you know why?” hehehe

      • admin
        February 4, 2014 Reply

        I’m using too, which works fine for me, possibly you haven’t compiled it with WX support?

        • hendri
          February 8, 2014 Reply

          But when i tried to run a simple grc the wxpy was run very well, i tried to change the tcp sink with audio sink or null sink, your ultrasound-fsk wx gui is showing up.

          i think, i have problem with the network configuration in gnuradio companion. 😀

        • hendri
          February 9, 2014 Reply

          I want to try, create ultrasonic like your grc project. i have a question for to ensure me, can we create ultrasonic with frequency more than 23 khz (maybe more than 30khz) using standard speaker (that written have spec: respond in 90 hz – 20 khz)?

          • admin
            February 9, 2014

            Potentially you could, but both your soundcard and speaker would have to support that. I know most laptop’s soundcards
            only seem to go up to around 48kHz, meaning the max. frequency you could output would be 48/2=24kHz (according to nyquist).

  • j054n
    April 23, 2014 Reply

    Hi, I’m trying to test your project, but I have some doubts about how to adapt it using GRC under Win7.
    Must I to run two instances in 2 laptops with different TCP addresses?
    Must I setup some parameters for audio soundcards?
    Must I setup some permissions? I’m obtaining some errors like this:

    Generating: “C:\Users\Usuario\top_block.py”
    Executing: “C:\Users\Usuario\top_block.py”

    8: Permission denied
    ÒC:\Program Files (x86)\gnuradio\lib\site-packages\gnuradio\grc\gui\Dialogs.py:4
    7: GtkWarning: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, le
    n, NULL)’ failed
    self.get_buffer().insert(self.get_buffer().get_end_iter(), line)
    : Permission denied

    Thanks in advance.

    • admin
      April 25, 2014 Reply

      I’m afraid I’m not sure what would cause that, as I don’t really use windows. However you may want
      to join the #gnuradio IRC channel on freenode for some good advice.

  • Aziz
    April 25, 2014 Reply


    I would like to know if you tested it in a closed environment like a steel pipe. I have project and it would be very helpfull if you test it inside a steel tube.


    • admin
      April 25, 2014 Reply

      I can’t see why it couldn’t work, could you expand more about your project though, sounds very interesting.

  • Luke Kim
    July 8, 2014 Reply

    Hello Chris!

    I’m interesting in ultrasound voice transmission.
    the idea is, transmitter device modulate the voice to 20khz ~ 24khz and play it through speaker, then the recevier device catch it and demodulate the sound and play it.

    the theory is make sense i think, but i’m not sure it really works well.
    the quick and best way is just code the program and run. but i wonder it can be.

    do you think my idea is make sense?
    and does it work you think?

    • admin
      July 8, 2014 Reply

      Hi Luke,

      You could possibly do it using FM/AM on a carrier wave at an ultrasound



  • Sree_ph
    November 24, 2014 Reply


    Good work

    I’m working in a similar project. I tried ur GRC. But it didn’t work.. Is dere any modifications to be done on topblock.py? I am using gnu companion 3.7.4 version. On running no gui options are working. Please Help



    • admin
      November 24, 2014 Reply

      Hi Sreena,

      Are there any error messages displayed in
      the console?



  • Thulani
    November 25, 2014 Reply

    Hello Chris!

    I tried running the same project but it keeps on telling me that the makefile can’t be created and it doesn’t offer me the input screen to enter the required text to be transmitted.
    After creating the flowchart using Gnuradio, do I have to write another python code for the capturing screen or it suppose to be generate when I run the flowchart.

    Thanks in advance

    • admin
      November 29, 2014 Reply


      Without further information on what it says, I’m not sure I can help I’m afraid.


  • wayde
    December 14, 2014 Reply

    Hi Chris,
    great project. ive been trying to get something like this to work for a while, great to finally get a complete grc file. unfortunately i cant get it to work 🙁

    i get this error:
    opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx/_core.py:16633: UserWarning: wxPython/wxWidgets release number mismatch
    warnings.warn(“wxPython/wxWidgets release number mismatch”)
    Using Volk machine: sse4_1_64_orc

    also not really sure how i use the TCP source but ill look into that. do you know how i could use a file source instead and send a text file or something.

    anyway ill continue my search, thanks very much for the project file im sure it will be a huge help once i get it working!


    • admin
      December 19, 2014 Reply

      I’m not sure what the error means I’m afraid. Maybe you have the wrong version
      of wxWidgets?

  • james
    January 25, 2015 Reply


    i just opened the grc file in gnu companion and everything works fine, except when i click generate I get an error

    File “/usr/lib/python2.7/dist-packages/grc_gnuradio/blks2/tcp.py”, line 58, in __init__
    fd = _get_sock_fd(addr, port, server)
    File “/usr/lib/python2.7/dist-packages/grc_gnuradio/blks2/tcp.py”, line 42, in _get_sock_fd
    sock.bind((addr, port))
    File “/usr/lib/python2.7/socket.py”, line 224, in meth
    return getattr(self._sock,name)(*args)
    socket.error: [Errno 98] Address already in use

    something probably with the socket and server may be. I wanted to ask you about the over all working of the modules, like how do we send the data as there is no console opening up, do we have to open both flows on each laptop or just transmit side on one and receive side on other, what is the use of tcp sink and tcp source. can you explain these a little

    • admin
      January 28, 2015 Reply

      Hi, it looks like you may already have something running on that socket?



    • Kailesh
      April 16, 2015 Reply

      hi james, have u got cleared of that socket error. could you explain me about this error. i have to clear this

  • Kailesh
    February 28, 2015 Reply

    Hi, i tried with ur ultrasonic_grc file. i have the setup of all the criteria for this project. once i started to execute the flowgraph its showing errors as,

    Using Volk machine:sse4_2_32_orc

    could u kindly correct this error. its getting the same error in both client and server laptop as i setted.

    • Kailesh
      February 28, 2015 Reply

      Hi, and am adding up another issue in this project. That is am using GNUradio 3.7.5.
      Is it necessary to use only 3.7.2 for this better execution.

      And another doubt is in both the laptop(as client and server) the addr we are giving is so is it possible to communicate both the machine, as far as i have installed GNUradio in VMware(Ubuntu) and in another machine as Main booting OS as ubuntu… Kindly clear my doubts.

      • admin
        March 1, 2015 Reply

        I’ve not tested it in the latest GNUradio, but it should work, as far as I know.

        I’m not sure exactly what you mean with respect to VMware.

    • admin
      February 28, 2015 Reply

      I’m not sure the “Using Volk machine:sse4_2_32_orc” text is actually an error message

      • Kailesh
        March 1, 2015 Reply

        could u clear my doubts regarding this… waiting for ur reply

  • Kailesh
    March 1, 2015 Reply

    Am using Ubuntu in VIrutal machine, in that am using GNUrado 3.7.5 but its getting error..

  • Nat
    March 13, 2015 Reply

    Hi, what window are you using to input and display the message? I tried searching under the x windows but am not getting any luck. Thanks!

    • admin
      March 14, 2015 Reply

      If I recall correctly, it was just a terminal, running netcat, to connect to the TCP server.

  • Nat
    March 23, 2015 Reply

    Thanks! Is it possible to run both on one laptop using two terminals?

  • Kailesh
    April 13, 2015 Reply

    hi, i would like to know which version of ubuntu you have used for GNUradio for this project. i have tried with ubuntu 14.04 version but its not working for me..

    showing error as volk machine running.

  • Jay
    July 1, 2020 Reply

    How can i open terminal with tcp in windows to tx/rx messages as you show in the video ? I tried that with newer GNURadio 3.8, It seems to works with vector source. But at receiver side i got no signal just noise around 0 dB, Can you explain this ?

    • admin
      July 1, 2020 Reply

      Hi, I’m afraid I haven’t used Windows for a while. You might be able to
      get netcat for Windows?

      Regarding not receiving anything on the receiver, have you tried using lower transmission
      frequencies and increasing the volume?

      • Jay Patel
        July 2, 2020 Reply


        Thanks for your reply. I did try lowering my frequency and increasing the volume and now my spike at zero frequency has more amplitude, which i believe is just a noise, right ? They have deprecated packet encoder and decoder in newer GNURadio version, what blocks can i use as alternative of those ?


Leave Comment

Error Please check your entries!