I'm trying to get audio data from an ADC connected to an Arduino into a host PC. I've done some digging and found LUFA, which I think Arduino uses under the hood. Is it possible to use the Arduino as a USB device, and if so, are there any examples? Thanks!

  • For those Arduinos which use general purpose microcontrollers for their USB interface, yes, you can reprogram them. But what data rate do you need to move? An ATmega based Arduino tends to imply a moderate one, and if you don't need to put it directly into the PC's unmodified audio stack, you can probably just crank the serial channel to maximum baud rate and push your data that way, with a lot less work. One where the USB comes direct from the sketch processor - either a Leonardo or one of the ARM-based boards - would probably be most capable. – Chris Stratton Aug 1 '14 at 18:03
  • 1
    Do you want to have it be a HID device or is serial to audio fine? It might be cheaper to buy something designed for this and prebuilt... anyway no, Arduino doesn't use LUFA. It uses a similar firmware for the serial connection. – Anonymous Penguin Aug 1 '14 at 18:26
  • I need it to appear as a USB Class Audio device so that it can interact with pre-existing OS drivers. – crocboy Aug 1 '14 at 18:29
  • I'd assume this would require me to do some low-level stuff – crocboy Aug 1 '14 at 18:29
  • Someone has done 10-bit 16 Ksps stereo with a Leonardo: forum.arduino.cc/index.php?topic=208140.0 – Chris Stratton Aug 1 '14 at 19:00

LUFA is used for the USB to serial firmware on the separate USB-serial bridge AVR found on Uno and newer Megas. The firmware is compiled using a supplied makefile. Otherwise LUFA isn't used by Arduino.

But LUFA is probably the right choice if you want to make a USB audio device. It comes with examples of both input and output audio devices. But you will have to compile using the supplied makefile, unless you are really ninja. On a Linux distro it's easy - don't know about other OS'es.

The demo "Audio Input Device Demo" comes with LUFA and is ompatible with the atmega32u4 used on Leonardo. It can be set up to sample analog input and send it to the pc. From the documentation:

On start-up the system will automatically enumerate and function as a USB microphone. By default, the demo will produce a square wave test tone when the board button is pressed. If USE_TEST_TONE is not defined in the project makefile, incoming audio from the ADC channel 1 will be sampled and sent to the host computer instead.


I am confused on what your end purpose is. do you want something that works or you want to make a project for self-learning purpose.

For ready-made products that you can buy, if you want the PC to be able to input and output sound, there are hundreds models of a) sound card plug into PC b) external sound card link to PC via USB cable They ranges from a few USD to 50 to 200 with huge range of performance in terms of sampling rate and number of bits (low noise).

Ardu build-in ADC is 10 to 12 bits. These card are 16 to 24 bits.

See http://www.bestbuy.com/site/computer-cards-components/sound-cards/abcat0507003.c?id=abcat0507003

24 bits 116 dB SNR very low noise http://us.creative.com/p/sound-blaster/sound-blaster-z

I used them as test instrument for commercial/university projects with success.

I saw on TV news that same setup (high bit card, at -110dB or lower noise level) used in the underwater signal search for MH370 down plane months ago.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.