MIDItio
MIDItio is a planned USB Midi to CV device. The device will act as a USB MIDI device connected to a USB host. It will be able to run two channels simultaneously with a CV indicating the pitch and a Gate indicating start and stop.
The name MIDItio is derived from MIDI and the Latin "ditio" which means "control".
Planned features are:
- USB MIDI Gadget/Device
- 2 MIDI channels
- Dual pitch CV output (1V/oct)
- Dual gate output
- 5 octave range (0V - 5V)
- Self calibration
The MIDItio device has got two analog outputs (CV) and two digital outputs (gate). It can be configured to run in two different "modes":
- Two channel pitch and gate
- One channel pitch, velocity and gate
When operating in two channel mode, the velocity is ignored.
Hardware Design
MCU
The primary concerns dictating the choice of MCU are:
- Built-in USB
- Built-in Digital to Analogue converters (DAC) - preferably 2
- Cost
The STM32L151 fits the bill nicely.
Output Amplifier
Without a boost regulator the highest available voltage on the board is the USB VBUS 5V. That means the output amplifier for the CV's need to map 0-3.3V into 0-5V.
A = 5 / 3.3. = 1.515
The amplification of a non-inverting opamp is:
A = 1 + Rf / R2
If we choose R2 = 9.1 kΩ, we can calculate Rf
Rf = (A - 1) * R2 = 0.515 * 9.1 kΩ = 4.68 kΩ
A Rf of 4.7 kΩ should do nicely.
Self calibration
The output amplifier will add a certain DC error (due to tolerances on the resistors) and we'll need a way to calibrate the device. In our case we simply feed the amplified output back to an ADC. The input pins on STM32 are 5V tolerant when in digital mode, but when set to analogue they are not! So some care should be taken not to set the value higher than 3.3 V while calibrating.
The internal voltage reference in the STM32 is quite poor, so we have also added a 0.1 % voltage reference. That way we can compare the measured values of the DAC's with this voltage reference and adjust for any errors.
Schematics
Renderings
Prototype rev a
Gallery
First prototype was ordered and this is how they turned out:
Testing
After receiving the rev. a prototype a few things became immediately obvious. First of all, the stm32l151 USB is gadget/device only and thus do not have a built-in pull up on the D+ line. Second, the stm32l151 does not have DFU support in it's built-in bootloader.
The first was easily tested with a bodge resistor:
I did not have a 1.5 k resistor lying around, so I used a 2 k one and that works fine.
Revision b
Based on the testing a few changes was made for revision b.
- 1.5 k pull-up resistor on USB D+ line
- B0 no longer connected to Boot0
- Additional filtering of VDDA
Firmware
STM32 Pin Assignment
The pin assignment is pretty straight forward, largely dictated by the analog pins and how they are wired together in the schematics.