#usbDevice

Simple DIY Electronic Music Projectsdiyelectromusic.com@diyelectromusic.com
2025-06-28

XIAO USB Device to Serial MIDI Converter

Having recently revisited the CircuitPython USB to Serial MIDI Router as part of XIAO ESP32-C3 MIDI Synthesizer – Part 2 it reminded me I didn’t really have a simple Arduino USB device to serial MIDI for the XIAO. So this is filling that gap.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to Arduino, see the Getting Started pages.

Parts list

  • XIAO SAMD21
  • Serial MIDI module
  • Breadboard and jumper wires

The Circuit

A 3V3 serial module can be hooked up to the TX/RX pins of the XIAO as shown above.

The Code

This is largely a simplification of the code used for XIAO SAMD21, Arduino and MIDI – Part 4 to use just the standard serial port and USB device MIDI.

There is one option at the top to determine how the serial port ought to be routed. There are two options:

  • Serial to USB. This allows a full bi-directional serial <-> USB.
  • Serial to Serial. This allows both USB and Serial RX to route to Serial TX.

In the other direction, USB always gets routed to the Serial port.

Find it on GitHub here.

Closing Thoughts

Often I find I’ve missed out a simpler use-case in pursuit of a more complex one. This was one of those times so hopefully that is now fixed.

In the above photo I’m using it as a USB to serial router for my M5 Stack Synth module based on the SAM2695 that I’ve been playing with. The Synth is powered from the XIAO’s 5V and GND and connected to the TX/D6 pin. This allows me to use USB MIDI which gets routed to the M5 Synth hanging off the XIAO TX pin.

There is more on that particular synth chip here: XIAO ESP32-C3 MIDI Synthesizer – Part 3.

Kevin

#m5stsack #midi #SAM2695 #samd21 #usbDevice #usbMidi #xiao

Simple DIY Electronic Music Projectsdiyelectromusic.com@diyelectromusic.com
2025-06-27

XIAO ESP32-C3 MIDI Synthesizer – Part 2

After an initial play with the XIAO ESP32-C3 MIDI Synthesizer the first thing I wanted to try was to swap out the ESP32-C3 for something else, just to see what could be done.

  • Part 1 – Getting started and getting code running.
  • Part 2 – Swapping the ESP32-C3 for a SAMD21 to get USB MIDI.
  • Part 3 – Taking a deeper look at the SAM2695 itself.
  • Part 4 – A USB MIDI Synth Module using the SAMD21 again as a USB MIDI Host.
  • Part 5 – A Serial MIDI Synth Module using the original ESP32-C3.
  • Part 6 – Pairs the Synth with a XIAO Expansion board to add display and potentiometers.

The XIAO range of boards support a range of options and Adafruit’s QTPy boards are also pin-compatible. For me, I have the following as possibilities:

  • XIAO SAMD21
  • XIAO RP2040
  • QTPy SAMD21
  • QTPy ESP32-C3

I also already have a range of projects that have looked at some of the above: https://diyelectromusic.com/tag/xiao/

So before I get too far into what the SAM2695 itself can do, I thought I’d try a few alternative options right from the start. This post looks at how to use the XIAO SAMD21 to support USB access to the Synth.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key tutorials for the main concepts used in this project:

If you are new to microcontrollers, see the Getting Started pages.

XIAO SAMD21 as a USB Device

My CircuitPython USB to Serial MIDI Router uses a XIAO SAMD21 in USB Device mode, so replacing the ESP32C3 with a SAMD21, should allow it to be used as a USB MIDI device.

The principle is exactly the same as the previous project but instead of a serial MIDI interface connected to the XIAO UART, it is connected directly to the SAMD21.

This should work just as well with a QTPy SAMD21 too.

There are two options for USB MIDI device support:

Using CircuitPython

The following steps are required for the CircuitPython version which, when it works, is the simplest:

When I first tried this, everything hung up. It turned out that the XIAO needs to use board.LED_INVERTED as the built-in LED label. Once that was updated all was good.

I also, as a precaution, added the following to boot.py:

import usb_hid, usb_midi
usb_hid.disable()
usb_midi.enable()

But this is probably unnecessary for the XIAO SAMD21.

The XIAO pops up as a USB MIDI device called “CircuitPython Audio” and any MIDI commands (such as note, Program Change, or control messages) sent to the device are forwarded directly onto the SAM2695 synth.

Whilst this is the simplest way to do this, it isn’t the most performant! Will a lot of notes (like my Rite of Spring example) some MIDI messages might not be accurately processed in time and others might get lost.

Using Arduino

It just so happens that the code I used for XIAO SAMD21, Arduino and MIDI – Part 4 “just works”. It is a little over the top, in that it sets up three serial ports, so will almost certainly clash with something else on the synth, but it does work if no buttons are pressed!

