[](https://bxxa.cc/gallery/image/projects/20261001_080127.jpg "measure once cut twice")
@ -25,20 +24,26 @@ For this project, I'm using the [le-potato](https://libre.computer/products/aml-
[](images/brd.png)
For the [prototype](https://bxxa.cc/gitea/cinnaboot/synth-modules/src/branch/main/midi_to_cv), we're using a single [MCP4921](https://ww1.microchip.com/downloads/en/DeviceDoc/21897a.pdf) digital to analog converter (DAC) and an op-amp circuit to level shift the gate signal from the board's 3.3V digital IO to the expected 0-5V gate on/off. The MCP4921 is a 12-bit DAC, which means we have 4096 discrete steps at the output. If we set the DAC reference voltage to ~5.018V, we can get a DAC output of 5V with a digital input value of 4080. This is cleanly divisilbe by `(5 * 12) = 60`, 5 octaves at 1V/octave. It's also divisible by `(10 * 12) = 120`, 10 octaves at 0.5V/octave, which can then be easily level shifted to 0-10V, or -5V-+5V. The prototype uses 0-10V, but -5V-+5V is probably the better option since those are the same levels as the audio signal levels already being passed around (at least now that we learned 10V p-p != -10V - +10V :) ).
For the [prototype](https://bxxa.cc/gitea/cinnaboot/synth-modules/src/branch/main/midi_to_cv), we're using a single [MCP4921](https://ww1.microchip.com/downloads/en/DeviceDoc/21897a.pdf) digital to analog converter (DAC) and an op-amp circuit to level shift the gate signal from the board's 3.3V digital IO to the expected 0-5V gate on/off. The MCP4921 is a 12-bit DAC, which means we have 4096 discrete steps at the output. If we set the DAC reference voltage to ~5.018V, we can get a DAC output of 5V with a digital input value of 4080. This is cleanly divisilbe by `(5 * 12) = 60`. That's 5 octaves at 1V/octave, and 12 [semitones](https://en.wikipedia.org/wiki/Semitone) per octave. 4080 is also divisible by `(10 * 12) = 120`, 10 octaves at 0.5V/octave, almost the full 128 note MIDI range, and which can then be level shifted to 0-10V, or -5V-+5V. The prototype uses 0-10V, but -5V-+5V is probably the better option since those are the same levels as the audio signal levels already being passed around (at least now that we learned 10V p-p != -10V - +10V :) ).
The current plan is to add dedicated [sample and hold](https://en.wikipedia.org/wiki/Sample_and_hold) and level shifting ICs for 5 CV/Gate channels in the final module. The DAC settling time is supposedly around 4.5 microseconds, according to the datasheet, which seems fast enough for 5 channels: `4.5 * 5 = 22.5us` per channel, and a quarter note at 200BPM is: `1 / (200 * 60 * 4) ~= 20us`. That's plenty fast for more reasonable tempos, but another limitation could be the output slew rate of the DAC at 0.55 V/us, and the unknowns from the sample hold and level shifting circuits.
[](images/midi_to_cv_schematic.png "the prototype circuit")
While breadboarding the circuit for the mainboard, I powered the SBC with its own dedicated power supply. The recommended supply from Libre Computer is at least 3A at 5V, which was going to be way too much from what was basically a reference voltage [buffered](https://bxxa.cc/gitea/cinnaboot/synth-modules/src/branch/main/power_breakout) by an op-amp. After verifying that the 5V pin on the le-potato GPIO connector fed into the input side of the polyfuse/input protection circuit, I milled and assembled the prototype mainboard, and added a second switching supply with a new power breakout board.
You can see in the last image that the 40 pin female connector doesn't seat all the way flush with the GPIO connector. The system on a chip (SoC) has a heatsink which needs about 12mm of clearance. Past me had already bought some M3 12.5mm standoffs. The electrical connections seem ok so far, but it looks a little janky. I guess it does match the rest of the synth though. I also spent awhile debugging a loose connection on the 8 pin DIP chip that's standing off too high from the board.
The original breadboard circuit had a 100 ohm resistor separating the analog and digital grounds, but that wasn't going to be possible with a single power connector and up to 3A flowing on the 5V circuit. Ideally we'd have a separate supply and return for the high current, digital circuit and the rest of the analog synth, but that's not really possible without changing the power connectors. There's also ocassionaly small signals that could be affected by the ground fluctuations like the VCA differential amplifier input, or the ~41mV steps on the DAC output. So far, I've been able to play music from the board through the synth voice without noticing any effects, but we'll have to keep it in mind in the future, and possibly re-re-design the power supplies.
Some final notes on things I learned from the prototype mainboard: We need to break out the connector for the le-potato [UART](https://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter). It's a pain the remove the mainboard/HAT, and the serial connection is useful for debugging. The front panel will need either 5 more outputs for each channel's gate LED, or (more likely) 5 LED driver transistors on the front panel board. If we want to make the board fit in the dimensions of the SBC, without overhanging, I think it will be neccesary to move to surface mount components. I already had to scrap the overvoltage protection diodes on the SPI connection to the DAC. It also could make sense to use an IO expander chip for some extra front panel controls.