Skip to content
Kevin edited this page Jul 30, 2023 · 57 revisions

Case

3d printable file

STL file for Raspberry Pi 2/3/4 with LCD and rotary encoder

Internals

Pinout

Please note: MiniDexed can be used without any hardware attached to the Raspberry Pi GPIOs. All hardware is optional.

Schematic:

Wiring diagram:

GPIO Pin Summary:

GPIO Pin Description
2 3 I2C SDA (Optional)
3 5 I2C SCL (Optional)
4 7 LCD RS
9 21 Encoder DT
10 19 Encoder CLK
11 23 Encoder Switch
14 8 TXD - MIDI OUT
15 10 RXD - MIDI IN
17 11 LCD E
18 12 DAC I2S BCK
19 35 DAC I2S LCK
21 40 DAC I2S DIN
22 15 LCD D4
23 16 LCD D5
24 18 LCD D6
25 22 LCD D7

Thanks @diyelectromusic (Details)

Display

16x2 LCD

LCD1602 display or similar. Midas MCOB21605C1V-EWP OLED is also known to work. Both "raw" displays and displays with an i2c "backpack" are supported by the software. So you can get a display with or without an i2c "backpack" board. An an i2c "backpack" board greatly simplifies the setup because fewer physical connections need to be made.

An an i2c "backpack" board comes with a built-in potentiometer to adjust contrast. If you are not using An an i2c "backpack" board, you can use a 10k potentiometer between the contrast pin (V0) and GND. The contrast varies with a changing environment temperature. If you don't have a 10k potentiometer at hand, a 2.2k resistor may also do the job, but you may have to experiment with the exact value. If you have a display with an i2c "backpack" PCB, there is already a contrast potentiometer installed.

WARNING: Simpler backpacks are designed to be powered by 5V and include pull-up resistors on the I2C bus to 5V too. If you have one of these you will need a 3V3 to 5V level shifter to avoid pulling up the Pi's I2C GPIO pins to 5V! Alternatively it may be possible to remove (desolder) the built-in pull-ups to 5V and add new ones to 3V3. If you're not sure what kind you have, power the LCD from 5V and GND only and measure the voltage on the I2C pins to see if it is 5V or 3V3.

Non-backpack LCDs, whilst still powered by 5V, are only connected to Pi GPIO outputs, so driving them at 3V3 from the Pi is fine.

Pinout with backpack assuming no level shifting is required (thanks @Banana71):

SSD1306 128x32 and 128x64 i2c OLED

There is also support for SSD1306 128x32 and 128x64 i2c OLEDs. These displays can be used via i2c. Currently there is only text mode supported, but any work that would allow us to show graphical representations of the algorithms would be highly welcome!

WARNING: Once again some of these displays assume 5V power and some 3V3, and some can be powered from 5V and still be fine with a 3V3 I2C bus. As a general rule, the 128x32 (shown left) tend to include a regulator, meaning they can be powered from 5V but only pull-up I2C to 3V. The 128x64 (shown right) often don't so the I2C bus is pulled-up to VCC. The regulator can usually be spotted on the board if you examine it, but once again, measure the voltage on the I2C connections prior to connecting to your Pi!

image image

Rotary Encoder

KY-040 rotary encoder or similar.

To improve precision, solder in 2 10nf capacitors: CLK to ground and DT to ground. Some breakout boards may even have empty pads for 0603 size capacitors to be soldered in.

KY-040 Kondensatoren small

Sample picture: KY-040 with two 10nF capacitors

Audio

The headphone jack on the Raspberry Pi is known to produce very low quality, noisy sound. Hence it is suitable for functional testing at best. For everything else, you need to either use an i2c DAC or HDMI audio.

i2c DAC

PCM5102A and PCM5122 based DACs are supported.

The GY PCM5102 DAC module (schematic) (also its variant HW-823) and the CJMCU 5102 DAC module seem to be reasonably priced i2c DAC modules.

Once again for any DIY solution, check the IO voltages are compatible with the Pi. In the case of the GY-PCM5102 modules, they include an on-board power stabiliser to ensure 3V3 operation (and interface) when powered by 5V.

HifiBerry DACs seem to use the same chips but are much higher priced.

The ES9023 based TeraDak.com board has been reported to work.

UDA1334A based DACs also work.

MAX98357 based Mono DACs with built-in amplifiers also work (but according to this volume is a bit low).

User reported working and non-working hardware is being discussed here.

Please note: We don't know whether MiniDexed can work with other DACs. DACs that only use i2s are more likely to work than DACs that use i2s and i2c, which may require an i2c initialization sequence that is different for each DAC model. If you have your i2s+i2c DAC working in Linux, you can make a dump of its registers as a starting point... and then get it ported to the (Circle)[https://github.com/rsta2/circle/] environment which MiniDexed is based on.

HDMI to audio

As an inexpensive, solder-free alternative you can use a HDMI to VGA adapter with audio out.

Unbenannt

For it to work, you need to simulate a VGA screen being attached by using a resistor, because otherwise the sound will be silent.

Unbenannt

Tested on a Raspberry Pi 2 and on a Raspberry Pi Zero.

USB MIDI device

MiniDexed will happily accept (Audio/MIDIStreaming) class compliant USB MIDI devices connected to it (e.g., MIDI controllers such as keyboards). If your device isn't recognised, then there are some additional USB options that can be specified in the cmdline.txt file that might help compatibility.

MiniDexed itself can currently not be used as a USB MIDI device (e.g., to play sound for MIDI coming from a DAW on another computer).

However, one can build an adapter using a Raspberry Pi Pico and the firmware from https://github.com/rsta2/pico/tree/main/midi_adapter, midi_adapter.uf2.zip. This adapter acts as a USB-MIDI device on the computer, and feeds the MIDI data into the serial input (RXD) on the MiniDexed device.

It might also be possible to use something like this CircuitPython based solution (to be verified).

As a result, one can e.g., send MIDI from another computer to MiniDexed.

Classic MIDI input

Thanks to Raspberry Pi builtin serial port, MiniDexed will happily accept Classic MIDI messages. There are a number of options for this. The following have been shown to work:

An alternative DIY MIDI IN circuit can be constructed using an optocoupler, diode and resistors. This is the circuit recommended by @diyelectromusic for use with 3V3 logic levels:

DIY MIDI Receive 3 3V - v2_schem

There is a discussion relating to DIY MIDI OUT for 3V3 systems here.

Warning: DO NOT use any of the 5V logic level circuits you'll find on the Internet (e.g. those using the 6N138 at 5V designed for use with an Arduino). Feeding a 5V RX level from an optocoupler into the Raspberry Pi's RX pin will damage the Pi.

Below is the original circuit described for use with MiniDexed that was apparently successfully tested on a Raspberry Pi 1B+ but that has had reports of possibly not being optimal. Please see this discussion.

classicMidi

Clone this wiki locally