Use the code from: https://github.com/diyelectromusic/sdemp/tree/main/src/SDEMP/XiaoSimpleUSBMIDIMerge

Download this using the “Seeeduino XIAO” board setting in the Arduino IDE and it should appear as a USB MIDI device called “Seeed XIAO M0” or something like that.

Performance wise, this passes the Rite of Spring test very well.

Alternatively, the code from XIAO USB Device to Serial MIDI Converter focusses more directly on the USB to serial conversion and includes an option for serial to serial routing too, which is more useful in this particular case.

XIAO SAMD21 as USB Host

In the post XIAO SAMD21, Arduino and MIDI – Part 5 I used the SAMD21 as a USB host. By providing an external power supply this allow the use of a USB MIDI controller with the SAM2695.

To plug anything in however will require an adaptor or two. This needs to go from an original “USB A” plug to a USB-C socket. For me, this involved using a “USB-C to USB-micro” adaptor and then a “USB OTG adaptor” as shown below.

Then I needed a 5V power source, so I cheated and use the 5V and GND from the original XIAO ESP32-C3 that I’d replaced with the XIAO SAMD21 and just jumpered them across to 5V and GND from the breakout headers on the synth.

I stayed away from the code I used as part of XIAO SAMD21, Arduino and MIDI – Part 4 directly, but instead used one of the sample applications from the SAMD21 USB Host Library.

I turns out the “USB_MIDI_Converter” sketch works really well. This can be found here: https://github.com/gdsports/USB_Host_Library_SAMD/blob/master/examples/USBH_MIDI/USB_MIDI_converter/USB_MIDI_converter.ino

Closing Thoughts

Similar tricks should also be possible using the RP2040 based boards, and as already mentioned it is also possible to use the Grove connector. One of the options for Grove is as a UART, and this is supported, for example, on the original XIAO breakout board: https://wiki.seeedstudio.com/Seeeduino-XIAO-Expansion-Board/

I believe the UART Grove socket would connect directly to the Synth Grove connector allowing use of the synth from the expansion board too.

Kevin

#esp32c3 #midi #SAM2695 #usbDevice #usbHost #xiao

Comunitatea Linux Româniaclr@comunitatealinux.ro
2025-06-16

Identificați mai multe dispozitive cu USB ID Repository

Există mii de dispozitive USB pe piață – tastaturi, scannere, imprimante, mouse-uri și multe altele – care funcționează toate cu Linux. Detaliile furnizorului acestora sunt stocate în USB ID Repository.

Comanda lsusb

Comanda lsusb listează informații despre dispozitivele USB conectate la un sistem, dar uneori informațiile sunt incomplete.

De exemplu, unul dintre dispozitivele USB nu era recunoscut. Dispozitivul era funcțional, dar listarea detaliilor dispozitivului USB […]

comunitatealinux.ro/identifica

USB ID Repository
2023-11-22

The amazing Rene Stange added USB Gadget (i.e. device) support to the Circle bare metal Raspberry Pi environment a while ago so I’ve now incorporated that into MiniDexed. This allows MiniDexed to be used as a USB device – i.e. it can just be plugged into a PC and used via USB MIDI directly, as long as your Raspberry Pi supports USB Gadget mode and you have some means of audio output.

This post looks at how to make a “USB dongle” that is basically a USB MIDI accessible DX7.

A quite note before I start however. Why would someone want to do this? There are several VST DX instruments for PCs if you want DX sounds in your DAW and Dexed itself gives you full access to a DX7 via a software interface.

So there is probably very little practical reason to do this. But personally, I just couldn’t resist the idea of having a plug-in DX7 on a USB stick!

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key tutorials for the main concepts used in this project:

If you are new to microcontrollers and single board computers, see the Getting Started pages.

Parts list

  • Raspberry Pi Zero, Zero W or Zero W2.
  • I2S or alternative audio output for a Pi Zero.
  • USB “STEM”, “Zero Dongle” or other USB device connection (micro USB to USB A).

Note: the Pi Zero and Zero W will give access to a single MiniDexed tone generator. The Pi Zero W2, will support 8 tone generators.

Warning: When using a Raspberry Pi in USB Gadget mode, do not plug in its usual power supply! It should be USB “bus powered” only.

The Hardware

Whilst any Raspberry Pi that supports USB Gadget mode could be used with a suitable lead to power and link to MiniDexed, to make a USB “dongle” requires the use of a Pi Zero (any flavour) and a “dongle style” add on.

I’ve used the following:

It will also need a means of outputting audio from the Zero as MiniDexed only supports USB MIDI, not USB audio.

There are several options for audio out on a Pi Zero. By far the easiest is some kind of off-the-shelf I2S audio interface.

A really good, low-profile one ideal for use as a dongle is the Pimoroni Audio SHIM, which can be found here. It doesn’t even need soldering, it can push-fit over the Pi’s GPIO headers, but any I2S audio interface for the Pi can be used as long it doesn’t interfere with the USB plug for the “dongle”.

My ideal combination is the USB STEM and the Pimoroni Audio SHIM as it is both low-profile and has the USB plug at one end and the audio output at the other. But it does have to be soldered on.

The cheap adaptor board has the advantage of using spring-loaded connectors, so no soldering is required, although the PCB is very thin, so I don’t know how long it would last.

The 8086 solderless dongle is a neat solution, but whilst it works, the combination of location of the audio output and USB plug isn’t great. I’d have preferred it to be the other way round.

But it seems a lot more robust for a solderless solution than the cheap adaptor board.

MiniDexed Configuration

Hopefully by the time you read this, USB Gadget support in MiniDexed will be merged into the main code (it is PR567). Details of how to configure it can be found on the wiki here, but the key MiniDexed configuration (minidexed.ini) required for this configuration is as follows:

USBGadget=1SoundDevice=i2s

The rest of the configuration is largely ignored, but things like the LCD, buttons and encoder can simply be disabled (set to 0) as they are not required.

A Single DX7

As mentioned previously if using a Zero V1/W then a single tone generator is available. The MIDI channel it uses will be as defined in the default performance.ini file. It is set to OMNI by default. To change it, change:

MIDIChannel1=<MIDI channel 1 to 16>

The default MIDI configuration for MiniDexed assumes voice changes will be made with a combination of bank select Control Change and Program Change messages with each bank containing 32 voices. But the following configuration allows four banks to be spread across all 128 Program Change values:

ExpandPCAcrossBanks=1

When plugged into a PC it will come up as “MIDI Gadget” as a USB MIDI compatible device. Here it can be seen in MidiOx, being selected as the MIDI output.

This configuration assumes you’ve installed ROMS 1a, 1b, 2a and 2b at least (details here) in your sysex/voices directory on the SD card.

I have a MidiOx instrument file with all the voices for Roms 1a/1b/2a/2b/3a/3b/4a/4b selectable via Bank Select messages, and Roms 1a+1b+2a+2b configured for use as a single 128-voice bank via Program Change messages.

Find it on GitHub here. This needs to be copied to the “instr” directory of the MidiOx installation.

In MidiOx, View -> Instrument Panel, select “INS File: DX7ROMS.INS” and then choose one of the following for “instr”:

  • “YAMAHA DX7 ROMS” for the individually selectable 8 ROMs.
  • “YAMAHA DX7 VOICES” for the first four ROMs to be linked as a 128-voice single bank.

Both views (and voice selections) are shown below.

An 8-DX7 Instrument

If using a Zero 2W then 8 tone generators are available. In that case there is a choice. It can be treated as eight independent tone generators, in which case the MIDI channels for each TG should be set independently.

The following configures TGs 1-8 for MIDI channels 1-8.

MIDIChannel1=1MIDIChannel2=2MIDIChannel3=3...MIDIChannel8=8

At this point, the MIDI interface is the same as before, but changing the MIDI channel will change the tone generator being used.

Alternatively, it is possible to now treat the 8-way TG MiniDexed as a single instrument with much more complex sounds.

If the following setting is enabled in minidexed.ini:

PerformanceSelectChannel=1

This will interpret Program Change messages on MIDI channel 1 as selecting “performances”. Each “performance” is a configuration of up to 8 tone generators with a range of voices and effets.

The full list of default “performances” can be sound by browsing the MiniDexed github repository here.

Once again I’ve added a mode in my MIDIOx instrument file to support performances:

Warning: There is a proviso with this configuration.

At present, MiniDexed loads performances into consecutive “slots” meaning that the numbers in the MiniDexed repository do not relate to the “patch numbers” used over MIDI. The MIDIOx file supports the files in the repository at the time of writing. If new performances are added in some of the gaps (and there are gaps) in the numbering, then the names will be out of sync with what is installed.

Personally I think we need to change this and make the numbers relate to the MIDI program numbers. Watch this space!

Closing Thoughts

As mentioned in the introduction, with a good selection of software synths available that provide a DX7 on a computer for use with a DAW, there is limited use for a “DX7 on a USB stick”.

But I still think this is a pretty neat thing to be able to do, if nothing else, just for the fun of knowing that a $2000 synth from the 1980s can now be replicated with ~$20 worth of hardware that can be plugged into any PC and just “played”.

Kevin

https://diyelectromusic.wordpress.com/2023/11/22/a-dx7-usb-dongle/

#midiox #minidexed #raspberryPi #RaspberryPiZero #usbDevice #usbGadget

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst