Arduino as a dummy USB HID

Hello,
I'm a software engineer wanting to get into IoT / embedded systems. I was thinking about a project lately, but I have only a vague idea on how it could be done, and I thought that maybe Arduino could be the right starting point to make a proof of concept.

What I want to do is a USB dongle that fakes its capabilities. That is, once inserted, I want it to present itself to the OS as a headset (microphone + speaker), or maybe, to start with something easier, as a keyboard. I want it to be able to be used with standard drivers at least on Linux.

The full project I have in mind is this: I want it to pretend to be a headset, so the OS sends it an audio stream and expects from it another audio stream. Also, I would simultaneously need another two data streams from/to the arduino (on the same USB, is it even possible?), call them DATA_IN and DATA_OUT. So four in total.

What I would like to do is something along this lines: some application on the machine is sending the Arduino an audio stream since it thinks it is a speaker; I take this audio on the arduino and loop it on DATA_OUT. At the same time, I inject data in DATA_IN and the Arduino loops it back on the microphone interface, and the application takes it.

Is this possible at all? I had a quick look at Arduino Nano Every, and I read that the firmware on the USB microcontroller SAMD11 can be customized, maybe that's the starting point to be able to make it present itself as a USB HID of some kind?

Thank you very much,
md

to be able to make it present itself as a USB HID of some kind?

Yes on some types of Arduino you can make a device look like a HID keyboard, mouse or even MIDI device. However, I know of no system that can handle audio in one direction let alone two.

Hi Mike, thank you for the quick reply.

However, I know of no system that can handle audio in one direction let alone two.

What do you mean? USB headsets having microphones + speaker are common. I imagine they work by presenting two HID to the OS, and then sending and receiving two data streams in parallel (or maybe on a time slot way).

USB headsets having microphones + speaker are common.

Yes I know, but they don’t use Arduinos. You are making the mistake in thinking because a thing is now common it can be handled by a 1980 power processor.

Most of these common devices use dedicated custom chips not general purpose controllers.

Teensy 3.x boards support audio over USB (bidirectional stereo), in combination with many other device types, such as HID (mouse/keyboard), Serial and MIDI.

Teensy 4.0 has hardware capabilities for more audio channels, but last time I checked, USB Audio wasn't implemented yet in the Teensyduino Core for this board.

That being said, just looping back the audio can easily be done using tools like pavucontrol or ALSA/Jack utilities on Linux.

If you want more portable audio applications, have a look at JUCE.

Pieter