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
No comments:
Post a Comment