Trinket M0 USB MIDI Interface for the Shruthi Synth

I managed to pick up a Shruthi synth second hand a while back and so far, I really like it, but I’ve not really had a chance to properly explore it yet.  One thing I’d like to do is build some kind of control interface for it so I’m not having to navigate all the menus so much.  I’ve played a little with the PC editor, which is pretty neat.

But what I’d really like is a USB interface. There seems to be plenty of space inside that might allow the addition of a microcontroller to handle USB MIDI and generate serial MIDI.

So to prove the concept, this project takes the Adafruit Trinket M0 from the USB-MIDI to MIDI Revisited project and works out how to insert it into the power/MIDI input side of the Shruthi, externally to allow it to be played with a USB MIDI controller keyboard.

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.

Parts list

  • Adafruit Trinket M0 (not the original or “Pro” – you need the Samd21 based one)
  • L7805 power regulator IC
  • 1x 100uF electrolytic capacitor
  • 1x 10uF electrolytic capacitor
  • 1x 100nF ceramic capacitor
  • 1x 10Ω resistor
  • 1x 33Ω resistor
  • 1x 5 pin 180 DIN plug
  • 1x 2.1mm barrel jack plug
  • 1x 2.1mm barrel jack socket
  • pin headers and sockets
  • Protoboard and jumper wires

The Circuit

TrinketMIDI9VPSU_bb

The idea is to power the Trinket from the Shruthi’s 9V power supply and connect the Trinket’s serial output to the Shruthi’s MIDI IN.

Of course, if you are happy for the Trinket to work entirely stand-alone, then it would work perfectly fine “as is” as described here: USB-MIDI to MIDI Revisited.

But I’m thinking about how to insert this module eventually maybe into the Shruthi itself – or at least have a nice, neat box sitting alongside it with a single power supply.

Now the Trinket has to be powered with 5V via the USB (VBUS) pin in order to be able to provide power to the USB socket to act as a USB host.  The Bat pin will take a wider range of inputs, but still not up to 9V, but it can’t be used to power USB.  This means I need to get from the 9V powering the Shruthi down to 5V somehow.  The standard way to achieve this is to use a 7805 regulator (the “05” bit means 5V.  You can get “09” and “12” versions too).

The datasheets include several standard application circuits.  Typically smoothing capacitors are required on the input and output, and usually a filtering capacitor is added to the output (as I understand things).

There are many circuits kicking around on the Internet, and as I’ve said many times, I am not really an electronics person, so I went with this one I found on Instructables (after getting it vetted by my electronics Twitter followers!): https://www.instructables.com/7805-Regulator-5V-Module-Easy-Tutorial/

The circuit is pretty simple: just the 7805 and three capacitors, and it can take a wide array of input voltages, but most crucially is quite happy with 9V.

On the MIDI side, this is a standard 3V3 compatible, simplified, MIDI OUT circuit connected to the Trinkets TX pin (IO pin 4).

I built the whole thing on protoboard as shown below.

IMG_6510IMG_6511

IMG_6509

As with the previous projects, a “USB on-the-go” adaptor is required to swap the Trinket’s micro USB port to a more typical USB A style socket.

The Code

This is using the (slightly updated – see the original post) code from here: USB-MIDI to MIDI Revisited.

Find it on GitHub here.

Closing Thoughts

When I first put this together, I had a number of issues:

a) I wasn’t getting any power reading on the input to the 7805. It turns out the barrel jack plug I was using wasn’t quite the right size to fit the socket I had (even though it worked fine in the Shruthi itself).

b) Once that was sorted I found I wasn’t getting any MIDI signals through. It turns out I’d forgotten to connect the two resistors from the MIDI OUT circuit to TX and 3V3 on the Trinket!

c) Then once working, I was losing MIDI messages and getting missed or stuck notes.  That turned out to be the sketch running on the Trinket. I found an alternative that seems to work better now.

What I’d like to work on now is a useful configuration of something like my Arturia MiniLab to let me use the pots and keys as a control interface for the Shruthi.  But the basics seem ok now.

I might see about making up a simple PCB for this.  And of course, ideally I’d still really like to have this somehow embedded in the Shruthi itself.

Kevin

IMG_6508

One thought on “Trinket M0 USB MIDI Interface for the Shruthi Synth

Leave a comment