[Bjonnh.net]# _

Projects / DINOctopus >


categories projects music hack techniques rp2040 electronics midi

DINOctopus

If you are looking for the configurator, it is here: SysEx Configurator

What is it

DINOctopus is a small device made to merge/split/mix MIDI signals and act as a USB card as well.

A cute little dinosaur that's also an octopus
A board with 10 jacks, 5 on each side, on a blue background. There are tiny leds next to each port and a 5 optocouplers

Structure

This is a general diagram of when the device has 10 physical ports (5 in and 5 out). All the physical ports can be routed to any other port.

flowchart TB subgraph Physical MIDI_1_IN[Midi Input 1] -.-> MIDI_1_OUT[Midi Output 1] MIDI_1_IN[Midi Input 1] -.-> MIDI_2_OUT[Midi Output 2] MIDI_1_IN[Midi Input 1] -.-> MIDI_3_OUT[Midi Output 3] MIDI_1_IN[Midi Input 1] -.-> MIDI_4_OUT[Midi Output 4] MIDI_1_IN[Midi Input 1] -.-> MIDI_5_OUT[Midi Output 5] MIDI_2_IN[Midi Input 2] -.-> MIDI_1_OUT[Midi Output 1] MIDI_2_IN[Midi Input 2] -.-> MIDI_2_OUT[Midi Output 2] MIDI_2_IN[Midi Input 2] -.-> MIDI_3_OUT[Midi Output 3] MIDI_2_IN[Midi Input 2] -.-> MIDI_4_OUT[Midi Output 4] MIDI_2_IN[Midi Input 2] -.-> MIDI_5_OUT[Midi Output 5] MIDI_3_IN[Midi Input 3] -.-> MIDI_1_OUT[Midi Output 1] MIDI_3_IN[Midi Input 3] -.-> MIDI_2_OUT[Midi Output 2] MIDI_3_IN[Midi Input 3] -.-> MIDI_3_OUT[Midi Output 3] MIDI_3_IN[Midi Input 3] -.-> MIDI_4_OUT[Midi Output 4] MIDI_3_IN[Midi Input 3] -.-> MIDI_5_OUT[Midi Output 5] MIDI_4_IN[Midi Input 4] -.-> MIDI_1_OUT[Midi Output 1] MIDI_4_IN[Midi Input 4] -.-> MIDI_2_OUT[Midi Output 2] MIDI_4_IN[Midi Input 4] -.-> MIDI_3_OUT[Midi Output 3] MIDI_4_IN[Midi Input 4] -.-> MIDI_4_OUT[Midi Output 4] MIDI_4_IN[Midi Input 4] -.-> MIDI_5_OUT[Midi Output 5] MIDI_5_IN[Midi Input 5] -.-> MIDI_1_OUT[Midi Output 1] MIDI_5_IN[Midi Input 5] -.-> MIDI_2_OUT[Midi Output 2] MIDI_5_IN[Midi Input 5] -.-> MIDI_3_OUT[Midi Output 3] MIDI_5_IN[Midi Input 5] -.-> MIDI_4_OUT[Midi Output 4] MIDI_5_IN[Midi Input 5] -.-> MIDI_5_OUT[Midi Output 5] end subgraph USB_in USB_1_IN[USB In 1] --> MIDI_1_IN[Midi Input 1] USB_2_IN[USB In 2] --> MIDI_2_IN[Midi Input 2] USB_3_IN[USB In 3] --> MIDI_3_IN[Midi Input 3] USB_4_IN[USB In 4] --> MIDI_4_IN[Midi Input 4] USB_5_IN[USB In 5] --> MIDI_5_IN[Midi Input 5] end subgraph USB_out MIDI_1_OUT[Midi Output 1] --> USB_1_OUT[USB Out 1] MIDI_2_OUT[Midi Output 2] --> USB_2_OUT[USB Out 2] MIDI_3_OUT[Midi Output 3] --> USB_3_OUT[USB Out 3] MIDI_4_OUT[Midi Output 4] --> USB_4_OUT[USB Out 4] MIDI_5_OUT[Midi Output 5] --> USB_5_OUT[USB Out 5] end

