In the first part of the series we built a MIDI to CV converter using MicroPython on the Raspberry Pi Pico. Check it out here if you haven’t done so already.
This time we’ll add a second CV output, as well as a distance sensor as a modulation source and a Neopixel ring to visualise its output.
The Set Up
In the above video the Elektron Model:Samples is set up to generate MIDI notes on track 6, which are sent to the MIDI input on the Pico. This generates a gate signal and pitch voltage (on CV1) for the Moog Werkstatt-01.
The distance sensor’s analogue output is visualised by the Neopixel ring as well as sent to CV2, which I have connected to the Werkstatt’s LFO FM input. This allows me to control the speed of the LFO, which is in turn modulating the cutoff frequency of the bassline. Wobble ensues…
Finally, the output of the Werkstatt goes to a Korg Monotron Delay, which is used to further filter the bassline and to add a touch of delay.
The Hardware
Given the multitude of in- and outputs I decided to make a semi-permanent perfboard setup with headers for the Raspberry Pi Pico and the two MCP4725 DACs.
Since space was a bit too tight for an onboard MIDI socket I am using an external daughter board, connected via jumper wires, as are the calibration pot, distance sensor, gate output and Neopixel ring.
I have added a calibration pot to the setup, as the DACs’ output voltages are directly related to VBUS (i.e. the voltage of the USB supply), which is currently used as their reference voltage. In a future revision I may add a voltage regulator to power the project with a more stable 5v.
The two DACs are connected to I2C1 on the Pico and have the addresses 0x62 and 0x63 (by soldering a jumper on one the boards). For now I simply soldered a 3.5mm jack socket to the VOUT and GND pins of each of the DACs. Eventually I may add another header on the perfboard instead.
The eagle-eyed will have spotted that there are headers (and some of the wiring) for two more DAC modules to create a possible 4CV outputs. In order to use these a second I2C bus will be needed (I2C0 on the Pico).
BOM
Raspberry Pi Pico
A 3.3V MIDI interface, such as the one we built in part 1
2x MCP4725 DAC module
Sharp GP2Y0A21YK0F infrared distance sensor
100k potentiometer
16 Neopixel ring
3x 3.5mm jack sockets
Circuit Diagram
The Code
The code is written in MicroPython. Its external dependencies are:
I have set up the functions polling the calibration pot and distance sensor ADCs to be called by a timer each, running every 100ms and 50ms respectively. For now these are just arbitrary numbers that seemed to work ok and hopefully leave enough clock cycles for the midi note commands to be tight.
The calibration pot is set up to fine-tune the expected reference voltage, from 4.5V to 5.5V to compensate for slightly different input voltages (for example, my PC’s USB port only delivers around 4.95V, whereas my phone charger outputs 5.1V).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters