Audio data transfer for AVR

I wrote some days ago about Tagsu – The Digital Wondertag. The inventor of that device pointed me to look at some more material on the device: 12kbps simple audio data transfer for AVR blog post is abou adventures in implementing a stupidly simple way of transferring data over audio to AVR (and why not other embedded chips too). It allows you to reach speeds up to 12kbps with really tiny code and memory footprint. This communication method was implemented to be allow to have a really easy way to update the contents of wearable message badge made out from Tiny 8-pin AVR chip and an LCD-screen.

The nice idea on using audio cable for the communications is that the analogue audio interface is that is is very widely available in very many devices easily. You have audio output plug on personal computers, tablets and smart phones. Audio connection allows you to update your gadgets with any device you usually carry with you (not just your laptop/desktop-computer). It is easy to access the audio output on those devices, just play back audio file with music player application, play back audio files from web server or even use HTML5+JavaScript to generate audio signal.

12kbps simple audio data transfer for AVR blog post mentions that  there exists plenty of different audio modulations for data-transfer purposes, it was hard to choose the most suitable one. Here is image of the approach used, effectively making it square wave with “clock” pulse for every bit! Sync pulses can be sent as often as you would like.

And the hardware part? Also stupidly simple.

The code referred in 12kbps simple audio data transfer for AVR can be found from GitHub. There is also a modem.py example code in GitHub to create wav files for testing the modem.

The 12kbps simple audio data transfer for AVR blog article also mentioned other different transfer methods USB, UART, Bluetooth and so on, but all of those had downsides:

  • USB: Needs 2 pins, Firmware takes 1/4th of the Flash space.
  • UART: Modern computers lack serial port and you have to have an USB adapter.
  • Bluetooth: All that pairing, price and code size… argh!
  • WiFi: Too expensive and complicated for a small device like this.

And on top of that, USB and UART are either simply missing or at least very hard to get to your phone or tablet. There are other applications where those other methods might be the right  choice, but not here.

4 Comments

  1. Tomi Engdahl says:

    Somewhat related project idea:

    Serial Data from the Web to an Arduino
    http://hackaday.com/2015/10/10/serial-data-from-the-web-to-an-arduino/

    In the old days, a serial port often connected to an acoustic coupler that gripped a phone handset and allowed a remote connection to a far away serial port (via another phone and acoustic coupler) at a blistering 300 baud or less.

    In a decidedly retro move, [James Halliday] and [jerky] put a modern spin on that old idea. They used the webaudio API to send serial data to a remote Arduino. The hack uses a FET, a capacitor, and a few resistors. They didn’t quite build a real modem with the audio. Instead, they basically spoof the audio port into sending serial data and recover it with the external circuitry. They also only implement serial sending (so the Arduino receives) so far, although they mention the next step would be to build the other side of the connection.

    serial over webaudio
    http://substack.net/serial_over_webaudio

    Reply
  2. Tomi Engdahl says:

    Serial Connection Over Audio: Arduino Can Listen To UART
    https://hackaday.com/2018/05/31/serial-connection-over-audio-arduino-can-listen-to-uart/

    We’ve all been there: after assessing a problem and thinking about a solution, we immediately rush to pursue the first that comes to mind, only to later find that there was a vastly simpler alternative. Thankfully, developing an obscure solution, though sometimes frustrating at the time, does tend to make a good Hackaday post. This time it was [David Wehr] and AudioSerial: a simple way of outputting raw serial data over the audio port of an Android phone. Though [David] could have easily used USB OTG for this project, many microcontrollers don’t have the USB-to-TTL capabilities of his Arduino – so this wasn’t entirely in vain.

    Serial communication via audio on Android
    https://davidawehr.com/blog/audioserial/
    At first, it seemed like a simple task: any respectable phone’s DAC should have a sample rate of at least 44.1kHz. [David] used Oboe, a high performance C++ library for Android audio apps, to create the required waveform. The 8-bit data chunks he sent can only make up 256 unique messages, so he pre-generated them.

    Oboe is a C++ library which makes it easy to build high-performance audio apps on Android.
    https://github.com/google/oboe

    Reply
    • Tomi Engdahl says:

      Thank you for informing about your update.
      I updated the links on the article pointing to new blog.

      By the way the older address https://labs.rakettitiede.com/?p=87 reported security warning:
      “Varoitus: mahdollinen tietoturvariski
      Firefox havaitsi mahdollisen turvallisuusuhan, eikä jatkanut sivustolle labs.rakettitiede.com”

      Reply

Leave a Comment

Your email address will not be published. Required fields are marked *

*

*