The USB ports are virtual and will through a single cable be displayed as multiple ports in your operating system:

The USB ports as seen in QJackCtl on Linux

Configuration

The configuration is done using SysEX, there is a WebMidi implementation here: SysEx Configurator

The SysEx configurator

Open Source Hardware and Software

Software

The firmware is available here: https://www.github.com/bjonnh/dinoctopus

There are builds of the UF2 files that can be directly sent to a RP2040 board by USB. Plug it while pressing the BOOTSEL button, and it will appear as a USB drive, just copy the file to it.

Latest release is always available at: https://github.com/bjonnh/dinoctopus/releases/latest

SysEX messages

This is the structure of the messages:

F0 44 49 4E 4F 00 <command> [optional_data] F7

Where

44 49 4E 4F  : Identifier of the device (DINO)
00            : Device number (0)

F0 and F7 are the normal sysex delimiters

and the replies:

F0 44 49 4E 4F 00 66 <response> F7

The commands are:

Command Description Data
0x00 Identity (Not implemented)
0x01 Dump the matrix None
0x02 Set the matrix 100 uint32/7 numbers (see below the format)
0x03 Get the matrix element at i,j 2 uint8 between 0 and 5 for the input and output
0x04 Set the matrix element at i,j 3 uint8 between 0 and 5 for the input, output and value as uint32/7
0x05 Save in the EEPROM None
0x06 Load from the EEPROM None
0x07 Reset everything to 0 None

All commands will return either : 0x60 (ACK) or 0x61 (NACK) except for 0x01 and 0x03 that are special.

Technically there is no EEPROM on the RP2040, but I use the flash for that. It is not supposed to be written too often but that’s unlikely to be a problem for this project.

Any command that do not match the above will just be forwared to the port(s).

Dump the matrix (0x01)

This returns 100 uint32/7 numbers. You can safely convert them to uint32.

Get the element (0x03)

This returns one uint32/7 number that can be safely converted to uint32.

What is uint32/7:

Currently the values are stored internaly as an uint32_t, and we only use 0 and 1. The other bits will be used for filtering and other features. I call the type uint32/7 because SysEX only allow to send 7 bits per element, so we end up with truncated values. They are LSB.

So 1 is : 1 0 0 0

250 cannot be represented

But 256 can: 0 1 0 0

Etc.

I will probably send the sysex differently at some point or just ignore that 1 bit, we will see when we get there.

Hardware

Schematics and PCBs are available at: https://www.github.com/bjonnh/dinoctopus/tree/main/hardware/electronics

There are some more explanations of the interfacing on the Minitopus page.

Current version (Revision 2)

A single board version, on which you just have to add a Raspberry Pico (or connect your own board at the right place)

A board with 10 jacks, 5 on each side, on a blue background. There are tiny leds next to each port and a 5 optocouplers

As I figure some of you may want to use a different board, here are the pinouts:

Pinouts to connect another kind of microcontroller

Looking at the board, top of this schematic is the J3/J4 side on the picture of the board

History

Document

  • 2024-06-01 Update for revision 2 and add all the documentation. This becomes the official documentation

Revision 1

This version had a display with a rotary encoder to configure it.

It was made with several boards, one RX board, one TX board and one main board. The main board had issues, I used the wrong pinouts for the level converter of the display.

Mainboard Mainboard RXboard TXboard

It was looking like that:

A OpenSCAD representation of a box with a display and 4 times 2 midi din ports

It used a repurposed cheap 3d printer display which is documented on https://www.bjonnh.net/article/20221126_mini_12864/.

I switched to a pure SysEx approach starting with revision 2 to facilitate things and reduce cost and size.

The settings could be seen and modified on the integrated display using the integrated rotary encoder:

LCD display

License

This project, dinoctoopus by Bjonnh is licensed under CC BY-SA 4.0 CC BY SA

The code is licensed under MIT

Thanks

DiyElectroMusic - About the idea of using PIOs for MIDI

Ha Thach - For TinyUSB, I had to extract some code from there to get virtual cable workings and they are the whole reason we can do USB properly these days.